从nub备份恢复(同平台)恢复RAC至单实例

来源:这里教程网 时间:2026-03-03 12:46:31 作者:

前段时间从生产的RAC的nub备份恢复到单实例数据库,过程如下:  1 将11.2.0.4 下的rac库备份并恢复到11.2.0.4 下的单实例环境下。    2.    由于是同步nub备份恢复所有不需要备份源端的RAC库,直接在nbu上找到备份,开始恢复     2.1.在单实例数据库中配置关于数据库的信息,.bash_profile文件,要注意字符集的定义,安装完成数据库软件。     2.2.在单实例数据库中创建参数文件,手工创建或者在源端库创建创建一个文本文件scp至目录库都行 方法一 :      手工创建:     cd  $ORACLE_HOME/dbs grep init.ora|grep -v ^$|grep -v ^#>initorcl.ora 然后修改里面的内容 方法二:      从生产库上      执行create pfile='/home/oracle/rman_back/initorcl.ora' from spfile; 使用scp传输至目标库的单实例下的$ORACLE_HOME/dbs下      修改完成以后内容如下 *.audit_file_dest='/u01/app/oracle/admin/orcl/adump' *.audit_trail='db' *.compatible='11.2.0.4.0' *.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='orcl' *.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area' *.db_recovery_file_dest_size=4070572032 *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)' *.log_archive_format='%t_%s_%r.dbf' *.memory_target=524288000 *.nls_date_format='YYYY-MM-DD HH24:mi:ss' *.open_cursors=300 *.processes=1500 *.remote_login_passwordfile='exclusive' 使用以下命令创建三个目录 mkdir -p /u01/app/oracle/oradata/orcl/ mkdir -p /u01/app/oracle/flash_recovery_area mkdir -p /u01/app/oracle/admin/orcl/adump       2.3 使用sqlplus 登录,    执行create  spfile  from pfile;         startup  nomount;-----启动数据库至nomount状态,       2.4 然后另外打开一个界面(我是使用的crt连接到数据库做的恢复),执行rman   target /  命令通过nub恢复控制文件,(在执行命令以前一定要源端库所在的主机上执行/usr/openv/netbackup/bin/oracle_link把这个db_link创建一下)         命令如下:     run { allocate channel c1 type  'SBT_TAPE';       SEND 'NB_ORA_SERV=BJV5240-02.nbadongbu.com.cn,NB_ORA_CLIENT=xf01orcl01-dr'; restore controlfile from '/cntrl_7755_1_110'; release channel c1; } 命令解释:   allocate channel c1 type  'SBT_TAPE';--------定义了通道一的恢复类型是 SBT_TAPE(这个意思就是磁带备份恢复). SEND 'NB_ORA_SERV=BJV5240-02.nbadongbu.com.cn,NB_ORA_CLIENT=xf01db01-dr'; ---------这个我们恢复控制文件的时候要去寻找的主机,后面是nbu客户端的类型,NB_ORA_SERV和,NB_ORA_CLIENT在备份脚本中都有(脚本的路径一般为/usr/openv/netbackup/script),需要和系统管理员确认一下,是不是这台主机。 restore controlfile from '/cntrl_7755_1_110';--------控制文件名字,需要在源端库上使用list backupset of  controlfile 查询控制文件的名字,需要注意的找full  database的时候的控制文件的名字。 控制文件恢复完成。需要执行alter database mount;       2.5 恢复数据文件,执行命令 run { allocate channel t1 type 'sbt_tape'; allocate channel t2 type 'sbt_tape'; allocate channel t3 type 'sbt_tape'; allocate channel t4 type 'sbt_tape'; SEND 'NB_ORA_SERV=BJV5240-02.nbadongbu.com.cn,NB_ORA_CLIENT=xf01orcl01-dr'; set newname for datafile  1 to   '/u01/app/oracle/oradata/orcl/system01.dbf';                                            set newname for datafile  2 to    '/u01/app/oracle/oradata/orcl/sysaux01.dbf';                                             set newname for datafile  3 to    '/u01/app/oracle/oradata/orcl/users01.dbf';                                              set newname for datafile  4 to    '/u01/app/oracle/oradata/orcl/undotbs01.dbf';                                                                                     restore database; switch datafile all; release channel t1; release channel t2; release channel t3; release channel t4; } 需要注意的是还原路径/u01/app/oracle/oradata/orcl这个目标端单实例数据库的路径。     2.6 recover database; RMAN> recover database; Starting recover at 22-MAR-18 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1441 instance=orcl device type=sbt_tape starting media recovery Oracle Error:  ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below ORA-01152: file 1 was not restored from a sufficiently old backup  ORA-01110: data file 1: '+DATAC110/orcl/datafile/system01.dbf' RMAN-00571:  RMAN-00569: ====ERROR MESSAGE STACK FOLLOWS ===== RMAN-00571:  RMAN-03002: failure of recover command at 03/22/2018 21:56:01 RMAN-06053: unable to perform media recovery because of missing log RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 7469 and starting SCN of 389605961 RMAN-06102: no channel to restore a backup or copy of archived log for thread 2 with sequence 2277 and starting SCN of 389605958 RMAN-06102: no channel to restore a backup or copy of archived log for thread 1 with sequence 7468 and starting SCN of 389557852 RMAN-06102: no channel to restore a backup or copy of archived log for thread 2 with sequence 2276 and starting SCN of 389445397     2.7 恢复归档日志 RMAN> run { allocate channel c1 type 'sbt_tape'; allocate channel c2 type 'sbt_tape'; SEND 'NB_ORA_SERV=BJV5240-02.nbadongbu.com.cn,NB_ORA_CLIENT=xf01orcl01-dr'; restore archivelog  sequence between 7468 and 7469 thread 1; restore archivelog  sequence between 22762 and 2277 thread 2; release channel c1; release channel c2;  恢复的 sequence between 7468 and 7469 thread 1          sequence between 22762 and 2277 thread 2;   归档的序列号区间需要执行list backupset of  controlfile;查看从我们恢复full  database时候的控制文件中开始的归档序列号,结束的归档序列为控制文件中最后显示的归档序列号。线程号1是源端rac的节点1,线程号2是源端rac的节点2.     2.8  恢复完成以后,再次执行recover database RMAN-00571:  RMAN-00569: === ERROR MESSAGE STACK FOLLOWS ==== RMAN-00571:  RMAN-03002: failure of recover command at 03/22/2018 21:58:47 RMAN-06054: media recovery requesting unknown archived log for thread 2 with sequence 2278 and starting SCN of 389605979     2.9   recover database RMAN> recover database until scn 389605979;     3.0  打开数据库 RMAN> alter database open resetlogs;

相关推荐