oracle 异库恢复

来源:互联网 发布:java redis连接池配置 编辑:程序博客网 时间:2024/06/10 23:44
原服务器数据库版本10G,新服务器版本11G
实例名必须相同。
目录最好相同,按原pfile里的有的目录创建


查询原数据库dbid
select dbid from v$database;


RMAN> set dbid=844174343                           


executing command: SET DBID


RMAN> startup nomount;


startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/oracle/db/dbs/initxezf.ora'


starting Oracle instance without parameter file for retrieval of spfile
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 05/12/2017 11:38:58
RMAN-04014: startup failed: ORA-04031: unable to allocate 3978656 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","FileOpenBlock")


原服务器scp 一份spfile或者pfile到新服务器




RMAN> startup nomount


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 05/12/2017 11:48:38
RMAN-04014: startup failed: ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated
ORA-07286: sksagdi: cannot obtain device information.
Linux-x86_64 Error: 2: No such file or directory
RMAN-04017: startup error description: ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance


创建所需要的目录
mkdir -p /u02/flash_recovery_area


RMAN> restore controlfile from '/oraclebak/ctl_file_fus3mu79_1_1_20170508';


Starting restore at 12-MAY-17
using channel ORA_DISK_1


channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u02/oradata/xezf/control01.ctl
output file name=/u02/oradata/xezf/control02.ctl
output file name=/u02/oradata/xezf/control03.ctl
Finished restore at 12-MAY-17


RMAN> startup mount;


database is already started
database mounted
released channel: ORA_DISK_1




run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
restore database;  
recover database until scn 14373193436;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}


查看各数据文件scn号是否一致
SQL> select distinct to_char(checkpoint_change#) from v$datafile a ;


TO_CHAR(CHECKPOINT_CHANGE#)
----------------------------------------
14373193440




RMAN> alter database open;


using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 05/14/2017 12:09:03
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option




SQL> startup upgrade;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.


Total System Global Area 1.7103E+10 bytes
Fixed Size    2220200 bytes
Variable Size 2281705304 bytes
Database Buffers 1.4764E+10 bytes
Redo Buffers   55287808 bytes
Database mounted.
Database opened.
0 0