Skip to main content

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> 

Comments

  1. This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post.! south african trading account

    ReplyDelete
  2. Although it has actually not been the case in the last one week, crypto has traditionally been the very best bush for typical markets. Its lack of correlation with the supplies, in particular, has been made sure that crypto is a must-have during their failures. This week has seen this trend change. As traditional markets plunged, the crypto market complied with the very same trend. Auto bitcoin bot

    ReplyDelete

Post a Comment

Popular posts from this blog

Rman encryption and other techniques

Today I will demonstrate Recovery Manager features, especially encryption and some other techniques. First of all let me note about RMAN backup encryption. Staring from Oracle 10g RMAN now creates encrypted backups that cannot be restored by unauthorized people. There are 3 modes of backup encryption: * Transparent encryption * Password encryption * Dual-mode encryption using either transparent or password encryption All RMAN backups are not encrypted but you can encrypt any RMAN backup in the form of a backup set. In this tutorial I will show you how to configure Password encryption. Let`s finish talking and start to demonstrate. check parameters with "SHOW ALL" command, by default encryption is OFF RMAN> show all; RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTR...

ORA-03206: maximum file size of (5242880) blocks in AUTOEXTEND clause is out of range

Today when I want to change max size of datafile I got strange error. ALTER DATABASE DATAFILE '/u01/app/oracle/oradata/MYDB/users01.dbf' AUTOEXTEND ON NEXT 1280K MAXSIZE 32GB ORA-03206: maximum file size of (5242880) blocks in AUTOEXTEND clause is out of range Here is reason: The maximum file size for an autoextendable file has exceeded the maximum number of blocks allowed. After research internet I found that instead of using 32GB we can use 32767M. (same values but in MB). Or you may use 31GB too. ALTER DATABASE DATAFILE '/u01/app/oracle/oradata/MYDB/users01.dbf' AUTOEXTEND ON NEXT 1280K MAXSIZE 32767M;

Fix ORA-01139: RESETLOGS option only valid after an incomplete database recovery

While shutting down my TEST database process was hanged. Then I had to use shutdown abort. But when I wanted to start database it did not open. SQL> select name from v$database; NAME --------- TEST SQL> shut abort; ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 6597406720 bytes Fixed Size 2265664 bytes Variable Size 3204451776 bytes Database Buffers 3372220416 bytes Redo Buffers 18468864 bytes Database mounted. SQL> alter database open; alter database open * ERROR at line 1: ORA-03113: end-of-file on communication channel Process ID: 6552 Session ID: 191 Serial number: 3  What`s wrong?  SQL> alter database open resetlogs; ERROR:    ORA-03114: not connected to ORACLE    SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Pr...