eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

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

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

从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-


历史上的今天...
    >> 2012-08-20文章:
    >> 2006-08-20文章:
    >> 2005-08-20文章:
           Blog与六度分割理论
           传说中的彼岸花
           升级MT到3.2Beta5版本

By eygle on 2007-08-20 15:11 | Comments (12) | Advanced | 1557 |

12 Comments

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

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

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

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

oracle 10.2.0.3
dataguard前边配置完成后
到rman这块
在standby start nomount时
rman远程连不上库 这是为何呢
我新建了库open下可以远程连 nomount不行
请问什么原因有可能

RMAN> connect auxiliary sys/oracle@dbstandby

MAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-04006: 来自辅助数据库的错误: ORA-12528: TNS: 监听程序: 所有适用例程都无法建立新连接

RMAN> quit

ncdata/home/oracle$sqlplus sys/oracle@dbstandby as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期五 11月 28 11:04:01 2008

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
这个是open下可以连

连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

Posted by: songguozhe at November 28, 2008 11:16 AM

远程Standby,启动到Nomount啊

远程Standby,启动到Nomount时无法连接:

SQL> startup nomount;
ORACLE 例程已经启动。

Total System Global Area 167772160 bytes
Fixed Size 1247876 bytes
Variable Size 62915964 bytes
Database Buffers 96468992 bytes
Redo Buffers 7139328 bytes
SQL>

RMAN-04006: 来自辅助数据库的错误: ORA-12528: TNS: 监听程序: 所有适用例程都无法建立新连接

只能将standby 库open之后才能连接.为何呢,我那里测试不对吗

我新建了库open下可以远程连 nomount不行

需要静态注册监听服务,我也遇到这个问题

主库和备份库的DB_block_size设置不同是否可以?

在多问一下. 我现在需要将默认的2k block size的一个库更改成8k的新数据块.
有没有什么好的建议. 要求要尽量减少down机的时间. 谢谢


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com