Oracle Technologies Blog

By ASKM

Posts Tagged ‘data guard’

Data Guard Administration – Weekend Online Training

Posted by Srikrishna Murthy Annam on November 27, 2013

Please visit our site http://askMLabs.com for more details

Direct Link For Free Demo Registration :  Free Demo

Oracle Database 11gR2 Data Guard Administration
Free Demo on 01-DEC-2013 From 10am to 11am.
Online Classes , 4 Weeks , Batch starts from 07-DEC-2013
Classes Every Week SAT and SUN From 5pm to 9pm IST
For Free Registrations Visit : http://askMLabs.com, info@askmlabs.com
24/7 Lab Access From Anywhere In The World

Data Guard Demo

Posted in Data Guard | Tagged: , , , , , | Leave a Comment »

Creating A Dataguard Broker Configuration Using DGMGRL

Posted by Srikrishna Murthy Annam on December 13, 2011

            In this article we will see step by step instructions on how to configure dataguard broker configuration using DGMGRL utility. The dataguard broker makes it easy to maintain and administer several standby databases. Dataguard broker maintains its own configuration files and runs a background process DMON both on primary and standby database servers. Dataguard broker configuration can be created using either OEM grid control or using a command line utility DGMGRL. In the present article we are using DGMGRL to create dataguard broker configuration to maintain standby databases.

Setup:

 

Primary Site

Standby Site

Hostname

dgaskmpri01

dgaskmsby01

Database Name

orcl

orcl

Database Unique Name

orcl

sbyorcl

Net Service Name

orcl

sbyorcl

 

  1. Prepare Primary Site ( Modify init.ora and listener.ora )
  2. Prepare Standby site ( Modify init.ora and listener.ora )
  3. Create Dataguard configuration
  4. Adding Standby Database
  5. Verify the Configuration
  6. Enable Configuration
  7. Verifying Configuration With Switchover
  8. Monitoring DataGuard Broker Configuration
Prepared By SRI

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/dr1orcl.dat’ sid=’*’;

System altered.

SQL> alter system set dg_broker_config_file2=’/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/dr2orcl.dat’ sid=’*’;

System altered.

SQL> alter system set dg_broker_start=true  sid=’*’;

System altered.

Listener.ora Changes : GLOBAL_DBNAME attribute value should be set as shown in the following listener.ora configuraiton on primary site otherwise you will get TNS-12154 error during switch over configuration. A service with name <sid>_DGMGRL will be started when the listener is started.

[oracle@dgaskmpri01 admin]$ cat listener.ora 
LISTENER_PRI = 
  (DESCRIPTION_LIST = 
    (DESCRIPTION = 
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1525)) 
    ) 
    (DESCRIPTION = 
      (ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmpri01.localdomain)(PORT = 1525)) 
    ) 
  )

SID_LIST_LISTENER_PRI = 
  (SID_LIST = 
    (SID_DESC = 
      (GLOBAL_DBNAME = orcl_DGMGRL.localdomain) 
      (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2) 
      (SID_NAME = orcl) 
      (SERVICE_NAME = orcl.localdomain) 
    ) 
  ) 
[oracle@dgaskmpri01 admin]$

2. Prepare Standby site:

Init.ora Changes:

SQL> alter system set dg_broker_config_file1=’/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/dr1sbyorcl.dat’ sid=’*’;

System altered.

SQL> alter system set dg_broker_config_file2=’/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/dr2sbyorcl.dat’ sid=’*’;

System altered.

SQL> alter system set dg_broker_start=true  sid=’*’;

System altered.

Listener.ora Changes:

[oracle@dgaskmsby01 admin]$ cat listener.ora 
LISTENER_SBY = 
  (DESCRIPTION_LIST = 
    (DESCRIPTION = 
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1525)) 
    ) 
    (DESCRIPTION = 
      (ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmsby01.localdomain)(PORT = 1525)) 
    ) 
  )

SID_LIST_LISTENER_SBY = 
  (SID_LIST = 
    (SID_DESC = 
      (GLOBAL_DBNAME = sbyorcl_DGMGRL.localdomain) 
      (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2) 
      (SID_NAME = sbyorcl) 
      (SERVICE_NAME = sbyorcl.localdomain) 
    ) 
  ) 
[oracle@dgaskmsby01 admin]$

3. Create Dataguard configuration:

On the primary Database Server connect to database using DGMGRL utility.

[oracle@dgaskmpri01 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 ‘askm_config’ AS PRIMARY DATABASE IS ‘orcl’ CONNECT IDENTIFIER IS orcl;

Configuration "askm_config" created with primary database "orcl"

DGMGRL> show configuration;

Configuration – askm_config

  Protection Mode: MaxPerformance

  Databases:

    orcl – Primary database

Fast-Start Failover: DISABLED

Configuration Status:

DISABLED

DGMGRL>

In the created configuration command,

askm_config = It is the name of the configuration. And it can be anything that your choice.

Primary Database is ‘orcl’ = Here ‘orcl’  is primary database db_unique_name value

Connect Identifier is ‘orcl’ = Here ‘orcl’  is alias name defined in tnsnames.ora to connect to primary database.

4. Adding Standby Databas:

DGMGRL> ADD DATABASE ‘sbyorcl’ AS CONNECT IDENTIFIER IS sbyorcl MAINTAINED AS PHYSICAL;

Database "sbyorcl" added

DGMGRL> show configuration;

Configuration – askm_config

  Protection Mode: MaxPerformance

  Databases:

    orcl    – Primary database

    sbyorcl – 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 – askm_config

  Protection Mode: MaxPerformance

  Databases:

    orcl    – Primary database

    sbyorcl – Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS

DGMGRL>

7. Verifying Configuration With Switchover:

[oracle@dgaskmpri01 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> switchover to ‘sbyorcl’;

Performing switchover NOW, please wait…

New primary database "sbyorcl" is opening…

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

Shutting down instance "orcl"…

ORACLE instance shut down.

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

Starting instance "orcl"…

ORACLE instance started.

Database mounted.

Switchover succeeded, new primary is "sbyorcl"

DGMGRL>

DGMGRL> exit

[oracle@dgaskmpri01 dbs]$ clear

[oracle@dgaskmpri01 dbs]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.2.0 Production on Thu Nov 17 08:54:54 2011

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


Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.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.2.0 – Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@dgaskmpri01 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> switchover to ‘orcl’;

Performing switchover NOW, please wait…

New primary database "orcl" is opening…

Operation requires shutdown of instance "sbyorcl" on database "sbyorcl"

Shutting down instance "sbyorcl"…

ORACLE instance shut down.

Operation requires startup of instance "sbyorcl" on database "sbyorcl"

Starting instance "sbyorcl"…

ORACLE instance started.

Database mounted.

Switchover succeeded, new primary is "orcl"

DGMGRL> exit

[oracle@dgaskmpri01 dbs]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.2.0 Production on Thu Nov 17 08:56:46 2011

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


Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.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          TO STANDBY

SQL>

8. Monitoring DataGuard Broker Configuration:

DGMGRL> help DGMGRL> show configuration;

DGMGRL> edit database "orcl" set property LogXptMode=’SYNC’;

DGMGRL> show database ‘orcl’ ‘LogXptStatus’;

DGMGRL> edit configuration set protection mode as MaxAvailability;

DGMGRL> enable fast_start failover; DGMGRL> show database ‘orcl’;

DGMGRL> enable database ‘orcl’; DGMGRL> remove configuration;

DGMGRL> show database verbose orcl;

DGMGRL> show database orcl InconsistentProperties

DGMGRL> show database ‘orcl’ ‘StatusReport’;

Reference :

http://docs.oracle.com/cd/B12037_01/server.101/b10822/cli.htm
Setup and maintenance of Data Guard Broker using DGMGRL [ID 201669.1]
10g DGMGRL CLI Configuration [ID 260112.1]
Unable To Recreate Data Guard Fast Start Failover Configuration With DGMGRL [ID 454418.1]
Creating a configuration using Data Guard Manager [ID 214071.1]
Interaction Between the Data Guard Broker and a Data Guard Configuration [ID 249703.1]
http://www.izzysoft.de/oracle/ifaqmaker.php?id=7;toc=1
Hope It Helps
SRI

Posted in Data Guard | Tagged: , , , , , , , | 11 Comments »

Creating A Physical Standby Database (11gR2)

Posted by Srikrishna Murthy Annam on December 7, 2011

Setup:

 

Primary Site

Standby Site

Hostname

dgaskmpri01

dgaskmsby01

Database Name

orcl

orcl

Database Unique Name

orcl

sbyorcl

Net Service Name

orcl

sbyorcl

 

Prepared By SRI
Prepared By SRI

Primary Site Preparation :

1.      Enable Database Force Logging

2.      Create SRL (Standby Redo Logs)

3.      Modify Init.ora parameters

4.      Enable Archiving

5.      Backup Primary Database

6.      Create a controlfile for Standby Database

7.      Create a init.ora file for Standby Database

8.      Configure listener.ora and tnsnames.ora

9.      Copy backups and configuration files to Standby Server

 

Standby Site Preparation :

1.      Create a remote login password file ( if it is not copied from primary site )

2.      Create a directory structure

3.      Modify the init.ora parameter file

4.      Configure listener.ora and tnsnames.ora

5.      Verify connectivity

 

Creating Physical Standby Database :

1.      Start the physical Standby Database

2.      Keep it in recovery

 

Verifications

 

Primary Site Preparation :

1.      Enable Database Force Logging:

SQL>  select FORCE_LOGGING from v$database;
SQL> ALTER DATABASE FORCE LOGGING;

2.      Create SRL ( Standby Redo Logs):

You need to create SRL with the same size or greater size as of the online redo logs and also the number of SRLs should be one greater than the online redologs.

SQL> select name,user from v$database;
NAME      USER
--------- ------------------------------
ORCL      SYS
SQL> col group# for 9999
SQL> col member for a50
SQL> set linesize 120
SQL> select name,user from v$database;
NAME      USER
--------- ------------------------------
ORCL      SYS
SQL> select GROUP#,THREAD#,MEMBERS,BYTES FROM V$LOG;
GROUP#    THREAD#    MEMBERS      BYTES
------ ---------- ---------- ----------
     1          1          1   52428800
     2          1          1   52428800
     3          1          1   52428800
SQL> select group#,member from v$logfile;
GROUP# MEMBER
------ --------------------------------------------------
     3 /home/oracle/app/oracle/oradata/orcl/redo03.log
     2 /home/oracle/app/oracle/oradata/orcl/redo02.log
     1 /home/oracle/app/oracle/oradata/orcl/redo01.log
SQL> SELECT GROUP#, BYTES FROM V$STANDBY_LOG;
no rows selected
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/home/oracle/app/oracle/oradata/orcl/s_redo01.log') SIZE 52428800;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/home/oracle/app/oracle/oradata/orcl/s_redo02.log') SIZE 52428800;
Database altered.
SQL> SELECT GROUP#, BYTES FROM V$STANDBY_LOG;
GROUP#      BYTES
------ ----------
     4   52428800
     5   52428800
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/home/oracle/app/oracle/oradata/orcl/s_redo03.log') SIZE 52428800;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/home/oracle/app/oracle/oradata/orcl/s_redo04.log') SIZE 52428800;
Database altered.
SQL> SELECT GROUP#, BYTES FROM V$STANDBY_LOG;
GROUP#      BYTES
------ ----------
     4   52428800
     5   52428800
     6   52428800
     7   52428800
SQL>

 

3.      Modify the init.ora parameters:

 

Modify the init.ora parameters on the primary database side to reflect the following values. If you are using spfile, you can add these parameter online without shutting down the primary database.

 

DB_NAME=orcl
DB_UNIQUE_NAME=orcl
LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,sbyorcl)'
LOG_ARCHIVE_DEST_1='LOCATION=/home/oracle/app/oracle/flash_recovery_area/orcl/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'
LOG_ARCHIVE_DEST_2='SERVICE=sbyorcl ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sbyorcl'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
FAL_SERVER=sbyorcl
DB_FILE_NAME_CONVERT='sbyorcl','orcl'
LOG_FILE_NAME_CONVERT='/home/oracle/app/oracle/flash_recovery_area/sbyorcl/','/home/oracle/app/oracle/flash_recovery_area/orcl/'
STANDBY_FILE_MANAGEMENT=AUTO

 

4.      Enable Archiving :

Make sure that your database is running in archive log mode. Because in a physical standby setup all the redologs generated on the primary database will be transferred to standby site and applied to the standby database.

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> STARTUP MOUNT;
ORACLE instance started.
Total System Global Area  456146944 bytes
Fixed Size                  1344840 bytes
Variable Size             381684408 bytes
Database Buffers           67108864 bytes
Redo Buffers                6008832 bytes
Database mounted.

SQL> ALTER DATABASE ARCHIVELOG;
Database altered.

SQL> ALTER DATABASE OPEN;
Database altered.

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/oracle/app/oracle/flash_recovery_area/orcl/
Oldest online log sequence     360
Next log sequence to archive   362
Current log sequence           362
SQL>

  

5.      Backup Primary Database :

In this demo I am using cold backup of the primary database. There are various other options like RMAN duplicate from active database to create physical standby database without even having the primary database backup in 11g. But in this article I am showing setup without RMAN and using simple sql commands.

Create a temporary directory (/tmp/askm/) on primary server and copy all the controlfile,online redolog files and database files to this location after shutting down the database.

    

6.      Create a controlfile for Standby Database:

SQL> startup mount
ORACLE instance started.
Total System Global Area  456146944 bytes
Fixed Size                  1344840 bytes
Variable Size             381684408 bytes
Database Buffers           67108864 bytes
Redo Buffers                6008832 bytes
Database mounted.

SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/askm/s_control01.ctl';
Database altered.

SQL> ALTER DATABASE OPEN;
Database altered.

 

7.      Create a init.ora file for Standby Database:

 

SQL> CREATE PFILE='/tmp/askm/initsbyorcl.ora' FROM SPFILE;
File created.

 

8.      Configure listener.ora and tnsnames.ora:

[oracle@dgaskmpri01 admin]$ cat listener.ora
LISTENER_PRI =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1525))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmpri01.localdomain)(PORT = 1525))
    )
  )
SID_LIST_LISTENER_PRI =
  (SID_LIST =
    (SID_DESC =
      (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2)
      (SID_NAME = orcl)
    )
  )

[oracle@dgaskmpri01 admin]$ cat tnsnames.ora
orcl =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmpri01.localdomain)(PORT = 1525))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID=orcl)
    )
  )

sbyorcl =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmsby01.localdomain)(PORT = 1525))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID=sbyorcl)
    )
  )
[oracle@dgaskmpri01 admin]$

 

9.      Copy backups and configuration files to Standby Server:

Create a temporary directory(/tmp/askm) on standby server and copy coldbackup, init.ora, password file(orapwsbyorcl) and standby controlfile (s_control01.ctl) from primary server to standby server.

 

Standby Site Preparation :

1.      Create a remote login password file ( if it is not copied from primary site )

Copy the password file /tmp/askm/orapwsbyorcl to $ORACLE_HOME/dbs

2.      Create a directory structure

If you are using a different directory structure on the standby server, they you need to create all the directories on the standby site.

Then copy coldbackup to the appropriate locations on the standby server. Also copy init.ora to $ORACLE_HOME/dbs location.

[oracle@dgaskmsby01]$ mkdir /home/oracle/app/oracle/oradata/sbyorcl/
[oracle@dgaskmsby01]$ mkdir /home/oracle/app/oracle/flash_recovery_area/sbyorcl/
[oracle@dgaskmsby01]$ cd $ORACLE_HOME/dbs
[oracle@dgaskmsby01 dbs]$ cd /home/oracle/app/oracle/oradata/sbyorcl/
[oracle@dgaskmsby01 sbyorcl]$ cp /tmp/askm/*.dbf .
[oracle@dgaskmsby01 sbyorcl]$ cp /tmp/askm/*.log .
[oracle@dgaskmsby01 sbyorcl]$ cp /tmp/askm/s_control01.ctl .
[oracle@dgaskmsby01 sbyorcl]$ cp /tmp/askm/s_control01.ctl /home/oracle/app/oracle/flash_recovery_area/sbyorcl/s_control02.ctl
[oracle@dgaskmsby01 sbyorcl]$ cp /tmp/askm/initsbyorcl.ora $ORACLE_HOME/dbs

3.      Modify the init.ora parameter file

Modify the initsbyorcl.ora file to reflect the following initialization parameters

DB_NAME=orcl
DB_UNIQUE_NAME=sbyorcl
LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,sbyorcl)'
CONTROL_FILES='/home/oracle/app/oracle/oradata/sbyorcl/s_control01.ctl', '/home/oracle/app/oracle/flash_recovery_area/sbyorcl/s_control02.ctl'
DB_FILE_NAME_CONVERT='orcl','sbyorcl'
LOG_FILE_NAME_CONVERT='/home/oracle/app/oracle/flash_recovery_area/orcl/','/home/oracle/app/oracle/flash_recovery_area/sbyorcl/'
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_DEST_1='LOCATION=/home/oracle/app/oracle/flash_recovery_area/sbyorcl/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=sbyorcl'
LOG_ARCHIVE_DEST_2='SERVICE=orcl ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
STANDBY_FILE_MANAGEMENT=AUTO
FAL_SERVER=orcl

 

4.      Configure listener.ora and tnsnames.ora:

[oracle@dgaskmsby01 admin]$ cat listener.ora
LISTENER_SBY =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1525))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmsby01.localdomain)(PORT = 1525))
    )
  )
SID_LIST_LISTENER_SBY =
  (SID_LIST =
    (SID_DESC =
      (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2)
      (SID_NAME = sbyorcl)
    )
  )

[oracle@dgaskmsby01 admin]$ cat tnsnames.ora
orcl =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmpri01.localdomain)(PORT = 1525))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID=orcl)
    )
  )

sbyorcl =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dgaskmsby01.localdomain)(PORT = 1525))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID=sbyorcl)
    )
  )
[oracle@dgaskmsby01 admin]$

 

5.      Verify connectivity

On Primary Server:

[oracle@dgaskmpri01]$ lsnrctl stop LISTENER_PRI
[oracle@dgaskmpri01]$ lsnrctl start LISTENER_PRI
[oracle@dgaskmpri01]$ tnsping orcl
[oracle@dgaskmpri01]$ tnsping sbyorcl
[oracle@dgaskmpri01]$ sqlplus sys/xxxxx@orcl
[oracle@dgaskmpri01]$ sqlplus sys/xxxxx@sbyorcl

 

On Standby Server:

[oracle@dgaskmsby01]$ lsnrctl stop LISTENER_SBY
[oracle@dgaskmsby01]$ lsnrctl start LISTENER_SBY
[oracle@dgaskmsby01]$ tnsping orcl
[oracle@dgaskmsby01]$ tnsping sbyorcl
[oracle@dgaskmsby01]$ sqlplus sys/xxxxx@orcl
[oracle@dgaskmsby01]$ sqlplus sys/xxxxx@sbyorcl

 

 

Creating Physical Standby Database :

1.      Start the physical Standby Database:

 

SQL> startup mount

ORACLE instance started.

 

Total System Global Area  456146944 bytes

Fixed Size                  1344840 bytes

Variable Size             381684408 bytes

Database Buffers           67108864 bytes

Redo Buffers                6008832 bytes

Database mounted.

SQL>

 

2.      Keep it in recovery:

 

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

 

Verifications :

On Standby:

SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

On Primary :

Do some redo log switches

SQL> ALTER SYSTEM SWITCH LOGFILE;

On Standby:

  Verify that the recent archived log file is shifted to standby side and applied with the following commands.

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

 

Other Useful Information:

To verify all the init.ora parameter in a single command:

egrep -i "DB_NAME|DB_UNIQUE_NAME|LOG_ARCHIVE_CONFIG|CONTROL_FILES|LOG_ARCHIVE_DEST_1|LOG_ARCHIVE_DEST_2|LOG_ARCHIVE_DEST_STATE_1|LOG_ARCHIVE_DEST_STATE_2|REMOTE_LOGIN_PASSWORDFILE|LOG_ARCHIVE_FORMAT|LOG_ARCHIVE_MAX_PROCESSES|FAL_SERVER|DB_FILE_NAME_CONVERT|LOG_FILE_NAME_CONVERT|STANDBY_FILE_MANAGEMENT" <specify init.ora parameter file>

 

To Cancel the Standby Recovery Mode:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

 

Useful commands To Troubleshoot:

select message from v$dataguard_status where dest_id = 2;
select archived_thread#, archived_seq#, applied_thread#, applied_seq# from v$archive_dest_status;
select registrar, creator, thread#, sequence#, first_change#, next_change# from v$archived_log;
select thread#, sequence#, first_change#, next_change# from v$log_history;

 

To Verify Recover Process On Standby:

select thread#, sequence# from v$log where status='CURRENT';  = >  On Primary
select thread#, sequence#, status from v$managed_standby where process='MRP0'; = > On Standby

 

References :

http://download.oracle.com/docs/cd/E11882_01/server.112/e25608/create_ps.htm#i63561

MOS ID :  249703.1

 

Hope It Helps

SRI

Posted in Data Guard | Tagged: , , , , , , , , , , | 9 Comments »

Physical Standby Switch Over Demo

Posted by Srikrishna Murthy Annam on September 16, 2010

This demo shows how to perform switch over operations for physical stand by operations.

One important point to remember:
Though the fact, that the previous Standby database became the primary afterwards applies to both variants – there are small differences which should for sure be considered. The most important is: After a FailOver there is no way to convert the former primary instance into a standby database for the new primary system: Due to the fact that both of them created redo information after the FailOver, they are completely out of sync, and in no way they can be synchronized again . The only possibility to get a new standby system again is to create it from the scratch.

After a SwitchOver, on the other hand, we have both, the primary and the standby system, available again as we had before. This means you should think twice before doing a FailOver.

Posted in Data Guard | Tagged: , , , , | 2 Comments »

 
%d bloggers like this: