In sweet memories of my ever loving brother "kutty thambi " ARUN KUMAR

Thursday, January 21, 2010

Step by Step, document for creating Physical Standby Database, 10g DATA GUARD

10g Data Guard, Physical Standby Creation, step by step

primary database name:  white on rac2 machine

standby database name: black  on rac1 machine

Creating a Data Guard Physical Standby environment, General Review.
Manually setting up a Physical standby database is a simple task when all prerequisites and setup steps are carefully met and executed.
In this example I did use 2 hosts, that host a RAC database. All RAC preinstall requisites are then in place and no additional configuration was
necessary to implement Data Guard Physical Standby manually.

The Enviroment
     2 Linux servers, Oracle Distribution 2.6.9-55 EL i686 i386 GNU/Linux
     Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
     ssh is configured for user oracle on both nodes
     Oracle Home is on identical path on both nodes
Implementation notes:
     Once you have your primary database up and running these are the steps to follow:
     1.  Enable Forced Logging
     2.  Create a Password File
     3.  Configure a Standby Redo Log
     4.  Enable Archiving
     5.  Set Primary Database Initialization Parameters
     Having followed these steps to implement the Physical Standby you need to follow these steps:
     1. Create a Control File for the Standby Database
     2. Backup the Primary Database and transfer a copy to the Standby node.
     3. Prepare an Initialization Parameter File for the Standby Database
     4. Configure the listener and tnsnames to support the database on both nodes
     5. Set Up the Environment to Support the Standby Database on the standby node.
     6. Start the Physical Standby Database
     7. Verify the Physical Standby Database Is Performing Properly
Step by Step Implementation of a Physical Standby Environment
Primary Database Steps
Primary Database General View

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     0
Current log sequence           1
SQL> select name from v$database;

NAME
---------
WHITE

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/white/system01.dbf
/u01/app/oracle/oradata/white/undotbs01.dbf
/u01/app/oracle/oradata/white/sysaux01.dbf
/u01/app/oracle/oradata/white/users01.dbf

SQL> show parameters unique

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      white
SQL>

Enable Forced Logging
  In order to implement Standby Database we enable 'Forced Logging'.
  This option ensures that even in the event that a 'nologging' operation is done, force logging takes precedence and all operations are logged
  into the redo logs.
  SQL> ALTER DATABASE FORCE LOGGING;
  Database altered.
Create a Password File
  A password file must be created on the Primary and copied over to the Standby site. The sys password must be identical on both sites. This is
  a key pre requisite in order to be able to ship and apply archived logs from Primary to Standby.

 [oracle@rac2 ~]$ cd $ORACLE_HOME/dbs
[oracle@rac2 dbs]$ orapwd file=orapwwhite password=oracle force=y

SQL> select * from v$pwfile_users;

USERNAME                       SYSDB SYSOP
------------------------------ ----- -----
SYS                            TRUE  TRUE



Configure a Standby Redo Log
  A Standby Redo log is added to enable Data Guard Maximum Availability and Maximum Protection modes. It is important to configure the
  Standby Redo Logs (SRL) with the same size as the online redo logs.
  In this example I'm using Oracle Managed Files, that's why I don't need to provide the SRL path and file name. If you are not using OMF's
  you then must pass the full qualified name.
SQL> select group#,type,member from v$logfile;

    GROUP# TYPE    MEMBER
---------- ------- --------------------------------------------------
         3 ONLINE  /u01/app/oracle/oradata/white/redo03.log
         2 ONLINE  /u01/app/oracle/oradata/white/redo02.log
         1 ONLINE  /u01/app/oracle/oradata/white/redo01.log
SQL> select bytes from v$log;
     BYTES
----------
  52428800
  52428800
  52428800

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4
  2  '/u01/app/oracle/oradata/white/stby04.log' size 50m;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5
  2  '/u01/app/oracle/oradata/white/stby05.log' size 50m;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6
  2  '/u01/app/oracle/oradata/white/stby06.log' size 50m;

Database altered.

SQL> SELECT GROUP#,TYPE,MEMBER FROM V$LOGFILE;

    GROUP# TYPE    MEMBER
---------- ------- --------------------------------------------------
         3 ONLINE  /u01/app/oracle/oradata/white/redo03.log
         2 ONLINE  /u01/app/oracle/oradata/white/redo02.log
         1 ONLINE  /u01/app/oracle/oradata/white/redo01.log
         4 STANDBY /u01/app/oracle/oradata/white/stby04.log
         5 STANDBY /u01/app/oracle/oradata/white/stby05.log
         6 STANDBY /u01/app/oracle/oradata/white/stby06.log

6 rows selected.

Set Primary Database Initialization Parameters
  Data Guard must use spfile, in order to configure it we create and configure the standby parameters on a regular pfile, and once it is ready we
  convert it to an spfile.
  Several init.ora parameters control the behavior of a Data Guard environment. In this example the Primary database init.ora is configured so
  that it can hold both roles, as Primary or Standby.

SQL> CREATE PFILE FROM SPFILE;

File created.

(or)

SQL> CREATE PFILE='/tmp/initwhite.ora' from spfile;

File created.

Edit the pfile to add the standby parameters, here shown highlighted:

white.__db_cache_size=184549376
white.__java_pool_size=4194304
white.__large_pool_size=4194304
white.__shared_pool_size=88080384
white.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/white/adump'
*.background_dump_dest='/u01/app/oracle/admin/white/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/app/oracle/oradata/white/control01.ctl','/u01/app/oracle/oradata/white/control02.ctl','/u01/app/oracle/oradata/white/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/white/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='white'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=whiteXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=285212672
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/white/udump'
db_unique_name='white'
LOG_ARCHIVE_CONFIG='DG_CONFIG=(white,black)'
LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/oradata/white/arch/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=white'
LOG_ARCHIVE_DEST_2='SERVICE=black LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=black'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
#Standby role parameters------------------------------------------
fal_server=black
fal_client=white
standby_file_management=auto
db_file_name_convert='/u01/app/oracle/oradata/black/','/u01/app/oracle/oradata/white/'
log_file_name_convert='/u01/app/oracle/oradata/black/','/u01/app/oracle/oradata/white/'




Once the new parameter file is ready we create from it the spfile:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>  startup nomount pfile=/u01/app/oracle/product/10.2.0/db_1/dbs/initwhite.ora
ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated
ORA-07286: sksagdi: cannot obtain device information.
Linux Error: 2: No such file or directory
note: create a archive log destination(location) folder as per in parameter file and then startup the database.
SQL> startup nomount pfile=/u01/app/oracle/product/10.2.0/db_1/dbs/initwhite.ora
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              96470608 bytes
Database Buffers          184549376 bytes
Redo Buffers                2973696 bytes
SQL> create spfile from pfile;

File created.

SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.

Enable Archiving
  On 10g you can enable archive log mode by mounting the database and executing the archivelog command:
SQL> startup mount
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              96470608 bytes
Database Buffers          184549376 bytes
Redo Buffers                2973696 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            /u01/app/oracle/oradata/white/arch/
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence           2
SQL>

Standby Database Steps
Here, i am going to create standby database using backup of the primary database datafiles,redologs, controlfile by rman. compare with user managed backup, rman is comfortable and flexible method.

Create an RMAN backup which we will use later to create the standby:

[oracle@rac2 ~]$ . oraenv
ORACLE_SID = [oracle] ? white
[oracle@rac2 ~]$ rman target=/

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 20 18:41:51 2010

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

connected to target database: WHITE (DBID=3603807872)

RMAN> backup full database format '/u01/app/oracle/backup/%d_%U.bckp' plus archivelog format '/u01/app/oracle/backup/%d_%U.bckp';

Next, create a standby controlfile backup via RMAN:
RMAN> configure channel device type disk format '/u01/app/oracle/backup/%U';

new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u01/app/oracle/backup/%U';
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1

RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY;

RMAN> BACKUP ARCHIVELOG ALL;


In this simple example, I am backing up the primary database to disk; therefore, I must make the backupsets available to the standby host if I want to use them as the basis for my duplicate operation:
[oracle@rac2 ~]$ cd /u01/app/oracle/backup
[oracle@rac2 backup]$ ls -lart
total 636080
drwxrwxr-x  9 oracle oinstall      4096 Jan 20 18:42 ..
-rw-r-----  1 oracle oinstall  50418176 Jan 20 18:43 WHITE_01l3v1uv_1_1.bckp
-rw-r-----  1 oracle oinstall 531472384 Jan 20 18:54 WHITE_02l3v203_1_1.bckp
-rw-r-----  1 oracle oinstall   7143424 Jan 20 18:54 WHITE_03l3v2jf_1_1.bckp
-rw-r-----  1 oracle oinstall   1346560 Jan 20 18:54 WHITE_04l3v2jv_1_1.bckp
-rw-r-----  1 oracle oinstall   7110656 Jan 20 19:19 05l3v41r_1_1
drwxr-xr-x  2 oracle oinstall      4096 Jan 20 19:20 .
-rw-r-----  1 oracle oinstall  53174272 Jan 20 19:21 06l3v448_1_1
[oracle@rac2 backup]$ scp * oracle@rac1:/u01/app/oracle/backup/
05l3v41r_1_1                                  100% 6944KB   6.8MB/s   00:00
06l3v448_1_1                                  100%   51MB  16.9MB/s   00:03
WHITE_01l3v1uv_1_1.bckp                       100%   48MB   2.7MB/s   00:18
WHITE_02l3v203_1_1.bckp                       100%  507MB   1.5MB/s   05:47
WHITE_03l3v2jf_1_1.bckp                       100% 6976KB 996.6KB/s   00:07
WHITE_04l3v2jv_1_1.bckp                       100% 1315KB   1.3MB/s   00:01

NOTE:
The primary and standby database location for backup folder must be same.
for eg: /u01/app/oracle/backup folder

On the standby node create the required directories to get the datafiles
mkdir -p /u01/app/oracle/oradata/black
mkdir -p /u01/app/oracle/oradata/black/arch
mkdir -p /u01/app/oracle/admin/black
mkdir -p /u01/app/oracle/admin/black/adump
mkdir -p /u01/app/oracle/admin/black/bdump
mkdir -p /u01/app/oracle/admin/black/udump
mkdir -p /u01/app/oracle/flash_recovery_area/WHITE
mkdir -p /u01/app/oracle/flash_recovery_area/WHITE/onlinelog

Prepare an Initialization Parameter File for the Standby Database

Copy from the primary pfile to the standby destination
[oracle@rac2 ~]$ cd /u01/app/oracle/product/10.2.0/db_1/dbs/
[oracle@rac2 dbs]$ scp initwhite.ora oracle@rac1:/tmp/initblack.ora
initwhite.ora                                 100% 1704     1.7KB/s   00:00

Copy and edit the primary init.ora to set it up for the standby role,as here shown highlighted:


black.__db_cache_size=188743680
black.__java_pool_size=4194304
black.__large_pool_size=4194304
black.__shared_pool_size=83886080
black.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/black/adump'
*.background_dump_dest='/u01/app/oracle/admin/black/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/app/oracle/oradata/black/control01.ctl','/u01/app/oracle/oradata/black/control02.ctl','/u01/app/oracle/oradata/black/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/black/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_file_name_convert='/u01/app/oracle/oradata/white/','/u01/app/oracle/oradata/black/'
*.db_name='white'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.db_unique_name='black'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=blackXDB)'
*.fal_client='black'
*.fal_server='white'
*.job_queue_processes=10
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(white,black)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/oradata/black/arch/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=black'
*.LOG_ARCHIVE_DEST_2='SERVICE=white LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=white'
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.LOG_ARCHIVE_DEST_STATE_2='ENABLE'
*.LOG_ARCHIVE_FORMAT='%t_%s_%r.arc'
*.LOG_ARCHIVE_MAX_PROCESSES=30
*.log_file_name_convert='/u01/app/oracle/oradata/white/','/u01/app/oracle/oradata/black/'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=285212672
*.standby_file_management='auto'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/black/udump'

Configure the listener and tnsnames to support the database on both nodes
Configure listener.ora on both servers to hold entries for both databases
#on RAC2 Machine
LISTENER_VMRACTEST =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.localdomain)(PORT = 1521))
    )
  )

SID_LIST_LISTENER_VMRACTEST =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = white)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (SID_NAME = white)
    )
)


#on rac1 machine

LISTENER_VMRACTEST =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.localdomain)(PORT = 1521))
    )
  )

SID_LIST_LISTENER_VMRACTEST =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = black)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (SID_NAME = black)
    )
)

Configure tnsnames.ora on both servers to hold entries for both databases
#on rac2 machine
LISTENER_VMRACTEST =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.localdomain)(PORT = 1521))
    )
  )

WHITE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = white)
    )
  )
BLACK =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = black)
    )
  )
#on rac1 machine
LISTENER_VMRACTEST =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.localdomain)(PORT = 1521))
    )
  )
WHITE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = white)
    )
  )
BLACK =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = black)
    )
  )
Start the listener and check tnsping on both nodes to both services
#on machine rac1
[oracle@rac1 tmp]$ lsnrctl stop LISTENER_VMRACTEST

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 20-JAN-2010 23:59:41

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.localdomain)(PORT=1521)))
The command completed successfully

[oracle@rac1 tmp]$ lsnrctl start LISTENER_VMRACTEST

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 21-JAN-2010 00:00:00

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

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener_vmractest.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.localdomain)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_VMRACTEST
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                21-JAN-2010 00:00:00
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener_vmractest.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.localdomain)(PORT=1521)))
Services Summary...
Service "black" has 1 instance(s).
  Instance "black", status UNKNOWN, has 1 handler(s) for this service...
Service "black_DGMGRL" has 1 instance(s).
  Instance "black", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[oracle@rac1 tmp]$ tnsping black

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 21-JAN-2010 00:00:21

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

Used parameter files:
/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = black)))
OK (10 msec)

[oracle@rac1 tmp]$ tnsping white

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 21-JAN-2010 00:00:29

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

Used parameter files:
/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = white)))
OK (10 msec)


#on rac2 machine
[oracle@rac2 dbs]$ lsnrctl stop LISTENER_VMRACTEST

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 21-JAN-2010 00:22:48

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac2.localdomain)(PORT=1 521)))
The command completed successfully

[oracle@rac2 dbs]$ lsnrctl start LISTENER_VMRACTEST

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 21-JAN-2010 00:23:08

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

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/liste ner.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener _vmractest.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac2.localdomain)(PORT=1 521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac2.localdomain)(PORT=1 521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_VMRACTEST
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                21-JAN-2010 00:23:08
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/list ener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listen er_vmractest.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac2.localdomain)(PORT=1521)))
Services Summary...
Service "white" has 1 instance(s).
  Instance "white", status UNKNOWN, has 1 handler(s) for this service...
Service "white_DGMGRL" has 1 instance(s).
  Instance "white", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[oracle@rac2 dbs]$ tnsping white

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 21-JAN-2010 00:23 :14

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

Used parameter files:
/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.loc aldomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = whi te)))
OK (0 msec)

[oracle@rac2 dbs]$ tnsping black

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 21-JAN-2010 00:23 :18

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

Used parameter files:
/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.loc aldomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bla ck)))
OK (10 msec)


Set Up the Environment to Support the Standby Database on the standby node.
Create a passwordfile for the standby:
[oracle@rac1 ~]$ orapwd file=$ORACLE_HOME/dbs/orapwblack password=oracle
note: sys password must be identical for both primary and standby database



Append an entry to oratab:

[oracle@rac1 ~]$ echo "black:/u01/app/oracle/product/10.2.0/db_1:N" >> /etc/oratab

Startup nomount the Standby database


Nomount the standby instance in preparation for the duplicate operation:
 Startup nomount the Standby database and generate an spfile

[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [whiteowl] ? black
[oracle@rac1 ~]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jan 21 00:38:03 2010

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

Connected to an idle instance.


SQL> startup nomount pfile='/tmp/initblack.ora'
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              92276304 bytes
Database Buffers          188743680 bytes
Redo Buffers                2973696 bytes

SQL> create spfile from pfile='/tmp/initblack.ora';

File created.

SQL> shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.


Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              92276304 bytes
Database Buffers          188743680 bytes
Redo Buffers                2973696 bytes


Create the standby database using rman:
[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? black
[oracle@rac1 ~]$ rman target=sys/oracle@white auxiliary=/

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jan 21 00:43:11 2010

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

connected to target database: WHITE (DBID=3603807872)
connected to auxiliary database: WHITE (not mounted)

RMAN> DUPLICATE TARGET DATABASE FOR STANDBY NOFILENAMECHECK;

 Start the redo apply:

SQL> alter database recover managed standby database disconnect from session;

Test the configuration by generating archive logs from the primary and then querying the standby to see if the logs are being successfully applied.

On the Primary:

SQL> alter system switch logfile;
SQL> alter system archive log current;

 SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/oradata/white/arch/
Oldest online log sequence     8
Next log sequence to archive   10
Current log sequence           10

 On the Standby:
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/oradata/black/arch/
Oldest online log sequence     8
Next log sequence to archive   0
Current log sequence           10

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG
  2  ORDER BY SEQUENCE#;
 
 Stop the managed recovery process on the standby:

SQL> alter database recover managed standby database cancel;
 
 Reference:
Oracle® Data Guard Concepts and Administration
10g Release 2 (10.2)
Part Number B14239-04
http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/create_ps.htm#SBYDB00210

 

12 comments:

Firdous Ahmed Bhat said...

its lovely doc , with good modifications, good piece of work

Sam said...

Good Work !!! Keep It up

Sarakaari said...

nice work thanks

saravanan

Manoj Kumar said...

Nice document.... a detailed one....!

Anonymous said...

GOOD WORK SIR!,!!!!!!

Unknown said...

super doc very simple way to create the oracle data guard configuration

Anonymous said...

Hi Every one if you want to post any information about Oracle Please follow this person, Because a person with close eyes can create datagurad.
Thank-YOU

Anonymous said...

The content in your article is understandable.
Take care...

my web site; Remedy Tips

Unknown said...

Good Document for Oracle 10g Data Guard.it is very easy to follow.

Pradip Patel said...

Awesome step wise document to easily implement DB on 10g.

Amey Lad said...

VERY VERY nicely step by step explained.... Thank you Very much "ARUN KUMAR" :)

Unknown said...

Good document, easy to understand even benenner.. Can we use same for oracle 11g ASM

free counters
 
Share/Bookmark