为了账号安全,请及时绑定邮箱和手机立即绑定

NBU异机恢复ORACLE成功版本

标签:
Oracle


经过《NBU异机恢复ORACLE(遇到的问题) 》,成功版本如下

源端:oracle10grac1 oracle10grac2 RAC+ASM 

目标端:ora10 

master server:nbuserver

1、在nbuserver的/usr/openv/netbackup/db/altnames目录下创建文件 No.Restrictions 

2、准备好脚本db_bak.sh,重点注意这里一定要加上归档的备份(至于删不删除,看实际情况),

      否则就会做到最后成《NBU异机恢复ORACLE(遇到的问题)》的情况

      还有注意除了归档不添加send参数之外,备份这些最好添加上send参数,以避免出错

RUN {

ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';

send 'NB_ORA_POLICY=oracle10grac_db_full,NB_ORA_SERV=nbuserver';

ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';

send 'NB_ORA_POLICY=oracle10grac_db_full,NB_ORA_SERV=nbuserver';

BACKUP

    $BACKUP_TYPE

    SKIP INACCESSIBLE

    TAG hot_db_bk_level0

    FILESPERSET 5

    # recommended format

    FORMAT 'bk_%s_%p_%t'

    DATABASE;

    sql 'alter system archive log current';

RELEASE CHANNEL ch00;

RELEASE CHANNEL ch01;

# backup all archive logs

ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' connect sys/oracle@orcl1;

#send 'NB_ORA_POLICY=oracle10grac_db_full,NB_ORA_SERV=nbuserver';  --这里加上要报错,就不加了

ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE' connect sys/oracle@orcl2;

#send 'NB_ORA_POLICY=oracle10grac_db_full,NB_ORA_SERV=nbuserver';

BACKUP

   filesperset 20

   FORMAT 'al_%s_%p_%t'

   ARCHIVELOG ALL DELETE INPUT;

RELEASE CHANNEL ch00;

RELEASE CHANNEL ch01;

3、源端(oracle10grac1)

select 'set newname for datafile '||t.file_id||' to'||'''/opt/oracle/oradata/orcl/' ||replace(t.file_name,'+DATA/orcl/datafile/','')||''';' from dba_data_files t order by t.file_id;

select dbid from v$database;

4、目标端(ora10)

[oracle@ora10 ~]$ /usr/openv/netbackup/bin/oracle_link

5、目标端参数文件和密码文件

[oracle@oracle10grac1 dbs]$ scp orapworcl1 ora10:/opt/oracle/10g/db/dbs

[oracle@ora10 dbs]$ mv orapworcl1 orapworcl

initorcl.ora也传一份过来手工修改成单机模式,相应目录应建好,ora10只安装oracle软件,特别注意版本要升级成源端的版本

[oracle@ora10 ~]$ more initorcl.ora

orcl.__db_cache_size=32914560

orcl.__java_pool_size=2194304

orcl.__large_pool_size=2194304

orcl.__shared_pool_size=60023424

orcl.__streams_pool_size=0

*.audit_file_dest='/opt/oracle/admin/orcl/adump'

*.background_dump_dest='/opt/oracle/admin/orcl/bdump'

*.compatible='10.2.0.5.0'

*.control_files='/opt/oracle/oradata/orcl/orcl.ctl'

*.core_dump_dest='/opt/oracle/admin/orcl/cdump'

*.db_block_size=8192

*.db_create_file_dest='/opt/oracle/oradata/orcl'

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='orcl'

*.db_recovery_file_dest='/opt/oracle/flash'

*.db_recovery_file_dest_size=2097152000

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'

*.job_queue_processes=10

*.log_archive_dest_1='location=/opt/oracle/arch'

*.log_archive_format='%t_%s_%r.dbf'

*.open_cursors=300

*.pga_aggregate_target=31457280

*.processes=500

*.remote_login_passwordfile='exclusive'

*.sessions=555

*.sga_target=209715200

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/opt/oracle/admin/orcl/udump'

6、启动到nomount,rman恢复控制文件

目标端(ora10):

SQL> startup nomount pfile='/home/oracle/initorcl.ora';

 

在nbuserver或其他server上查看最后的控制文件进行恢复(因为全备脚本有备份)

The -t 4 on this command specifies the Oracle backups. The -R specifies the default number (999) of directory levels to search.

 

下面这个命令就是要加“/”,指定真真实路径(/nbu/bak)反而出不来,netbackup_commands文档有出入

[root@nbuserver ~]# bplist -S nbuserver -C oracle10grac1 -t 4 -R -l /

-rw-rw---- oracle    oinstall     15990784 Apr 12 10:06 /cntrl_416_1_780401205

-rw-rw---- oracle    oinstall       262144 Apr 12 10:06 /al_415_1_780401181

-rw-rw---- oracle    oinstall       262144 Apr 12 10:06 /al_413_1_780401165

-rw-rw---- oracle    oinstall       262144 Apr 12 10:05 /bk_412_1_780401135

-rw-rw---- oracle    oinstall     15990784 Apr 12 10:05 /bk_411_1_780401134

-rw-rw---- oracle    oinstall    225181696 Apr 12 10:04 /bk_410_1_780401068

-rw-rw---- oracle    oinstall    393740288 Apr 12 10:04 /bk_409_1_780401068

-rw-rw---- oracle    oinstall     15990784 Apr 12 10:03 /cntrl_408_1_780401011

-rw-rw---- oracle    oinstall       262144 Apr 12 10:03 /al_407_1_780400992

-rw-rw---- oracle    oinstall       786432 Apr 12 10:02 /al_405_1_780400976

也可以直接到源段机器的rman查看

 

[oracle@ora10 ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Thu Apr 12 01:37:15 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: orcl (not mounted)

RMAN> set dbid=1307155182

executing command: SET DBID

RMAN> RUN{

2> ALLOCATE CHANNEL ch00 TYPE  'SBT_TAPE';

3> SEND 'NB_ORA_SERV=nbuserver,NB_ORA_CLIENT=oracle10grac1';

4> restore controlfile from 'cntrl_416_1_780401205';

5> RELEASE CHANNEL ch00;

6> }

using target database control file instead of recovery catalog

allocated channel: ch00

channel ch00: sid=542 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.1 (2011020316)

sent command to channel: ch00

Starting restore at 12-APR-12

channel ch00: restoring control file

channel ch00: restore complete, elapsed time: 00:00:15

output filename=/opt/oracle/oradata/orcl/orcl.ctl

Finished restore at 12-APR-12

released channel: ch00

7、启动目标端到mount状态,rman恢复

SQL> alter database mount;

RMAN> RUN {

2> ALLOCATE CHANNEL ch00 TYPE  'SBT_TAPE';

3> SEND 'NB_ORA_SERV=nbuserver,NB_ORA_CLIENT=oracle10grac1';

4> set newname for datafile 1 to'/opt/oracle/oradata/orcl/system.256.779374375';

5> set newname for datafile 2 to'/opt/oracle/oradata/orcl/undotbs1.258.779374377';

6> set newname for datafile 3 to'/opt/oracle/oradata/orcl/sysaux.257.779374377';

7> set newname for datafile 4 to'/opt/oracle/oradata/orcl/users.259.779374377';

8> set newname for datafile 5 to'/opt/oracle/oradata/orcl/undotbs2.264.779374547';

9> set newname for datafile 6 to'/opt/oracle/oradata/orcl/test01.dbf';

10> RESTORE    DATABASE;

11> switch datafile all;

12> RESTORE ARCHIVELOG ALL;

13> RELEASE CHANNEL ch00;

14> }

allocated channel: ch00

channel ch00: sid=542 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.1 (2011020316)

sent command to channel: ch00

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 12-APR-12

Starting implicit crosscheck backup at 12-APR-12

Finished implicit crosscheck backup at 12-APR-12

Starting implicit crosscheck copy at 12-APR-12

Crosschecked 2 objects

Finished implicit crosscheck copy at 12-APR-12

searching for all files in the recovery area

cataloging files...

no files cataloged

channel ch00: starting datafile backupset restore

channel ch00: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /opt/oracle/oradata/orcl/system.256.779374375

restoring datafile 00004 to /opt/oracle/oradata/orcl/users.259.779374377

restoring datafile 00005 to /opt/oracle/oradata/orcl/undotbs2.264.779374547

channel ch00: reading from backup piece bk_409_1_780401068

channel ch00: restored backup piece 1

piece handle=bk_409_1_780401068 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:00:56

channel ch00: starting datafile backupset restore

channel ch00: specifying datafile(s) to restore from backup set

restoring datafile 00002 to /opt/oracle/oradata/orcl/undotbs1.258.779374377

restoring datafile 00003 to /opt/oracle/oradata/orcl/sysaux.257.779374377

restoring datafile 00006 to /opt/oracle/oradata/orcl/test01.dbf

channel ch00: reading from backup piece bk_410_1_780401068

channel ch00: restored backup piece 1

piece handle=bk_410_1_780401068 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:00:35

Finished restore at 12-APR-12

datafile 1 switched to datafile copy

input datafile copy recid=12 stamp=780370845 filename=/opt/oracle/oradata/orcl/system.256.779374375

datafile 2 switched to datafile copy

input datafile copy recid=13 stamp=780370845 filename=/opt/oracle/oradata/orcl/undotbs1.258.779374377

datafile 3 switched to datafile copy

input datafile copy recid=14 stamp=780370845 filename=/opt/oracle/oradata/orcl/sysaux.257.779374377

datafile 4 switched to datafile copy

input datafile copy recid=15 stamp=780370845 filename=/opt/oracle/oradata/orcl/users.259.779374377

datafile 5 switched to datafile copy

input datafile copy recid=16 stamp=780370845 filename=/opt/oracle/oradata/orcl/undotbs2.264.779374547

datafile 6 switched to datafile copy

input datafile copy recid=17 stamp=780370845 filename=/opt/oracle/oradata/orcl/test01.dbf

Starting restore at 12-APR-12

released channel: ch00

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 04/12/2012 01:40:46

RMAN-06026: some targets not found - aborting restore

RMAN-06025: no backup of log thread 2 seq 130 lowscn 929777 found to restore

RMAN-06025: no backup of log thread 2 seq 129 lowscn 929724 found to restore

RMAN-06025: no backup of log thread 2 seq 128 lowscn 928733 found to restore

RMAN-06025: no backup of log thread 2 seq 127 lowscn 907963 found to restore

RMAN-06025: no backup of log thread 2 seq 126 lowscn 907776 found to restore

RMAN-06025: no backup of log thread 2 seq 125 lowscn 906250 found to restore

RMAN-06025: no backup of log thread 2 seq 124 lowscn 885594 found to restore

RMAN-06025: no backup of log thread 2 seq 123 lowscn 865475 found to restore

RMAN-06025: no backup of log thread 2 seq 122 lowscn 864010 found to restore

RMAN-06025: no backup of log thread 2 seq 121 lowscn 863247 found to restore

RMAN-06025: no backup of log thread 2 seq 120 lowscn 863140 found to restore

RMAN-06025: no backup of log thread 2 seq 119 lowscn 859445 found to restore

RMAN-06025: no backup of log thread 2 seq 118 lowscn 854593 found to restore

RMAN-06025: no backup of log thread 2 seq 117 lowscn 854454 found to restore

RMAN-06025: no backup of log thread 2 seq 116 lowscn 854003 found to restore

RMAN-06025: no backup of log thread 2 seq 115 lowscn 851640 found to restore

RMAN-06025: no backup of log thread 2 seq 114 lowscn 808961 found to restore

RMAN-06025: no backup of log thread 2 seq 113 lowscn 785764 found to restore

RMAN-06025: no backup of log thread 2 seq 112 lowscn 765763 found to restore

RMAN-06025: no backup of log thread 2 seq 111 lowscn 765689 found to restore

RMAN-06025: no backup of log thread 2 seq 110 lowscn 745300 found to restore

RMAN-06025: no backup of log thread 2 seq 109 lowscn 723232 found to restore

RMAN-06025: no backup of log thread 2 seq 108 lowscn 685345 found to restore

RMAN-06025: no backup of log thread 2 seq 107 lowscn 685303 found to restore

RMAN-06025: no backup of log thread 2 seq 106 lowscn 685194 found to restore

RMAN-06025: no backup of log thread 2 seq 105 lowscn 685167 found to restore

RMAN-06025: no backup of log thread 2 seq 104 lowscn 685012 found to restore

RMAN-06025: no backup of log thread 2 seq 103 lowscn 684991 found to restore

RMAN-06025: no backup of log thread 2 seq 102 lowscn 658111 found to restore

RMAN-06025: no backup of log thread 2 seq 101 lowscn 658045 found to restore

RMAN-06025: no backup of log thread 2 seq 100 lowscn 658006 found to restore

RMAN-06025: no backup of log thread 2 seq 99 lowscn 657949 found to restore

RMAN-06025: no backup of log thread 2 seq 98 lowscn 656969 found to restore

RMAN-06025: no backup of log thread 2 seq 97 lowscn 656944 found to restore

RMAN-06025: no backup of log thread 2 seq 96 lowscn 624908 found to restore

RMAN-06025: no backup of log thread 2 seq 95 lowscn 624869 found to restore

RMAN-06025: no backup of log thread 2 seq 94 lowscn 624260 found to restore

RMAN-06025: no backup of log thread 2 seq 93 lowscn 623703 found to restore

RMAN-06025: no backup of log thread 2 seq 92 lowscn 622621 found to restore

RMAN-06025: no backup of log thread 2 seq 91 lowscn 622596 found to restore

RMAN-06025: no backup of log thread 2 seq 90 lowscn 621818 found to restore

RMAN-06025: no backup of log thread 2 seq 89 lowscn 621791 found to restore

RMAN-06025: no backup of log thread 2 seq 88 lowscn 613706 found to restore

RMAN-06025: no backup of log thread 2 seq 87 lowscn 613316 found to restore

RMAN-06025: no backup of log thread 2 seq 86 lowscn 612817 found to restore

RMAN-06025: no backup of log thread 2 seq 85 lowscn 592253 found to restore

RMAN-06025: no backup of log thread 2 seq 84 lowscn 592225 found to restore

RMAN-06025: no backup of log thread 2 seq 83 lowscn 587065 found to restore

RMAN-06025: no backup of log thread 2 seq 82 lowscn 546386 found to restore

RMAN-06025: no backup of log thread 2 seq 81 lowscn 522027 found to restore

RMAN-06025: no backup of log thread 2 seq 80 lowscn 490716 found to restore

RMAN-06025: no backup of log thread 2 seq 79 lowscn 490683 found to restore

RMAN-06025: no backup of log thread 2 seq 78 lowscn 483478 found to restore

RMAN-06025: no backup of log thread 2 seq 77 lowscn 483457 found to restore

RMAN-06025: no backup of log thread 2 seq 76 lowscn 483217 found to restore

RMAN-06025: no backup of log thread 2 seq 75 lowscn 483183 found to restore

RMAN-06025: no backup of log thread 2 seq 74 lowscn 483040 found to restore

RMAN-06025: no backup of log thread 2 seq 73 lowscn 483020 found to restore

RMAN-06025: no backup of log thread 2 seq 72 lowscn 482284 found to restore

RMAN-06025: no backup of log thread 2 seq 71 lowscn 482258 found to restore

RMAN-06025: no backup of log thread 2 seq 70 lowscn 479954 found to restore

RMAN> recover database;

Starting recover at 12-APR-12

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=542 devtype=DISK

starting media recovery

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 04/12/2012 01:41:26

RMAN-06053: unable to perform media recovery because of missing log

RMAN-06102: no channel to restore a backup or copy of log thread 2 seq 146 lowscn 971389

RMAN-06102: no channel to restore a backup or copy of log thread 1 seq 146 lowscn 971386

RMAN-06102: no channel to restore a backup or copy of log thread 2 seq 145 lowscn 970959

RMAN-06102: no channel to restore a backup or copy of log thread 1 seq 145 lowscn 970956

RMAN> alter database open resetlogs;

database opened

RMAN>

 

OK,并且ORACLE 已经建立好了日志文件和临时表空间(当然生产环境还是要调整)

 

SQL> /

    GROUP# MEMBER

---------- ----------------------------------------------------------------------

         2 /opt/oracle/oradata/orcl/ORCL/onlinelog/o1_mf_2_7rcjm0w4_.log

         2 /opt/oracle/flash/ORCL/onlinelog/o1_mf_2_7rcjm2gs_.log

         1 /opt/oracle/oradata/orcl/ORCL/onlinelog/o1_mf_1_7rcjly58_.log

         1 /opt/oracle/flash/ORCL/onlinelog/o1_mf_1_7rcjlzhl_.log

         3 /opt/oracle/oradata/orcl/ORCL/onlinelog/o1_mf_3_7rcjm46y_.log

         3 /opt/oracle/flash/ORCL/onlinelog/o1_mf_3_7rcjm5s8_.log

         4 /opt/oracle/oradata/orcl/ORCL/onlinelog/o1_mf_4_7rcjm76z_.log

         4 /opt/oracle/flash/ORCL/onlinelog/o1_mf_4_7rcjm98g_.log

8 rows selected.

 

SQL> /

     FILE# NAME

---------- ----------------------------------------------------------------------

         1 /opt/oracle/oradata/orcl/ORCL/datafile/o1_mf_temp_7rcjmkrn_.tmp

 

 

 

 

 

 

 

 

©著作权归作者所有:来自51CTO博客作者lcrash的原创作品,如需转载,请注明出处,否则将追究法律责任

ORACLENBU


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消