Physical Standby Database (DR) Configuration: Standalone:
Primary Server : OLX495
Primary Database : RAZZ
Secondary Server : olx494
Secondary Database : RAZZDR
- There are some basic prerequisites parameters need to be set at primary database as follows :
ON OLX495 : Primary
[oracle@olx495 dbawork]$ export ORACLE_SID=RAZZ
[oracle@olx495 dbawork]$ sqlplus sys/saturn08@RAZZ as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 17 21:13:32 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the OLAP, Data Mining and Real Application Testing options
SQL> show parameter db_n
NAME TYPE VALUE
———————————— ———– ——————————
db_name string RAZZ
SQL> show parameter db_unique
NAME TYPE VALUE
———————————— ———– ——————————
db_unique_name string RAZZ
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
SQL> alter system set LOG_ARCHIVE_CONFIG=’DG_CONFIG=(RAZZ,RAZZDR)’ scope=both;
System altered.
SQL> show parameter control_files
NAME TYPE VALUE
———————————— ———– ——————————
control_files string /oracle/dbawork/RAZZ_TEST/cont
rol/RAZZ/control01.ctl, /oracl
e/dbawork/RAZZ_TEST/control/RA
ZZ/control02.ctl
SQL> alter system set LOG_ARCHIVE_DEST_1=’LOCATION=/oracle/dbawork/RAZZ_TEST/archive_logs VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=RAZZ’ scope=both;
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_2=’SERVICE=RAZZDR LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=RAZZDR’ scope=both;
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=both;
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=both;
System altered.
SQL> alter system set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE scope=spfile;
System altered.
SQL> alter system set STANDBY_FILE_MANAGEMENT=AUTO scope=both;
System altered.
SQL> show parameter fal_
NAME TYPE VALUE
———————————— ———– ——————————
fal_client string RAZZ
fal_server string RAZZDR
SQL>
SQL>exit
2 : Take Full backup of Primary database :
[oracle@olx495 backup]$ rman target /
Recovery Manager: Release 11.2.0.3.0 – Production on Mon Feb 17 21:38:30 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: RAZZ (DBID=824804085)
RMAN> run
2> {
3> allocate channel t1 device type disk format ‘/oracle/dbawork/RAZZ_TEST/backup/df_%U.bak’;
4> allocate channel t2 device type disk format ‘/oracle/dbawork/RAZZ_TEST/backup/df_%U.bak’;
5> backup database;
6> release channel t1;
7> release channel t2;
8> }
using target database control file instead of recovery catalog
allocated channel: t1
channel t1: SID=145 device type=DISK
allocated channel: t2
channel t2: SID=40 device type=DISK
Starting backup at 17-FEB-14
channel t1: starting full datafile backup set
channel t1: specifying datafile(s) in backup set
input datafile file number=00002 name=/oracle/dbawork/RAZZ_TEST/oradata/RAZZ/sysaux01.dbf
channel t1: starting piece 1 at 17-FEB-14
channel t2: starting full datafile backup set
channel t2: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/dbawork/RAZZ_TEST/oradata/RAZZ/system01.dbf
input datafile file number=00004 name=/oracle/dbawork/RAZZ_TEST/oradata/RAZZ/users01.dbf
channel t2: starting piece 1 at 17-FEB-14
channel t1: finished piece 1 at 17-FEB-14
piece handle=/oracle/dbawork/RAZZ_TEST/backup/df_4bp0skq1_1_1.bak tag=TAG20140217T214017 comment=NONE
channel t1: backup set complete, elapsed time: 00:00:25
channel t1: starting full datafile backup set
channel t1: specifying datafile(s) in backup set
input datafile file number=00005 name=/oracle/dbawork/RAZZ_TEST/oradata/RAZZ/example01.dbf
input datafile file number=00003 name=/oracle/dbawork/RAZZ_TEST/oradata/RAZZ/undotbs01.dbf
input datafile file number=00006 name=/oracle/dbawork/RAZZ_TEST/oradata/RAZZ/razz01.dbf
input datafile file number=00007 name=/oracle/dbawork/RAZZ_TEST/oradata/RAZZ/TEST1.dbf
channel t1: starting piece 1 at 17-FEB-14
channel t2: finished piece 1 at 17-FEB-14
piece handle=/oracle/dbawork/RAZZ_TEST/backup/df_4cp0skq1_1_1.bak tag=TAG20140217T214017 comment=NONE
channel t2: backup set complete, elapsed time: 00:00:25
channel t2: starting full datafile backup set
channel t2: specifying datafile(s) in backup set
including current control file in backup set
channel t2: starting piece 1 at 17-FEB-14
channel t1: finished piece 1 at 17-FEB-14
piece handle=/oracle/dbawork/RAZZ_TEST/backup/df_4dp0skqq_1_1.bak tag=TAG20140217T214017 comment=NONE
channel t1: backup set complete, elapsed time: 00:00:02
channel t1: starting full datafile backup set
channel t1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel t1: starting piece 1 at 17-FEB-14
channel t2: finished piece 1 at 17-FEB-14
piece handle=/oracle/dbawork/RAZZ_TEST/backup/df_4ep0skqq_1_1.bak tag=TAG20140217T214017 comment=NONE
channel t2: backup set complete, elapsed time: 00:00:01
channel t1: finished piece 1 at 17-FEB-14
piece handle=/oracle/dbawork/RAZZ_TEST/backup/df_4fp0skqs_1_1.bak tag=TAG20140217T214017 comment=NONE
channel t1: backup set complete, elapsed time: 00:00:00
Finished backup at 17-FEB-14
released channel: t1
released channel: t2
RMAN> exit
Recovery Manager complete.
- Create Controlfile and pfile for Standby Database :
[oracle@olx495 backup]$ sqlplus sys/saturn08@RAZZ as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 17 21:41:02 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the OLAP, Data Mining and Real Application Testing options
SQL> alter database create standby controlfile as ‘/oracle/dbawork/RAZZ_TEST/control/RAZZ/RAZZDR_control.ctl’;
Database altered.
SQL> create pfile from spfile;
File created.
- : Points to Do :
- Create password file in both the databases (password must be same), you can copy the password file from prod to DR and rename it in DR site.
after creation of password file, put the tns entries in both the servers.check the connection in both the servers.
Eg :
orapwd file=orapwRAZZ.ora password=saturn08
or
$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/pwd<sid>.ora password=oracle entries=5
- Transfer all backup pieces,controlfile and pfile on olx494(Secondary).
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Change parameter on init file according to Standby database :
on Glaolx494:
*.db_name=’RAZZ’
*.db_unique_name=’RAZZDR’
*.log_archive_config=’DG_CONFIG=(RAZZDR,RAZZ)’
*.log_archive_dest_1=’LOCATION=/oracle/dbawork/RAZZ_TEST/archive_logs VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=RAZZDR’
*.log_archive_dest_2=’SERVICE=RAZZ LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=RAZZ’
*.fal_client=’RAZZDR’
*.fal_server=’RAZZ’
- Start DR Database as follows :
[oracle@olx494 dbs]$ export ORACLE_SID=RAZZDR
[oracle@olx494 dbs]$ sqlplus “/as sysdba”
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 17 22:30:24 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup pfile=’initRAZZDR.ora’ mount;
ORACLE instance started.
Total System Global Area 939495424 bytes
Fixed Size 2233960 bytes
Variable Size 578816408 bytes
Database Buffers 352321536 bytes
Redo Buffers 6123520 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
Create password file in both the databases (password must be same), you can coppy the password file from prod to DR and rename it in DR site.
after creation of password file, put the tns entries in both the servers.check the connection in both the servers.
orapwd file=orapwRAZZ.ora password=saturn08
or
$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/pwd<sid>.ora password=oracle entries=5
- Check Connection tns entries :
[oracle@olx494 dbs]$ sqlplus sys/saturn08@RAZZDR as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 17 22:30:59 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
SQL> conn sys/saturn08@RAZZ as sysdba
Connected.
SQL> conn sys/saturn08@RAZZDR as sysdba
Connected.
SQL>exit
- Restore Database using backup pieces :
[oracle@olx494 backup]$ rman target /
Recovery Manager: Release 11.2.0.3.0 – Production on Mon Feb 17 22:41:48 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: RAZZ (DBID=824804085, not open)
RMAN> catalog start with ‘/oracle/dbawork/RAZZ_TEST/backup/’;
using target database control file instead of recovery catalog
searching for all files that match the pattern /oracle/dbawork/RAZZ_TEST/backup/
no files found to be unknown to the database
RMAN> restore database;
Starting restore at 2014-02-17 22:42:15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=216 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /oracle/dbawork/RAZZ_TEST/oradata/RAZZ/system01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /oracle/dbawork/RAZZ_TEST/oradata/RAZZ/users01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/dbawork/RAZZ_TEST/backup/df_4cp0skq1_1_1.bak
channel ORA_DISK_1: piece handle=/oracle/dbawork/RAZZ_TEST/backup/df_4cp0skq1_1_1.bak tag=TAG20140217T214017
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /oracle/dbawork/RAZZ_TEST/oradata/RAZZ/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/dbawork/RAZZ_TEST/backup/df_4bp0skq1_1_1.bak
channel ORA_DISK_1: piece handle=/oracle/dbawork/RAZZ_TEST/backup/df_4bp0skq1_1_1.bak tag=TAG20140217T214017
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /oracle/dbawork/RAZZ_TEST/oradata/RAZZ/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /oracle/dbawork/RAZZ_TEST/oradata/RAZZ/example01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /oracle/dbawork/RAZZ_TEST/oradata/RAZZ/razz01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /oracle/dbawork/RAZZ_TEST/oradata/RAZZ/TEST1.dbf
channel ORA_DISK_1: reading from backup piece /oracle/dbawork/RAZZ_TEST/backup/df_4dp0skqq_1_1.bak
channel ORA_DISK_1: piece handle=/oracle/dbawork/RAZZ_TEST/backup/df_4dp0skqq_1_1.bak tag=TAG20140217T214017
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 2014-02-17 22:42:45
RMAN> exit
Recovery Manager complete.
[oracle@olx494 backup]$ sqlplus sys/saturn08@RAZZDR as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 17 22:43:07 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/dbawork/RAZZ_TEST/archive_logs
Oldest online log sequence 279
Next log sequence to archive 0
Current log sequence 280
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/dbawork/RAZZ_TEST/archive_logs
Oldest online log sequence 279
Next log sequence to archive 0
Current log sequence 280
Switch logfiles manually on RAZZ:
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/dbawork/RAZZ_TEST/archive_logs
Oldest online log sequence 278
Next log sequence to archive 280
Current log sequence 280
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/dbawork/RAZZ_TEST/archive_logs
Oldest online log sequence 284
Next log sequence to archive 286
Current log sequence 286
Now Check logs status on RAZZDR :
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/dbawork/RAZZ_TEST/archive_logs
Oldest online log sequence 284
Next log sequence to archive 0
Current log sequence 286
SQL>