tsm备份mysql_记一次TSM备份软件的rman恢复

一、背景

oracle:11.2.0.3 单机  通过tsm备份软件备份(什么玩意不太读懂,反正就是调用rman接口备份)。这是客户的一套OA的数据库,现在需要通过tsm做个恢复测试演练。

二、撸起袖子,开干

2.1 还原参数文件,忘记记录(略)

2.2 还原控制文件

run{

allocate channel t1 type'sbt_tape'parms'ENV=(tdpo_optfile= /opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';restore controlfile from 'NEROA_cntrl_12753_1_1023216458';

release channel t1;

}

2.3 还原数据库

run

{

allocate channel t1 type'sbt_tape'parms'ENV=(tdpo_optfile= /opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';set newname for datafile 1 to '/rmanbak/oracle/oradata/NEROA/system01.dbf';set newname for datafile 2 to '/rmanbak/oracle/oradata/NEROA/sysaux01.dbf';set newname for datafile 3 to '/rmanbak/oracle/oradata/NEROA/undotbs01.dbf';set newname for datafile 4 to '/rmanbak/oracle/oradata/NEROA/users01.dbf';set newname for datafile 5 to '/rmanbak/oracle/oradata/NEROA/NEROA.dbf';set newname for datafile 6 to '/rmanbak/oracle/oradata/NEROA/NEROA_TEST.dbf';set newname for datafile 7 to '/rmanbak/oracle/oradata/OATEST.dbf';set newname for datafile 8 to '/rmanbak/oracle/oradata/NEROA/oalinuxtest.dbf';set newname for datafile 9 to '/rmanbak/oracle/oradata/NEROA/system02.dbf';set newname for datafile 10 to '/rmanbak/oracle/oradata/NEROA/NEROA02.dbf';set newname for datafile 11 to '/rmanbak/oracle/oradata/NEROA/sysaux02.dbf';set newname for datafile 12 to '/rmanbak/oracle/oradata/NEROA/system03.dbf';set newname for datafile 13 to '/rmanbak/oracle/oradata/NEROA/system04.dbf';set newname for datafile 14 to '/rmanbak/oracle/oradata/NEROA/system05.dbf';set newname for datafile 15 to '/rmanbak/oracle/oradata/NEROA/system06.dbf';set newname for datafile 16 to '/rmanbak/oracle/oradata/NEROA/NEROA03.dbf';set newname for datafile 17 to '/rmanbak/oracle/oradata/NEROA/system07.dbf';set newname for datafile 18 to '/rmanbak/oracle/oradata/NEROA/system08.dbf';set newname for datafile 19 to '/rmanbak/oracle/oradata/NEROA/system09.dbf';set newname for datafile 20 to '/rmanbak/oracle/oradata/NEROA/NEROA04.dbf';set newname for datafile 21 to '/rmanbak/oracle/oradata/NEROA/NEROA05.dbf';restore database;

release channel t1;

}--别问我为什么只开一个通道,我也想知道为什么开多个会报错

2.4 注册数据文件为datafilecopy

catalog datafilecopy '/rmanbak/oracle/oradata/NEROA/system01.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/sysaux01.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/undotbs01.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/users01.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/NEROA.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/NEROA_TEST.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/OATEST.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/oalinuxtest.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/system02.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/NEROA02.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/sysaux02.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/system03.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/system04.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/system05.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/system06.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/NEROA03.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/system07.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/system08.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/system09.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/NEROA04.dbf';

catalog datafilecopy'/rmanbak/oracle/oradata/NEROA/NEROA05.dbf';

2.5 切换至副本

switch datafile 1 tocopy;

switch datafile2 tocopy;

switch datafile3 tocopy;

switch datafile4 tocopy;

switch datafile5 tocopy;

switch datafile6 tocopy;

switch datafile7 tocopy;

switch datafile8 tocopy;

switch datafile9 tocopy;

switch datafile10 tocopy;

switch datafile11 tocopy;

switch datafile12 tocopy;

switch datafile13 tocopy;

switch datafile14 tocopy;

switch datafile15 tocopy;

switch datafile16 tocopy;

switch datafile17 tocopy;

switch datafile18 tocopy;

switch datafile19 tocopy;

switch datafile20 tocopy;

switch datafile21 tocopy;--别问我为什么部switch database all ,问就是报错

2.6 由于源库有个数据文件状态为recover,需要将状态设置为offline。不然将从没有变化的scn号开始恢复

SQL> alter database datafile 4 offline;

2.7 手工recover,确认所需的归档(为什么要手工,因为rman报错,就是这么操蛋)

SQL> recover database using backup controlfile until cancel; --确定所需的归档

run{

allocate channel t1 type'sbt_tape'parms'ENV=(tdpo_optfile= /opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';restore archivelog from logseq 14060; --从14060开始还原归档

release channel t1;

}

SQL> recover database using backup controlfile until cancel; --应用已经还原的归档

2.8 重命名redo日志,因为路径不对

alter database rename file '/u01/oracle/oradata/NEROA/redo02.log' to '/rmanbak/oracle/oradata/NEROA/redo02.log';alter database rename file '/u01/oracle/oradata/NEROA/redo01.log' to '/rmanbak/oracle/oradata/NEROA/redo01.log';alter database rename file '/u01/oracle/oradata/NEROA/redo03.log' to '/rmanbak/oracle/oradata/NEROA/redo03.log';

2.9 open

SQL> alter database openresetlogs;alter database openresetlogs*第1行出现错误:

ORA-00392: 日志 3 (用于线程 1) 正被清除, 不允许操作

ORA-00312: 联机日志 3 线程 1: '/rmanbak/oracle/oradata/NEROA/redo03.log'SQL> alter database clear logfile group 1;

数据库已更改。

SQL> alter database clear logfile group 2;

数据库已更改。

SQL> alter database clear logfile group 3;

SQL> alter database open resetlogs;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值