由于以后工作可能会有变化,为了防止自己记忆力衰退
将oracle通过nbu做的异机整库恢复记录下来
首先要保证操作系统平台大版本一致(从HP 11.31到11.11进行恢复也没有问题),如果是跨平台的恢复这里不做讨论
oracle版本必须一致,包括小版本号
假设恢复的源主机hostname叫 hosta,目标主机hostname叫 hostb,数据库sid叫 orasid
先保证NBU的设置允许异机恢复
----------------------------------------------------------------------
确保将 NetBackup 服务器配置为允许重定向恢复。管理员通过在 Netbackup 主服务器上创建下面的文件可删除对所客户机的限制:
/usr/openv/netbackup/db/altnames/No.Restrictions
或者,要限制客户机只从其他特定的客户机恢复,请创建下面的文件:
/usr/openv/netbackup/db/altnames/client_name
其中 client_name 是允许进行重定向恢复的客户机(目标客户机)的名称。然后,将NetBackup for Oracle 源客户机的名称添加到此文件。
本节信息适用于使用命令行执行的恢复,而不适用于“备份、归档和恢复”客户机界面----------------------------------------------------------------------
1、在NBU Master上用bplist命令查出已经备份的信息bplist -C hosta -t 4 -R |more
。。。
记录下对应的controlfile备份信息,以后备用,这里是c-297293101-20110427-01
2、配置好hostb的oracle,安装完成,并且按照hosta的目录结构建好目录和文件系统
3、配置好hostb的nbu,完成oracle_link
接下来的4到6步是进行spfile的恢复动作4、启动hostb上的oracle到nomount状态,这时使用的是安装完成默认的pfile文件
- [oracle@hostb:/u01/oracle/product/db10gr2/dbs]$sqlplus /nolog
-
-
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Apr 27 15:58:31 2011
-
-
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
-
-
SQL> connect /as sysdba;
-
Connected to an idle instance.
-
SQL> startup nomount pfile='/u01/oracle/product/db10gr2/dbs/init.ora';
-
ORACLE instance started.
-
-
Total System Global Area 171966464 bytes
-
Fixed Size 2067664 bytes
-
Variable Size 150995760 bytes
-
Database Buffers 16777216 bytes
-
Redo Buffers 2125824 bytes
-
SQL>
5、启动成功后,用rman恢复源机数据库的spfile
- [oracle@hostb:/u01/oracle/product/db10gr2/dbs]$rman target /
-
-
Recovery Manager: Release 10.2.0.4.0 - Production on Wed Apr 27 16:01:32 2011
-
-
Copyright (c) 1982, 2007, Oracle. All rights reserved.
-
-
connected to target database: DEFAULT (not mounted)
-
-
RMAN> run {
-
2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' parms 'ENV=(NB_ORA_CLIENT=hosta)';
-
3> restore spfile from 'c-297293101-20110427-01';
-
4> release channel ch00;
-
5> }
-
-
using target database control file instead of recovery catalog
-
allocated channel: ch00
-
channel ch00: sid=47 devtype=SBT_TAPE
-
channel ch00: Veritas NetBackup for Oracle - Release 6.5 (2009050107)
-
-
Starting restore at 2011-04-27 16:03:59
-
-
channel ch00: autobackup found: c-297293101-20110427-01
-
channel ch00: SPFILE restore from autobackup complete
-
Finished restore at 2011-04-27 16:05:46
-
-
released channel: ch00
-
-
RMAN>
6、接下来将oracle shutdown,如果需要修改spfile可以先生成pfile文件进行修改然后在create spfile
第7和第8步用来恢复controlfile7、使用新的spfile启动oracle到nomount状态
- [oracle@hostb:/u01/oracle/admin/sxzhdb/bdump]$sqlplus /nolog
-
-
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Apr 27 16:35:50 2011
-
-
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
-
-
SQL> connect /as sysdba;
-
Connected to an idle instance.
-
SQL> startup nomount;
-
ORACLE instance started.
-
-
Total System Global Area 2.1475E+10 bytes
-
Fixed Size 2107632 bytes
-
Variable Size 1996490512 bytes
-
Database Buffers 1.9462E+10 bytes
-
Redo Buffers 14667776 bytes
-
SQL>
8、启动没有问题的话就可以开始恢复controlfile了
- [oracle@hfylhp01:/u01/oracle/admin/sxzhdb/bdump]$rman target /
-
-
Recovery Manager: Release 10.2.0.4.0 - Production on Wed Apr 27 16:39:09 2011
-
-
Copyright (c) 1982, 2007, Oracle. All rights reserved.
-
-
connected to target database: sxzhdb (not mounted)
-
-
RMAN> run {
-
2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' parms 'ENV=(NB_ORA_CLIENT=hosta)';
-
restore controlfile from 'c-297293101-20110427-01';
-
3> 4> release channel ch00;
-
5> }
-
-
using target database control file instead of recovery catalog
-
allocated channel: ch00
-
channel ch00: sid=1091 devtype=SBT_TAPE
-
channel ch00: Veritas NetBackup for Oracle - Release 6.5 (2009050107)
-
-
Starting restore at 2011-04-27 16:39:32
-
-
channel ch00: restoring control file
-
channel ch00: restore complete, elapsed time: 00:01:57
-
output filename=/orasid/sys_u01/control01.ctl
-
output filename=/orasid/redo_u01/control02.ctl
-
output filename=/orasid/undo_u01/control03.ctl
-
Finished restore at 2011-04-27 16:41:29
-
-
released channel: ch00
-
-
RMAN>
9、确认controlfile恢复成功后将数据库启动到mount状态
- RMAN> alter database mount;
-
-
database mounted
-
-
RMAN>
10、开始恢复数据库,这时最好写成脚本放在后台运行,并且将输出从定向到文件
- [oracle@hostb:/usr/openv/scripts]$cat res.rcv
-
run {
-
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' parms 'ENV=(NB_ORA_CLIENT=hosta)';
-
restore database;
-
recover database;
-
release channel ch00;
-
}
-
[oracle@hostb:/usr/openv/scripts]$cat res.sh
-
nohup rman nocatalog target / cmdfile=res.rcv msglog=res.log.`date +%y%m%d%H%M` &
-
[oracle@hostb:/usr/openv/scripts]$
直接执行res.sh,等到恢复完成后用命令打开数据库
- alter database open resetlog;
完成
阅读(2000) | 评论(0) | 转发(0) |