Oracle RMAN 恢复数据库到不同主机(3)

List of Permanent Datafiles
===========================
File Size(MB) Tablespace          RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    0        SYSTEM              ***    /u01/app/oracle/oradata/scp/system01.dbf
2    0        ZYTK_AC              ***    /u01/app/oracle/oradata/scp/zytk_ac01.dbf
3    0        SYSAUX              ***    /u01/app/oracle/oradata/scp/sysaux01.dbf
4    0        UNDOTBS1            ***    /u01/app/oracle/oradata/scp/undotbs01.dbf
5    0        EXAMPLE              ***    /u01/app/oracle/oradata/scp/example01.dbf
6    0        USERS                ***    /u01/app/oracle/oradata/scp/users01.dbf
7    0        ZYTK_AC              ***    /u01/app/oracle/oradata/scp/zytk_ac02.dbf
8    0        ZYTK_ID              ***    /u01/app/oracle/oradata/scp/zytk_id01.dbf
9    0        ZYTK_ID              ***    /u01/app/oracle/oradata/scp/zytk_id02.dbf
10  0        ZYTK_OP              ***    /u01/app/oracle/oradata/scp/zytk_op01.dbf
11  0        ZYTK_OP              ***    /u01/app/oracle/oradata/scp/zytk_op02.dbf
12  0        ZYTK_TEST01          ***    /u01/app/oracle/oradata/scp/zytk_test01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace          Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    60      TEMP                32767      /u01/app/oracle/oradata/scp/temp01.dbf

注意:restore 的时候不会对temp 表空间进行restore。所以等restore 之后,我们需要手工创建temp表空间。

J、为了将数据文件恢复到不同于原来的目录结构中,必须编写脚本,重新命名数据文件的位置,最后进行全库的恢复。

(如果数据文件路径和原来的相同则直接还原数据库)

run{
set newname for datafile 1 to '/home/OracleData/scp/system01.dbf';
set newname for datafile 2 to '/home/OracleData/scp/zytk_ac01.dbf';
set newname for datafile 3 to '/home/OracleData/scp/sysaux01.dbf';
set newname for datafile 4 to '/home/OracleData/scp/undotbs01.dbf';
set newname for datafile 5 to '/home/OracleData/scp/example01.dbf';
set newname for datafile 6 to '/home/OracleData/scp/users01.dbf';
set newname for datafile 7 to '/home/OracleData/scp/zytk_ac02.dbf';
set newname for datafile 8 to '/home/OracleData/scp/zytk_id01.dbf';
set newname for datafile 9 to '/home/OracleData/scp/zytk_id02.dbf';
set newname for datafile 10 to '/home/OracleData/scp/zytk_op01.dbf';
set newname for datafile 11 to '/home/OracleData/scp/zytk_op02.dbf';
set newname for datafile 12 to '/home/OracleData/scp/zytk_test01.dbf';
restore database;
switch datafile all; 
}

对switch datafile all命令的说明:

--对于nocatalog 模式下,rman备份的信息是保存在控制文件里的,包括数据文件的路径信息。 这里的  switch datafile all  的作用,就是更新控制文件里的信息。如果不更新控制文件的话,则进行recover操作时还在原来的位置找文件。

K、还原数据库以后,进行 recover 操作

RMAN> recover database;

Starting recover at 06-MAY-16
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=148
channel ORA_DISK_1: reading from backup piece /home/OracleBack/rmanbak/arch_20160223_0bqukp92_1_1
channel ORA_DISK_1: piece handle=/home/OracleBack/rmanbak/arch_20160223_0bqukp92_1_1 tag=ZYTK_DB_FULL
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/home/OracleArch/ArchiveLog/1_148_899483175.dbf thread=1 sequence=148
unable to find archived log
archived log thread=1 sequence=149
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 05/06/2016 23:53:58
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 149 and starting SCN of 3507749

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/740d08683947289abe76675bf0f0932e.html