数据库
首页 > 数据库> > Oracle Windows异机恢复

Oracle Windows异机恢复

作者:互联网

环境:windows2008r2  Oracle11gr2

先手动创建新实例

********************************手动创建pfile
db_name='ORCL'
processes = 150
audit_file_dest='D:\app\xyz\admin\orcl\adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='D:\app\xyz\flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='D:\app\xyz'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300 
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
* You may want to ensure that control files are created on separate physical
* devices
control_files = 'D:\app\xyz\oradata\orcl\control01.ctl','D:\app\xyz\flash_recovery_area\orcl\control02.ctl'
compatible ='11.2.0'
memory_target=0
sga_max_size=3439329280
sga_target=3439329280
pga_aggregate_target=104857600
 *************************************手动创建新实例,cmd下使用oradim命令
oradim -NEW -SID xyz -SYSPWD password -STARTMODE MANUAL -PFILE  D:\app
*****************************pfile放在D:\app\Administrator\product\11.2.0\dbhome_1\database,(这个目录根据你的实际情况去改)启动实例
C:\sqlplus /nolog
SQL>connect sys/mynewdb as sysdba;
SQL>startup nomount;

参考链接:https://blog.csdn.net/weixin_33696822/article/details/92958518

实例启动后使用rman进行恢复

select 'set newname for datafile '||file_id||' to '||chr(39)||'d:\app\xyz\oradata\'||substr(file_name,(instr(file_name,'/',-1)+1))||chr(39)||';' from dba_data_files where tablespace_name in ('SYSTEM','SYSAUX','UNDOTBS1','USERS','EXAMPLE');

*******************************使用rman恢复
rman target /
set dbid=1621815288;
restore controlfile from 'd:\bak\C-1621815288-20220116-02';
alter database mount;
catalog start with 'd:\bak';
**************************************************恢复数据文件
run {
allocate channel ch0 type disk;
set newname for datafile 4 to 'd:\app\xyz\oradata\USERS01.DBF';
set newname for datafile 3 to 'd:\app\xyz\oradata\UNDOTBS01.DBF';
set newname for datafile 2 to 'd:\app\xyz\oradata\SYSAUX01.DBF';
set newname for datafile 1 to 'd:\app\xyz\oradata\SYSTEM01.DBF';
set newname for datafile 5 to 'd:\app\xyz\oradata\EXAMPLE01.DBF';
set until scn 1145279;
restore database;
switch datafile all;
switch tempfile all;
release channel ch0;
}
**************恢复过程中如果报ORA-19693: 已包括备份片段 D:\******的错误
先使用crosscheck backup一下,检查可以重命名一下备份文件,delete expired backup删除过期文件。
如果不行再尝试重命名一下备份文件目录
*****************************************恢复到指定的scn
recover database until scn  1145279;
*********************
alter database open resetlogs;

 

标签:datafile,set,Windows,app,db,oradata,Oracle,xyz,异机
来源: https://www.cnblogs.com/wa-zz/p/15810568.html