RMAN catalog的还原与恢复

试验环境是基于RMAN catalog的创建和基本使用和RMAN catalog自动备份脚本设计


检查备份集是否有效

RMAN> crosscheck backupset;
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=139 devtype=DISK
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/inc0_ZHONG_1dn70dii_1_1 recid=40 stamp=779105874
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/inc0_ZHONG_1en70djb_1_1 recid=41 stamp=779105899
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/arch_ZHONG_1fn70djf_1_1 recid=42 stamp=779105904
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/inc1_ZHONG_1hn70dke_1_1 recid=44 stamp=779105934
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/inc1_ZHONG_1in70dkh_1_1 recid=45 stamp=779105938
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/arch_ZHONG_1jn70dkm_1_1 recid=46 stamp=779105943
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/inc2_ZHONG_1ln70dlm_1_1 recid=48 stamp=779105974
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/inc2_ZHONG_1mn70dlp_1_1 recid=49 stamp=779105978
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/arch_ZHONG_1nn70dlu_1_1 recid=50 stamp=779105983
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/orabackup/backupctl.ctl recid=51 stamp=779105986
Crosschecked 10 objects
RMAN> validate backupset 1783,1784,1812,1839,1840,1869,1896,1897,1926,1938;
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc0_ZHONG_1dn70dii_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc0_ZHONG_1dn70dii_1_1 tag=INC0
channel ORA_DISK_1: validation complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc0_ZHONG_1en70djb_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc0_ZHONG_1en70djb_1_1 tag=INC0
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting validation of archive log backupset
channel ORA_DISK_1: reading from backup piece /orabackup/arch_ZHONG_1fn70djf_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/arch_ZHONG_1fn70djf_1_1 tag=BKARCH
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc1_ZHONG_1hn70dke_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc1_ZHONG_1hn70dke_1_1 tag=INC1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc1_ZHONG_1in70dkh_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc1_ZHONG_1in70dkh_1_1 tag=INC1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting validation of archive log backupset
channel ORA_DISK_1: reading from backup piece /orabackup/arch_ZHONG_1jn70dkm_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/arch_ZHONG_1jn70dkm_1_1 tag=BKARCH
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc2_ZHONG_1ln70dlm_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc2_ZHONG_1ln70dlm_1_1 tag=INC2
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc2_ZHONG_1mn70dlp_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc2_ZHONG_1mn70dlp_1_1 tag=INC2
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting validation of archive log backupset
channel ORA_DISK_1: reading from backup piece /orabackup/arch_ZHONG_1nn70dlu_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/arch_ZHONG_1nn70dlu_1_1 tag=BKARCH
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/backupctl.ctl
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/backupctl.ctl tag=BKCTL
channel ORA_DISK_1: validation complete, elapsed time: 00:00:02

RMAN>
RMAN> validate backupset 1783,1784,1812,1839,1840,1869,1896,1897,1926,1938 check logical;
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc0_ZHONG_1dn70dii_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc0_ZHONG_1dn70dii_1_1 tag=INC0
channel ORA_DISK_1: validation complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc0_ZHONG_1en70djb_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc0_ZHONG_1en70djb_1_1 tag=INC0
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting validation of archive log backupset
channel ORA_DISK_1: reading from backup piece /orabackup/arch_ZHONG_1fn70djf_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/arch_ZHONG_1fn70djf_1_1 tag=BKARCH
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc1_ZHONG_1hn70dke_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc1_ZHONG_1hn70dke_1_1 tag=INC1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc1_ZHONG_1in70dkh_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc1_ZHONG_1in70dkh_1_1 tag=INC1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting validation of archive log backupset
channel ORA_DISK_1: reading from backup piece /orabackup/arch_ZHONG_1jn70dkm_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/arch_ZHONG_1jn70dkm_1_1 tag=BKARCH
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc2_ZHONG_1ln70dlm_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc2_ZHONG_1ln70dlm_1_1 tag=INC2
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/inc2_ZHONG_1mn70dlp_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/inc2_ZHONG_1mn70dlp_1_1 tag=INC2
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting validation of archive log backupset
channel ORA_DISK_1: reading from backup piece /orabackup/arch_ZHONG_1nn70dlu_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/arch_ZHONG_1nn70dlu_1_1 tag=BKARCH
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /orabackup/backupctl.ctl
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabackup/backupctl.ctl tag=BKCTL
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01

RMAN>

恢复非系统表空间

[oracle@zhong zhong]$ rm -rf example01.dbf
SYS@zhong:~>alter database datafile 5 online;
alter database datafile 5 online
*
ERROR at line 1:
ORA-01116: error in opening database file 5
ORA-01110: data file 5: '/u01/app/oracle/oradata/zhong/example01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3

恢复datafile5
RMAN> run{
2> allocate channel c1 device type disk;
3> sql 'alter database datafile 5 offline';
4> restore datafile 5;
5> recover datafile 5;
6> sql 'alter database datafile 5 online';
7> release channel c1;
8> }
released channel: ORA_DISK_1
allocated channel: c1
channel c1: sid=139 devtype=DISK

sql statement: alter database datafile 5 offline

Starting restore at 28-MAR-12

channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to /u01/app/oracle/oradata/zhong/example01.dbf
channel c1: reading from backup piece /orabackup/inc0_ZHONG_1dn70dii_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc0_ZHONG_1dn70dii_1_1 tag=INC0
channel c1: restore complete, elapsed time: 00:00:08
Finished restore at 28-MAR-12

Starting recover at 28-MAR-12
channel c1: starting incremental datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00005: /u01/app/oracle/oradata/zhong/example01.dbf
channel c1: reading from backup piece /orabackup/inc1_ZHONG_1hn70dke_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc1_ZHONG_1hn70dke_1_1 tag=INC1
channel c1: restore complete, elapsed time: 00:00:01
channel c1: starting incremental datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00005: /u01/app/oracle/oradata/zhong/example01.dbf
channel c1: reading from backup piece /orabackup/inc2_ZHONG_1ln70dlm_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc2_ZHONG_1ln70dlm_1_1 tag=INC2
channel c1: restore complete, elapsed time: 00:00:01

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 28-MAR-12

sql statement: alter database datafile 5 online

released channel: c1

RMAN>
SYS@zhong:~>select status from v$datafile;
STATUS
-------
SYSTEM
ONLINE
ONLINE
ONLINE
ONLINE

SYS@zhong:~>create table hr.emp tablespace example as select * from hr.employees;

Table created.

SYS@zhong:~>

UNDO表空间恢复

[oracle@zhong zhong]$ rm -rf undotbs01.dbf
RMAN> run {
2> allocate channel c1 device type disk;
3> restore datafile 2;
4> recover datafile 2;
5> release channel c2;
6> }
allocated channel: c1
channel c1: sid=139 devtype=DISK

Starting restore at 28-MAR-12

channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /u01/app/oracle/oradata/zhong/undotbs01.dbf
channel c1: reading from backup piece /orabackup/inc0_ZHONG_1dn70dii_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc0_ZHONG_1dn70dii_1_1 tag=INC0
channel c1: restore complete, elapsed time: 00:00:08
Finished restore at 28-MAR-12

Starting recover at 28-MAR-12
channel c1: starting incremental datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00002: /u01/app/oracle/oradata/zhong/undotbs01.dbf
channel c1: reading from backup piece /orabackup/inc1_ZHONG_1hn70dke_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc1_ZHONG_1hn70dke_1_1 tag=INC1
channel c1: restore complete, elapsed time: 00:00:01
channel c1: starting incremental datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00002: /u01/app/oracle/oradata/zhong/undotbs01.dbf
channel c1: reading from backup piece /orabackup/inc2_ZHONG_1ln70dlm_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc2_ZHONG_1ln70dlm_1_1 tag=INC2
channel c1: restore complete, elapsed time: 00:00:01

starting media recovery
media recovery failed
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-03114: not connected to ORACLE
RMAN-03002: failure of recover command at 03/28/2012 11:14:43
RMAN-11003: failure during parse/execution of SQL statement: alter database recover datafile list clear
ORA-00603: ORACLE server session terminated by fatal error

RMAN>
restore成功了,recover的时候报错session被中断,sqlplus登陆到目标数据库

[oracle@zhong ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 28 11:13:52 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SYS@zhong:~>select status from v$datafile;

STATUS
-------
SYSTEM
RECOVER
ONLINE
ONLINE
ONLINE

SYS@zhong:~>recover datafile 2;
ORA-00603: ORACLE server session terminated by fatal error

SYS@zhong:~>exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@zhong ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 28 11:18:36 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SYS@zhong:~>select status from v$datafile;

STATUS
-------
SYSTEM
OFFLINE
ONLINE
ONLINE
ONLINE

SYS@zhong:~>alter database datafile 2 online;

Database altered.

SYS@zhong:~>select status from v$datafile;

STATUS
-------
SYSTEM
ONLINE
ONLINE
ONLINE
ONLINE

SYS@zhong:~>

系统表空间恢复

[oracle@zhong zhong]$ rm -rf system01.dbf
将目标数据库启动到mount状态之后恢复

SYS@zhong:~>startup mount force
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 100664912 bytes
Database Buffers 180355072 bytes
Redo Buffers 2973696 bytes
Database mounted.
SYS@zhong:~>
[oracle@catalog scripts]$ rman catalog cataloguser/cataloguser target sys/oracle@zhong
Recovery Manager: Release 10.2.0.1.0 - Production on Wed Mar 28 11:26:30 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ZHONG (DBID=1447686871, not open)
connected to recovery catalog database

RMAN> run {
2> allocate channel c1 device type disk;
3> restore datafile 1;
4> recover datafile 1;
5> sql 'alter database open';
6> release channel c1;
7> }

allocated channel: c1
channel c1: sid=155 devtype=DISK

Starting restore at 28-MAR-12

channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/zhong/system01.dbf
channel c1: reading from backup piece /orabackup/inc0_ZHONG_1dn70dii_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc0_ZHONG_1dn70dii_1_1 tag=INC0
channel c1: restore complete, elapsed time: 00:00:25
Finished restore at 28-MAR-12

Starting recover at 28-MAR-12
channel c1: starting incremental datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/app/oracle/oradata/zhong/system01.dbf
channel c1: reading from backup piece /orabackup/inc1_ZHONG_1hn70dke_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc1_ZHONG_1hn70dke_1_1 tag=INC1
channel c1: restore complete, elapsed time: 00:00:01
channel c1: starting incremental datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/app/oracle/oradata/zhong/system01.dbf
channel c1: reading from backup piece /orabackup/inc2_ZHONG_1ln70dlm_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc2_ZHONG_1ln70dlm_1_1 tag=INC2
channel c1: restore complete, elapsed time: 00:00:01

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 28-MAR-12

sql statement: alter database open

released channel: c1
SYS@zhong:~>select open_mode from v$database;
OPEN_MODE
----------
READ WRITE

控制文件的还原

[oracle@zhong zhong]$ rm -rf *.ctl
将目标数据库启动到nomount状态

SYS@zhong:~>startup nomount force
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 100664912 bytes
Database Buffers 180355072 bytes
Redo Buffers 2973696 bytes
RMAN> run {
2> allocate channel c1 device type disk;
3> restore controlfile from tag='BKCTL';
4> sql 'alter database mount';
5> recover database;
6> sql 'alter database open resetlogs';
7> release channel c1;
8> }
allocated channel: c1
channel c1: sid=155 devtype=DISK

Starting restore at 28-MAR-12

channel c1: starting datafile backupset restore
channel c1: restoring control file
channel c1: reading from backup piece /orabackup/backupctl.ctl
channel c1: restored backup piece 1
piece handle=/orabackup/backupctl.ctl tag=BKCTL
channel c1: restore complete, elapsed time: 00:00:01
output filename=/u01/app/oracle/oradata/zhong/control01.ctl
output filename=/u01/app/oracle/oradata/zhong/control02.ctl
output filename=/u01/app/oracle/oradata/zhong/control03.ctl
Finished restore at 28-MAR-12

sql statement: alter database mount

Starting recover at 28-MAR-12
Starting implicit crosscheck backup at 28-MAR-12
Crosschecked 10 objects
Finished implicit crosscheck backup at 28-MAR-12

Starting implicit crosscheck copy at 28-MAR-12
Finished implicit crosscheck copy at 28-MAR-12

searching for all files in the recovery area
cataloging files...
no files cataloged

starting media recovery

archive log thread 1 sequence 21 is already on disk as file /u01/app/oracle/oradata/zhong/redo02.log
archive log thread 1 sequence 22 is already on disk as file /u01/app/oracle/oradata/zhong/redo03.log
archive log filename=/u01/app/oracle/oradata/zhong/redo02.log thread=1 sequence=21
archive log filename=/u01/app/oracle/oradata/zhong/redo03.log thread=1 sequence=22
media recovery complete, elapsed time: 00:00:01
Finished recover at 28-MAR-12

sql statement: alter database open resetlogs
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

released channel: c1

RMAN>
SYS@zhong:~>select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/zhong/control01.ctl
/u01/app/oracle/oradata/zhong/control02.ctl
/u01/app/oracle/oradata/zhong/control03.ctl

SYS@zhong:~>

online redolog
[oracle@zhong zhong]$ rm -rf *.log
SYS@zhong:~>startup mount force
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 104859216 bytes
Database Buffers 176160768 bytes
Redo Buffers 2973696 bytes
Database mounted.
SYS@zhong:~>
SYS@zhong:~>recover database until cancel;
ORA-00279: change 568289 generated at 03/28/2012 11:47:50 needed for thread 1
ORA-00289: suggestion : /arch/1_5_779110904.dbf
ORA-00280: change 568289 for thread 1 is in sequence #5
Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00308: cannot open archived log '/arch/1_5_779110904.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

SYS@zhong:~>recover database until cancel;
ORA-00279: change 568289 generated at 03/28/2012 11:47:50 needed for thread 1
ORA-00289: suggestion : /arch/1_5_779110904.dbf
ORA-00280: change 568289 for thread 1 is in sequence #5

Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SYS@zhong:~>alter database open resetlogs;

Database altered.

SYS@zhong:~>select open_mode from v$database;

OPEN_MODE
----------
READ WRITE

SYS@zhong:~>

online redolog, controlfile, datafile全部删除恢复

[oracle@zhong zhong]$ rm -rf rm -rf *.ctl *.log *.dbf
[oracle@zhong zhong]$ ls
[oracle@zhong zhong]$
SYS@zhong:~>startup nomount force
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 104859216 bytes
Database Buffers 176160768 bytes
Redo Buffers 2973696 bytes
SYS@zhong:~>
[oracle@catalog scripts]$ rman catalog cataloguser/cataloguser target sys/oracle@zhong
Recovery Manager: Release 10.2.0.1.0 - Production on Wed Mar 28 13:11:25 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: zhong (not mounted)
connected to recovery catalog database

RMAN> run {
2> allocate channel c1 device type disk;
3> restore database;
4> sql 'alter database mount';
5> recover database;
6> release channel c1;
7> }

allocated channel: c1
channel c1: sid=155 devtype=DISK

Starting restore at 28-MAR-12

channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/zhong/system01.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/zhong/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/zhong/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/zhong/users01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/zhong/example01.dbf
channel c1: reading from backup piece /orabackup/inc0_ZHONG_1qn70iom_1_1
channel c1: restored backup piece 1
piece handle=/orabackup/inc0_ZHONG_1qn70iom_1_1 tag=INC0
channel c1: restore complete, elapsed time: 00:00:35
Finished restore at 28-MAR-12

sql statement: alter database mount
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 03/28/2012 13:12:53
RMAN-11003: failure during parse/execution of SQL statement: alter database mount
ORA-00205: error in identifying control file, check alert log for more info

RMAN>
重建控制文件的脚本

create controlfile set database "zhong" resetlogs archivelog
maxlogfiles 16
maxlogmembers 3
maxdatafiles 100
maxinstances 8
maxloghistory 292
logfile
group 1 '/u01/app/oracle/oradata/zhong/redo01.log' size 50M,
group 2 '/u01/app/oracle/oradata/zhong/redo02.log' size 50M,
group 3 '/u01/app/oracle/oradata/zhong/redo03.log' size 50M
datafile
'/u01/app/oracle/oradata/zhong/system01.dbf',
'/u01/app/oracle/oradata/zhong/undotbs01.dbf',
'/u01/app/oracle/oradata/zhong/sysaux01.dbf',
'/u01/app/oracle/oradata/zhong/users01.dbf',
'/u01/app/oracle/oradata/zhong/example01.dbf'
character set zhs16gbk
;
[oracle@zhong ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 28 13:28:19 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SYS@zhong:~>select open_mode v$database;
select open_mode v$database
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

SYS@zhong:~>select open_mode from v$database;
select open_mode from v$database
*
ERROR at line 1:
ORA-01507: database not mounted

SYS@zhong:~>@cte_ctl

Control file created.

SYS@zhong:~>
[oracle@catalog scripts]$ rman catalog cataloguser/cataloguser target sys/oracle@zhong
Recovery Manager: Release 10.2.0.1.0 - Production on Wed Mar 28 13:33:04 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ZHONG (DBID=1447686871, not open)
connected to recovery catalog database

RMAN> run{
2> allocate channel c1 device type disk;
3> sql 'alter database mount';
4> recover database;
5> release channel c1;
6> }

allocated channel: c1
channel c1: sid=157 devtype=DISK

sql statement: alter database mount
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 03/28/2012 13:34:05
RMAN-11003: failure during parse/execution of SQL statement: alter database mount
ORA-01100: database already mounted

RMAN> recover database;

Starting recover at 28-MAR-12
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/28/2012 13:35:03
RMAN-12010: automatic channel allocation initialization failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20011: target database incarnation is not current in recovery catalog

RMAN> exit
[oracle@catalog scripts]$ rman nocatalog target sys/oracle@zhong

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Mar 28 13:37:27 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ZHONG (DBID=1447686871, not open)
using target database control file instead of recovery catalog

RMAN> recover database;

Starting recover at 28-MAR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK

starting media recovery

unable to find archive log
archive log thread=1 sequence=1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/28/2012 13:37:49
RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 567965

RMAN> alter database open resetlogs;

database opened

RMAN> exit









你可能感兴趣的:(oracle,oracle,oracle,oracle,rman)