##1 编辑参数文件
orcl.__db_cache_size=629145600
orcl.__java_pool_size=4194304
orcl.__large_pool_size=71303168
orcl.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=314572800
rman.__db_cache_size=629145600
rman.__java_pool_size=4194304
rman.__large_pool_size=71303168
rman.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
rman.__pga_aggregate_target=314572800
rman.__db_cache_size=629145600
rman.__java_pool_size=4194304
rman.__large_pool_size=71303168
rman.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
rman.__pga_aggregate_target=314572800
rman.__sga_target=947912704
rman.__shared_io_pool_size=0
rman.__shared_pool_size=230686720
rman.__streams_pool_size=0
*._use_adaptive_log_file_sync='FALSE'
*.audit_file_dest='/u01/oracle/admin/rman/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/oracle/oradata/rman/control01.ctl','/u01/oracle/oradata/rman/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='rman'
*.db_recovery_file_dest='/u01/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/u01/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=rmanXDB)'
*.open_cursors=3000
*.pga_aggregate_target=314572800
*.processes=1500
*.remote_login_passwordfile='EXCLUSIVE'
*.sec_case_sensitive_logon=FALSE
##2 创建目录。这里如果时间够用的话,个人建议创建一个相同名称的实例更好。
[oracle@rman1 ~]$ mkdir -p /u01/oracle/admin/$ORACLE_SID/{dpdump,adump,pfile}
[oracle@rman1 ~]$ mkdir -p /u01/oracle/diag/rdbms/orcl/orcl/{alert,cdump,incident,incpkg,ir,lck,metadata,metadata_dgif,metadata_pv,stage,sweep,trace}
[oracle@rman1 ~]$ mkdir -p /u01/oracle/oradata/$ORACLE_SID
[oracle@rman1 ~]$ mkdir -p /u01/oracle/fast_recovery_area/$ORACLE_SID/{onlinelog,archivelog}
##3 恢复
[oracle@rman1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Fri May 5 13:24:52 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
#RMAN> set dbid 1829607053 #注意,我自己在这里并没有指定dbid,恢复成功了。但是,如果可能知道dbid的情况下,还是需要指定的。
RMAN> startup nomount
Oracle instance started
Total System Global Area 993775616 bytes
Fixed Size 2259360 bytes
Variable Size 859833952 bytes
Database Buffers 125829120 bytes
Redo Buffers 5853184 bytes
RMAN> restore controlfile from '/u01/backup/ctl_20170505_RMAN_db_6_1.bak';
Starting restore at 05-MAY-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/oracle/oradata/rman/control01.ctl
output file name=/u01/oracle/oradata/rman/control02.ctl
Finished restore at 05-MAY-17
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> catalog start with '/u01/backup';
RMAN> restore database;
Starting restore at 05-MAY-17
Starting implicit crosscheck backup at 05-MAY-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
Crosschecked 4 objects
Finished implicit crosscheck backup at 05-MAY-17
Starting implicit crosscheck copy at 05-MAY-17
using channel ORA_DISK_1
Finished implicit crosscheck copy at 05-MAY-17
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/oracle/oradata/rman/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/oracle/oradata/rman/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/oracle/oradata/rman/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/oracle/oradata/rman/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/backup_1829607053_20170505_RMAN_3_1.bak
channel ORA_DISK_1: piece handle=/u01/backup/backup_1829607053_20170505_RMAN_3_1.bak tag=TAG20170505T104501
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 05-MAY-17
RMAN> recover database;
Starting recover at 05-MAY-17
using channel ORA_DISK_1
starting media recovery
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=5
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=6
channel ORA_DISK_1: reading from backup piece /u01/backup/arc_20170505_RMAN_5_1.bak
channel ORA_DISK_1: piece handle=/u01/backup/arc_20170505_RMAN_5_1.bak tag=TAG20170505T105032
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/oracle/fast_recovery_area/RMAN/archivelog/2017_05_05/o1_mf_1_5_djr4l1qk_.arc thread=1 sequence=5
channel default: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/RMAN/archivelog/2017_05_05/o1_mf_1_5_djr4l1qk_.arc RECID=4 STAMP=943192130
archived log file name=/u01/oracle/fast_recovery_area/RMAN/archivelog/2017_05_05/o1_mf_1_6_djr4l1t9_.arc thread=1 sequence=6
channel default: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/RMAN/archivelog/2017_05_05/o1_mf_1_6_djr4l1t9_.arc RECID=3 STAMP=943192129
unable to find archived log
archived log thread=1 sequence=7
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 05/05/2017 13:48:51
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 7 and starting SCN of 966849
##在sqlplus里面继续恢复
[oracle@rman1 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Fri May 5 13:49:52 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 966849 generated at 05/05/2017 10:50:32 needed for thread 1
ORA-00289: suggestion :
/u01/oracle/fast_recovery_area/RMAN/archivelog/2017_05_05/o1_mf_1_7_%u_.arc
ORA-00280: change 966849 for thread 1 is in sequence #7
Specify log: {=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.
SQL> alter database open resetlogs;
database opened
#redo log会在resetlogs后自动根据controlfile创建,temp表空间也会在resetlogs后自动创建。
[root@rman1 ~]# ls /u01/oracle/oradata/rman/*
/u01/oracle/oradata/rman/control01.ctl /u01/oracle/oradata/rman/sysaux01.dbf /u01/oracle/oradata/rman/undotbs01.dbf
/u01/oracle/oradata/rman/control02.ctl /u01/oracle/oradata/rman/system01.dbf /u01/oracle/oradata/rman/users01.dbf
[root@rman1 ~]# ls /u01/oracle/oradata/rman/*
/u01/oracle/oradata/rman/control01.ctl /u01/oracle/oradata/rman/redo02.log /u01/oracle/oradata/rman/system01.dbf /u01/oracle/oradata/rman/users01.dbf
/u01/oracle/oradata/rman/control02.ctl /u01/oracle/oradata/rman/redo03.log /u01/oracle/oradata/rman/temp01.dbf
/u01/oracle/oradata/rman/redo01.log /u01/oracle/oradata/rman/sysaux01.dbf /u01/oracle/oradata/rman/undotbs01.dbf
[root@rman1 ~]# ls /u01/oracle/oradata/rman/* -lh
-rw-r----- 1 oracle oinstall 9.3M May 5 13:52 /u01/oracle/oradata/rman/control01.ctl
-rw-r----- 1 oracle oinstall 9.3M May 5 13:52 /u01/oracle/oradata/rman/control02.ctl
-rw-r----- 1 oracle oinstall 51M May 5 13:52 /u01/oracle/oradata/rman/redo01.log
-rw-r----- 1 oracle oinstall 51M May 5 13:51 /u01/oracle/oradata/rman/redo02.log
-rw-r----- 1 oracle oinstall 51M May 5 13:51 /u01/oracle/oradata/rman/redo03.log
-rw-r----- 1 oracle oinstall 491M May 5 13:51 /u01/oracle/oradata/rman/sysaux01.dbf
-rw-r----- 1 oracle oinstall 741M May 5 13:51 /u01/oracle/oradata/rman/system01.dbf
-rw-r----- 1 oracle oinstall 21M May 5 13:52 /u01/oracle/oradata/rman/temp01.dbf
-rw-r----- 1 oracle oinstall 76M May 5 13:51 /u01/oracle/oradata/rman/undotbs01.dbf
-rw-r----- 1 oracle oinstall 5.1M May 5 13:51 /u01/oracle/oradata/rman/users01.dbf
#检查DBID
SQL> select DBID from v$database;
DBID
----------
1829607053
SQL> !ls /u01/backup
arc_20170505_RMAN_5_1.bak backup_1829607053_20170505_RMAN_3_1.bak ctl_20170505_RMAN_db_6_1.bak
backup_1829607053_20170505_RMAN_2_1.bak backup_1829607053_20170505_RMAN_4_1.bak
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28572479/viewspace-2138535/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28572479/viewspace-2138535/