Tuesday, February 18, 2014

Data Guard Broker Configuration

Today I decided to use Oracle`s magic dgmgrl utility and configure my standby database.

Below you can see my environment:

PRIMARY

SQL> select status,instance_name,database_role,protection_mode from v$database,v$instance;

STATUS     INSTANCE_NAME    DATABASE_ROLE    PROTECTION_MODE
------------ ---------------- ---------------- --------------------
OPEN     FCDBPROD      PRIMARY       MAXIMUM PERFORMANCE

SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------
  674

SQL> 


STANBDY

SQL> select status,instance_name,database_role,protection_mode from v$database,v$instance;

STATUS     INSTANCE_NAME    DATABASE_ROLE    PROTECTION_MODE
------------ ---------------- ---------------- --------------------
MOUNTED      FCDBSTND      PHYSICAL STANDBY MAXIMUM PERFORMANCE

SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------
  674

SQL> 

Now, set dataguard broker process on both primary and standby databases.

SQL> alter system set dg_broker_start=true;

System altered.

SQL> 


Add a below lines in the listener.ora file on both the primary and standby servers.


On Primary:

   (SID_DESC=
      (GLOBAL_DBNAME=FCDBPROD_DGMGRL)
      (ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/db_1)
      (SID_NAME=FCDBPROD)
   )

On Standby

   (SID_DESC=
      (GLOBAL_DBNAME=FCDBSTND_DGMGRL)
      (ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/db_1)
      (SID_NAME=FCDBSTND)
   )

[oracle@fcdbdb admin]$ vi listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.3/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

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

SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC=
      (GLOBAL_DBNAME=FCDBPROD_DGMGRL)
      (ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/db_1)
      (SID_NAME=FCDBPROD)
   )
   (SID_DESC =
     (SID_NAME = FCDBPROD)
     (ORACLE_HOME = /u01/app/oracle/product/11.2.0.3/db_1)
   )
 )

ADR_BASE_LISTENER = /u01/app/oracle

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON





[oracle@fcdbdb_stby admin]$ vi listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.3/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

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

SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC=
      (GLOBAL_DBNAME=FCDBSTND_DGMGRL)
      (ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/db_1)
      (SID_NAME=FCDBSTND)
   )
   (SID_DESC =
     (SID_NAME = FCDBSTND)
     (ORACLE_HOME = /u01/app/oracle/product/11.2.0.3/db_1)
   )
 )

ADR_BASE_LISTENER = /u01/app/oracle

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
[oracle@fcdbdb_stby admin]$ 



Or, instead of you may add

SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC =
     (SID_NAME = FCDBPROD)
     (GLOBAL_DBNAME=FCDBPROD_DGMGRL)
     (ORACLE_HOME = /u01/app/oracle/product/11.2.0.3/db_1)
   )
 )


reload listener on both side

[oracle@fcdbdb_stby admin]$ lsnrctl reload




On the primary server, create the Dataguard Broker configuration.


[oracle@fcdbdb admin]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production

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

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle@FCDBPROD
Connected.
DGMGRL> create configuration 'DGMANAGER' 
> as primary database is 'FCDBPROD'
> connect identifier is FCDBPROD;
Configuration "DGMANAGER" created with primary database "FCDBPROD"
DGMGRL> 

Check status

DGMGRL> show configuration;

Configuration - DGMANAGER

  Protection Mode: MaxPerformance
  Databases:
    FCDBPROD - Primary database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

DGMGRL> 



Add the standby database "FCDBSTND" to the configuration created above.


DGMGRL> add database 'FCDBSTND'
> as connect identifier is FCDBSTND
> maintained as physical;      
Database "FCDBSTND" added
DGMGRL> 


DGMGRL> show configuration;

Configuration - DGMANAGER

  Protection Mode: MaxPerformance
  Databases:
    FCDBPROD - Primary database
    FCDBSTND - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

DGMGRL> 



The configuration is added, now needs to be enabled.

DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration;

Configuration - DGMANAGER

  Protection Mode: MaxPerformance
  Databases:
    FCDBPROD - Primary database
    FCDBSTND - Physical standby database
      Error: ORA-16797: database is not using a server parameter file

Fast-Start Failover: DISABLED

Configuration Status:
ERROR

DGMGRL> 

We have to restart standby database, create spfile and start from spfile.

SQL> show parameter pfile

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile     string
SQL> 

SQL> alter database recover managed standby database cancel;

Database altered.

SQL> shut immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@fcdbdb_stby dbs]$ pwd
/u01/app/oracle/product/11.2.0.3/db_1/dbs

[oracle@fcdbdb_stby dbs]$ ls -lrt
total 9632
-rw-r--r--. 1 oracle oinstall    1610 Jan 13 10:01 initFCDBSTND.ora
-rw-r-----. 1 oracle oinstall    1536 Jan 13 10:17 orapwFCDBSTND
-rw-r-----. 1 oracle oinstall      24 Jan 13 10:17 lkFCDBSTND
-rw-r-----. 1 oracle oinstall 9814016 Jan 13 11:32 snapcf_FCDBSTND.f
-rw-r-----. 1 oracle oinstall   16384 Feb 18 10:41 dr1FCDBSTND.dat
-rw-r-----. 1 oracle oinstall   16384 Feb 18 10:41 dr2FCDBSTND.dat
-rw-rw----. 1 oracle oinstall    1544 Feb 18 10:44 hc_FCDBSTND.dat

[oracle@fcdbdb_stby dbs]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Tue Feb 18 10:45:16 2014

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

Connected to an idle instance.

SQL> create spfile from pfile;

File created.

SQL> exit
Disconnected

[oracle@fcdbdb_stby dbs]$ ls -lrt
total 9640
-rw-r--r--. 1 oracle oinstall    1610 Jan 13 10:01 initFCDBSTND.ora
-rw-r-----. 1 oracle oinstall    1536 Jan 13 10:17 orapwFCDBSTND
-rw-r-----. 1 oracle oinstall      24 Jan 13 10:17 lkFCDBSTND
-rw-r-----. 1 oracle oinstall 9814016 Jan 13 11:32 snapcf_FCDBSTND.f
-rw-r-----. 1 oracle oinstall   16384 Feb 18 10:41 dr1FCDBSTND.dat
-rw-r-----. 1 oracle oinstall   16384 Feb 18 10:41 dr2FCDBSTND.dat
-rw-rw----. 1 oracle oinstall    1544 Feb 18 10:44 hc_FCDBSTND.dat
-rw-r-----. 1 oracle oinstall    4608 Feb 18 10:45 spfileFCDBSTND.ora

[oracle@fcdbdb_stby dbs]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Tue Feb 18 10:45:32 2014

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

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area 5394837504 bytes
Fixed Size    2237896 bytes
Variable Size 1275071032 bytes
Database Buffers 4110417920 bytes
Redo Buffers    7110656 bytes
Database mounted.

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

Database altered.


SQL> show parameter pfile

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile     string /u01/app/oracle/product/11.2.0
.3/db_1/dbs/spfileFCDBSTND.ora
SQL> 

recheck again

DGMGRL> show configuration;

Configuration - DGMANAGER

  Protection Mode: MaxPerformance
  Databases:
    FCDBPROD - Primary database
    FCDBSTND - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> 

3 comments:

  1. Path Infotech is in the field of oracle training program from past several years.

    For more info : Oracle Certification Path

    ReplyDelete
  2. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Oracle 11g Dataguard Admin, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Oracle 11g Dataguard Admin. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email : arun@maxmunus.com
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –http://www.maxmunus.com



    ReplyDelete