概述:
Rman備份完畢,需要在異機恢復進行備份的校驗,今天拿Rman例項的spfile手工建立TEST例項,操作步驟如下:
1、建立相應目錄
[oracle@gstest /]$ cd u01/app/oracle/product/11gR2/db/dbs/[oracle@gstest dbs]$ cp -ap spfilerman.ora spfiletest.ora$ mkdir -p /u01/app/oracle/oradata/TEST/controlfile$ mkdir -p /u01/app/oracle/oraarch/test$ mkdir -p /u01/app/oracle/admin/test/adump
2、初始化引數檔案
$ export ORACLE_SID=test$ sqlplus / as sysdbaSQL> shutdown abort;SQL> startup nomountSQL> alter system set sga_target=5G scope=spfile;SQL> alter system set control_files='/u01/app/oracle/oradata/TEST/controlfile/control01.ctl' scope=spfile;SQL> alter system set db_unique_name=test scope=spfile;SQL> alter system set log_archive_dest_1='location=/u01/app/oracle/oraarch/test' scope=spfile;SQL> alter system set audit_file_dest='/u01/app/oracle/admin/test/adump' scope=spfile;SQL> shutdown abortSQL> startup nomount
3、恢復控制檔案:
nomount狀態
rman target /
RMAN> restore controlfile from '/u01/rman/c-1920773739-20200418-09';
4、恢復資料檔案
mount狀態下
RMAN> alter database mount;RMAN> crosscheck backup;RMAN> crosscheck copy;RMAN> delete noprompt expired backup;RMAN> delete noprompt expired copy;RMAN> catalog start with '/u01/rman';RMAN> list backup;RMAN> run{allocate channel c1 device type disk;allocate channel c2 device type disk;set newname for database to new;set newname for tempfile 1 to new;set newname for tempfile 2 to new;set newname for tempfile 3 to new;restore database;switch datafile all;switch tempfile all;release channel c1;release channel c2;}
recover database;
RMAN> alter database open resetlogs;
database opened
5、搞定
最新評論