Configuration of Oracle Database 10g Dataguard
Upcoming SlideShare
Loading in...5
×
 

Configuration of Oracle Database 10g Dataguard

on

  • 5,932 views

Step Configuration of Oracle Database 10g Dataguard

Step Configuration of Oracle Database 10g Dataguard

Statistics

Views

Total Views
5,932
Views on SlideShare
5,928
Embed Views
4

Actions

Likes
3
Downloads
434
Comments
0

2 Embeds 4

http://pinterest.com 3
http://www.linkedin.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Configuration of Oracle Database 10g Dataguard Configuration of Oracle Database 10g Dataguard Document Transcript

  • CONFIGURATION OFORACLE DATABASE 10g DATA GUARD (DATED: 27 AUGUST 2011) Written By: Ahmer Mansoor Email : ahmer_mansoor@hotmail.com Profile : http://www.linkedin.com/in/ahmermansoor
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoorCONSIDERATIONS PRIMARY STANDBY DATABASE NAME KARACHI LAHORE IP ADDRESS 172.17.1.4 172.17.1.5 DATABASE VERSION 10.2.0.2 10.2.0.2 SHARED FOLDER C:SHARED N/A CONSOLE SYSTEM 172.17.1.53 STANDBY DATABASE PHYSICAL STANDBY PROTECTION LEVEL MAXIMUM PERFORMANCE Page | 2
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor1) PREPARE PRIMARY DATABASE a) Connect to Primary Database Server using Remote Desktop Connection C:> MSTSC b) Enable Archivelog Mode C:> SET ORACLE_SID=KARACHI C:> SQLPLUS / AS SYSDBA SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP MOUNT; SQL> ALTER DATABASE ARCHIVELOG; SQL> ALTER DATABASE OPEN; c) Enable Force Logging on the Primary Database SQL> ALTER DATBASE FORCE LOGGING; d) Set Required Parameter SQL> CREATE PFILE=C:SHAREDINITKARACHI.ORA FROM SPFILE; Open the file INITKARACHI.ORA on notepad and set following parameters LOG_ARCHIVE_DEST_1=SERVICE=LAHORE LGWR ASYNC NOAFFIRM STANDBY_FILE_MANAGEMENT=AUTO FAL_SERVER=LAHORE FAL_CLIENT=KARACHI LOG_FILE_NAME_CONVERT=LAHORE,KARACHI DB_FILE_NAME_CONVERT=LAHORE,KARACHI DG_BROKER_START=TRUE SQL> SHUTDOWN IMMEDIATE; SQL> CREATE SPFILE FROM PFILE=C:SHAREDINITKARACHI.ORA; SQL> STARTUP; Page | 3
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor e) Create Standby Redo Logs for Active Archival i) Get size of Redo Log files in the KARACHI Database SQL> SELECT BYTES FROM V$LOG; ii) Create Standby Redo Log files of the same size as Redo Log files SQL> ALTER DATABASE ADD STANDBY LOGFILE (C:ORACLEPRODUCT10.2.0ORADATAKARACHISTANDBY01.LOG) SIZE 52428800; SQL> ALTER DATABASE ADD STANDBY LOGFILE (C:ORACLEPRODUCT10.2.0ORADATAKARACHISTANDBY02.LOG) SIZE 52428800; SQL> ALTER DATABASE ADD STANDBY LOGFILE (C:ORACLEPRODUCT10.2.0ORADATAKARACHISTANDBY03.LOG) SIZE 52428800; SQL> ALTER DATABASE ADD STANDBY LOGFILE (C:ORACLEPRODUCT10.2.0ORADATAKARACHISTANDBY04.LOG) SIZE 52428800; f) Configure Listener and TNS Names at Primary Database Server TNSNAMES.ORA KARACHI = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.1.4)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = KARACHI) ) ) LAHORE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.1.5)(PORT = 1521)) Page | 4
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = LAHORE) ) ) LISTENER.ORA SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = c:oracleproduct10.2.0db_1) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = KARACHI) (SID_NAME = KARACHI) ) (SID_DESC = (GLOBAL_DBNAME = KARACHI_DGMGRL) (SID_NAME = KARACHI) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.1.4)(PORT = 1521)) ) ) C:>LSNRCTL STOP C:>LSNRCTL START Page | 5
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor g) Copy required file to shared folder to transfer to Standby Site i) Create Standby Controlfile for Standby Database C:>SET ORACLE_SID=KARACHI C:>SQLPLUS / AS SYSDBA SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS C:SHAREDCONTROL01.CTL; ii) Take a cold backup of Primary Database SQL> SHUTDOWN IMMEDIATE; C:>MKDIR SHAREDDB C:>CD ORACLEPRODUCT10.2.0ORADATAKARACHI C: ORACLEPRODUCT10.2.0ORADATAKARACHI>COPY *.DBF SHAREDDB C: ORACLEPRODUCT10.2.0ORADATAKARACHI>COPY *.LOG SHAREDDB SQL> STARTUP; iii) Copy Password file to Shared Folder C:>COPY ORACLEPRODUCT10.2.0DB_1DATABASE>PWDKARACHI.ORA SHAREDPWDLAHORE.ORA h) Disconnect from Primary Database Server Page | 6
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor2) PREPARE STANDBY DATABASE a) Connect to Primary Database Server using Remote Desktop Connection C:> MSTSC b) Create Windows Service for Standby Database C:ORADIM -NEW -SID LAHORE –STARTMODE AUTO c) Create directories for the Standby Database C:>MKDIR C:oracleproduct10.2.0oradataLAHORE C:>MKDIR C:oracleproduct10.2.0ADMINLAHORE (Create complete directory including subdirectories as well) C:>MKDIR C:oracleproduct10.2.0flash_recovery_areaLAHORE d) Copy files from Primary Database to Standby Database as follows: Run 171.17.1.4SHARED Copy CONTROL01.CTL to C:ORACLEPRODUCT10.2.0ADMINLAHORECONTROL01.CTL Copy CONTROL01.CTL to C:ORACLEPRODUCT10.2.0ADMINLAHORECONTROL02.CTL Copy CONTROL01.CTL to C:ORACLEPRODUCT10.2.0ADMINLAHORECONTROL03.CTL Copy Primary Database Cold Backup to C:ORACLEPRODUCT10.2.0ADMINLAHORE Copy PWDLAHORE.ORA & INITLAHORE.ORA to C:ORACLEPRODUCT10.2.0DB_1DATABASE e) Configure Listener and TNS Names at Standby Database Server TNSNAMES.ORA KARACHI = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.1.4)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = KARACHI) ) ) Page | 7
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor LAHORE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.1.5)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = LAHORE) ) ) LISTENER.ORA SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = c:oracleproduct10.2.0db_1) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = LAHORE) (SID_NAME = LAHORE) ) (SID_DESC = (GLOBAL_DBNAME = LAHORE_DGMGRL) (SID_NAME = LAHORE) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.1.5)(PORT = 1521)) ) ) C:>LSNRCTL STOP C:>LSNRCTL START Page | 8
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor f) Create Parameter File for Standby Database OPEN THE FILE INITLAHORE.ORA ON NOTEPAD AND SET FOLLOWING PARAMETERS SEARCH KARACHI AND REPLACE WITH XYZ SEARCH LAHORE AND REPLACE WITH KARACHI SEARCH XYZ AND REPLACE WITH LAHORE db_name=KARACHI C:>SET ORACLE_SID=LAHORE SQL> CONNECT / AS SYSDBA SQL> CREATE SPFILE FROM PFILE= C:ORACLEPRODUCT10.2.0DB_1DATABASEINITLAHORE.ORA; SQL> STARTUP MOUNT; g) Create Managed Recovery SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT; h) Disconnect from Standby Database Server Page | 9
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor3) CONFIGURE TNS NAMES AT CONSOLE TNSNAMES.ORA KARACHI = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.1.4)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = KARACHI) ) ) LAHORE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.1.5)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = LAHORE) ) ) C:>LSNRCTL STOP C:>LSNRCTL START Page | 10
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor4) TEST DATAGUARD CONFIGURATION Run following commands from your Console System (Oracle 10g Client Tools must be installed) C:> SQLPLUS /NOLOG SQL> CONNECT SYS@KARACHI AS SYSDBA SQL> INSERT INTO HR.DEPARTMENTS VALUES (300,’New Business Division’,NULL,1700); SQL> COMMIT; SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> CONNECT SYS@LAHORE AS SYSDBA SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; SQL> ALTER DATABASE OPEN READ ONLY; SQL> SELECT * FROM HR.DEPARTMENTS; (You should get the inserted row with DEPT_ID=300 at KARACHI in the result.) SQL> SHUTDOWN IMMEDIATE; SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT; Page | 11
  • Written By: Ahmer MansoorEmail : ahmer_mansoor@hotmail.comProfile : http://www.linkedin.com/in/ahmermansoor5) CONFIGURE DATAGUARD BROKER AND SWITCHOVER a) Configure Dataguard Broker Tool C:>DGMGRL DGMGRL> CONNECT SYS@KARACHI DGMGRL> CREATE CONFIGURATION DR_KARACHI AS PRIMARY DATABASE IS KARACHI CONNECT IDENTIFIER IS KARACHI; DGMGRL> ADD DATABASE LAHORE AS CONNECT IDENTIFIER IS LAHORE MAINTAINED AS PHYICAL; DGMGRL> ENABLE CONFIGURATION; b) Perform Switchover DGMGRL> SWITCHOVER TO LAHORE; Page | 12