Oracle Data Guard Broker测试

Normal 0 0 2 false false false EN-US ZH-TW X-NONE 前言:

Oracle 推出Data Guard Broker为简化Data Guard创建与维护。可用一条命令实现主从库角色切换,客户端做相关设置后可重新连接到新的主库上。

 

阶段1Data Guard初始设置

A.Data Guard初始环境建立

 

1、将主库设为强制归档模式

 

alter database force logging;

 

2、修改主库db_unique_name

alter system set db_unique_name='orcl_pd' scope=spfile;

 

alter system set service_names=orcl;

 

3、修改主库归档参数

 

alter system set log_archive_config='DG_CONFIG=(orcl_pd,orcl_st)';

 

alter system set log_archive_dest_1='LOCATION=/data/orcl/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl_pd';

 

alter system set log_archive_dest_2='service=orcl_st LGWR SYNC AFFIRM

 NET_TIMEOUT=30 DB_UNIQUE_NAME=orcl_st  VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)';

 

4、修改主库相关参数以备角色切换使用

 

alter system set fal_server=orcl_st;

 

alter system set fal_client=orcl_pd;

 

alter system set standby_file_management='AUTO' ;

 

5、在主库上添加standby log;

 

alter database add standby logfile thread 4 '/u01/product/oradata/orcl/standby_01.log' size 50m;

 

alter database add standby logfile thread 5 '/u01/product/oradata/orcl/standby_02.log' size 50m;

 

alter database add standby logfile thread 6 '/u01/product/oradata/orcl/standby_03.log' size 50m;

 

alter database add standby logfile thread 7 '/u01/product/oradata/orcl/standby_04.log' size 50m;

 

6、主库tnsname.ora中添加standby db的项目

 

orcl_st =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.192.29.178)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = orcl)

    )

  )

 

B.在主库上生成standby db 控制文件,初始化参数文件

 

alter database create standby controlfile as '/data/standby.ctl';

 

create pfile from spfile;

 

C.拷贝控制文件,初始化参数文件,密码文件,数据文件到Standby DB

 

primary$pwd

/u01/product/oracle/dbs

primary$scp initorcl.ora 10.192.29.178:/u01/product/oracle/dbs/

oracle@10.192.29.178's password:

initorcl.ora                                                           100% 1328     1.3KB/s   00:00   

 

primary$scp orapworcl 10.192.29.178:/u01/product/oracle/dbs/

oracle@10.192.29.178's password:

orapworcl                                                              100% 1536     1.5KB/s   00:00   

primary$

 

SQL> alter tablespace  SYSTEM begin  backup;                       

alter tablespace  UNDOTBS1 begin  backup;                     

alter tablespace  SYSAUX begin  backup;                       

alter tablespace  USERS begin  backup;  

Tablespace altered.

SQL>

 

primary$pwd

/u01/product/oradata/orcl

primary$scp *.dbf 10.192.29.178:/u01/product/oradata/orcl/

oracle@10.192.29.178's password:

sysaux01.dbf                                                           100%  260MB  14.4MB/s   00:18   

system01.dbf                                                           100%  480MB  16.6MB/s   00:29   

temp01.dbf                                                             100%   20MB  20.0MB/s   00:01   

undotbs01.dbf                                                          100%   25MB  12.5MB/s   00:02   

users01.dbf                                                            100% 5128KB   5.0MB/s   00:00   

primary$

 

SQL> alter tablespace  UNDOTBS1 end backup;                     

alter tablespace  SYSAUX end backup;                        

alter tablespace  USERS end backup;                        

alter tablespace  TEMP end backup; 

Tablespace altered.

SQL>

 

SQL> alter system switch logfile;

 

System altered.

 

Remark

热备模式结束后需在主库上归一下档

 

primary$pwd

/data

primary$scp standby.ctl 10.192.29.178:/u01/product/oradata/orcl/control01.ctl

oracle@10.192.29.178's password:

standby.ctl                                                            100% 6896KB   6.7MB/s   00:00   

primary$scp standby.ctl 10.192.29.178:/u01/product/oradata/orcl/control02.ctl

oracle@10.192.29.178's password:

standby.ctl                                                            100% 6896KB   6.7MB/s   00:01   

primary$scp standby.ctl 10.192.29.178:/u01/product/oradata/orcl/control03.ctl

oracle@10.192.29.178's password:

standby.ctl                                                            100% 6896KB   6.7MB/s   00:00   

primary$

 

D.修改Standby DB参数文件

 

*.db_unique_name='orcl_st'

*.fal_client='ORCL_ST'

*.fal_server='ORCL_PD'

*.log_archive_dest_1='LOCATION=/data/orcl/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES)  DB_UNIQUE_NAME=orcl_st'

*.log_archive_dest_2='service=orcl_pd  LGWR SYNC AFFIRM

NET_TIMEOUT=30 DB_UNIQUE_NAME=orcl_pd VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)'

*. service_names=orcl

 

E.开启Standby DBMount状态,并做初始Recover

 

secondary$sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.4.0 - Production on Wed Apr 25 13:21:06 2012

 

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

 

Connected to an idle instance.

 

SQL> startup mount

ORACLE instance started.

 

Total System Global Area  285212672 bytes

Fixed Size                  2083368 bytes

Variable Size             121636312 bytes

Database Buffers          155189248 bytes

Redo Buffers                6303744 bytes

Database mounted.

SQL> recover standby database;

ORA-00279: change 703086 generated at 04/25/2012 13:15:23 needed for thread 1

ORA-00289: suggestion : /data/orcl/arch/1_10_781435805.arc

ORA-00280: change 703086 for thread 1 is in sequence #10

 

 

Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00279: change 703188 generated at 04/25/2012 13:19:00 needed for thread 1

ORA-00289: suggestion : /data/orcl/arch/1_11_781435805.arc

ORA-00280: change 703188 for thread 1 is in sequence #11

ORA-00278: log file '/data/orcl/arch/1_10_781435805.arc' no longer needed for

this recovery

 

 

ORA-00308: cannot open archived log '/data/orcl/arch/1_11_781435805.arc'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

 

 

SQL>

 

F.Standby DB上添加Standby Log,并开启实时应用

 

alter database drop standby logfile '/u01/product/oradata/orcl/standby_01.log';

 

alter database drop standby logfile '/u01/product/oradata/orcl/standby_02.log';

 

alter database drop standby logfile '/u01/product/oradata/orcl/standby_03.log';

 

alter database drop standby logfile '/u01/product/oradata/orcl/standby_04.log';

 

Remark

因为事先在主库上添加了四组standby logstandby db的控制文件来自主库,这里需要先在从库删掉standby log并重新添加一遍

 

alter database add standby logfile group 4 '/u01/product/oradata/orcl/standby_01.log' size 50m;

 

alter database add standby logfile group 5 '/u01/product/oradata/orcl/standby_02.log' size 50m;

 

alter database add standby logfile group 6 '/u01/product/oradata/orcl/standby_03.log' size 50m;

 

alter database add standby logfile group 7 '/u01/product/oradata/orcl/standby_04.log' size 50m;

 

 

SQL> alter database recover managed standby database using current logfile disconnect from session;

 

Database altered.

 

SQL>

 

 

阶段2Data Guard Broker设置

 

A.闪回与Data Guard保护模式设置

 

在主从两个库上都需要开启闪回,并将保护模式设为最大可用性

 

SQL> alter system set db_recovery_file_dest_size=2G;

 

System altered.

 

SQL> alter system set db_recovery_file_dest='/u01/product/flash_recovery_area';

 

System altered.

 

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount

ORACLE instance started.

 

Total System Global Area  285212672 bytes

Fixed Size                  2083368 bytes

Variable Size             121636312 bytes

Database Buffers          155189248 bytes

Redo Buffers                6303744 bytes

Database mounted.

SQL> alter database flashback on;

 

Database altered.

 

SQL> alter database open;

 

Database altered.

 

SQL> alter database set standby database to maximize availability;

 

Database altered.

 

SQL> select db_unique_name,flashback_on,protection_mode from v$database;

 

DB_UNIQUE_NAME                 FLASHBACK_ON       PROTECTION_MODE

------------------------------ ------------------ --------------------

orcl_pd                        YES                MAXIMUM AVAILABILITY

 

SQL>

 

B.Data Guard Broker侦听修改

主从两个库都需设置侦听

 

alter system set local_listener='orcl_pd';

 

Remark

After the initial connection, the DMON process constructs connect descriptors for communication with other DMON processes on other databases,

using the address value from the LOCAL_LISTENER initialization parameter from those databases. The LOCAL_LISTENER initialization parameter

on each instance that is part of a Data Guard broker configuration must resolve to a listener address that is reachable by all members of the configuration.

 

alter system set dg_broker_start = true scope=both;

 

Remark:

做完这步后,此时用ps –ef命令已可以看到dmon进程

 

primary$pwd

/u01/product/oracle/network/admin

primary$cat listener.ora

# listener.ora Network Configuration File: /u01/product/oracle/network/admin/listener.ora

# Generated by Oracle configuration tools.

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

      (ORACLE_HOME = /u01/product/oracle)

      (PROGRAM = extproc)

    )

    (SID_DESC =

      (SID_NAME = orcl)

      (ORACLE_HOME = /u01/product/oracle)

      (GLOBAL_DBNAME = orcl)

    )

    (SID_DESC =

      (GLOBAL_DBNAME = orcl_pd_DGMGRL)

      (ORACLE_HOME = /u01/product/oracle)

      (SID_NAME = orcl)

    )

  )

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = primary)(PORT = 1521))

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

    )

  )

 

Remark

To enable the Data Guard broker’s CLI to restart instances during the course of broker operations, a service with a specific name must be statically registered with the local listener of each instance. The value for the GLOBAL_DBNAME attribute must be set to a concatenation of db_unique_name_DGMGRL.db_domain.

其中db_unique_name 大小写敏感

 

primary$lsnrctl reload

 

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 25-APR-2012 17:02:00

 

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=primary)(PORT=1521)))

The command completed successfully

primary$lsnrctl status

 

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 25-APR-2012 17:02:07

 

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=primary)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production

Start Date                24-APR-2012 09:34:30

Uptime                    1 days 7 hr. 27 min. 37 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/product/oracle/network/admin/listener.ora

Listener Log File         /u01/product/oracle/network/log/listener.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=primary)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl" has 2 instance(s).

  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

  Instance "orcl", status READY, has 1 handler(s) for this service...

Service "orclXDB" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

Service "orcl_pd" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

Service "orcl_pd_DGMGRL" has 1 instance(s).

  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl_pd_XPT" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

The command completed successfully

primary$

 

Remark

配置完侦听后需重启一下以生效,这里已经可以看到orcl_pd_DGMGRL服务被开启

 

secondary$lsnrctl status

 

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 25-APR-2012 17:13:06

 

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=secondary)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production

Start Date                24-APR-2012 09:54:20

Uptime                    1 days 7 hr. 18 min. 45 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/product/oracle/network/admin/listener.ora

Listener Log File         /u01/product/oracle/network/log/listener.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secondary)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl" has 1 instance(s).

  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl_st" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

Service "orcl_st_DGMGRL" has 1 instance(s).

  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl_st_XPT" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

The command completed successfully

secondary$

 

C.配置Data Guard Broker

 

secondary$dgmgrl

DGMGRL for Linux: Version 10.2.0.4.0 - 64bit Production

 

Copyright (c) 2000, 2005, Oracle. All rights reserved.

 

Welcome to DGMGRL, type "help" for information.

DGMGRL> connect sys/password@orcl_pd;

Connected.

 

Remark

第一步需连接到主库,standby dbtnsnames.ora需设置主库相关项目

 

DGMGRL> create configuration 'OrclBroker' as primary database is 'orcl_pd'

> connect identifier is orcl_pd;

 

 

Configuration "OrclBroker" created with primary database "orcl_pd"

 

Remark

创建broker配置命令,其中:

1.'OrclBroker'是创建的Configuration的名稱;

2.第一個'orcl_pd'是主库的db_unique_name

3.第二個'orcl_pd'tnsname文件中配置的主库连接方式。

創建的語法格式可輸入Create Help獲得

 

DGMGRL>

DGMGRL> add database 'orcl_st' as connect identifier is orcl_st maintained as physical;

Database "orcl_st" added

DGMGRL>

 

Remark

dgmgrl命令提示符下,增加Physical Standby到配置檔中

这时默認会在$ORACLE_HOME/dbs/下生成2个配置文件,分別為dr1orcl_pd.dat dr2orcl_pd.dat.

如果想將配置文件存放在其它位置,則需在主庫上設置dg_broker_config_file1dg_broker_config_file2兩個參數

 

DGMGRL> show configuration

 

Configuration

  Name:                OrclBroker

  Enabled:             NO

  Protection Mode:     MaxAvailability

  Fast-Start Failover: DISABLED

  Databases:

    orcl_pd - Primary database

    orcl_st - Physical standby database

 

Current status for "OrclBroker":

DISABLED

 

Remark

查看DataGuard Broker的配置信息,此时刚创建的配置仍为DISABLED状态

 

DGMGRL> enable configuration

Enabled.

 

Remark

激活上述配置

 

DGMGRL> show database verbose 'orcl_pd';

 

Database

  Name:            orcl_pd

  Role:            PRIMARY

  Enabled:         YES

  Intended State:  ONLINE

  Instance(s):

    orcl

 

  Properties:

    InitialConnectIdentifier        = 'orcl_pd'

    ObserverConnectIdentifier       = ''

    LogXptMode                      = 'ASYNC'

    Dependency                      = ''

    DelayMins                       = '0'

    Binding                         = 'OPTIONAL'

    MaxFailure                      = '0'

    MaxConnections                  = '1'

    ReopenSecs                      = '300'

    NetTimeout                      = '180'

    LogShipping                     = 'ON'

    PreferredApplyInstance          = ''

    ApplyInstanceTimeout            = '0'

    ApplyParallel                   = 'AUTO'

    StandbyFileManagement           = 'AUTO'

    ArchiveLagTarget                = '0'

    LogArchiveMaxProcesses          = '2'

    LogArchiveMinSucceedDest        = '1'

    DbFileNameConvert               = ''

    LogFileNameConvert              = ''

    FastStartFailoverTarget         = ''

    StatusReport                    = '(monitor)'

    InconsistentProperties          = '(monitor)'

    InconsistentLogXptProps         = '(monitor)'

    SendQEntries                    = '(monitor)'

    LogXptStatus                    = '(monitor)'

    RecvQEntries                    = '(monitor)'

    HostName                        = 'primary'

    SidName                         = 'orcl'

    LocalListenerAddress            = '(ADDRESS=(PROTOCOL=TCP)(HOST=10.192.29.177)(PORT=1521))'

    StandbyArchiveLocation          = '/data/orcl/arch'

    AlternateLocation               = ''

    LogArchiveTrace                 = '0'

    LogArchiveFormat                = '%t_%s_%r.arc'

    LatestLog                       = '(monitor)'

    TopWaitEvents                   = '(monitor)'

 

Current status for "orcl_pd":

SUCCESS

 

DGMGRL> edit database  orcl_pd set property logxptmode=sync;

Property "logxptmode" updated

DGMGRL>

 

Remark:

如果看到日志传送方式为异步,即LogXptMode = 'ASYNC',应将其改为同步模式。

如果不改为同步模式,下一步开启fast_start failover时会报错。

 

DGMGRL> enable fast_start failover

Enabled.

 

Remark:

Enable fast-start failover to fail over automatically when the primary database becomes unavailable. When fast-start failover is enabled, the Data Guard broker determines if a failover is necessary and initiates the failover to the specified target standby database automatically, with no need for DBA intervention.

 

DGMGRL> show configuration

 

Configuration

  Name:                OrclBroker

  Enabled:             YES

  Protection Mode:     MaxAvailability

  Fast-Start Failover: ENABLED

  Databases:

    orcl_pd - Primary database

    orcl_st - Physical standby database

            - Fast-Start Failover target

 

Current status for "OrclBroker":

Warning: ORA-16608: one or more databases have warnings

 

Remark:

此时查看配置仍有警告

 

DGMGRL> show database orcl_st;

 

Database

  Name:            orcl_st

  Role:            PHYSICAL STANDBY

  Enabled:         YES

  Intended State:  ONLINE

  Instance(s):

    orcl

 

Current status for "orcl_st":

Warning: ORA-16819: Fast-Start Failover observer not started

 

Remark:

显示Fast-Start Failover observer尚未启动

 

 

DGMGRL> start observer

Observer started

 

Remark:

此处开启observer

 

secondary$dgmgrl

DGMGRL for Linux: Version 10.2.0.4.0 - 64bit Production

 

Copyright (c) 2000, 2005, Oracle. All rights reserved.

 

Welcome to DGMGRL, type "help" for information.

DGMGRL> connect sys/password@orcl_pd

Connected.

DGMGRL> show configuration

 

Configuration

  Name:                OrclBroker

  Enabled:             YES

  Protection Mode:     MaxAvailability

  Fast-Start Failover: ENABLED

  Databases:

    orcl_pd - Primary database

    orcl_st - Physical standby database

            - Fast-Start Failover target

 

Current status for "OrclBroker":

SUCCESS

 

DGMGRL>

 

Remark:

Observer开启后需要重新开一个session查看broker状态

 

 

阶段3Data Guard Broker环境验证

 

A.主库添加相应Service,以便主从DB切换后客户端可重新连接到新的Primary DB

 

BEGIN

   DBMS_SERVICE.create_service ('myapp', 'myapp');

END;

/

 

BEGIN

   DBMS_SERVICE.START_SERVICE ('myapp');

END;

/

 

Remark

首先先在主库上添加一个Service

 

/* Formatted on 2012/5/7 下午 02:54:31 (QP5 v5.136.908.31019) */

CREATE TRIGGER myapptrigg

   AFTER STARTUP

   ON DATABASE

DECLARE

   v_role   VARCHAR (30);

BEGIN

   SELECT database_role INTO v_role FROM v$database;

 

   IF v_role = 'PRIMARY'

   THEN

      DBMS_SERVICE.START_SERVICE ('myapp');

   ELSE

      DBMS_SERVICE.STOP_SERVICE ('myapp');

   END IF;

END;

/

 

Remark

再添加相关的数据库启动Trigger,如果数据库角色为Primary,则启动之前所加myapp Service

 

/* Formatted on 2012/5/7 下午 02:56:04 (QP5 v5.136.908.31019) */

BEGIN

   DBMS_SERVICE.modify_service ('myapp',

                                FAILOVER_METHOD    => 'BASIC',

                                FAILOVER_TYPE      => 'SELECT',

                                FAILOVER_RETRIES   => 200,

                                FAILOVER_DELAY     => 1);

END;

/

 

Remark

设置必要的Service属性


MYAPP =
 (DESCRIPTION =
 (ADDRESS_LIST =
 (ADDRESS = (PROTOCOL = TCP)(HOST = 10.192.29.177)(PORT = 1521))
 (ADDRESS = (PROTOCOL = TCP)(HOST = 10.192.29.178)(PORT = 1521))
 )
 (CONNECT_DATA =
 (SERVICE_NAME = myapp)
 )
 )

Remark

客户端tnsname.ora设置


B.Data Guard Broker SwitchOver测试

 

DGMGRL> switchover to orcl_st;

Performing switchover NOW, please wait...

Operation requires shutdown of instance "orcl" on database "orcl_pd"

Shutting down instance "orcl"...

ORA-01109: database not open

 

Database dismounted.

ORACLE instance shut down.

Operation requires shutdown of instance "orcl" on database "orcl_st"

Shutting down instance "orcl"...

ORA-01109: database not open

 

Database dismounted.

ORACLE instance shut down.

Operation requires startup of instance "orcl" on database "orcl_pd"

Starting instance "orcl"...

ORACLE instance started.

Database mounted.

Operation requires startup of instance "orcl" on database "orcl_st"

Starting instance "orcl"...

ORACLE instance started.

Database mounted.

 

Switchover succeeded, new primary is "orcl_st"

 

Remark

Broker中一条switchover命令即可实现主从DB切换

 

C.Data Guard Broker FailOver测试

 

secondary$sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.4.0 - Production on Mon May 7 15:30:27 2012

 

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

 

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine

and Real Application Testing options

 

SQL> shutdown abort

ORACLE instance shut down.

SQL>

 

Remark

强制关闭主库

 

secondary$dgmgrl

DGMGRL for Linux: Version 10.2.0.4.0 - 64bit Production

 

Copyright (c) 2000, 2005, Oracle. All rights reserved.

 

Welcome to DGMGRL, type "help" for information.

DGMGRL> connect sys/password@orcl_pd

Connected.

DGMGRL> show configuration

 

Configuration

  Name:                OrclBroker

  Enabled:             YES

  Protection Mode:     MaxAvailability

  Fast-Start Failover: ENABLED

  Databases:

    orcl_pd - Physical standby database

            - Fast-Start Failover target

    orcl_st - Primary database

 

Current status for "OrclBroker":

Error: ORA-16625: cannot reach the database

 

 

DGMGRL>

 

Remark

此时Broker中已连接不到主库

 

15:17:44.73  Monday, May 07, 2012

Initiating fast-start failover to database "orcl_st"...

Performing failover NOW, please wait...

Failover succeeded, new primary is "orcl_st"

15:18:34.78  Monday, May 07, 2012

 

Remark

Observer窗口中主库已切换到orcl_st

 

secondary$sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.4.0 - Production on Mon May 7 15:57:07 2012

 

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

 

Connected to an idle instance.

 

SQL> startup mount

ORACLE instance started.

 

Total System Global Area  285212672 bytes

Fixed Size                  2083368 bytes

Variable Size             146802136 bytes

Database Buffers          130023424 bytes

Redo Buffers                6303744 bytes

Database mounted.

SQL>

 

Remark

原主库(现从库)重新启动到Mount状态

 

15:57:53.17  Monday, May 07, 2012

Initiating reinstatement for database "orcl_st"...

Reinstating database "orcl_st", please wait...

Operation requires shutdown of instance "orcl" on database "orcl_st"

Shutting down instance "orcl"...

ORA-01109: database not open

 

Database dismounted.

ORACLE instance shut down.

Operation requires startup of instance "orcl" on database "orcl_st"

Starting instance "orcl"...

ORACLE instance started.

Database mounted.

Continuing to reinstate database "orcl_st" ...

Reinstatement of database "orcl_st" succeeded

15:58:44.61  Monday, May 07, 2012

 

Remark

Observer窗口中可以看到原主库(现从库)已自动开始reinstate

 

DGMGRL>

DGMGRL> show configuration

 

Configuration

  Name:                OrclBroker

  Enabled:             YES

  Protection Mode:     MaxAvailability

  Fast-Start Failover: ENABLED

  Databases:

    orcl_pd - Primary database

    orcl_st - Physical standby database

            - Fast-Start Failover target

 

Current status for "OrclBroker":

SUCCESS

 

DGMGRL>

 

Remark

新的从库reinstate完成后,Broker恢复正常

 

阶段4Data Guard Broker问题处理

如主库中出现ORA-16086: standby database does not contain available standby log files以下错误,则需要在从库中删掉standby log,并重新添加一遍

 

LGWR: Attempting destination LOG_ARCHIVE_DEST_3 network reconnect (16086)

LGWR: Destination LOG_ARCHIVE_DEST_3 network reconnect abandoned

LGWR: Error 16086 creating archivelog file '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.192.29.177)(PORT=1521)))(CONNECT_DATA=

(SERVICE_NAME=orcl_pd_XPT)(INSTANCE_NAME=orcl)(SERVER=dedicated)))'

Mon May  7 15:05:56 2012

Errors in file /u01/product/admin/orcl/bdump/orcl_lgwr_24561.trc:

ORA-16086: standby database does not contain available standby log files

LGWR: Failed to archive log 3 thread 1 sequence 185 (16086)

Mon May  7 15:06:00 2012

Thread 1 advanced to log sequence 185 (LGWR switch)

  Current log# 3 seq# 185 mem# 0: /u01/product/oradata/orcl/redo03.log

 

 

alter database drop standby logfile '/u01/product/oradata/orcl/standby_01.log';

 

alter database drop standby logfile '/u01/product/oradata/orcl/standby_02.log';

 

alter database drop standby logfile '/u01/product/oradata/orcl/standby_03.log';

 

alter database drop standby logfile '/u01/product/oradata/orcl/standby_04.log';

 

alter database add standby logfile group 4 '/u01/product/oradata/orcl/standby_01.log' size 50m;

 

alter database add standby logfile group 5 '/u01/product/oradata/orcl/standby_02.log' size 50m;

 

alter database add standby logfile group 6 '/u01/product/oradata/orcl/standby_03.log' size 50m;

 

alter database add standby logfile group 7 '/u01/product/oradata/orcl/standby_04.log' size 50m;

~

 参考资料:

Normal 0 0 2 false false false EN-US ZH-TW X-NONE

http://blog.csdn.net/tianlesoftware/article/details/6073911

http://ppgunjack.iteye.com/blog/1058610


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/38267/viewspace-722952/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/38267/viewspace-722952/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值