Sie sind auf Seite 1von 9

Creating A Dataguard Broker Configuration Using DGMGRL For QA XACTLY TEAM:

Setup: Hostname Database Name Database Unique Name Net Service Name Primary Site qadgdb01 SANX SANXP SANXP Standby Site qadgdb02 SANX SANXS SANXS

1. 2. 3. 4. 5. 6. 7. 8.

Prepare Primary Site ( Modify init.ora and listener.ora ) Prepare Standby site ( Modify init.ora and listener.ora ) Create Dataguard configuration Adding Standby Database Verify the Configuration Enable Configuration Verifying Configuration With Switchover Monitoring DataGuard Broker Configuration

1.Prepare Primary Site : Init.ora Changes: DB_BROKER_CONFIG_FILEn parameter is used to specify the location of the dataguard configuration. DG_BROKER_START parameter is used to start the broker automatically when the instance starts. SQL> alter system set dg_broker_config_file1=/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/d r1SANXP.dat scope=both; System altered. SQL> alter system set dg_broker_config_file2=/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/d r2SANXP.dat scope=both; System altered. SQL> alter system set dg_broker_start=true scope=both; System altered.

Listener.ora Changes: GLOBAL_DBNAME attribute value should be set as shown in the following listener.ora configuration on primary site otherwise you will get TNS-12154 error during switch over configuration. A service with name SANX_DGMGRL will be started when the listener is started. [oracle@qadgdb01 admin]$ cat listener.ora LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = qadgdb01)(PORT = 1521)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = SANXP_DGMGRL) (ORACLE_HOME = /oracle/11.2.0) (SID_NAME = SANX) (SERVICE_NAME = SANXP) ) ) [oracle@qadgdb01 admin]$ 2. Prepare Standby site: Init.ora Changes: SQL> alter system set dg_broker_config_file1=/oracle/11.2.0/dbs/dr1sbySANXP.dat scope=both; System altered. SQL> alter system set dg_broker_config_file2=/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/d r2sbySANXP.dat scope=both; System altered. SQL> alter system set dg_broker_start=true scope=both ; System altered.

Listener.ora Changes: [oracle@qadgdb02 admin]$ cat listener.ora LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =qadgdb01)(PORT = 1521)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = SANXS_DGMGRL.) (ORACLE_HOME = /oracle/11.2.0) (SID_NAME = SANX) (SERVICE_NAME = SANXS) ) ) 3. Create Dataguard configuration: On the primary Database Server connect to database using DGMGRL utility. [oracle@qadgdb01 dbs]$ dgmgrl DGMGRL for Linux: Version 11.2.0.2.0 Production Copyright (c) 2000, 2009, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. DGMGRL> connect sys/oracle Connected. DGMGRL> CREATE CONFIGURATION DEVXDR AS PRIMARY DATABASE IS DEVXP CONNECT IDENTIFIER IS DEVXP; Configuration "SANXDR" created with primary database "SANXP" DGMGRL> show configuration;

Configuration SANXDR Protection Mode: MaxPerformance Databases: SANXP Primary database Fast-Start Failover: DISABLED Configuration Status: DISABLED DGMGRL> In the created configuration command, SANXDR = It is the name of the configuration. And it can be anything that your choice. Primary Database is SANXP = Here SANXP is primary database db_unique_name value Connect Identifier is SANXP = Here SANXP is alias name defined in tnsnames.ora to connect to primary database. 4. Adding Standby Database: DGMGRL> ADD DATABASE SANXS AS CONNECT IDENTIFIER IS SANXS MAINTAINED AS PHYSICAL; Database "SANXS" added DGMGRL> show configuration; Configuration SANXDR Protection Mode: MaxPerformance Databases:

SANXP

Primary database

SANXS Physical standby database Fast-Start Failover: DISABLED Configuration Status: DISABLED DGMGRL> 6. Enable Configuration: DGMGRL> help enable configuration; Enables a configuration, a database, or fast-start failover Syntax: ENABLE CONFIGURATION; ENABLE DATABASE <database name>; ENABLE FAST_START FAILOVER [CONDITION <condition>]; DGMGRL> enable configuration; Enabled. DGMGRL> show configuration; Configuration SANXDR Protection Mode: MaxPerformance Databases: SANXP SANXS Primary database Physical standby database

Fast-Start Failover: DISABLED

Configuration Status: SUCCESS DGMGRL> 7. Verifying Configuration with Switchover: [oracle@qadgdb01 dbs]$ dgmgrl DGMGRL for Linux: Version 11.2.0.3.0 Production Copyright (c) 2000, 2009, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. DGMGRL> connect sys/oracle Connected. DGMGRL> switchover to SANXS; Performing switchover NOW, please wait New primary database "SANXS" is opening Operation requires shutdown of instance "SANXP" on database "SANXP" Shutting down instance "SANXP" ORACLE instance shut down. Operation requires startup of instance "SANXP" on database "SANXP" Starting instance "SANXP" ORACLE instance started. Database mounted. Switchover succeeded, new primary is "SANXS" DGMGRL>

DGMGRL> exit [oracle@qadgdb01 dbs]$ clear [oracle@qadgdb01 dbs]$ sqlplus /as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 17 08:54:54 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select database_role,switchover_status from v$database; DATABASE_ROLE SWITCHOVER_STATUS

- PHYSICAL STANDBY NOT ALLOWED SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@qadgdb01 dbs]$ dgmgrl DGMGRL for Linux: Version 11.2.0.3.0 Production Copyright (c) 2000, 2009, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. DGMGRL> connect sys/oracle

Connected. DGMGRL> switchover to SANXP; Performing switchover NOW, please wait New primary database "SANXP" is opening Operation requires shutdown of instance "SANXS" on database "SANXS" Shutting down instance "SANXS" ORACLE instance shut down. Operation requires startup of instance "SANXS" on database "SANXS" Starting instance "SANXS" ORACLE instance started. Database mounted. Switchover succeeded, new primary is "SANXP" DGMGRL> exit [oracle@qadgdb01 dbs]$ sqlplus /as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 17 08:56:46 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select database_role,switchover_status from v$database;

DATABASE_ROLE

SWITCHOVER_STATUS

- PRIMARY SQL> 8. Monitoring DataGuard Broker Configuration: DGMGRL> help DGMGRL> show configuration; DGMGRL> edit database "SANXP" set property LogXptMode=ASYNC; DGMGRL> show database SANXP LogXptStatus; DGMGRL> edit configuration set protection mode as MaxAvailability; DGMGRL> enable fast_start failover; DGMGRL> show database SANXP; DGMGRL> enable database SANXP; DGMGRL> remove configuration; DGMGRL> show database verbose SANXP; DGMGRL> show database SANXP InconsistentProperties; DGMGRL> show database SANXP StatusReport; TO STANDBY

Das könnte Ihnen auch gefallen