nbu恢复mysql_[Howto]使用NBU恢复oracle数据库

博客文章除注明转载外,均为原创。转载请注明出处。

有多年没有使用NBU恢复oracle,今天给开发做了一次异机恢复,简单记录下思路:

1、检查有效可用的备份

[oracle@trade netbackup]$ /usr/openv/netbackup/bin/bplist -S 'nbu5230_bj' -C 'orcl' -t 4 -R -l /

-rw-rw---- oracle    dba          59768832 Jul 25 06:16 /c-1373768042-20180725-02

-rw-rw---- oracle    dba          59768832 Jul 25 06:15 /cntrl_16168_1_982390548

-rw-rw---- oracle    dba          59768832 Jul 25 06:15 /c-1373768042-20180725-01

-rw-rw---- oracle    dba          8097024K Jul 25 06:11 /al_16166_1_982390305

-rw-rw---- oracle    dba          8493312K Jul 25 06:09 /al_16165_1_982390149

-rw-rw---- oracle    dba          8534784K Jul 25 06:07 /al_16164_1_982390074

-rw-rw---- oracle    dba          8628480K Jul 25 06:05 /al_16163_1_982389958

-rw-rw---- oracle    dba          8835584K Jul 25 06:04 /al_16162_1_982389893

-rw-rw---- oracle    dba          8807424K Jul 25 06:02 /al_16161_1_982389757

-rw-rw---- oracle    dba          9262592K Jul 25 06:01 /al_16160_1_982389682

-rw-rw---- oracle    dba          9055488K Jul 25 05:58 /al_16159_1_982389506

-rw-rw---- oracle    dba          9178880K Jul 25 05:58 /al_16158_1_982389499

-rw-rw---- oracle    dba          8996608K Jul 25 05:54 /al_16157_1_982389253

-rw-rw---- oracle    dba          8871680K Jul 25 05:54 /al_16156_1_982389253

-rw-rw---- oracle    dba          59768832 Jul 25 05:53 /c-1373768042-20180725-00

-rw-rw---- oracle    dba         17912320K Jul 25 05:32 /bk_16154_1_982387978

-rw-rw---- oracle    dba         35706112K Jul 25 05:00 /bk_16152_1_982386042

-rw-rw---- oracle    dba         32936960K Jul 25 05:00 /bk_16153_1_982386042

2、恢复spfile

[oracle@trade ~]$ rman target sys/oracle

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Jul 25 09:35:31 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)

RMAN> startup nomount

Oracle instance started

Total System Global Area    4158865408 bytes

Fixed Size                     2259800 bytes

Variable Size               2181039272 bytes

Database Buffers            1962934272 bytes

Redo Buffers                  12632064 bytes

RMAN> run{

2>   allocate channel ch00 type 'sbt_tape';

3>  send 'NB_ORA_CLIENT=orcl,NB_ORA_SERV=nbu5230_bj';

4>   restore spfile to '/home/oracle/spfile.ora' from 'c-1373768042-20180725-02';

5>   release channel ch00;

6>   }

using target database control file instead of recovery catalog

allocated channel: ch00

channel ch00: SID=298 device type=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

sent command to channel: ch00

Starting restore at 25-JUL-18

channel ch00: restoring spfile from AUTOBACKUP c-1373768042-20180725-02

channel ch00: SPFILE restore from AUTOBACKUP complete

Finished restore at 25-JUL-18

released channel: ch00

恢复spfile后创建数据库相应的文件目录。

3、恢复控制文件

创建后使用恢复的spfile启动数据库到nomount模式下。

MAN>

RMAN>    run {

2>  allocate channel ch00 type 'sbt_tape';

3>  send 'NB_ORA_CLIENT=orcl,NB_ORA_SERV=nbu5230_bj';

4>  restore controlfile from 'cntrl_16168_1_982390548';

5>  release channel ch00;

6>  }

allocated channel: ch00

channel ch00: SID=298 device type=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

sent command to channel: ch00

Starting restore at 25-JUL-18

channel ch00: restoring control file

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

output file name=/opt/oradata/orcl/control01.ctl

output file name=/opt/oradata/orcl/control02.ctl

Finished restore at 25-JUL-18

released channel: ch00

RMAN>  alter database mount;

database mounted

4、恢复数据库

RMAN>  run

2>  {

3>  allocate channel ch00 type 'sbt_tape';

4>  allocate channel ch01 type 'sbt_tape';

5>  send 'NB_ORA_CLIENT=orcl,NB_ORA_SERV=nbu5230_bj';

6>  restore database;

7>  Recover database;

8>   release channel ch00;

9>   release channel ch01;

10>  }

allocated channel: ch00

channel ch00: SID=298 device type=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

allocated channel: ch01

channel ch01: SID=357 device type=SBT_TAPE

channel ch01: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

sent command to channel: ch00

sent command to channel: ch01

Starting restore at 25-JUL-18

channel ch00: starting datafile backup set restore

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

channel ch00: restoring datafile 00003 to /opt/oradata/orcl/undotbs01.dbf

channel ch00: restoring datafile 00005 to /opt/oradata/orcl/hsfa.dbf

channel ch00: restoring datafile 00006 to /opt/oradata/orcl/TS_RISK3.DBF

channel ch00: restoring datafile 00009 to /opt/oradata/orcl/TS_RISK303.dbf

channel ch00: reading from backup piece bk_16152_1_982386042

channel ch01: starting datafile backup set restore

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

channel ch01: restoring datafile 00007 to /opt/oradata/orcl/TS_ODS.DBF

channel ch01: restoring datafile 00008 to /opt/oradata/orcl/TS_RISK302.dbf

channel ch01: restoring datafile 00011 to /opt/oradata/orcl/TS_RISK305.dbf

channel ch01: reading from backup piece bk_16153_1_982386042

channel ch00: piece handle=bk_16152_1_982386042 tag=HOT_DB_BK_LEVEL0

channel ch00: restored backup piece 1

channel ch00: restore complete, elapsed time: 00:10:26

channel ch00: starting datafile backup set restore

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

channel ch00: restoring datafile 00001 to /opt/oradata/orcl/system01.dbf

channel ch00: restoring datafile 00002 to /opt/oradata/orcl/sysaux01.dbf

channel ch00: restoring datafile 00004 to /opt/oradata/orcl/users01.dbf

channel ch00: restoring datafile 00010 to /opt/oradata/orcl/TS_RISK304.dbf

channel ch00: restoring datafile 00012 to /opt/oradata/orcl/hsfa02.dbf

channel ch00: reading from backup piece bk_16154_1_982387978

channel ch01: piece handle=bk_16153_1_982386042 tag=HOT_DB_BK_LEVEL0

channel ch01: restored backup piece 1

channel ch01: restore complete, elapsed time: 00:10:43

channel ch00: piece handle=bk_16154_1_982387978 tag=HOT_DB_BK_LEVEL0

channel ch00: restored backup piece 1

channel ch00: restore complete, elapsed time: 00:04:36

Finished restore at 25-JUL-18

Starting recover at 25-JUL-18

starting media recovery

channel ch00: starting archived log restore to default destination

channel ch00: restoring archived log

archived log thread=1 sequence=18767

channel ch00: restoring archived log

archived log thread=1 sequence=18768

channel ch00: reading from backup piece al_16166_1_982390305

channel ch00: piece handle=al_16166_1_982390305 tag=TAG20180725T055410

channel ch00: restored backup piece 1

channel ch00: restore complete, elapsed time: 00:02:25

archived log file name=/archtz/1_18767_845987306.dbf thread=1 sequence=18767

archived log file name=/archtz/1_18768_845987306.dbf thread=1 sequence=18768

unable to find archived log

archived log thread=1 sequence=18769

released channel: ch00

released channel: ch01

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

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

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

RMAN-03002: failure of recover command at 07/25/2018 10:00:52

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 18769 and starting SCN of 5975688777200

进行不完全日志恢复,后打开数据库。

RMAN> recover database until scn 5975688777200;

Starting recover at 25-JUL-18

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=298 device type=DISK

starting media recovery

media recovery complete, elapsed time: 00:00:01

Finished recover at 25-JUL-18

RMAN> alter database open resetlogs;

database opened

后面就是处理redo,undo,temp,监听等,就不再赘述了。

--The end

阅读(1388) | 评论(0) | 转发(1) |

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值