You are on page 1of 10

CREATE STANDBY DATABASE ON ORACLE 10G (STANDARD EDITION

ONE) ON WINDOW PLATFORM USING RMAN

Overview
This document explains how to setup Standby Database and apply logs.

This document describes oracle Standby setup for ORCL databases.

All of the Machine have Oracle 10g (10.2.0.1.0)

Prerequisite :
1. Install Oracle 10g software on Standby Server;
2. On Primary Server Archiving log should be ON. use below command to check archiving is enable

SQL>select log_mode from v$database;

Enviroment:
db version: 10.2.0.1.0 (standard edition One)
Primary         database Name: orcl      location: D:\Oracle\product\10.2.0\db_1 ipaddress:
10.8.18.56
Physical standby    database Name: orcl   location: D:\Oracle\product\10.2.0\db_1 ipaddress:
10.8.18.57

Step 1: Create a Folders on Primary and Standby Servers for Create files on specific folders.

Primary Machine:

C:\> D:\Oracle\product\10.2.0\flash_recovery_area\

Standby Machine

C:\> D:\Oracle\product\10.2.0\flash_recovery_area\ANKUR\ARCHIVELOG

C:\> D:\Oracle\product\10.2.0\admin\ANKUR\adump
C:\> D:\Oracle\product\10.2.0\admin\ANKUR\udump
C:\> D:\Oracle\product\10.2.0\admin\ANKUR\bdump
C:\> D:\Oracle\product\10.2.0\admin\ANKUR\cdump
C:\> D:\Oracle\product\10.2.0\oradata\ANKUR

Step 2: On Primary Server Create a password file for the standby :

This file will become on location C:\rman_backup\ANKUR_backup\ with named orapworcl as below

C:\> orapwd file = C:\rman_backup\ANKUR_backup\orapworcl password=password entries=2

Step 3: Create a listener and make the tns entries for both Servers

Example : Below are the example of tns entries of both Servers (Primary and Standby)

Primary Entries:

orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.18.56)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

orclq =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.18.57)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(UR=A)
)
)

Standby Entries:

orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.18.56)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

orclq =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.18.57)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(UR=A)
)
)

Note : You Can Ping The Tns Entries Of Both Machine Like
C:\> tnsping orcl
C:\> tnsping orclq

Step 4: On primary Server Create a PFILE from spfile on location ’C:\rman_backup\ANKUR_backup


with named pfile.ora

Sql> create pfile=’C:\rman_backup\ANKUR_backup/pfile.ora’ from spfile;

Note: Open the pfile and remove the some entries, which is in bold and italic font. Below are the exapmle.

Before deletion Entries:+


orcl.__db_cache_size=390070272
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__shared_pool_size=197132288
orcl.__streams_pool_size=8388608
*.audit_file_dest='D:\oracle\product\10.2.0/admin/orcl/adump'
*.background_dump_dest='D:\oracle\product\10.2.0/admin/orcl/bdump'
*.compatible='10.2.0.1.0'
*.control_files='D:\oracle\product\10.2.0/oradata/orcl/\control01.ctl','D:\oracle\product\10.2.0/oradata/
orcl/\control02.ctl','D:\oracle\product\10.2.0/oradata/orcl/\control03.ctl'
*.core_dump_dest='D:\oracle\product\10.2.0/admin/orcl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.db_recovery_file_dest='D:\oracle\product\10.2.0/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=D:\Oracle\product\10.2.0\flash_recovery_area\ORCL\
ARCHIVELOG'
*.log_archive_format='ARCHIVELOGARC%S_%R.%T'
*.open_cursors=300
*.pga_aggregate_target=202375168
*.processes=800
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=609222656
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='D:\oracle\product\10.2.0/admin/orcl/udump'

After Deletion Entries:

*.audit_file_dest='C:\oracle\product\10.2.0\admin\orcl\adump'
*.background_dump_dest='C:\Oracle\product\10.2.0\admin\orcl\bdump'
*.compatible='10.2.0.1.0'
*.control_files='C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL','C:\ORACLE\
PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL','C:\ORACLE\PRODUCT\10.2.0\
ORADATA\ORCL\CONTROL03.CTL'#Restore Controlfile
*.db_block_size=8192
*.DB_FILE_NAME_CONVERT='D:\Oracle\product\10.2.0\oradata\orcl','C:\oracle\product\10.2.0\
oradata\orcl'
*.db_name='orcl'
*.db_recovery_file_dest='C:\oracle\product\10.2.0\flash_recovery_area\orcl'
*.db_recovery_file_dest_size=2G
*.log_archive_dest_1='LOCATION=C:\Oracle\product\10.2.0\flash_recovery_area\ORCL\
ARCHIVELOG'
*.log_archive_format='ARC%S_%R.%T'
*.LOG_FILE_NAME_CONVERT='D:\Oracle\product\10.2.0\oradata\orcl','C:\oracle\product\10.2.0\
oradata\orcl'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='C:\oracle\product\10.2.0/admin/orcl/udump'

Note : --If binaries of machine are on different location or different location of logfile and datafile of
standby database then for convert the location use DB_FILE_NAME_CONVERT and
LOG_FILE_NAME_CONVERT parameter.

Step 5: On Primary Server Connect to rman to taking complete backup with archivelog,

C:\> rman target sys/password@orcl

Rman> configure channel device type disk format ‘C:\rman_backup\ANKUR_backup\orcl_backup_%U’;

Rman > backup database plus archivelog;

Rman>exit
Steop 6: Copy Folders from Primary to Standby Machine:

Copy all files from ANKUR_backup folder (Primary Machine) to ANKUR_backup folder (Standby Machine).
Where we recently take the backup and make the orapw and pfile files.

Step 7: On standby Server Copy orapwd file on default location

Copy a orapworcl file from ANKUR_backup to D:\Oracle\product\10.2.0\db_1\dbs location. Which is a


default location

Step 8: On standby Server Create instance using oradim command

C:\> oradim –new –sid orcl -intpwd password –startmode manual

Note: if not able to shutdown then delete it like oradim –delete –sid orcl and then if not able to create new then
use below command

C:\> oradim -new -sid orcl –syspwd password -startmode auto -srvcstart system -spfile -shutmode
immediate

Step 9: On standby Server Create a spfile from pfile

C:\> sqlplus sys/password as sysdba

NOTE: connect to an idle instance

Sql> create spfile from pfile=’ /opt/oracle/product/backup/orcl/pfile.ora’;

Step 10: On Standby Server Start database on nomount state

Sql> startup nomount

Step 11: On Primary Server Connect to rman with auxiliary database to create duplicate target database

C:\> rman target sys/password@orcl auxiliary sys/password@orclq

Rman> duplicate target database to “orcl” nofilenamecheck


Step 12: On Standby Server Connect through sql and check the status

C:\> sqlplus sys/password@orclq as sysdba

Sql> select status from v$instance;

Sql> shu immediate

Sql>startup

Step 13: On Primary Server Connect to rman and take the complete backup

C:\> rman target sys/password@orcl

Rman> backup database plus archivelog;

Rman> backup current controlfile for standby format ‘C:\rman_backup\ANKUR_backup/standby_control_


%U’;

Rman>exit

Step 14: On Primary Server Connect through SQL and alter switch logfile.

C:\> sqlplus sys/password@pd1epsc as sysdba

Sql> alter system switch logfile;

Sql> /

Sql> select max (sequence#) from v$archived_log;

Step 15: On Primary Server Connect to rman and backup the archievlog files

C:\> rman target sys/password@orcl

Rman> backup archivelog all;

Rman>exit
Step 16: On Standby Server Edit the pfile

Goto on C:\rman_backup\ANKUR_backup folder and edit pfile

Add the below parameters in pfile:

*.db_recovery_file_dest_size=2147483648
*.db_recovery_file_dest=' D:\Oracle\product\10.2.0\flash_recovery_area\orcl\ARCHIVELOG/'
*.log_archive_dest_1='LOCATION= D:\Oracle\product\10.2.0\flash_recovery_area\orcl\ARCHIVELOG’
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='orcl_%t_%s_%r.arc'

Step 17: On Standby Server Create a spfile from pfile

C:\> sqlplus sys/password@orclq as sysdba

NOTE: connect to an idle instance

Sql> create spfile from pfile=’C:\rman_backup\ANKUR_backup/pfile.ora’;

Step 18: On Standby Server Start database on nomount state

Sql> startup nomount

Step 19: On Primary Server Connect to rman with auxiliary database to create duplicate target database.

C:\> rman target sys/password@orcl auxiliary sys/password@orclq

Rman> run{
Set until sequence 170;
Duplicate target database for standby dorecover nofilenamecheck;
}

Step 20: On Standby Server Connect through sql and recover standby database through archivelog files.

C:\> sqlplus sys/password@orclq as sysdba

Sql> SELECT open_mode FROM v$database;

Sql> recover standby database;


Auto (write when asked)

Note: It will show the required logfile number for apply updates:

Sql> select sequence#, name from v$archived_name;

Step 21: On Primary Server Connect through SQL and alter the system switchlog file:

For testing purpose create tables on Primary Server by apply log and it will automatically create tables on
Standby server

C:\> sqlplus sys/password@pd1epsc as sysdba

Sql> alter system switch logfile;

Sql> /

Sql> select sequence#, name from v$archived_name;

Sql> create table test_table(id number);


Sql> insert into test_table values (22);
Sql> commt;

Sql> alter system switch logfile;

Sql> /

Steop22: Move Archivelog from primary Server to Standby Server.

Copy files from D:\Oracle\product\10.2.0\flash_recovery_area\ANKUR\ARCHIVELOG (Primary Server)


folder to D:\Oracle\product\10.2.0\flash_recovery_area\ANKUR\ARCHIVELOG (Standby Server)

Step 23: On Standby Server Connect through SQL and recover standby database

C:\> sqlplus sys/password@orclq as sysdba

Sql> recover standby database;


Auto (write when asked)

Note: It will show the required logfile number for apply updates:
Sql> select sequence#, name from v$archived_name;

Step 24: on standby Server Check newly created table test_table


Sql> alter database open;
Sql> select count (*) from tab;
Sql> select * from test_table;

Note : Standby database will open In read only database Mode;

You might also like