You are on page 1of 12

CREATE STANDBY DATABASE USING RMAN

1. Check Primary database parameters: SQL> alter database FORCE LOGGING; Database altered.

SQL> select FORCE_LOGGING from v$database; FOR --YES SQL> alter system set fal_client='eabprd1'; System altered.

SQL> alter system set fal_server='sb_eabprd1'; System altered.

SQL> alter system set log_archive_dest_2='service=sb_eabprd1 optional reopen=15'; System altered.

SQL> alter system set log_archive_dest_state_2='defer'; System altered.

SQL> alter system set standby_archive_dest='/eabprd104/oradata/eabprd1/arch';

System altered.

SQL> alter system set standby_file_management='auto'; System altered.

2. Run backup standby controlfile at Primary to use for Standby


$ setsid eabprd1 $ rman target / catalog rman/rman@eabprd1 RMAN> run { allocate channel c1 type disk; backup current controlfile for standby format '/datadomain/prod/eabprd1/%U'; }

3. Copy init file and password file from Primary database to Standby server.
scp initeabprd1.ora oracle@rohan:/u01/app/oracle/product/10.2.0.4/db/dbs/. scp orapweabprd1 oracle@rohan:/u01/app/oracle/product/10.2.0.4/db/dbs/.

4. Create similar directory structure as Primary database server (Hawaii) on Standby Server (Rohan). Add instance name to /etc/oratab file. $ cat /etc/oratab
eabprd1:/u01/app/oracle/product/10.2.0.4/db:N $ setsid eabprd1

5. Modify init file on Standby if directory structure is different than Primary. If directory structure is similar then ignore db_file_name_covert and log_file_name_convert parameters.

*.db_file_name_convert='/eabprd1-01/','/u02/','/eabprd102/','/u03/','/eabprd1-03','/u04/','/eabprd1-04','/u04/' *.log_file_name_convert='/eabprd1-04/','/u04/' *.fal_client='sb_eabprd1' *.fal_server='eabprd1' *.log_archive_dest_1='LOCATION=/u04/oradata/eabprd1/arch' *.log_archive_dest_2='service=eabprd1 optional reopen=15' *.log_archive_dest_state_1='enable' *.log_archive_dest_state_2='defer' *.standby_archive_dest='/u04/oradata/eabprd1/arch' *.standby_file_management='auto'

6. Create spfile from pfile on Standby database and startup in nomount stage. idle> create spfile from pfile='?/dbs/initeabprd1.ora'; File created. idle> startup nomount ORACLE instance started. Total System Global Area 1610612736 bytes Fixed Size Variable Size Database Buffers Redo Buffers 2084296 bytes 570425912 bytes 1023410176 bytes 14692352 bytes

7. Create and copy TNS entry for Standby to Primary database and copy TNS Entry for Primary database to Standby database server.

Primary: EABPRD1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.99.1)(PORT = 42516)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.99.1)(PORT = 42517)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.99.1)(PORT = 42518)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.99.1)(PORT = 42519)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.99.1)(PORT = 42520)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = eabprd1) ) )

Standby:

SB_EABPRD1 = (DESCRIPTION = (ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 10.170.1.19)(PORT = 42516)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.170.1.19)(PORT = 42517)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.170.1.19)(PORT = 42518)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.170.1.19)(PORT = 42519)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.170.1.19)(PORT = 42520)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = eabprd1) ) )

8. Login to Primary database and create standby controlfile oracle@hawaii[/eabprd1-04/oradata/eabprd1/arch] rman target / catalog rman/rman@eabprd1

Recovery Manager: Release 10.2.0.4.0 - Production on Thu Jun 25 13:28:14 2009

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

connected to target database: EABPRD1 (DBID=4026159785)

connected to recovery catalog database

RMAN> backup current controlfile for standby format '/datadomain/prod/eabprd1/stdby_ctl_%U';

Starting backup at 25-JUN-09 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=1298 devtype=DISK 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-JUN-09 channel ORA_DISK_1: finished piece 1 at 25-JUN-09 piece handle=/datadomain/prod/eabprd1/stdby_ctl_49kifg0o_1_1 tag=TAG20090625T132856 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 Finished backup at 25-JUN-09

Starting Control File and SPFILE Autobackup at 25-JUN-09 piece handle=/datadomain/prod/eabprd1/cf_c-4026159785-2009062505_full_ctrl comment=NONE Finished Control File and SPFILE Autobackup at 25-JUN-09

9. Login to Standby (auxiliary) , target and catalog from Standby server and run following script: If directory structure is same on Primary and Standby database server then use following script:

create_standby.rcv run { set until scn 5933075; duplicate target database for standby nofilenamecheck dorecover; }

If directory structure is different then use following script: create_standby.rcv run { set until scn 5933075; duplicate target database for standby dorecover; }

oracle@rohan[/u01/app/oracle/eabprd1_scripts] rman target sys/oe197#eab1@eabprd1 catalog rman/rman@eabprd1 auxiliary /

Recovery Manager: Release 10.2.0.4.0 - Production on Thu Jun 25 13:47:22 2009

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

connected to target database: EABPRD1 (DBID=4026159785)

connected to recovery catalog database connected to auxiliary database: EABPRD1 (not mounted)

RMAN> @ create_standby.rcv run { set until scn 5933075; duplicate target database for standby dorecover; } executing command: SET until clause

Starting Duplicate Db at 25-JUN-09 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: sid=1311 devtype=DISK

contents of Memory Script: { set until scn 5933075; restore clone standby controlfile; sql clone 'alter database mount standby database'; } . . . media recovery complete, elapsed time: 00:00:02

Finished recover at 25-JUN-09 Finished Duplicate Db at 25-JUN-09 RMAN> exit

10. Once duplicate database becomes successful then turn on the Managed Recover Process (MRP) on standby database. Standby Database: oracle@rohan[/u01/app/oracle] sqlplus '/ as sysdba'

SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jun 25 13:50:54 2009

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

idle> alter database recover managed standby database disconnect;

Database altered.

11. Enable log_archive_dest_state_2 on Primary database and switch archive logs couple of times.

Primary database: oracle@hawaii[/datadomain/prod/eabprd1] sqlplus '/ as sysdba' SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jun 25 13:51:13 2009 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> alter system set log_archive_dest_state_2=enable; System altered. SQL> alter system switch logfile; System altered. SQL> / System altered. SQL> / SQL> archive log list Database log mode Automatic archival Archive destination Archive Mode Enabled /eabprd1-04/oradata/eabprd1/arch 186

Oldest online log sequence

Next log sequence to archive 188 Current log sequence 188

12. Login to Standby database and check if archive logs are getting applied

On Standby database: oracle@rohan[/u01/app/oracle/eabprd1_scripts] sqlplus '/ as sysdba' SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jun 25 13:58:15 2009 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

idle> select sequence#,applied from v$archived_log order by sequence#;

SEQUENCE# APP ---------- --176 YES 177 YES 178 YES 179 YES 180 YES 181 YES 182 YES 183 YES 184 YES 185 YES 186 YES

187 YES

12 rows selected.

13.

Make sure to add this database to database of databases.

Follow these steps: Update Ticket. Update database of databases (gbyeas) tables. (databases, machines,user_codes etc.). Update tnsnames.ora file on Ganesha server. Make sure cronjobs are running.