oracle 之物理DG 创建

  今天是2014-04-16,继续完成DG的整理内容。该篇日志,将记录创建DG的所需参数简要介绍,和创建物理DG的过程。

第一:参数介绍:

db_unique_name(db_name):该参数指定数据库唯一名字,注意该参数将和log_archive_config存在关联,对于物理dg必须存有相同的db_name,对于逻辑DG必须 存有不同的db_name
log_archive_config:配置有效的db_unique_name列表,且负责主备验证内容。
control_files:控制文件所在位置,如果备用数据库的控制文件和主库的控制文件路径不同那么需要使用该参数进行修改
log_archive_max_processes:最大归档进程,最多为30个,默认为2个,建议将其设置为5-10之内,太多进程存在导致切换日志缓慢的情况,因为在切换的时候需要唤醒他们需要时间消耗,另外当存在传输滞后的时候,需要有专门的进程(可以多个进程并行)负责传输滞后归档。切记:不可只有一个arch进程,因为需要有专用进程负责归档online redo:
db_create_file_dest:创建数据文件指定位置(如:asm指定磁盘组名,OMF管理方式)
log_archive_dest_n:这是非常主要的参数,负责传输重做。有如下几个值:
service:定义远端服务器参数
sync:传输模式为同步传输
async:传输模式为异步传输
net_timeout:当lns收不到备库rfs确认应用重做消息时,lgwr进程等待的时间,如果运行在高可用性模式下那么将放弃等待,如果是最大保护模式且无其他备库,那么主库将关闭。当再次和备库取得联系后,那么主库的旧lns进程关闭启动新的lns进程,然后连接备库,然后停旧的备库rfs进程启动新的rfs进程,获得新的standby log并初始化,完后传输连接准备就绪了。
reopen:主数据库连接失效备库的时间建议将该值设置为(15-30秒)
valid_for:定义使用log_archive_dest_n参数归档,在什么模式下使用,有如下子参数:
online_logfile:仅归档联机日志文件
standby_logfile:归档备用日志文件
all_logfiles:归档所有日志文件
primary_role:在主角色起作用
standby_role:在备角色起作用
all_roles:在所有角色起作用
affirm:使用于最打保护模式和最高可用性模式,确认重做在备库得到应用消息
noaffirm:默认类型,适用最高性能
compression:压缩,注意是在传送中进行压缩,而不是压缩到本地磁盘,且需要消耗cpu,但可缓解带宽压力。
max_connections(11G废掉):发送间隔归档日志启用的最大进程数。
delay:在备库延迟应用redo的时间(秒/单位)
location(快速闪回恢复区dest_10):本地归档位置,但是当闪回区存在了那么是log_archive_dest_10为:USE_DB_RECOVERY_FILE_DEST
log_archive_dest_state_n:启动那个目录位置
备用角色参数:
db_file_name_convert:当备库和主库文件不同,彼此切换主备的时候使用该参数转换
log_file_name_convert:同上(只是log)
fal_server(物理备用):仅适用于物理dg,当主库无法和备库连接的时候,那么该备库可以从其他级联数据备库接受滞后日志所需名称列表。
fal_client(物理备用):需要接受滞后日志的那方名称
standby_file_management:主备操作同步参数,如auto,那么在主库创建一个联机日志,备库也同样操作,在主库删除,那么在备库也是删除。默认为manual:

好了,参数就说这些,具体可以参考联机手册呗。

第二:创建物理DG:

前提条件:

1、主库需要按照完数据库(包括建库),备库需要按照软件即可

2、主库和备库需要配置好网络,配置好监听和net 服务。

3、切记:备库的密码文件在11G必须为主库的密码文件,且在之前手动创建相同sys密码文件的方式行不通了,因为在11g有了新的加密验证方式。

4、其他使用rman 复制即可完成。

下面开始操作:

1、配置网络及备库参数文件

主库:

监听配置如下:

[oracle@dg-one admin]$ more listener.ora 
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.219)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

#ADR_BASE_LISTENER = /u01/app/oracle
SID_LIST_LISTENER=
  (SID_LIST=
      (SID_DESC=
         (GLOBAL_DBNAME=dg1)
         (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
        (SID_NAME=dg1)
   )
  )

tnsname.ora配置如下:

 

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools.

DG1 =   (DESCRIPTION =     (ADDRESS_LIST =       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.219)(PORT = 1521))     )     (CONNECT_DATA =       (SERVICE_NAME = dg1)     )   ) DG2 =   (DESCRIPTION =     (ADDRESS_LIST =       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.230)(PORT = 1521))     )     (CONNECT_DATA =       (SERVICE_NAME = dg2)     )   )

 


备库监听配置如下:

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.230)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle
SID_LIST_LISTENER=
  (SID_LIST=
      (SID_DESC=
         (GLOBAL_DBNAME=dg2)
         (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
        (SID_NAME=dg2)
   )
  )


tnsname,ora配置如下:

 

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools.

DG1 =   (DESCRIPTION =     (ADDRESS_LIST =       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.219)(PORT = 1521))     )     (CONNECT_DATA =       (SERVICE_NAME = dg1)     )   ) DG2 =   (DESCRIPTION =     (ADDRESS_LIST =       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.230)(PORT = 1521))     )     (CONNECT_DATA =       (SERVICE_NAME = dg2)     )   )

 


互相测试如下:

[oracle@dg-two ~]$ tnsping dg1

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 15-APR-2014 23:49:55

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.219)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = dg1)))
OK (30 msec)
[oracle@dg-two ~]$ 
[oracle@dg-one admin]$ tnsping dg2

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 15-APR-2014 23:50:00

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.230)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = dg2)))
OK (20 msec)
[oracle@dg-one admin]$ 


在备库创建临时参数文件:

[oracle@dg-two dbs]$ more initdg2.ora 
db_name=DG
[oracle@dg-two dbs]$ 

主库查询:

SQL> select dbid,name from v$database;

      DBID NAME
---------- ---------
1756848898 DG

2、copy主库密码文件到备库目录,且将备库启动到nomount状态:

[oracle@dg-two ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 16 00:05:21 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  217157632 bytes
Fixed Size                  2251816 bytes
Variable Size             159384536 bytes
Database Buffers           50331648 bytes
Redo Buffers                5189632 bytes
SQL> 

3、在主库创建standby log file,当使用rman创建备库的时候,将在备库同步。

SQL> alter database add standby logfile ‘/u01/app/oracle/oradata/dg/std01.log‘ size 50m;

Database altered.

SQL> alter database add standby logfile ‘/u01/app/oracle/oradata/dg/std02.log‘ size 50m;

Database altered.

SQL> alter database add standby logfile ‘/u01/app/oracle/oradata/dg/std03.log‘ size 50m;

Database altered.

SQL> alter database add standby logfile ‘/u01/app/oracle/oradata/dg/std04.log‘ size 50m;

Database altered.

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
         1          1         10   52428800        512          1 NO  CURRENT                1079725 15-APR-14   2.8147E+14
         2          1          8   52428800        512          1 YES INACTIVE               1015435 15-APR-14      1045647 15-APR-14
         3          1          9   52428800        512          1 YES INACTIVE               1045647 15-APR-14      1079725 15-APR-14

SQL> select * from v$standby_log;

    GROUP# DBID                                        THREAD#  SEQUENCE#      BYTES  BLOCKSIZE       USED ARC STATUS     FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME LAST_CHANGE# LAST_TIME
---------- ---------------------------------------- ---------- ---------- ---------- ---------- ---------- --- ---------- ------------- --------- ------------ --------- ------------ ---------
         4 UNASSIGNED                                        0          0   52428800        512          0 YES UNASSIGNED
         5 UNASSIGNED                                        0          0   52428800        512          0 YES UNASSIGNED
         6 UNASSIGNED                                        0          0   52428800        512          0 YES UNASSIGNED
         7 UNASSIGNED                                        0          0   52428800        512          0 YES UNASSIGNED

SQL> 


注意:创建standby redo 建议多余一个redo个数。

4、使用rman创建备库:

注:备库要启动到nomount,主备库监听需要全部启动且 是静态监听。

使用的脚本可以到代码片中查找

整个过程如下:

[oracle@dg-one ~]$ rman target sys/root@dg1 auxiliary sys/root@dg2

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Apr 16 04:25:10 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DG (DBID=1756848898) connected to auxiliary database: DG (not mounted)

RMAN> run{ 2>  allocate channel ch1 type disk; 3>  allocate channel ch2 type disk; 4>  allocate channel ch3 type disk; 5>  allocate channel ch4 type disk; 6>  allocate channel ch5 type disk; 7>  allocate channel ch6 type disk; 8>  allocate channel ch7 type disk; 9>  allocate auxiliary channel ch8 type disk; 10>  duplicate target database for standby from active database nofilenamecheck 11>  spfile 12>    parameter_value_convert ‘dg1‘,‘dg2‘ 13>    set db_unique_name=‘dg2‘ 14>    set db_recovery_file_dest=‘/u01/app/oracle/fast_recovery_area‘ 15>    set DB_RECOVERY_FILE_DEST_SIZE=‘4G‘ 16>    set control_files=‘/u01/app/oracle/oradata/dg/control01.ctl‘ 17>    set db_create_file_dest=‘/u01/app/oracle/oradata/dg‘ 18>    set db_create_online_log_dest_1=‘/u01/app/oracle/oradata/dg‘ 19>    set log_archive_max_processes=‘5‘ 20>    set fal_client=‘dg2‘ 21>    set fal_server=‘dg1‘ 22>    set standby_file_management=‘AUTO‘ 23>    set log_archive_config=‘dg_config=(dg1,dg2)‘ 24>    set log_archive_dest_1=‘location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles)‘ 25>    set log_archive_dest_2=‘service=dg1 lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=dg1‘; 26>     sql channel ch6 "alter system set log_archive_max_processes=5"; 27>     sql channel ch7 "alter system set fal_client=dg1"; 28>     sql channel ch7 "alter system set fal_server=dg2"; 29>     sql channel ch5 "alter system set standby_file_management=AUTO"; 30>     sql channel ch6 "alter system set log_archive_config=‘‘dg_config=(dg1,dg2)‘‘"; 31>     sql channel ch7 "alter system set log_archive_dest_2=‘‘service=dg2 lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=dg2‘‘"; 32>     sql channel ch6 "alter system set log_archive_dest_1=‘‘location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles)‘‘"; 33>     sql channel ch1 "alter system archive log current"; 34>     sql channel ch8 "alter database recover managed standby database using current logfile disconnect from session"; 35>  release channel ch1; 36>  release channel ch2; 37>  release channel ch3; 38>  release channel ch4; 39>  release channel ch5; 40>  release channel ch6; 41>  release channel ch7; 42>  release channel ch8; 43> }

using target database control file instead of recovery catalog allocated channel: ch1 channel ch1: SID=48 device type=DISK

allocated channel: ch2 channel ch2: SID=44 device type=DISK

allocated channel: ch3 channel ch3: SID=47 device type=DISK

allocated channel: ch4 channel ch4: SID=46 device type=DISK

allocated channel: ch5 channel ch5: SID=45 device type=DISK

allocated channel: ch6 channel ch6: SID=39 device type=DISK

allocated channel: ch7 channel ch7: SID=35 device type=DISK

allocated channel: ch8 channel ch8: SID=20 device type=DISK

Starting Duplicate Db at 16-APR-14

contents of Memory Script: {    backup as copy reuse    targetfile  ‘/u01/app/oracle/product/11.2.0/db_1/dbs/orapwdg1‘ auxiliary format  ‘/u01/app/oracle/product/11.2.0/db_1/dbs/orapwdg2‘   targetfile  ‘/u01/app/oracle/product/11.2.0/db_1/dbs/spfiledg1.ora‘ auxiliary format  ‘/u01/app/oracle/product/11.2.0/db_1/dbs/spfiledg2.ora‘   ;    sql clone "alter system set spfile= ‘‘/u01/app/oracle/product/11.2.0/db_1/dbs/spfiledg2.ora‘‘"; } executing Memory Script

Starting backup at 16-APR-14 Finished backup at 16-APR-14

sql statement: alter system set spfile= ‘‘/u01/app/oracle/product/11.2.0/db_1/dbs/spfiledg2.ora‘‘

contents of Memory Script: {    sql clone "alter system set  core_dump_dest =  ‘‘/u01/app/oracle/diag/rdbms/dg/dg2/cdump‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  db_unique_name =  ‘‘dg2‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  db_recovery_file_dest =  ‘‘/u01/app/oracle/fast_recovery_area‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  DB_RECOVERY_FILE_DEST_SIZE =  4G comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  control_files =  ‘‘/u01/app/oracle/oradata/dg/control01.ctl‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  db_create_file_dest =  ‘‘/u01/app/oracle/oradata/dg‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  db_create_online_log_dest_1 =  ‘‘/u01/app/oracle/oradata/dg‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  log_archive_max_processes =  5 comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  fal_client =  ‘‘dg2‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  fal_server =  ‘‘dg1‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  standby_file_management =  ‘‘AUTO‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  log_archive_config =  ‘‘dg_config=(dg1,dg2)‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  log_archive_dest_1 =  ‘‘location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles)‘‘ comment=  ‘‘‘‘ scope=spfile";    sql clone "alter system set  log_archive_dest_2 =  ‘‘service=dg1 lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=dg1‘‘ comment=  ‘‘‘‘ scope=spfile";    shutdown clone immediate;    startup clone nomount; } executing Memory Script

sql statement: alter system set  core_dump_dest =  ‘‘/u01/app/oracle/diag/rdbms/dg/dg2/cdump‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  db_unique_name =  ‘‘dg2‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  db_recovery_file_dest =  ‘‘/u01/app/oracle/fast_recovery_area‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  DB_RECOVERY_FILE_DEST_SIZE =  4G comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  control_files =  ‘‘/u01/app/oracle/oradata/dg/control01.ctl‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  db_create_file_dest =  ‘‘/u01/app/oracle/oradata/dg‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  db_create_online_log_dest_1 =  ‘‘/u01/app/oracle/oradata/dg‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  log_archive_max_processes =  5 comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  fal_client =  ‘‘dg2‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  fal_server =  ‘‘dg1‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  standby_file_management =  ‘‘AUTO‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  log_archive_config =  ‘‘dg_config=(dg1,dg2)‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  log_archive_dest_1 =  ‘‘location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles)‘‘ comment= ‘‘‘‘ scope=spfile

sql statement: alter system set  log_archive_dest_2 =  ‘‘service=dg1 lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=dg1‘‘ comment= ‘‘‘‘ scope=spfile

Oracle instance shut down

connected to auxiliary database (not started) Oracle instance started

Total System Global Area     313159680 bytes

Fixed Size                     2252824 bytes Variable Size                171970536 bytes Database Buffers             134217728 bytes Redo Buffers                   4718592 bytes allocated channel: ch8 channel ch8: SID=19 device type=DISK

contents of Memory Script: {    backup as copy current controlfile for standby auxiliary format  ‘/u01/app/oracle/oradata/dg/control01.ctl‘; } executing Memory Script

Starting backup at 16-APR-14 channel ch1: starting datafile copy copying standby control file output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_dg1.f tag=TAG20140416T042545 RECID=19 STAMP=845007946 channel ch1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 16-APR-14

contents of Memory Script: {    sql clone ‘alter database mount standby database‘; } executing Memory Script

sql statement: alter database mount standby database

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;    backup as copy reuse    datafile  1 auxiliary format new    datafile  2 auxiliary format new    datafile  3 auxiliary format new    datafile  4 auxiliary format new    ;    sql ‘alter system archive log current‘; } executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/dg/DG2/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

Starting backup at 16-APR-14 channel ch1: starting datafile copy input datafile file number=00001 name=/u01/app/oracle/oradata/dg/system01.dbf channel ch2: starting datafile copy input datafile file number=00002 name=/u01/app/oracle/oradata/dg/sysaux01.dbf channel ch3: starting datafile copy input datafile file number=00003 name=/u01/app/oracle/oradata/dg/undotbs01.dbf channel ch4: starting datafile copy input datafile file number=00004 name=/u01/app/oracle/oradata/dg/users01.dbf output file name=/u01/app/oracle/oradata/dg/DG2/datafile/o1_mf_users_2ap5rj2m_.dbf tag=TAG20140416T042557 channel ch4: datafile copy complete, elapsed time: 00:00:07 output file name=/u01/app/oracle/oradata/dg/DG2/datafile/o1_mf_undotbs1_29p5rj2m_.dbf tag=TAG20140416T042557 channel ch3: datafile copy complete, elapsed time: 00:00:45 output file name=/u01/app/oracle/oradata/dg/DG2/datafile/o1_mf_sysaux_28p5rj2m_.dbf tag=TAG20140416T042557 channel ch2: datafile copy complete, elapsed time: 00:02:36 output file name=/u01/app/oracle/oradata/dg/DG2/datafile/o1_mf_system_27p5rj2m_.dbf tag=TAG20140416T042557 channel ch1: datafile copy complete, elapsed time: 00:03:16 Finished backup at 16-APR-14

sql statement: alter system archive log current

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

datafile 1 switched to datafile copy input datafile copy RECID=19 STAMP=845008154 file name=/u01/app/oracle/oradata/dg/DG2/datafile/o1_mf_system_27p5rj2m_.dbf datafile 2 switched to datafile copy input datafile copy RECID=20 STAMP=845008154 file name=/u01/app/oracle/oradata/dg/DG2/datafile/o1_mf_sysaux_28p5rj2m_.dbf datafile 3 switched to datafile copy input datafile copy RECID=21 STAMP=845008154 file name=/u01/app/oracle/oradata/dg/DG2/datafile/o1_mf_undotbs1_29p5rj2m_.dbf datafile 4 switched to datafile copy input datafile copy RECID=22 STAMP=845008154 file name=/u01/app/oracle/oradata/dg/DG2/datafile/o1_mf_users_2ap5rj2m_.dbf Finished Duplicate Db at 16-APR-14

sql statement: alter system set log_archive_max_processes=5

sql statement: alter system set fal_client=dg1

sql statement: alter system set fal_server=dg2

sql statement: alter system set standby_file_management=AUTO

sql statement: alter system set log_archive_config=‘‘dg_config=(dg1,dg2)‘‘

sql statement: alter system set log_archive_dest_2=‘‘service=dg2 lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=dg2‘‘

sql statement: alter system set log_archive_dest_1=‘‘location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles)‘‘

sql statement: alter system archive log current

sql statement: alter database recover managed standby database using current logfile disconnect from session

released channel: ch1

released channel: ch2

released channel: ch3

released channel: ch4

released channel: ch5

released channel: ch6

released channel: ch7

released channel: ch8

RMAN>


验证如下:

在备库可以查看如下信息:

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME ---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------          1          1         35   52428800        512          1 YES CLEARING               1106799 16-APR-14      1106799 16-APR-14          3          1         34   52428800        512          1 YES CLEARING               1106413 16-APR-14      1105288 16-APR-14          2          1         35   52428800        512          1 YES CURRENT                1106799 16-APR-14      1104233 16-APR-14

SQL> select * from v$standby_log;

    GROUP# DBID                                        THREAD#  SEQUENCE#      BYTES  BLOCKSIZE       USED ARC STATUS     FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME LAST_CHANGE# LAST_TIME ---------- ---------------------------------------- ---------- ---------- ---------- ---------- ---------- --- ---------- ------------- --------- ------------ --------- ------------ ---------          4 1756848898                                        1         35   52428800        512     108544 YES ACTIVE           1106799 16-APR-14                           1106904 16-APR-14          5 UNASSIGNED                                        1          0   52428800        512          0 NO  UNASSIGNED          6 UNASSIGNED                                        0          0   52428800        512          0 YES UNASSIGNED          7 UNASSIGNED                                        0          0   52428800        512          0 YES UNASSIGNED

SQL> select process,status from v$managed_standby;

PROCESS   STATUS --------- ------------ ARCH      CLOSING ARCH      CLOSING ARCH      CONNECTED ARCH      CONNECTED ARCH      CONNECTED RFS       IDLE MRP0      APPLYING_LOG RFS       IDLE RFS       IDLE RFS       IDLE RFS       IDLE

11 rows selected.

SQL>

 

注:在使用rman脚本的时候,非常要细心,或是因为一个单引号或是因为一个双引号缺失就会导致整个任务失败,对脚本要求比较严格。另外如何使用10G之前的rman方式,那么需要将全部备份集copy到备库,进而使用duplicate target database for standby dorecover nofilenamecheck;完成搭建。



 

 

 

oracle 之物理DG 创建,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。