rman备份恢复命令之switch(五)

2014-11-24 16:56:14 · 作者: · 浏览: 3
ing command: SET NEWNAME executing command: SET NEWNAME renamed tempfile 1 to /oracle/CRM/test/temp01.dbf in control file renamed tempfile 2 to /oracle/CRM/test/temp02.dbf in control file database opened RMAN> report schema; Report of database schema for database with db_unique_name CRM List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- ------------------------ 1 750 SYSTEM *** /oracle/CRM/test/SYSTEM1.dbf 2 540 SYSAUX *** /oracle/CRM/test/SYSAUX2.dbf 3 100 UNDOTBS3 *** /oracle/CRM/test/UNDOTBS33.dbf 4 1742 USERS *** /oracle/CRM/test/USERS4.dbf 5 500 POS *** /oracle/CRM/test/POS5.dbf 6 100 ERP *** /oracle/CRM/test/ERP6.dbf 7 5 USER01 *** /oracle/CRM/test/USER017.dbf 8 1 TEST *** /oracle/CRM/test/TEST8.dbf 9 10 POS *** /oracle/CRM/test/POS9.dbf List of Temporary Files ======================= File Size(MB) Tablespace Maxsize(MB) Tempfile Name ---- -------- -------------------- ----------- -------------------- 1 218 TEMP 32767 /oracle/CRM/test/temp01.dbf 2 3072 MYNEWTEMP 40960 /oracle/CRM/test/temp02.dbf 例五 用switch datafile all更新表空间所有数据位置和名字 语句: run{ sql 'alter tablespace pos offline immediate'; set newname for datafile '/oracle/CRM/test/POS5.dbf' to '/oracle/CRM/pos1.dbf'; set newname for datafile '/oracle/CRM/test/POS9.dbf' to '/oracle/CRM/pos2.dbf'; restore tablespace pos; switch datafile all; recover tablespace pos; sql 'alter tablespace pos online'; } 执行过程如下: RMAN> run{ 2> sql 'alter tablespace pos offline immediate'; 3>
set newname for datafile '/oracle/CRM/test/POS5.dbf' to '/oracle/CRM/pos1.dbf'; 4> set newname for datafile '/oracle/CRM/test/POS9.dbf' to '/oracle/CRM/pos2.dbf'; 5> restore tablespace pos; 6> switch datafile all; 7> recover tablespace pos; 8> sql 'alter tablespace pos online'; 9> } sql statement: alter tablespace pos offline immediate executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 2013-02-22 15:18:37 using channel ORA_DISK_1 using channel ORA_DISK_2 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 00005 to /oracle/CRM/pos1.dbf channel ORA_DISK_1: restoring datafile 00009 to /oracle/CRM/pos2.dbf channel ORA_DISK_1: reading from backup piece /backup/20130222_hho2k7jn_1_1 channel ORA_DISK_1: piece handle=/backup/20130222_hho2k7jn_1_1 tag=TAG20130222T145756 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:25 Finished restore at 2013-02-22 15:19:03 datafile 5 switched to datafile copy input datafile copy RECID=72 STAMP=808067944 file name=/oracle/CRM/pos1.dbf datafile 9 switched to datafile copy input datafile copy RECID=73 STAMP=808067944 file name=/oracle/CRM/pos2.dbf Starting recover at 2013-02-22 15:19:04 using channel ORA_DISK_1 using channel ORA_DISK_2 starting media recovery media recovery complete, elapsed time: 00:00:00 Finished recover at 2013-02-22 15:19:05 sql statement: alter tablespace po