Continuation of Part 2
ORACLE – Creating a Data Guard Physical Standby environment – Part2
Standby Database Steps
Create a Control File from Primary database for the Standby Database.
The standby database will use a control file that is generated on the primary database
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
SQL> startup mount; 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 Database mounted. SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/DB/oracle/product/10gDB/dbs/blackowl.ctl; Database altered. SQL> ALTER DATABASE OPEN; Database altered. |
Backup the Primary Database and transfer a copy to the Standby node.
Generate a script to copy files(Datafiles, Tempfiles and Redolog files).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
SQL> set pages 50000 lines 120 head off veri off flush off ti off SQL> spool cpfiles SQL> select 'scp -p '||file_name||' $v_dest' from dba_data_files; scp -p /test/db/PRIMARYDB/datafile/o1_mf_users_310mzml9_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_sysaux_310mzm34_.dbf $ v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_undotbs1_310mzmk2_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_system_310mzm27_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_test2_3117h15v_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_test3_3117h8nv_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_test4_3117hk7d_.dbf $v_dest 7 rows selected. SQL> select 'scp -p '||file_name||' $v_dest' from dba_temp_files; scp -p /test/db/PRIMARYDB/datafile/o1_mf_temp_310n2bnj_.tmp $v_dest SQL> select 'scp -p '||member||' $v_dest' from v$logfile; scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_3_310n22jj_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_2_310n21sx_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_1_310n215q_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_4_3gznjc9v_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_5_3gznnrh0_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_6_3gznrwd7_.log $v_dest 6 rows selected. SQL> spool off |
Shutdown the database, edit the script to add the v_dest location, and execute it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
[TEST1] > mv cpfiles.lst cpfiles $v_dest #!/bin/ksh v_dest=TEST2:/oradisk/od01/BLACKOWL/datafile/ scp -p /test/db/PRIMARYDB/datafile/o1_mf_users_310mzml9_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_sysaux_310mzm34_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_undotbs1_310mzmk2_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_system_310mzm27_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_test2_3117h15v_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_test3_3117h8nv_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_test4_3117hk7d_.dbf $v_dest scp -p /test/db/PRIMARYDB/datafile/o1_mf_temp_310n2bnj_.tmp $v_dest v_dest= TEST2:/oradisk/od01/BLACKOWL/onlinelog/ scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_3_310n22jj_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_2_310n21sx_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_1_310n215q_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_4_3gznjc9v_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_5_3gznnrh0_.log $v_dest scp -p /test/db/PRIMARYDB/onlinelog/o1_mf_6_3gznrwd7_.log $v_dest |
On the standby node create the required directories to get the datafiles
1 2 3 4 5 |
[root@TEST2 root]# mkdir -p /oradisk/od01/BLACKOWL/datafile/ [root@TEST2 root]# mkdir -p /oradisk/od01/BLACKOWL/onlinelog/ [root@TEST2 root]# chown -R oracle:dba /oradisk/od01 |
On the primary node execute the script to copy the database while the main database is down (or in backup mode)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
[TEST1] > chmod 700 cpfiles [TEST1] > ./cpfiles o1_mf_users_310mzml9_.dbf 100% 2801MB 7.0MB/s 06:37 o1_mf_sysaux_310mzm34_.dbf 100% 340MB 7.4MB/s 00:45 o1_mf_undotbs1_310mzmk2_.dbf 100% 100MB 8.0MB/s 00:12 o1_mf_system_310mzm27_.dbf 100% 490MB 7.0MB/s 01:09 o1_mf_test2_3117h15v_.dbf 100% 100MB 6.5MB/s 00:15 o1_mf_test3_3117h8nv_.dbf 100% 100MB 6.0MB/s 00:16 o1_mf_test4_3117hk7d_.dbf 100% 100MB 6.4MB/s 00:15 o1_mf_temp_310n2bnj_.tmp 100% 433MB 5.8MB/s 01:14 o1_mf_3_310n22jj_.log 100% 50MB 7.5MB/s 00:06 o1_mf_2_310n21sx_.log 100% 50MB 8.4MB/s 00:05 o1_mf_1_310n215q_.log 100% 50MB 8.8MB/s 00:05 o1_mf_4_3gznjc9v_.log 100% 50MB 7.7MB/s 00:06 o1_mf_5_3gznnrh0_.log 100% 50MB 8.2MB/s 00:06 o1_mf_6_3gznrwd7_.log 100% 50MB 4.9MB/s 00:10 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
[TEST1] > chmod 700 cpfiles [TEST1] > ./cpfiles o1_mf_users_310mzml9_.dbf 100% 2801MB 7.0MB/s 06:37 o1_mf_sysaux_310mzm34_.dbf 100% 340MB 7.4MB/s 00:45 o1_mf_undotbs1_310mzmk2_.dbf 100% 100MB 8.0MB/s 00:12 o1_mf_system_310mzm27_.dbf 100% 490MB 7.0MB/s 01:09 o1_mf_test2_3117h15v_.dbf 100% 100MB 6.5MB/s 00:15 o1_mf_test3_3117h8nv_.dbf 100% 100MB 6.0MB/s 00:16 o1_mf_test4_3117hk7d_.dbf 100% 100MB 6.4MB/s 00:15 o1_mf_temp_310n2bnj_.tmp 100% 433MB 5.8MB/s 01:14 o1_mf_3_310n22jj_.log 100% 50MB 7.5MB/s 00:06 o1_mf_2_310n21sx_.log 100% 50MB 8.4MB/s 00:05 o1_mf_1_310n215q_.log 100% 50MB 8.8MB/s 00:05 o1_mf_4_3gznjc9v_.log 100% 50MB 7.7MB/s 00:06 o1_mf_5_3gznnrh0_.log 100% 50MB 8.2MB/s 00:06 o1_mf_6_3gznrwd7_.log 100% 50MB 4.9MB/s 00:10 |
Prepare an Initialization Parameter File for the Standby Database
Copy and edit the primary init.ora to set it up for the standby role
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
*.db_name='PRIMARYDB' *.db_unique_name='blackowl' *.audit_file_dest='/DB/oracle/admin/blackowl/adump' *.background_dump_dest='/DB/oracle/admin/blackowl/bdump' *.core_dump_dest='/DB/oracle/admin/blackowl/cdump' *.user_dump_dest='/DB/oracle/admin/blackowl/udump' *.compatible='10.2.0.1.0' *.control_files='/oradisk/od01/BLACKOWL/controlfile/blackowl_01.ctl','/oradisk/od01/BLACKOWL/controlfile/blackowl_02.ctl' *.db_block_size=8192 *.db_create_file_dest='/oradisk/od01/BLACKOWL' *.db_domain='' *.db_file_multiblock_read_count=16 *.db_file_name_convert='/oradisk/od01/BLACKOWL/datafile/','/test/db/PRIMARYDB/datafile/' *.log_file_name_convert='/oradisk/od01/BLACKOWL/onlinelog/','/test/db/PRIMARYDB/onlinelog/' *.fal_server='PRIMARYDB' *.fal_client='blackowl' *.job_queue_processes=10 *.LOG_ARCHIVE_CONFIG='DG_CONFIG=(PRIMARYDB,blackowl)' *.LOG_ARCHIVE_DEST_1='LOCATION=/oradisk/od01/BLACKOWL/archives/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=blackowl' *.LOG_ARCHIVE_DEST_2='SERVICE=PRIMARYDB LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PRIMARYDB' *.LOG_ARCHIVE_DEST_STATE_1='ENABLE' *.LOG_ARCHIVE_DEST_STATE_2='ENABLE' *.LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' *.LOG_ARCHIVE_MAX_PROCESSES=30 *.open_cursors=300 *.pga_aggregate_target=94371840 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.sga_target=283115520 *.standby_file_management='auto' *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1' |
Create all required directories for dump directories and archived log destination
1 2 3 4 5 6 7 8 9 |
[TEST2] > mkdir -p /DB/oracle/admin/blackowl/adump{oracle} [TEST2] > mkdir -p /DB/oracle/admin/blackowl/bdump {oracle} [TEST2] > mkdir -p /DB/oracle/admin/blackowl/cdump {oracle} [TEST2] > mkdir -p /DB/oracle/admin/blackowl/udump {oracle} [TEST2] > mkdir -p /oradisk/od01/BLACKOWL/archives/ |
Copy from the primary the standby controlfile to its destination
1 2 3 |
[TEST1] > scp -p blackowl.ctl TEST2:/oradisk/od01/BLACKOWL/controlfile/blackowl_02.ctl [TEST1] > scp -p blackowl.ctl TEST2:/oradisk/od01/BLACKOWL/controlfile/blackowl_01.ctl |
Continued in the Next Article………