同时,需要将自动备份的控制文件copy到ora9208用户的$ORACLE_HOME/dbs下(rman恢复时,会自动到这个路径下寻找自动备份的控制文件)
[ora9208@ora-as4 prod]$ cp /oracle/product/9.2.0.4/dbs/c-59186099-20080223-03 $ORACLE_HOME/dbs
3.在ora9208用户下,将备份恢复到新的路径下,恢复脚本如下:
以下是引用片段:
rman target /<
startup force nomount;
set DBID=51059446;
run{
restore controlfile from autobackup;
sql 'alter database mount';
set newname for datafile 1 to '/ora9208/oradata/prod/system01.dbf';
set newname for datafile 2 to '/ora9208/oradata/prod/undotbs01.dbf';
set newname for datafile 3 to '/ora9208/oradata/prod/users01.dbf';
set newname for datafile 4 to '/ora9208/oradata/prod/idx01.dbf';
set newname for datafile 5 to '/ora9208/oradata/prod/tools01.dbf';
set newname for datafile 6 to '/ora9208/oradata/prod/stress_test_tables01.dbf';
set newname for datafile 7 to '/ora9208/oradata/prod/stress_test_indexes01.dbf';
restore database;
switch datafile 1;
switch datafile 2;
switch datafile 3;
switch datafile 4;
switch datafile 5;
switch datafile 6;
switch datafile 7;
recover database ;
}
EOF
4.将源数据库的归档日志copy到目标数据库的归档路径下,做recover。
以下是引用片段:
[ora9208@ora-as4 arch]$ sqlplus '/as sysdba'
SQL*Plus: Release 9.2.0.4.0 - Production on Sat Feb 23 12:39:34 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> recover database using backup controlfile;
ORA-00279: change 2929288 generated at 02/23/2008 12:07:20 needed for thread 1
ORA-00289: suggestion : /ora9208/arch/1_130.dbf
ORA-00280: change 2929288 for thread 1 is in sequence #130
Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 2929319 generated at 02/23/2008 12:08:49 needed for thread 1
ORA-00289: suggestion : /ora9208/arch/1_131.dbf
ORA-00280: change 2929319 for thread 1 is in sequence #131
ORA-00278: log file '/ora9208/arch/1_130.dbf' no longer needed for this
recovery
ORA-00279: change 2929613 generated at 02/23/2008 12:23:23 needed for thread 1
ORA-00289: suggestion : /ora9208/arch/1_132.dbf
ORA-00280: change 2929613 for thread 1 is in sequence #132
ORA-00278: log file '/ora9208/arch/1_131.dbf' no longer needed for this
recovery
ORA-00279: change 2929615 generated at 02/23/2008 12:23:23 needed for thread 1
ORA-00289: suggestion : /ora9208/arch/1_133.dbf
ORA-00280: change 2929615 for thread 1 is in sequence #133
ORA-00278: log file '/ora9208/arch/1_132.dbf' no longer needed for this
recovery
ORA-00279: change 2929618 generated at 02/23/2008 12:23:24 needed for thread 1
ORA-00289: suggestion : /ora9208/arch/1_134.dbf
ORA-00280: change 2929618 for thread 1 is in sequence #134
ORA-00278: log file '/ora9208/arch/1_133.dbf' no longer needed for this
recovery
ORA-00279: change 2929620 generated at 02/23/2008 12:23:25 needed for thread 1
ORA-00289: suggestion : /ora9208/arch/1_135.dbf
ORA-00280: change 2929620 for thread 1 is in sequence #135
ORA-00278: log file '/ora9208/arch/1_134.dbf' no longer needed for this
recovery
ORA-00308: cannot open archived log '/ora9208/arch/1_135.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
[ora9208@ora-as4 arch]$