Oracle restore & recovery from tsm tape

本文详细介绍了如何通过磁带恢复数据库至原有路径,并在数据文件路径发生变化时的转换方法。包括恢复控制文件、数据文件,以及打开数据库的操作流程。同时,提供了数据库路径变更的具体步骤,涉及初始化参数文件生成、数据库恢复、数据文件重命名等关键环节。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

例子1-通过磁带恢复和原来相同路径的数据库。
源    库 P1EBSDB01 10.10.30.33 OS用户名oraprod DBNAME prod
目标库 T1ERPDB01 10.10.30.12 OS用户名oraeut  DBNAME prod
准备工作:先将安装软件恢复至/oracle/db/tech_st,接下来数据库文件会恢复到/oracle/db/data,最后恢复监听服务。
1.恢复控制文件
a.rman target /
b.SQL>startup nomount
c.RMAN>run{
allocate channel ch00 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
restore controlfile from 'proddb_control_75_1_804813476';
release channel ch00;
}
2.恢复数据文件
a.SQL>alter database mount
b.RMAN>run{
allocate channel ch00 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
restore database;
recover database;
release channel ch00;
}
3, 打开数据库
SQL>alter database open resetlogs;
注意:这个恢复会将数据库恢复到最后一个归档日志结束时的状态,当前的活动的日志不会被恢复出来。

SQL> startup nomount;
[oraeut@T1ERPDB01 dbs]$ rman target /

Recovery Manager: Release 11.1.0.7.0 - Production on Wed Jan 16 13:47:40 2013

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

connected to target database: PROD (not mounted)

RMAN> run{    
2> allocate channel ch00 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
3> restore controlfile from 'proddb_control_75_1_804813476';
4> release channel ch00;
5> }

using target database control file instead of recovery catalog
allocated channel: ch00
channel ch00: SID=2382 device type=SBT_TAPE
channel ch00: Data Protection for Oracle: version 5.5.1.0

Starting restore at 16-JAN-13

channel ch00: restoring control file
channel ch00: restore complete, elapsed time: 00:02:05
output file name=/oracle/db/apps_st/data/cntrl001.dbf
output file name=/oracle/db/apps_st/data/cntrl002.dbf
output file name=/oracle/db/apps_st/data/cntrl003.dbf
Finished restore at 16-JAN-13

released channel: ch00

RMAN>

[oraeut@T1ERPDB01 ~]$ rman target /

Recovery Manager: Release 11.1.0.7.0 - Production on Wed Jan 16 14:00:12 2013

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

connected to target database: PROD (DBID=212588479, not open)

RMAN> run{
2> allocate channel ch00 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
3> restore database;
4> release channel ch00;
5> }

using target database control file instead of recovery catalog
allocated channel: ch00
channel ch00: SID=2384 device type=SBT_TAPE
channel ch00: Data Protection for Oracle: version 5.5.1.0

Starting restore at 16-JAN-13

channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00001 to /oracle/db/apps_st/data/system01.dbf
channel ch00: restoring datafile 00002 to /oracle/db/apps_st/data/system02.dbf
channel ch00: restoring datafile 00003 to /oracle/db/apps_st/data/system03.dbf
channel ch00: restoring datafile 00004 to /oracle/db/apps_st/data/system04.dbf
channel ch00: restoring datafile 00005 to /oracle/db/apps_st/data/system05.dbf
channel ch00: restoring datafile 00006 to /oracle/db/apps_st/data/ctxd01.dbf
channel ch00: restoring datafile 00007 to /oracle/db/apps_st/data/owad01.dbf
channel ch00: restoring datafile 00008 to /oracle/db/apps_st/data/a_queue02.dbf
channel ch00: restoring datafile 00009 to /oracle/db/apps_st/data/odm.dbf
channel ch00: restoring datafile 00010 to /oracle/db/apps_st/data/olap.dbf
channel ch00: restoring datafile 00011 to /oracle/db/apps_st/data/sysaux01.dbf
channel ch00: restoring datafile 00012 to /oracle/db/apps_st/data/apps_ts_tools01.dbf
channel ch00: restoring datafile 00013 to /oracle/db/apps_st/data/system12.dbf
channel ch00: restoring datafile 00014 to /oracle/db/apps_st/data/a_txn_data04.dbf
channel ch00: restoring datafile 00015 to /oracle/db/apps_st/data/a_txn_ind06.dbf
channel ch00: restoring datafile 00016 to /oracle/db/apps_st/data/a_ref03.dbf
channel ch00: restoring datafile 00017 to /oracle/db/apps_st/data/a_int02.dbf
channel ch00: restoring datafile 00018 to /oracle/db/apps_st/data/sysaux02.dbf
channel ch00: restoring datafile 00019 to /oracle/db/apps_st/data/cuxd_data01
channel ch00: restoring datafile 00020 to /oracle/db/apps_st/data/cuxx_data01
channel ch00: restoring datafile 00288 to /oracle/db/apps_st/data/system10.dbf
channel ch00: restoring datafile 00295 to /oracle/db/apps_st/data/system06.dbf
channel ch00: restoring datafile 00314 to /oracle/db/apps_st/data/portal01.dbf
channel ch00: restoring datafile 00351 to /oracle/db/apps_st/data/system07.dbf
channel ch00: restoring datafile 00352 to /oracle/db/apps_st/data/system09.dbf
channel ch00: restoring datafile 00353 to /oracle/db/apps_st/data/system08.dbf
channel ch00: restoring datafile 00354 to /oracle/db/apps_st/data/system11.dbf
channel ch00: restoring datafile 00379 to /oracle/db/apps_st/data/undo01.dbf
channel ch00: restoring datafile 00392 to /oracle/db/apps_st/data/a_txn_data01.dbf
channel ch00: restoring datafile 00393 to /oracle/db/apps_st/data/a_txn_ind01.dbf
channel ch00: restoring datafile 00394 to /oracle/db/apps_st/data/a_ref01.dbf
channel ch00: restoring datafile 00395 to /oracle/db/apps_st/data/a_int01.dbf
channel ch00: restoring datafile 00396 to /oracle/db/apps_st/data/a_summ01.dbf
channel ch00: restoring datafile 00397 to /oracle/db/apps_st/data/a_nolog01.dbf
channel ch00: restoring datafile 00398 to /oracle/db/apps_st/data/a_archive01.dbf
channel ch00: restoring datafile 00399 to /oracle/db/apps_st/data/a_queue01.dbf
channel ch00: restoring datafile 00400 to /oracle/db/apps_st/data/a_media01.dbf
channel ch00: restoring datafile 00401 to /oracle/db/apps_st/data/a_txn_data02.dbf
channel ch00: restoring datafile 00402 to /oracle/db/apps_st/data/a_txn_data03.dbf
channel ch00: restoring datafile 00403 to /oracle/db/apps_st/data/a_txn_ind02.dbf
channel ch00: restoring datafile 00404 to /oracle/db/apps_st/data/a_txn_ind03.dbf
channel ch00: restoring datafile 00405 to /oracle/db/apps_st/data/a_txn_ind04.dbf
channel ch00: restoring datafile 00406 to /oracle/db/apps_st/data/a_txn_ind05.dbf
channel ch00: restoring datafile 00407 to /oracle/db/apps_st/data/a_ref02.dbf
channel ch00: reading from backup piece proddb_full_20130115_804813014_28nvgu6m_1_1
channel ch00: piece handle=proddb_full_20130115_804813014_28nvgu6m_1_1 tag=TAG20130115T231014
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:23:05
Finished restore at 16-JAN-13

released channel: ch00

RMAN>

RMAN> run{
2> allocate channel ch00 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
3> recover database;
4> release channel ch00;
5> }

allocated channel: ch00
channel ch00: SID=2384 device type=SBT_TAPE
channel ch00: Data Protection for Oracle: version 5.5.1.0

Starting recover at 16-JAN-13

starting media recovery

channel ch00: starting archived log restore to default destination
channel ch00: restoring archived log
archived log thread=1 sequence=35
channel ch00: reading from backup piece proddb_arc_74_1_804813451
channel ch00: piece handle=proddb_arc_74_1_804813451 tag=TAG20130115T231731
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:24
archived log file name=/oracle/archive/prod_1_35_800750143.arc thread=1 sequence=35
unable to find archived log
archived log thread=1 sequence=36
released channel: ch00
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/16/2013 14:31:10
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 36 and starting SCN of 5965168313688

RMAN> alter database open resetlogs;

database opened

RMAN>


最后检查监听配置文件,启动监听服务。

例子2-如果数据文件路径发生变化,需要转换。

1,利用恢复出来的spfile生成pfile,并修改成initprod.ora,SQLPLUS启动数据库nomount状态。
2,恢复DB_NAME相同的数据库: RMAN恢复控制文件,转换恢复数据文件,恢复数据库,启用新的归档日志,再次恢复数据库。
startup nomount;
set dbid=228115897
restore controlfile from '/u01/CTRL_PROD_20130715_18';
alter database mount;
catalog start with '/u01';
run{     
SET NEWNAME FOR DATABASE TO '/prod/oracle/oradata/prod/%b';
SET NEWNAME FOR TEMPFILE 1 TO '/prod/oracle/oradata/prod/%b';
RESTORE DATABASE;
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
}
RECOVER DATABASE;
此时数据库会开始使用归档目录下的归档日志,重新catalog新产生并拷贝过来的归档文件。
catalog start with '/prod/oracle/fast_recovery_area/PROD/archivelog/2013_07_15';
RECOVER DATABASE;
alter database open resetlogs;
通过nis可以进行数据库改名。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值