45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:如何利用rman创建standby?

如何利用rman创建standby?

2016-09-05 12:39:05 来源:www.45fan.com 【

如何利用rman创建standby?

第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来创建备库,过程简洁了不少,无需在手动创建备库控制文件。

 

本文地址:http://www.45fan.com/a/question/72652.html
Tags: 创建 standby rman
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部