一、大致步骤
通过RMAN备份创建standby数据库大致分为这几个步骤:
(1)设置主数据库为force loggin模式
(2)设置主数据库为archived log模式
(3)配置好主备库的参数文件
(4)两边的密码文件保持一致
(5)配置监听
(6)用参数文件启动standby到nomount状态
(7)通过rman对主库做完全备份
(8)通过rman为standby创建控制文件
(9)通过rman dumplicate命令创建备库
(10)创建完成后,自动将standby 数据库启动到mount状态,并且不会自动启动redo apply
二、实施创建操作
环境:primary数据库名DGWH,standby数据库名DGBJ,db_unique_name=DGWH
在我总结的10步中,前5步骤和使用常规的方式一样,参见:
理论知识:
有详细配置步骤,这里省略,从第6步开始。
注意这里我是直接创建好了spfile文件,当修改好了参数文件后可以用create spfile from pfile创建
相关参考:
Oracle Data Guard 重要配置参数
基于同一主机配置 Oracle 11g Data Guard
探索Oracle之11g DataGuard
Oracle Data Guard (RAC+DG) 归档删除策略及脚本
Oracle Data Guard 的角色转换
Oracle Data Guard的日志FAL gap问题
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 处理方法
(1)在备库上使用spfile启动到nomount状态。
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 318046208 bytes
Fixed Size 1299652 bytes
Variable Size 297798460 bytes
Database Buffers 12582912 bytes
Redo Buffers 6365184 bytes
SQL>
(2)将主库启动到mount状态下,然后用rman连接备份数据库
RMAN> backup database include current controlfile for standby plus archivelog; //注意 备份数据库的同时创建了standby控制文件,并且包含了归档日志。 也可以分开来做例如 backup database ;copy current controlfile for standby to '/tmp/st.ctl'
Starting backup at 22-SEP-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=154 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=463 RECID=917 STAMP=826842432
channel ORA_DISK_1: starting piece 1 at 22-SEP-13
channel ORA_DISK_1: finished piece 1 at 22-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/DGWH/backupset/2013_09_22/o1_mf_annnn_TAG20130922T224340_93y0k0wl_.bkp tag=TAG20130922T224340 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 22-SEP-13
Starting backup at 22-SEP-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/DGWH/datafile/o1_mf_system_9361jnkf_.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/DGWH/datafile/o1_mf_sysaux_9361jnkx_.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/DGWH/datafile/o1_mf_undotbs1_9361jnol_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/DGWH/datafile/o1_mf_users_9361jnpq_.dbf
channel ORA_DISK_1: starting piece 1 at 22-SEP-13
channel ORA_DISK_1: finished piece 1 at 22-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/DGWH/backupset/2013_09_22/o1_mf_nnndf_TAG20130922T224346_93y0k69f_.bkp tag=TAG20130922T224346 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 22-SEP-13
channel ORA_DISK_1: finished piece 1 at 22-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/DGWH/backupset/2013_09_22/o1_mf_ncsnf_TAG20130922T224346_93y0n4ss_.bkp tag=TAG20130922T224346 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 //piece handle生成了3个备份片到/u01/app/oracle/flash_recovery_area/DGWH/backupset
Finished backup at 22-SEP-13
Starting backup at 22-SEP-13
using channel ORA_DISK_1
specification does not match any archived log in the recovery catalog
backup cancelled because all files were skipped
Finished backup at 22-SEP-13
接下来请看第2页精彩内容: