eygle.com   eygle.com
eygle.com  
 

« 《循序渐进Oracle》第一章PDF完整版下载 | Blog首页 | Oracle10gR2的ORA-06512 OLAP错误 »

使用RMAN进行快速Dataguard数据库创建

作者:eygle |【转载时请务必以超链接形式标明文章和作者信息及本声明
链接:

从Oracle9i开始,Oracle允许使用duplicate的方式进行Dataguard备用数据库的创建,非常简便。

当然首先需要在主库进行一个RMAN备份,然后需要将备份传送到备用数据库和主库相同的目录下。
在备用主机创建监听、必要的目录结构、参数文件,启动实例,然后就可以在主库连接从库进行恢复。

恢复的主要命令是: duplicate target database for standby;

$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Aug 20 13:58:12 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: EYGLE (DBID=1447940999)

RMAN> connect auxiliary sys/oracle@julia

connected to auxiliary database: EYGLE (not mounted)

RMAN> duplicate target database for standby;

Starting Duplicate Db at 20-AUG-07
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK

contents of Memory Script:
{
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script

Starting restore at 20-AUG-07
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /data2/ora10g/flash_recovery_area/EYGLE/backupset/2007_08_08/o1_mf_ncsnf_TAG20070808T104424_3clcn8p7_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/data2/ora10g/flash_recovery_area/EYGLE/backupset/2007_08_08/o1_mf_ncsnf_TAG20070808T104424_3clcn8p7_.bkp tag=TAG20070808T104424
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:05
output filename=/data2/ora10g/oradata/JULIA/controlfile/o1_mf_3clr03bp_.ctl
output filename=/data2/ora10g/flash_recovery_area/JULIA/controlfile/o1_mf_3clr04gj_.ctl
Finished restore at 20-AUG-07

sql statement: alter database mount standby database
released channel: ORA_AUX_DISK_1

contents of Memory Script:
{
set newname for clone tempfile 1 to new;
switch clone tempfile all;
set newname for clone datafile 1 to new;
set newname for clone datafile 2 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 4 to new;
set newname for clone datafile 5 to new;
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to /data2/ora10g/oradata/JULIA/datafile/o1_mf_temp_%u_.tmp in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 20-AUG-07
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=157 devtype=DISK

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 /data2/ora10g/oradata/JULIA/datafile/o1_mf_system_%u_.dbf
restoring datafile 00002 to /data2/ora10g/oradata/JULIA/datafile/o1_mf_undotbs1_%u_.dbf
restoring datafile 00003 to /data2/ora10g/oradata/JULIA/datafile/o1_mf_sysaux_%u_.dbf
restoring datafile 00004 to /data2/ora10g/oradata/JULIA/datafile/o1_mf_users_%u_.dbf
restoring datafile 00005 to /data2/ora10g/oradata/JULIA/datafile/o1_mf_eygle_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /data2/ora10g/flash_recovery_area/EYGLE/backupset/2007_08_08/o1_mf_nnndf_TAG20070808T104424_3clcj9k0_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/data2/ora10g/flash_recovery_area/EYGLE/backupset/2007_08_08/o1_mf_nnndf_TAG20070808T104424_3clcj9k0_.bkp tag=TAG20070808T104424
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:04:28
Finished restore at 20-AUG-07

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy recid=6 stamp=631118486 filename=/data2/ora10g/oradata/JULIA/datafile/o1_mf_system_3dlfnc5b_.dbf
datafile 2 switched to datafile copy
input datafile copy recid=7 stamp=631118486 filename=/data2/ora10g/oradata/JULIA/datafile/o1_mf_undotbs1_3dlfnc77_.dbf
datafile 3 switched to datafile copy
input datafile copy recid=8 stamp=631118487 filename=/data2/ora10g/oradata/JULIA/datafile/o1_mf_sysaux_3dlfnc80_.dbf
datafile 4 switched to datafile copy
input datafile copy recid=9 stamp=631118487 filename=/data2/ora10g/oradata/JULIA/datafile/o1_mf_users_3dlfncb6_.dbf
datafile 5 switched to datafile copy
input datafile copy recid=10 stamp=631118488 filename=/data2/ora10g/oradata/JULIA/datafile/o1_mf_eygle_3dlfnbx8_.dbf
Finished Duplicate Db at 20-AUG-07

然后从库即可启动进行恢复:

SQL> alter database mount standby database;
alter database mount standby database
*
ERROR at line 1:
ORA-01100: database already mounted

SQL> alter database recover managed standby database disconnect from session;

Database altered.

一切都非常的简便。

-The End-

By eygle on 2007-08-20 15:11 | Comments (3) | Posted to Advanced | Edit |Pageviews:

相关文章 随机文章
  • RMAN的"rman: can't open target"错误
  • Oracle10gR2的ORA-06512 OLAP错误
  • 用Rman的Plus archvielog选项简化数据库备份
  • Use RMAN to Manage BackupSet
  • DataGuard数据库服务器硬盘故障处理一则
  • 赛门铁克推出数据库安全产品SDSA 3100
    Oracle的X$表系列介绍之-X$KCCCP
    天下无贼-那一滴金砂的缘起缘落
    Oracle10g的UNDO_RETENTION自动化管理增强
    Oracle 10g Release 2 new tools:asmcmd
    网上相关主题:
    Google

    留言 (3)

    简单是很简单,速度如何?
    我这边一个4T的库,采用dd(热复制),只需要1.5小时就可以完成!

    Posted by: Thomas Zhang at August 20, 2007 7:28 PM

    要速度显然是你这种方式快一点,可以消除一次恢复的时间吧。

    数据库如果不大,加上DG应该不是time critical的活,使用RMAN是可以的。

    Posted by: eygle at August 21, 2007 9:06 AM

    duplicate target database for standby;
    我执行这一步的时候老是提示找不到备份的控制文件怎么回事啊?我也都拷贝到对应的从机的目录下了?

    Posted by: sunql at October 10, 2007 11:04 PM

    发表留言:



    Remember Me?
    (输入验证码后方可评论,谢谢支持)



    CopyRight © 2004 eygle.com, All rights reserved.