利用rman创建standby(二)

本文介绍使用RMAN工具通过简单步骤完成备库创建的过程,包括主库备份、归档日志、启动备库到nomount状态及利用RMAN进行恢复等关键步骤。

第1步到第6步和前一个试验一致,这里不再重复。

7.利用rman备份主库

注意同时备库控制文件

C:>rman target /

Recovery Manager: Release 9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: NING (DBID=1192138470)

RMAN> backup full format='d:backup.ora' database include current controlfile for standby;

Starting backup at 21-NOV-06
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=17 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
including standby controlfile in backupset
input datafile fno=00001 name=D:ORACLEORADATANINGSYSTEM01.DBF
input datafile fno=00002 name=D:ORACLEORADATANINGUNDOTBS01.DBF
input datafile fno=00004 name=D:ORACLEORADATANINGEXAMPLE01.DBF
input datafile fno=00005 name=D:ORACLEORADATANINGINDX01.DBF
input datafile fno=00007 name=D:ORACLEORADATANINGUSERS01.DBF
input datafile fno=00003 name=D:ORACLEORADATANINGCWMLITE01.DBF
input datafile fno=00006 name=D:ORACLEORADATANINGTOOLS01.DBF
input datafile fno=00008 name=D:ORACLEORADATANINGTEST01.DBF
channel ORA_DISK_1: starting piece 1 at 21-NOV-06
channel ORA_DISK_1: finished piece 1 at 21-NOV-06
piece handle=D:BACKUP.ORA comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:17
Finished backup at 21-NOV-06

8.归档主库当前日志
SQL> alter system archive log current;

System altered.

9.启动备库到nomount
SQL> conn
/@test as sysdba
Connected to an idle instance.

SQL> startup nomount pfile='d:/oracle/ora92/database/inittest.ora'
ORACLE instance started.

Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes

10.利用rman恢复备库C:>rman target / auxiliary /@test

Recovery Manager: Release 9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: NING (DBID=1192138470)
connected to auxiliary database: ning (not mounted)

RMAN> duplicate target database for standby;

Starting Duplicate Db at 21-NOV-06
using target database controlfile instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=13 devtype=DISK

printing stored script: Memory Script
{
restore clone standby controlfile to clone_cf;
replicate clone controlfile from clone_cf;
sql clone 'alter database mount standby database';
}
executing script: Memory Script

Starting restore at 21-NOV-06

using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring controlfile
output filename=D:ORACLEORADATATESTCONTROLSTANDBY.CTL
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=D:BACKUP.ORA tag=TAG20061121T163118 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 21-NOV-06

replicating controlfile
input filename=D:ORACLEORADATATESTCONTROLSTANDBY.CTL

sql statement: alter database mount standby database

printing stored script: Memory Script
{
set until scn 710788;
set newname for datafile 1 to
"D:ORACLEORADATATESTSYSTEM01.DBF";
set newname for datafile 2 to
"D:ORACLEORADATATESTUNDOTBS01.DBF";
set newname for datafile 3 to
"D:ORACLEORADATATESTCWMLITE01.DBF";
set newname for datafile 4 to
"D:ORACLEORADATATESTEXAMPLE01.DBF";
set newname for datafile 5 to
"D:ORACLEORADATATESTINDX01.DBF";
set newname for datafile 6 to
"D:ORACLEORADATATESTTOOLS01.DBF";
set newname for datafile 7 to
"D:ORACLEORADATATESTUSERS01.DBF";
set newname for datafile 8 to
"D:ORACLEORADATATESTTEST01.DBF";
restore
check readonly
clone database
;
}
executing script: Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

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 21-NOV-06

using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to D:ORACLEORADATATESTSYSTEM01.DBF
restoring datafile 00002 to D:ORACLEORADATATESTUNDOTBS01.DBF
restoring datafile 00003 to D:ORACLEORADATATESTCWMLITE01.DBF
restoring datafile 00004 to D:ORACLEORADATATESTEXAMPLE01.DBF
restoring datafile 00005 to D:ORACLEORADATATESTINDX01.DBF
restoring datafile 00006 to D:ORACLEORADATATESTTOOLS01.DBF
restoring datafile 00007 to D:ORACLEORADATATESTUSERS01.DBF
restoring datafile 00008 to D:ORACLEORADATATESTTEST01.DBF
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=D:BACKUP.ORA tag=TAG20061121T163118 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 21-NOV-06

printing stored script: Memory Script
{
switch clone datafile all;
}
executing script: Memory Script

datafile 2 switched to datafile copy
input datafilecopy recid=9 stamp=607106726 filename=D:ORACLEORADATATESTUNDOT
BS01.DBF
datafile 3 switched to datafile copy
input datafilecopy recid=10 stamp=607106726 filename=D:ORACLEORADATATESTCWML
ITE01.DBF
datafile 4 switched to datafile copy
input datafilecopy recid=11 stamp=607106726 filename=D:ORACLEORADATATESTEXAM
PLE01.DBF
datafile 5 switched to datafile copy
input datafilecopy recid=12 stamp=607106726 filename=D:ORACLEORADATATESTINDX
01.DBF
datafile 6 switched to datafile copy
input datafilecopy recid=13 stamp=607106726 filename=D:ORACLEORADATATESTTOOL
S01.DBF
datafile 7 switched to datafile copy
input datafilecopy recid=14 stamp=607106726 filename=D:ORACLEORADATATESTUSER
S01.DBF
datafile 8 switched to datafile copy
input datafilecopy recid=15 stamp=607106726 filename=D:ORACLEORADATATESTTEST
01.DBF
Finished Duplicate Db at 21-NOV-06

如果第8步没有归档当前日志,duplicate时可能出现错误:
RMAN-05507: standby controlfile checkpoint (710256) is more recent than duplicat
ion point in time (709530)

至此,备库创建成功,后续步骤可以参照前一个试验

可以看到,使用rman的duplicate来创建备库,过程简洁了不少,无需在手动创建备库控制文件。 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值