语句:select * from v$version;
源库:
查询数据库名语句:select name fromv$database;
如果不一致通过恢复spfile文件再把spfile文件转为为pfile文件修改数据库名;
恢复spfile:
restore spfile from '/home/oracle/backup/spfile_20171103_0hsijpo8_1_1.bak';
根据spfile创建pfile:
createpfile from spfile;
语句:select dbid fromv$database;
语句:startup pfile ='$ORACLE_HOME/dbs/initauth.ora' nomount;
命令:restorecontrolfile from '/home/oracle/backup/ctl_20171109_1usj3jvs_1_1.ctl'
命令: alterdatabase mount;
命令:catalogstart with '/home/oracle/backup/';
脚本如下:
run{
allocate channel t1 type DISK FORMAT'/home/oracle/backup/%U';
allocate channel t2 type DISK FORMAT'/home/oracle/backup/%U';
allocate channel t3 type DISK FORMAT'/home/oracle/backup/%U';
set newname for datafile 1 to'/u01/app/oracle/oradata/AUTH/system.259.856237927';
set newname for datafile 2 to'/u01/app/oracle/oradata/AUTH/sysaux.260.856237941';
set newname for datafile 3 to'/u01/app/oracle/oradata/AUTH/undotbs1.261.856237955';
set newname for datafile 4 to'/u01/app/oracle/oradata/AUTH/undotbs2.263.856237975';
set newname for datafile 5 to'/u01/app/oracle/oradata/AUTH/users.264.856237981';
set newname for datafile 6 to'/u01/app/oracle/oradata/AUTH/auth.268.856243549';
set newname for datafile 7 to'/u01/app/oracle/oradata/AUTH/auth.269.856243795';
set newname for datafile 8 to'/u01/app/oracle/oradata/AUTH/sysaux02.dbf';
set newname for datafile 9 to'/u01/app/oracle/oradata/AUTH/system02.dbf';
restore database;
switch datafile all;
release channel t1;
release channel t2;
release channel t3;
}
等待。。。。
脚本如下:
run {
allocate channel t1 type DISK FORMAT'/home/oracle/backup/%U';
allocate channel t2 type DISK FORMAT'/home/oracle/backup/%U';
allocate channel t3 type DISK FORMAT'/home/oracle/backup/%U';
recover database;
release channel t1;
release channel t2;
release channel t3;
}
删除选中两行
alter system setlog_archive_dest='/u01/app/oracle/oradata/arch_log';
命令: alterdatabase open resetlogs;
在sqlplusz中
通过 select memberfrom V$logfile; 查询
通过 alterdatabase rename file ‘原路径’ to ‘新路径’ 全部修改完毕
再次尝试resetlog方式打开数据库
删除 log 10;
再次尝试resetlog方式打开数据库
由于rman备份的时候并不备temporarytablespaces,所以恢复完毕后,要重新创建它们。如:
$sqlplus /nolog
SQL>conn /as sysdba
SQL> altertablespace temp add tempfile '/u01/app/oracle/oradata/AUTH/temp01.dbf' size1024m;