日期:2014-05-16  浏览次数:20462 次

oracle 11g 利用duplicate from active database 创建data guard

操作系统版本:
oracle@admtps-Sun-Fire-X4150:/media/oracle/fast_recovery_area$ uname -a
Linux admtps-Sun-Fire-X4150 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:17:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

数据库版本:
SQL> select * from v$version;

BANNER
--------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

SQL>

数据库规划(db_unique_name):
主库: DREAM
备库: DREAM01

操作步骤如下:

1.检查主库是否为归档模式,并且主库为force logging,(database flashback模式可选,选择有利于备库在failover模式迅速恢复)

SQL> select log_mode,force_logging from v$database;

LOG_MODE FOR
------------ ---
ARCHIVELOG NO

SQL> alter database force logging;

Database altered.

SQL> select log_mode,force_logging from v$database;

LOG_MODE FOR
------------ ---
ARCHIVELOG YES

SQL>

2.检查是否创建standby log file,假如没有创建,则创建
standby log file的文件大小和redo log file 文件大小一样,并且组数为redo log group count * thread count + 1


SQL> select * from v$logfile;
rows will be truncated


GROUP# STATUS TYPE MEMBER
---------- ------- ------- -----------------------------------------------------
3 ONLINE /media/oracle/oradata/DREAM/redo03.log
2 ONLINE /media/oracle/oradata/DREAM/redo02.log
1 ONLINE /media/oracle/oradata/DREAM/redo01.log

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- ---------- --- ----------
1 1 4 52428800 512 1 YES INACTIVE
2 1 5 52428800 512 1 NO CURRENT
3 1 3 52428800 512 1 YES INACTIVE

SQL> select 52428800/1024/1024 from dual;

52428800/1024/1024
------------------
50

SQL> alter database add standby logfile '/media/oracle/oradata/DREAM/stdlog04.log' size 50m;

Database altered.

SQL> alter database add standby logfile '/media/oracle/oradata/DREAM/stdlog05.log' size 50m;

Database altered.

SQL> alter database add standby logfile '/media/oracle/oradata/DREAM/stdlog06.log' size 50m;

Database altered.

SQL> alter database add standby logfile '/media/oracle/oradata/DREAM/stdlog07.log' size 50m;

Database altered.

SQL> select * from v$standby_log;

GROUP# DBID THREAD# SEQUENCE# ARC ST
---------- ---------------------------------------- ---------- ---------- --- --
4 UNASSIGNED 0 0 YES UN
5 UNASSIGNED 0 0 YES UN
6 UNASSIGNED 0 0 YES UN
7 UNASSIGNED 0 0 YES UN

SQL> select * from v$logfile;
rows will be truncated


GROUP# STATUS TYPE MEMBER
---------- ------- ------- -----------------------------------------------------
3 ONLINE /media/oracle/oradata/DREAM/redo03.log
2 ONLINE /media/oracle/oradata/DREAM/redo02.log
1 ONLINE /media/oracle/oradata/DREAM/redo01.log
4 STANDBY /media/oracle/oradata/DREAM/stdlog04.log
5 STANDBY /media/oracle/oradata/DREAM/stdlog05.log
6 STANDBY /media/oracle/oradata/DREAM/stdlog06.log
7 STANDBY /media/oracle/ora