Resync Physical standby using RMAN Incremental backup

Just another day at the office, our production database has 2 physical standby and it lagging for more that 1000 archives.
the reason is the password was changed and the password file was not copied to standby.

below are the steps i did to resync the standby. for the first standby i tried to restore archive but its taking time .

NOTE:
– Primay and Standby filesystem is the same.
– Shared NFS is mounted on both server.

Continue reading

Advertisements

Enable Active Guard with DG Broker (11.2.0.2).

We a have new created standby and we need to make it active to utilized its resources.

current configuration

 
DGMGRL> show configuration;

Configuration - FITS

  Protection Mode: MaxPerformance
  Databases:
    FITS     - Primary database
    FITSDG   - Physical standby database
    FITSdg02 - Physical standby database <<< --- enable active guard. 
Fast-Start Failover: DISABLED 
Configuration Status: 
SUCCESS 

DGMGRL>

Continue reading

Adding new physical standby database and apply incremental backup to sync

just another day in my work…
i will add another physical standby to our existing setup.

        Database Version : 11.2.0.2
	primary          :  FITS
	physical standby :  FITSDG
	physical standby :  FITSDG02 <<--- i will add this.

1. restore the cold backup from another standby.
canceled and shutdown the first standby database and copy all file to my another server. Continue reading

Switchover on Physical Standby (10.2.0.1) Manual

another notes for DG…. performing manual switch without using Dataguard Broker.


>check the init files of both nodes
[PRIMARY]

log_archive_dest_2     service=test01dr valid_for=(online_logfiles,primary_role) db_unique_name=test01dr
fal_client             test01dr
fal_server             test01, test01dr

[STANDBY]

log_archive_dest_2     service=test01.bai.com valid_for=(online_logfiles,primary_role) db_unique_name=test01
fal_client             test01dr
fal_server             test01, test01dr

>CHECK FOR THE TEMPFILES OF BOTH STANDBY AND PRIMARY

select ts.name as "Tablespace", tf.name as "Tempfile", tf.status as "Status" from v$tablespace ts join v$tempfile tf using (ts#);

[PRIMARY]

Tablespace               Tempfile                       Status
------------------------------ -------------------------------------------------- -------
TEMP                   /dbTEST01/u04/oradata/TEST01/temp01.dbf          ONLINE

[STANDBY]
Tablespace               Tempfile                       Status
------------------------------ -------------------------------------------------- -------
TEMP                   /dbTEST01/u04/oradata/TEST01DR/temp01.dbf      ONLINE

> Verify redo is current in primay.

SQL> alter system switch logfile;

System altered.

SQL> select status, error from v$archive_dest where dest_id = 2;

STATUS      ERROR
--------- -----------------------------------------------------------------
VALID

SQL> select client_process, process, sequence#, status from v$managed_standby;

CLIENT_P PROCESS    SEQUENCE# STATUS
-------- --------- ---------- ------------
ARCH     ARCH           56 CLOSING
ARCH     ARCH           57 CLOSING
ARCH     ARCH           58 CLOSING
ARCH     ARCH           59 CLOSING
N/A     MRP0           60 WAIT_FOR_LOG
UNKNOWN  RFS            0 IDLE
UNKNOWN  RFS            0 IDLE
UNKNOWN  RFS            0 IDLE

> Verify standby redo logfile on primary

SQL> select group#, status, type, count(*) as "Members" from v$logfile group by group#, status, type order by group#;

GROUP# STATUS  TYPE       Members
---------- ------- ------- ----------
1       ONLINE        1
2       ONLINE        1
3       ONLINE        1
4       STANDBY        1
5       STANDBY        1
6       STANDBY        1
7       STANDBY        1

7 rows selected.

>check/cancel all running backup on primary

SQL> select s.process, r.operation, r.status, r.mbytes_processed as "PCT", s.status
2  from v$rman_status r join v$session s using (sid);

no rows selected

>perform switchover operation with the physical standby

[PRIMARY]

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO STANDBY

If SWITCHOVER_STATUS returns a value of TO STANDBY, then everything is good and a switchover can occur. If on the other hand SWITCHOVER_STATUS returns SESSIONS ACTIVE, the SWITCHOVER command (below) will need to be issued with the "WITH SESSION SHUTDOWN" clause.

>Convert the primary database into a physical standby database.

SQL> alter database commit to switchover to physical standby;

Database altered.

As noted in the previous step, all sessions to the primary database need to be disconnected. If the SWITCHOVER_STATUS column of V$DATABASE indicated SESSIONS ACTIVE, issue the SWITCHOVER command with the "WITH SESSION SHUTDOWN" clause.
SQL> alter database commit to switchover to physical standby with session shutdown;

Database altered

>Shut down and restart the former primary as a new standby database.

SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount;
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.
Total System Global Area  167772160 bytes
Fixed Size            2019320 bytes
Variable Size           83886088 bytes
Database Buffers       79691776 bytes
Redo Buffers            2174976 bytes
Database mounted.
SQL>
check alert log.
Successful mount of redo thread 1, with mount id 3570225048
Sun Sep 25 20:11:09 2011
Physical Standby Database mounted.
Completed: ALTER DATABASE   MOUNT
ARC3 started with pid=19, OS id=4488

[ON STANDBY]

SQL>  select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO PRIMARY

>Convert the former standby to a primary database.
SQL> alter database commit to switchover to primary;

Database altered.

Or, if SWITCHOVER_STATUS returned SESSIONS ACTIVE in the previous step, use:
SQL> alter database commit to switchover to primary with session shutdown;

Database altered.

>To complete the transition of the standby database to the primary role, the new primary database needs to be shut down and restarted.

SQL> SHUTDOWN IMMEDIATE;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size            2019320 bytes
Variable Size           75497480 bytes
Database Buffers       88080384 bytes
Redo Buffers            2174976 bytes
Database mounted.
Database opened.
SQL>

As a final step, issue either of the following statements from the new physical standby database to begin managed recovery operations.

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

Database altered.

SQL> SELECT PROTECTION_MODE, PROTECTION_LEVEL, DATABASE_ROLE FROM V$DATABASE;

PROTECTION_MODE      PROTECTION_LEVEL      DATABASE_ROLE
-------------------- -------------------- ----------------
MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> SELECT PROTECTION_MODE, PROTECTION_LEVEL, DATABASE_ROLE FROM V$DATABASE;

PROTECTION_MODE      PROTECTION_LEVEL      DATABASE_ROLE
-------------------- -------------------- ----------------
MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PRIMARY

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

DONE

bai

creating a physical standby database

just another notes in creating a physical standby database on Linux.

Configuration                                           Primary Database

Oracle Release                                        Oracle 10g Release 2 — (10.2.0.1)
Host Name                                            lnxdg01.bai.com
Operating System                                    Red Hat Linux 5 — (CentOS 5.5)
Database Name (db_name)                                test01
Database Domain (db_domain)                            bai.com
Oracle SID                                            test01
Database Unique Name (db_unique_name)                test01
TNS Alias                                            test01.bai.com
Service Names                                        test01.bai.com, test01
Database Files - (db_create_file_dest)                /dbTEST01/u04/oradata
Flash Recovery Area - (db_recovery_file_dest)        /opt/app/oracle/flash_recovery_area
Local Online Redo Log Files - (log_archive_dest_1)    location=use_db_recovery_file_dest — (all_logfiles,all_roles)
Remote Archive Destination - (log_archive_dest_2)    service=turlock — (online_logfiles,primary_role)

Physical Standby Database
Oracle Release                                        Oracle 10g Release 2 — (10.2.0.1)
Host Name                                            lnxdg02.bai.com
Operating System                                    Red Hat Linux 5 — (CentOS 5.5)
Database Name (db_name)                                TEST01
Database Domain (db_domain)                            bai.com
Oracle SID                                            TEST01DR
Database Unique Name (db_unique_name)                TEST01DR
TNS Alias                                            TEST01DR.bai.com
Service Names                                        TEST01DR.bai.com, TEST01DR
Database Files - (db_create_file_dest)                /dbTEST01/u04/oradata
Flash Recovery Area - (db_recovery_file_dest)        /opt/app/oracle/flash_recovery_area
Local Online Redo Log Files - (log_archive_dest_1)    location=use_db_recovery_file_dest — (all_logfiles,all_roles)
Remote Archive Destination - (log_archive_dest_2)    service=TEST01DR — (online_logfiles,primary_role)

Configure the Primary Database
->Enable Archivelog Mode

->Create a Password File

[oracle@lnxdg01 ~]$ cd $ORACLE_HOME/dbs
 [oracle@lnxdg01 dbs]$ orapwd file=orapwtest01 password=syspassword

SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;

System altered.

SQL> shutdown immediate;
 Database closed.
 Database dismounted.
 ORACLE instance shut down.
 SQL> startup

Total System Global Area  167772160 bytes
 Fixed Size            2019320 bytes
 Variable Size           75497480 bytes
 Database Buffers       88080384 bytes
 Redo Buffers            2174976 bytes
 Database mounted.
 Database opened.
 SQL>

->Enable Force Logging (optional)

SQL> alter database force logging;

Database altered.

SQL> select force_logging from v$database;

FOR
 ---
 YES

->Create Standby Redo Logs (optional)

(# of online redo log file groups on primary + 1) * maximum # of threads

SQL> select group#, type, member from v$logfile order by group#, member;

GROUP# TYPE    MEMBER
 ---------- ------- --------------------------------------------------
 1 ONLINE  /dbTEST01/u04/oradata/TEST01/redo01.log
 2 ONLINE  /dbTEST01/u04/oradata/TEST01/redo02.log
 3 ONLINE  /dbTEST01/u04/oradata/TEST01/redo03.log

SQL> alter database add standby logfile thread 1 group 4 size 50m;

Database altered.

SQL> alter database add standby logfile thread 1 group 5 size 50m;

Database altered.

SQL> alter database add standby logfile thread 1 group 6 size 50m;

Database altered.

SQL> alter database add standby logfile thread 1 group 7 size 50m;

Database altered.

verify..

SQL> select group#, type, member from v$logfile order by group#, member;

GROUP# TYPE    MEMBER
 ---------- ------- --------------------------------------------------------------------------------
 1 ONLINE  /dbTEST01/u04/oradata/TEST01/redo01.log
 2 ONLINE  /dbTEST01/u04/oradata/TEST01/redo02.log
 3 ONLINE  /dbTEST01/u04/oradata/TEST01/redo03.log
 4 STANDBY /opt/app/oracle/flash_recovery_area/TEST01/onlinelog/o1_mf_4_77vxrfw1_.log
 5 STANDBY /opt/app/oracle/flash_recovery_area/TEST01/onlinelog/o1_mf_5_77vxvbcl_.log
 6 STANDBY /opt/app/oracle/flash_recovery_area/TEST01/onlinelog/o1_mf_6_77vxvnjy_.log
 7 STANDBY /opt/app/oracle/flash_recovery_area/TEST01/onlinelog/o1_mf_7_77vxvx6z_.log

7 rows selected.

->Configure the Primary Database Initialization Parameters

# ---[ Dump Destination Parameters ] --- #
 audit_file_dest='/opt/app/oracle/admin/TEST01/adump'
 background_dump_dest='/opt/app/oracle/admin/TEST01/bdump'
 core_dump_dest='/opt/app/oracle/admin/TEST01/cdump'
 user_dump_dest='/opt/app/oracle/admin/TEST01/udump'

# ---[ Role-independent Parameters ] --- #
 archive_lag_target=900
 compatible='10.2.0.1.0'
 control_files='/dbTEST01/u04/oradata/TEST01/control01.ctl', '/dbTEST01/u04/oradata/TEST01/control02.ctl', '/dbTEST01/u04/oradata/TEST01/control03.ctl'
 db_name='test01'
 db_domain='bai.com'
 db_create_file_dest='/dbTEST01/u04/oradata'
 db_recovery_file_dest='/opt/app/oracle/flash_recovery_area'
 dispatchers='(PROTOCOL=TCP) (SERVICE=modestoXDB)'
 instance_name='test02'
 log_archive_config='dg_config=(test01,test01dr)'
 log_archive_max_processes=4
 remote_login_passwordfile='exclusive'

# ---[ Primary Role Parameters ] --- #
 db_unique_name='test01'
 log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=test01'
 log_archive_dest_2='service=test01dr valid_for=(online_logfiles,primary_role) db_unique_name=test01dr'
 log_archive_dest_state_1='enable'
 log_archive_dest_state_2='defer'
 service_names='test01.bai.com, test01'

# ---[ Standby Role Parameters ] --- #
 db_file_name_convert='/dbTEST01/u04/oradata/TEST01/','/dbTEST01/u04/oradata/TEST01DR/'
 log_file_name_convert='/dbTEST01/u04/oradata/TEST01/','/dbTEST01/u04/oradata/TEST01DR/'

fal_server='test01','test01dr'
 fal_client='test01'
 standby_file_management='auto'

restart database...

->Create a Backup of the Primary Database

[oracle@lnxdg01 TEST01]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Sep 25 07:24:34 2011

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

connected to target database: TEST01 (DBID=3570172646)

RMAN> backup device type disk format '/dbTEST01/u05/backup/TEST01/%U' database plus archivelog;

Starting backup at 25-SEP-2011 15:11:00
 current log archived
 using target database control file instead of recovery catalog
 allocated channel: ORA_DISK_1
 channel ORA_DISK_1: sid=139 devtype=DISK
 channel ORA_DISK_1: starting archive log backupset
 channel ORA_DISK_1: specifying archive log(s) in backup set
 input archive log thread=1 sequence=1 recid=1 stamp=762731675
 input archive log thread=1 sequence=2 recid=2 stamp=762731683
 input archive log thread=1 sequence=3 recid=3 stamp=762765924
 .
 .

input archive log thread=1 sequence=35 recid=35 stamp=762793580
 input archive log thread=1 sequence=36 recid=36 stamp=762793860
 channel ORA_DISK_1: starting piece 1 at 25-SEP-2011 15:11:03
 channel ORA_DISK_1: finished piece 1 at 25-SEP-2011 15:11:06
 piece handle=/dbTEST01/u05/backup/TEST01/05mnejs6_1_1 tag=TAG20110925T151101 comment=NONE
 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
 Finished backup at 25-SEP-2011 15:11:06

Starting backup at 25-SEP-2011 15:11:06
 using channel ORA_DISK_1
 channel ORA_DISK_1: starting full datafile backupset
 channel ORA_DISK_1: specifying datafile(s) in backupset
 input datafile fno=00001 name=/dbTEST01/u04/oradata/TEST01/system01.dbf
 input datafile fno=00003 name=/dbTEST01/u04/oradata/TEST01/sysaux01.dbf
 input datafile fno=00002 name=/dbTEST01/u04/oradata/TEST01/undotbs01.dbf
 input datafile fno=00004 name=/dbTEST01/u04/oradata/TEST01/users01.dbf
 channel ORA_DISK_1: starting piece 1 at 25-SEP-2011 15:11:06
 channel ORA_DISK_1: finished piece 1 at 25-SEP-2011 15:11:41
 piece handle=/dbTEST01/u05/backup/TEST01/06mnejsa_1_1 tag=TAG20110925T151106 comment=NONE
 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
 channel ORA_DISK_1: starting full datafile backupset
 channel ORA_DISK_1: specifying datafile(s) in backupset
 including current control file in backupset
 channel ORA_DISK_1: starting piece 1 at 25-SEP-2011 15:11:42
 channel ORA_DISK_1: finished piece 1 at 25-SEP-2011 15:11:43
 piece handle=/dbTEST01/u05/backup/TEST01/07mnejtd_1_1 tag=TAG20110925T151106 comment=NONE
 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
 Finished backup at 25-SEP-2011 15:11:43

Starting backup at 25-SEP-2011 15:11:43
 current log archived
 using channel ORA_DISK_1
 channel ORA_DISK_1: starting archive log backupset
 channel ORA_DISK_1: specifying archive log(s) in backup set
 input archive log thread=1 sequence=37 recid=37 stamp=762793903
 channel ORA_DISK_1: starting piece 1 at 25-SEP-2011 15:11:44
 channel ORA_DISK_1: finished piece 1 at 25-SEP-2011 15:11:45
 piece handle=/dbTEST01/u05/backup/TEST01/08mnejtf_1_1 tag=TAG20110925T151143 comment=NONE
 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
 Finished backup at 25-SEP-2011 15:11:45

RMAN>

->Create a Standby Controlfile

RMAN> backup device type disk format '/dbTEST01/u05/backup/TEST01/%U' current controlfile for standby;

Starting backup at 25-SEP-2011 15:12:17
 using channel ORA_DISK_1
 channel ORA_DISK_1: starting full datafile backupset
 channel ORA_DISK_1: specifying datafile(s) in backupset
 including standby control file in backupset
 channel ORA_DISK_1: starting piece 1 at 25-SEP-2011 15:12:17
 channel ORA_DISK_1: finished piece 1 at 25-SEP-2011 15:12:18
 piece handle=/dbTEST01/u05/backup/TEST01/09mnejuh_1_1 tag=TAG20110925T151217 comment=NONE
 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
 Finished backup at 25-SEP-2011 15:12:18

RMAN> exit

->Prepare an Initialization Parameter for the Standby Database

# ---[ Memory Parameters ] --- #
 TEST01DR.__db_cache_size=905969664
 TEST01DR.__java_pool_size=16777216
 TEST01DR.__large_pool_size=16777216
 TEST01DR.__shared_pool_size=285212672
 TEST01DR.__streams_pool_size=0

# ---[ Dump Destination Parameters ] --- #
 audit_file_dest='/opt/app/oracle/admin/TEST01DR/adump'
 background_dump_dest='/opt/app/oracle/admin/TEST01DR/bdump'
 core_dump_dest='/opt/app/oracle/admin/TEST01DR/cdump'
 user_dump_dest='/opt/app/oracle/admin/TEST01DR/udump'

# ---[ Role-independent Parameters ] --- #
 archive_lag_target=900
 compatible='10.2.0.1.0'
 control_files='/dbTEST01/u04/oradata/TEST01DR/control01.ctl', '/dbTEST01/u04/oradata/TEST01DR/control02.ctl', '/dbTEST01/u04/oradata/TEST01DR/control03.ctl'

db_name='test01'
 db_domain='bai.com'
 #db_create_file_dest='/dbTEST01/u04/oradata'
 db_recovery_file_dest='/opt/app/oracle/flash_recovery_area'
 dispatchers='(PROTOCOL=TCP) (SERVICE=turlockXDB)'
 instance_name='test01dr'
 log_archive_config='dg_config=(test01,test01dr)'
 log_archive_max_processes=4
 remote_login_passwordfile='exclusive'

# ---[ Primary Role Parameters ] --- #
 db_unique_name='test01dr'
 log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=test01dr'
 log_archive_dest_2='service=test01.bai.com valid_for=(online_logfiles,primary_role) db_unique_name=test01'
 log_archive_dest_state_1='enable'
 log_archive_dest_state_2='enable'
 service_names='test01dr.bai.com, test01'

# ---[ Standby Role Parameters ] --- #
 db_file_name_convert='/dbTEST01/u04/oradata/TEST01/','/dbTEST01/u04/oradata/TEST01DR/'
 log_file_name_convert='/dbTEST01/u04/oradata/TEST01/','/dbTEST01/u04/oradata/TEST01DR/'
 fal_server='test01','test01dr'
 fal_client='test01dr'
 standby_file_management='auto'

->Transfer Files to the Standby Host

[oracle@lnxdg01 TEST01]$ scp * lnxdg02:/dbTEST01/u05/backup/TEST01/
 oracle@lnxdg02's password:
 05mnejs6_1_1                                                                                                  100%   51MB  17.1MB/s   00:03
 06mnejsa_1_1                                                                                                  100%  506MB  14.4MB/s   00:35
 07mnejtd_1_1                                                                                                  100% 7232KB   7.1MB/s   00:00
 08mnejtf_1_1                                                                                                  100% 3072     3.0KB/s   00:00
 09mnejuh_1_1                                                                                                  100% 7232KB   7.1MB/s   00:01
 initTEST01DR.ora                                                                                              100% 2085     2.0KB/s   00:00

Configure Oracle Net Components

 Primary Host

SID_LIST_LISTENER =
 (SID_LIST =
 (SID_DESC =
 (SID_NAME = PLSExtProc)
 (ORACLE_HOME = /opt/app/oracle/product/10.2.0/db_1)
 (PROGRAM = extproc)
 )
 (SID_DESC =
 (GLOBAL_DBNAME = test01.bai.com)
 (SID_NAME = test01)
 (ORACLE_HOME = /opt/app/oracle/product/10.2.0/db_1)
 )
 )

INBOUND_CONNECT_TIMEOUT_LISTENER = 0

LISTENER =
 (DESCRIPTION_LIST =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST = lnxdg01.bai.com)(PORT = 1521))
 (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
 )
 )
Standby Host

SID_LIST_LISTENER =
 (SID_LIST =
 (SID_DESC =
 (SID_NAME = PLSExtProc)
 (ORACLE_HOME = /opt/app/oracle/product/10.2.0/db_1)
 (PROGRAM = extproc)
 )
 (SID_DESC =
 (GLOBAL_DBNAME = test01dr.bai.com)
 (SID_NAME = test01dr)
 (ORACLE_HOME = /opt/app/oracle/product/10.2.0/db_1)
 )
 )

INBOUND_CONNECT_TIMEOUT_LISTENER = 0

LISTENER =
 (DESCRIPTION_LIST =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST = lnxdg02.bai.com)(PORT = 1521))
 (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
 )
 )

>add entry to tnsnames.ora

test01.bai.com =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST = lnxdg01.bai.com)(PORT = 1521))
 (CONNECT_DATA =
 (SERVER = DEDICATED)
 (SERVICE_NAME = test01.bai.com)
 )
 )

test01dr.bai.com =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST = lnxdg02.bai.com)(PORT = 1521))
 (CONNECT_DATA =
 (SERVER = DEDICATED)
 (SERVICE_NAME = test01dr.bai.com)
 )
 )

Configure the Standby Database

> create standby password file
[oracle@lnxdg02 admin]$ cd $ORACLE_HOME/dbs
[oracle@lnxdg02 dbs]$ orapwd file=orapwTEST01DR password=syspassword

>create pfile for standby database.
[oracle@lnxdg02 TEST01]$scp initTEST01DR.ora /opt/app/oracle/product/10.2.0/db_1/dbs/

[oracle@lnxdg02 dbs]$ ls -lrt
total 36
-rw-r—– 1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r—– 1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r—– 1 oracle oinstall  1536 Sep 25 08:20 orapwTEST01DR
-rw-r–r– 1 oracle oinstall  2086 Sep 25 14:35 initTEST01DR.ora
[oracle@lnxdg02 dbs]$

> create standby directory

mkdir -p /opt/app/oracle/admin/TEST01DR/adump
mkdir -p /opt/app/oracle/admin/TEST01DR/bdump
mkdir -p /opt/app/oracle/admin/TEST01DR/cdump
mkdir -p /opt/app/oracle/admin/TEST01DR/dpdump
mkdir -p /opt/app/oracle/admin/TEST01DR/pfile
mkdir -p /opt/app/oracle/admin/TEST01DR/scripts
mkdir -p /opt/app/oracle/admin/TEST01DR/udump

mkdir -p /dbTEST01/u04/oradata/TEST01

mkdir -p /opt/app/oracle/flash_recovery_area/TEST01DR/archivelog
mkdir -p /opt/app/oracle/flash_recovery_area/TEST01DR/onlinelog

> start standby database
[oracle@lnxdg02 dbs]$ sqlplus ‘/ as sysdba’

SQL*Plus: Release 10.2.0.1.0 – Production on Sun Sep 25 14:46:13 2011

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

Connected to an idle instance.

SQL> startup nomount;
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size            2019320 bytes
Variable Size           75497480 bytes
Database Buffers       88080384 bytes
Redo Buffers            2174976 bytes
SQL>

create the physical standby
[oracle@lnxdg02 dbs]$ rman target sys/syspassword@test01.bai.com auxiliary /

Recovery Manager: Release 10.2.0.1.0 – Production on Sun Sep 25 17:23:17 2011

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

connected to target database: TEST01 (DBID=3570172646)
connected to auxiliary database: TEST01 (not mounted)

RMAN> duplicate target database for standby;

Starting Duplicate Db at 25-SEP-2011 17:23:28
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

contents of Memory Script:
{
restore clone standby controlfile;
sql clone ‘alter database mount standby database’;
}
executing Memory Script

Starting restore at 25-SEP-2011 17:23:29
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /dbTEST01/u05/backup/TEST01/09mnejuh_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/dbTEST01/u05/backup/TEST01/09mnejuh_1_1 tag=TAG20110925T151217
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output filename=/dbTEST01/u04/oradata/TEST01DR/control01.ctl
output filename=/dbTEST01/u04/oradata/TEST01DR/control02.ctl
output filename=/dbTEST01/u04/oradata/TEST01DR/control03.ctl
Finished restore at 25-SEP-2011 17:23:30

sql statement: alter database mount standby database
released channel: ORA_AUX_DISK_1

contents of Memory Script:
{
set newname for tempfile  1 to
“/dbTEST01/u04/oradata/TEST01DR/temp01.dbf”;
switch clone tempfile all;
set newname for datafile  1 to
“/dbTEST01/u04/oradata/TEST01DR/system01.dbf”;
set newname for datafile  2 to
“/dbTEST01/u04/oradata/TEST01DR/undotbs01.dbf”;
set newname for datafile  3 to
“/dbTEST01/u04/oradata/TEST01DR/sysaux01.dbf”;
set newname for datafile  4 to
“/dbTEST01/u04/oradata/TEST01DR/users01.dbf”;
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to /dbTEST01/u04/oradata/TEST01DR/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 25-SEP-2011 17:23:36
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /dbTEST01/u04/oradata/TEST01DR/system01.dbf
restoring datafile 00002 to /dbTEST01/u04/oradata/TEST01DR/undotbs01.dbf
restoring datafile 00003 to /dbTEST01/u04/oradata/TEST01DR/sysaux01.dbf
restoring datafile 00004 to /dbTEST01/u04/oradata/TEST01DR/users01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /dbTEST01/u05/backup/TEST01/06mnejsa_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/dbTEST01/u05/backup/TEST01/06mnejsa_1_1 tag=TAG20110925T151106
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 25-SEP-2011 17:23:53

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy recid=5 stamp=762801834 filename=/dbTEST01/u04/oradata/TEST01DR/system01.dbf
datafile 2 switched to datafile copy
input datafile copy recid=6 stamp=762801834 filename=/dbTEST01/u04/oradata/TEST01DR/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=7 stamp=762801834 filename=/dbTEST01/u04/oradata/TEST01DR/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=8 stamp=762801834 filename=/dbTEST01/u04/oradata/TEST01DR/users01.dbf
Finished Duplicate Db at 25-SEP-2011 17:23:54

RMAN> exit

>Start Redo Apply on the Standby Database
alter database recover managed standby database disconnect;

Start Remote Archiving
alter system set log_archive_dest_state_2=enable scope=both;
alter system archive log current;

Verifying the Physical Standby Database

SQL> select status, error from v$archive_dest where dest_id = 2;

STATUS      ERROR
——— —————————————————————–
VALID

on standby
SQL> alter session set nls_date_format = ‘DD-MON-YYYY HH24:MI:SS’;

Session altered.

SQL> select sequence#, first_time, next_time, archived, applied from v$archived_log order by sequence#;

SEQUENCE# FIRST_TIME        NEXT_TIME         ARC APP
———- ——————– ——————– — —
37 25-SEP-2011 15:11:00 25-SEP-2011 15:11:43 YES YES
38 25-SEP-2011 15:11:43 25-SEP-2011 15:26:43 YES YES
39 25-SEP-2011 15:26:43 25-SEP-2011 17:08:09 YES YES
40 25-SEP-2011 17:08:09 25-SEP-2011 17:21:42 YES YES
41 25-SEP-2011 17:21:42 25-SEP-2011 17:29:33 YES YES
42 25-SEP-2011 17:29:33 25-SEP-2011 17:29:34 YES YES
43 25-SEP-2011 17:29:34 25-SEP-2011 17:44:37 YES YES
44 25-SEP-2011 17:44:37 25-SEP-2011 17:59:37 YES YES
45 25-SEP-2011 17:59:37 25-SEP-2011 18:02:20 YES YES
46 25-SEP-2011 18:02:20 25-SEP-2011 18:02:23 YES YES
47 25-SEP-2011 18:02:23 25-SEP-2011 18:02:26 YES YES
48 25-SEP-2011 18:02:26 25-SEP-2011 18:14:01 YES YES
49 25-SEP-2011 18:14:01 25-SEP-2011 18:14:02 YES YES
50 25-SEP-2011 18:14:02 25-SEP-2011 18:14:05 YES YES

14 rows selected.

DONE

THANKS

Bai