今天做两个实验,两个都是朋友问的问题。
问题1:假如做了3次全备,full1,full2,full3,其中full3是最近做的备份,但是最近做的这次full3的备份集不能用了,问:能从前一次的备份集恢复到现在吗?
解决问题1:实验:
[oracle@redhat ~]$ sqlplus /nolog
SQL> conn /as sysdba
Connected to an idle
SQL> startup
ORACLE instance started.、
。。。
Database opened.
SQL> exit
[oracle@redhat ~]$ rman target /
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
27 Full DISK 00:00:52 14-JUL-10
BP Key: 27 Status: AVAILABLE Compressed: NO Tag: TAG20100714T155205
Piece Name: /bak/full_29_1 <<做的一次全备
List of Datafiles in backup set 27
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 632173 14-JUL-10 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_63rxvkxc_.dbf
2 Full 632173 14-JUL-10 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_63rxvlb7_.dbf
3 Full 632173 14-JUL-10 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_63rxvky8_.dbf
4 Full 632173 14-JUL-10 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_63rxvl91_.dbf
5 Full 632173 14-JUL-10 u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_63rxvl05_.dbf
BS Key Type Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
28 Full DISK 00:00:01 14-JUL-10
BP Key: 28 Status: AVAILABLE Compressed: NO Tag: TAG20100714T155301
Piece Name: /bak/c-1251117377-20100714-01
Control File Included: Ckp SCN: 632201 Ckp time: 14-JUL-10
SPFILE Included: Modification time: 14-JUL-10
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
29 DISK 00:00:01 14-JUL-10
BP Key: 29 Status: AVAILABLE Compressed: NO Tag: TAG20100714T155413
Piece Name: /bak/archbak/arc_31_1.arc
List of Archived Logs in backup set 29
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 15 629488 14-JUL-10 632261 14-JUL-10
BS Key Type Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
30 Full DISK 00:00:01 14-JUL-10
BP Key: 30 Status: AVAILABLE Compressed: NO Tag: TAG20100714T155415
Piece Name: /bak/c-1251117377-20100714-02
Control File Included: Ckp SCN: 632270 Ckp time: 14-JUL-10
SPFILE Included: Modification time: 14-JUL-10
RMAN> exit
Recovery Manager complete.
[oracle@redhat ~]$ cd /bak
[oracle@redhat bak]$ ll
总用量 782220
drwxr-xr-x 2 oracle oinstall 4096 7月 14 15:54 arch
drwxr-xr-x 2 oracle oinstall 4096 7月 14 15:54 archbak
-rw-r----- 1 oracle oinstall 118530048 7月 14 15:51 full_27_1
-rw-r----- 1 oracle oinstall 653099008 7月 14 15:52 full_29_1
drwx------ 2 root root 16384 7月 7 11:50 lost+found
-rw-r----- 1 oracle oinstall 7061504 7月 14 15:54 snapcf_orcl.f
[oracle@redhat bak]$ sqlplus /nolog
QL> conn scott/tiger
Connected.
SQL> select count (*) from est2;
COUNT(*)
----------
16
SQL> insert into test2 select * from test2;
256 rows created.
SQL> select count(*) from test2;
COUNT(*)
----------
512
SQL> commit;
Commit complete.
SQL> exit
Disconnected from Oracle Database Enterprise Edition Release .1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@redhat bak]$ cd ~/bin/
[oracle@redhat bin]$ ./full.sh
RMAN> 2> 3> 4> 5> 6>
using target database control file instead of recovery catalog
allocated channel: a2
channel a2: sid=139 devtype=DISK
Starting backup at 14-JUL-10
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_63rxvkxc_.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_63rxvky8_.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_63rxvl05_.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_63rxvl91_.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_63rxvlb7_.dbf
channel a2: starting piece 1 at 14-JUL-10
channel a2: finished piece 1 at 14-JUL-10
piece handle=/bak/full_33_1 tag=TAG20100714T180519 comment=NONE <<又做了一次全备
channel a2: backup set complete, elapsed time: 00:00:56
Finished backup at 14-JUL-10
Starting Control File and SPFILE Autobackup at 14-JUL-10
piece handle=/bak/c-1251117377-20100714-03 comment=NONE
Finished Control File and SPFILE Autobackup at 14-JUL-10
released channel: a2
RMAN>
Recovery Manager complete.
三 7月 14 18:06:17 CST 2010
[oracle@redhat bin]$ cd /bak/
[oracle@redhat bak]$ ll
总用量 1428188
-rw-r----- 1 oracle oinstall 118530048 7月 14 15:51 full_27_1
-rw-r----- 1 oracle oinstall 653099008 7月 14 15:52 full_29_1
-rw-r----- 1 oracle oinstall 653664256 7月 14 18:06 full_33_1
drwx------ 2 root root 16384 7月 7 11:50 lost+found
-rw-r----- 1 oracle oinstall 7061504 7月 14 18:06 snapcf_orcl.f
[oracle@redhat bak]$ mv full_33_1 full_33_1.bak <<使该备份集失效
[oracle@redhat bak]$ rman target /
RMAN> crosscheck backup;
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/bak/full_27_1 recid=25 stamp=724348223
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/bak/c-1251117377-20100714-00 recid=26 stamp=724348278
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/bak/full_29_1 recid=27 stamp=724348326
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/bak/c-1251117377-20100714-01 recid=28 stamp=724348381
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/bak/archbak/arc_31_1.arc recid=29 stamp=724348454
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/bak/c-1251117377-20100714-02 recid=30 stamp=724348456
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/bak/full_33_1 recid=31 stamp=724356320
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/bak/c-1251117377-20100714-03 recid=32 stamp=724356376
Crosschecked 8 objects
RMAN> exit
Recovery Manager complete.
[oracle@redhat bak]$
[oracle@redhat bak]$ cd /u01/app/oracle/oradata/ORCL/datafile/
[oracle@redhat datafile]$
[oracle@redhat datafile]$ ll
总用量 913920
-rw-r----- 1 oracle oinstall 104865792 7月 14 18:05 o1_mf_example_63rxvl05_.dbf
-rw-r----- 1 oracle oinstall 262152192 7月 14 18:05 o1_mf_sysaux_63rxvky8_.dbf
-rw-r----- 1 oracle oinstall 503324672 7月 14 18:05 o1_mf_system_63rxvkxc_.dbf
-rw-r----- 1 oracle oinstall 20979712 7月 13 22:00 o1_mf_temp_63b12j_.tmp
-rw-r----- 1 oracle oinstall 31465472 7月 14 18:05 o1_mf_undotbs1_63rxvlb7_.dbf
-rw-r----- 1 oracle oinstall 32776192 7月 14 18:05 o1_mf_users_63rxvl91_.dbf
[oracle@redhat ORCL]$ sqlplus /nolog
SQL> conn /as sysdba
Connected.
SQL>
SQL> shutdown immediate
SQL> exit
[
[oracle@redhat ORCL]$ rm datafile/*.dbf
[oracle@redhat ORCL]$ ll datafile
总用量 0
[oracle@redhat ORCL]$ sqlplus /nolog
SQL*Plus: Release .1.0 - Production on Wed Jul 14 18:08:46 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1:
'/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_63rxvkxc_.dbf'
SQL> exit
Disconnected from Oracle Database Enterprise Edition Release .1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@redhat ORCL]$ rman target /
RMAN> restore database;
Starting restore at 14-JUL-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_63rxvkxc_.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_63rxvlb7_.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_63rxvky8_.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_63rxvl91_.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_63rxvl05_.dbf
channel ORA_DISK_1: reading from backup piece /bak/full_29_1 <<从最近一次可用的备份集读取
channel ORA_DISK_1: restored backup piece 1
piece handle=/bak/full_29_1 tag=TAG20100714T155205
channel ORA_DISK_1: restore complete, elapsed time: 00:00:56
Finished restore at 14-JUL-10
RMAN>
[oracle@redhat ORCL]$ ll datafile
总用量 913616
-rw-r----- 1 oracle oinstall 104865792 7月 14 18:09 o1_mf_example_63v36rs7_.dbf
-rw-r----- 1 oracle oinstall 262152192 7月 14 18:10 o1_mf_sysaux_63v36rqx_.dbf
-rw-r----- 1 oracle oinstall 503324672 7月 14 18:10 o1_mf_system_63v36rpr_.dbf
-rw-r----- 1 oracle oinstall 31465472 7月 14 18:09 o1_mf_undotbs1_63v36rwg_.dbf
-rw-r----- 1 oracle oinstall 32776192 7月 14 18:09 o1_mf_users_63v36rvc_.dbf
[oracle@redhat ORCL]$
[oracle@redhat ORCL]$
[oracle@redhat ORCL]$ rman target /
RMAN> recover database;
Starting recover at 14-JUL-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=158 devtype=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:05
Finished recover at 14-JUL-10
RMAN> exit
Recovery Manager complete.
[oracle@redhat ORCL]$ sqlplus /nolog
SQL>
SQL> alter database open;
SP2-0640: Not connected
SQL> conn /as sysdba
Connected.
SQL> alter database open;
Database altered.
SQL> conn scott/tiger
Connected.
SQL> select count(*) from test2;
COUNT(*)
----------
512
SQL> exit
文中用到脚本:
[oracle@redhat bin]$ cat full.sh
#!/bin/bash
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0.2/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
date
rman target /<<EOF
run
{ allocate channel a2 type disk;
backup
format '/bak/full_%s_%p'
(database);
}
exit
EOF
date
总结:full1 、full2、full3.。。如果full3备份集不可用,则自动从full2开始restore。
rman实验(二)
问题2:假如依次做了几次这样的备份:
a、全备
b、level 0
c、全备
d、level 1
做完这几次备份后,如果恢复,rman是从哪个备份集开始restore?recover的时候用到哪些备份集?
更多参考:
the specified nodes are not clusterable
根据rowid删除表中重复的行
Agent process exited abnormally during initialization
一次字符乱码的解决过程
rman实验(一)
rman实验(二)
ORA-00600: internal error code, arguments: [keltnf
ORA-00600: ORA-12012 ORA-08102解决
linux下完全删除oracle
INFO: /usr/bin/ld: crt1.o: No such file: No such file or directory
centos4.8_64上安装oracle10201建库报ORA-12547
EM乱码解决
ORA-31613 Master process DM00 failed during startup
ORA-00600: internal error code, arguments: [4194], [29], [27], [], [], [], [], []
ORA-24324 ORA-01041 ORA-03113
centos5.3升级oracle
pdksh-5.2.14-36.el5.i386.rpm
使用rman进行数据库迁移
oracle10.2.0.1升级到10.2.0.4报错
Upgrade Oracle 10g from 10.2.0.1 to 10.2.0.4 (Single Instance)
改oracle的name和dbid
修改oracle实例名
Solaris8上迁移oracle8i---上
Solaris8上迁移oracle8i---下
未备份归档日志导致数据丢失的实验
使用NBU进行数据库迁移
catalog备份数据库
RMAN FORMAT字符串格式化
Error: can not register my instance state - -1
not all alterations performed
The ASM instance configured on the local node is a single-instance ASM
/u01/crs102/bin/crsctl.bin: error while loading shared libraries: libstdc++.so.5: cannot open shared
Initializing the Oracle ASMLib driver: [FAILED]
ORA-00245: control file backup operation failed
WARNING: failed to read mirror side 1 of virtual extent 229 logical extent
模拟恢复参数文件
Interface eth0 checked failed
import server uses ZHS16GBK character set (possible charset conversion)