Data Guard Project Details

  • Upload
    maleem

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

  • 7/27/2019 Data Guard Project Details

    1/8

    This document explains the step by step process of Configuring 10g R2Single Instance Data guard for Single Instance Primaryon RedHat Enterprise Linux 32 bit (RHEL3) / Cantos 3.6.

    Click HERE for Step By Step Process of Configuring RAC Standby

    Data guard for RAC Primary ON Redhat Linux.

    Task List:10g R2 Data guard Technical Architecture

    Primary DB init parameter

    Standby DB init parameter

    Enable Archiving On Primary DB

    tnsnames.ora/listener.ora configuration

    Creating Standby Redo logs (SLRs)

    Backup the Primary DB.Creating the standby control file

    Startig and verifying Standby DB

    Testing Realtime Apply

    Technical Architecture of DataGuard

    Primary Database Name: primaryService Name: primaryPrimary Node:

    SID: primaryNetwork name (hostname): node1-prvORACLE_BASE: /u01/app/oracle

    Standby Database Name: stndbyService Name: stndbyStandby Node:

    SID: stndbyNetwork name (hostname): node2-prvORACLE_BASE: /u01/app/oracle

    Primary DB init parameter

    primary.__db_cache_size=67108864primary.__java_pool_size=4194304primary.__large_pool_size=4194304primary.__shared_pool_size=88080384primary.__streams_pool_size=0*.archive_lag_target=0*.audit_file_dest='/u01/app/oracle/admin/primary/adump' *.background_dump_dest='/u01/app/oracle/admin/primary/bdump' *.compatible='10.2.0.1.0'

    http://www.oracledba.org/10g/dr/10gR2_dataguard_RAC_to_RAC.htmlhttp://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Technical_Architecture_of_DataGuard%23Technical_Architecture_of_DataGuardhttp://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Primary_DB_init_parameter%23Primary_DB_init_parameterhttp://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Standby_DB_init_parameter%23Standby_DB_init_parameterhttp://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Enabling_Archiving_on_primary_DB:%23Enabling_Archiving_on_primary_DB:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#tnsnameslistener.ora_configuration:%23tnsnameslistener.ora_configuration:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Standby_Redo_Logs_SLRs_Creation:%23Standby_Redo_Logs_SLRs_Creation:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Backup_the_primary_DB:%23Backup_the_primary_DB:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Create_the_Standby_Controlfile:%23Create_the_Standby_Controlfile:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Starting_and_Verifying_the_standby_DB:%23Starting_and_Verifying_the_standby_DB:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Testing_Realtime_Apply:%23Testing_Realtime_Apply:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Technical_Architecture_of_DataGuard%23Technical_Architecture_of_DataGuardhttp://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Primary_DB_init_parameter%23Primary_DB_init_parameterhttp://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Standby_DB_init_parameter%23Standby_DB_init_parameterhttp://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Enabling_Archiving_on_primary_DB:%23Enabling_Archiving_on_primary_DB:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#tnsnameslistener.ora_configuration:%23tnsnameslistener.ora_configuration:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Standby_Redo_Logs_SLRs_Creation:%23Standby_Redo_Logs_SLRs_Creation:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Backup_the_primary_DB:%23Backup_the_primary_DB:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Create_the_Standby_Controlfile:%23Create_the_Standby_Controlfile:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Starting_and_Verifying_the_standby_DB:%23Starting_and_Verifying_the_standby_DB:http://www.oracledba.org/10g/dr/10gR2_dataguard_on_Linux.html#Testing_Realtime_Apply:%23Testing_Realtime_Apply:http://www.oracledba.org/10g/dr/10gR2_dataguard_RAC_to_RAC.html
  • 7/27/2019 Data Guard Project Details

    2/8

    *.control_files='/u01/app/oracle/oradata/PRIMARY/controlfile/o1_mf_26lg83r9_.ctl','/u01/app/oracle/flash_recovery_area/PRIMARY/controlfile/o1_

    mf_26lg844c_.ctl'*.core_dump_dest='/u01/app/oracle/admin/primary/cdump' *.db_block_size=8192*.db_create_file_dest='/u01/app/oracle/oradata' *.db_domain=''*.db_file_multiblock_read_count=16 *.db_name='primary'*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area' *.db_recovery_file_dest_size=2147483648 *.db_unique_name='primary'*.dg_broker_start=TRUE*.dispatchers='(PROTOCOL=TCP) (SERVICE=primary)'*.fal_client='primary'*.fal_server='stndby'*.job_queue_processes=10*.log_archive_config='DG_CONFIG=(primary,stndby)' *.log_archive_dest_1='LOCATION=/u01/app/oracle/oradata/PRIMARY/archVALID_FOR=(ALL_LOGFILES,ALL_ROLES)

    DB_UNIQUE_NAME=primary'*.log_archive_dest_2='SERVICE=stndby LGWR ASYNCVALID_FOR=(ALL_LOGFILES,PRIMARY_ROLE)DB_UNIQUE_NAME=stndby'

    *.log_archive_dest_state_1='ENABLE' *.log_archive_dest_state_2='ENABLE' *.log_archive_format='%t_%s_%r.dbf'

    primary.log_archive_format='%t_%s_%r.dbf'*.log_archive_max_processes=2*.log_archive_min_succeed_dest=1

    primary.log_archive_trace=0*.open_cursors=300*.pga_aggregate_target=16777216*.processes=150*.remote_login_passwordfile='EXCLUSIVE' *.sga_target=167772160

    primary.standby_archive_dest='/u01/app/oracle/oradata/PRIMARY/arch '*.standby_file_management='AUTO'*.undo_management='AUTO'*.undo_tablespace='UNDOTBS1'*.user_dump_dest='/u01/app/oracle/admin/primary/udump' *.local_listener=prim

    Standby DB init parameter

    stndby.__db_cache_size=75497472stndby.__java_pool_size=4194304stndby.__large_pool_size=4194304stndby.__shared_pool_size=79691776 stndby.__streams_pool_size=0*.archive_lag_target=0*.audit_file_dest='/u01/app/oracle/admin/stndby/adump' *.background_dump_dest='/u01/app/oracle/admin/stndby/bdump' *.compatible='10.2.0.1.0'

  • 7/27/2019 Data Guard Project Details

    3/8

    *.control_files='/u01/app/oracle/oradata/STNDBY/controlfile/stndby01.ctl','/u01/app/oracle/flash_recovery_area/STNDBY/controlfile/stndby02.ctl'*.core_dump_dest='/u01/app/oracle/admin/stndby/cdump' *.db_block_size=8192*.db_create_file_dest='/u01/app/oracle/oradata' *.db_domain=''*.db_file_multiblock_read_count=16 *.db_name='primary'*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area' *.db_recovery_file_dest_size=2147483648 *.db_unique_name='stndby'*.dg_broker_start=TRUE*.dispatchers='(PROTOCOL=TCP) (SERVICE=stndbyXDB)'*.fal_client='stndby'*.fal_server='primary'*.job_queue_processes=10*.log_archive_config='DG_CONFIG=(stndby,primary)' *.log_archive_dest_1='LOCATION=/u01/app/oracle/oradata/STNDBY/archVALID_FOR=(ALL_LOGFILES,ALL_ROLES)DB_UNIQUE_NAME=stndby'

    *.log_archive_dest_2='SERVICE=primary LGWR ASYNCVALID_FOR=(ALL_LOGFILES,PRIMARY_ROLE)DB_UNIQUE_NAME=primary'

    *.log_archive_dest_state_1='ENABLE' *.log_archive_dest_state_2='ENABLE' *.log_archive_format='%t_%s_%r.dbf' *.log_archive_max_processes=2*.log_archive_trace=0*.db_file_name_convert= 'PRIMARY', 'STNDBY'*.log_file_name_convert='PRIMARY', 'STNDBY'*.open_cursors=300*.pga_aggregate_target=16777216*.processes=150*.remote_login_passwordfile='EXCLUSIVE' *.sga_target=167772160*.standby_archive_dest='/u01/app/oracle/oradata/STNDBY/arch' *.standby_file_management='AUTO'*.undo_management='AUTO'*.undo_tablespace='UNDOTBS1'*.user_dump_dest='/u01/app/oracle/admin/stndby/udump'*.local_listener=stnd

    Enabling Archiving on primary DB:

    Ensure that the primary is in archive log mode

    SQL>shutdown immediateSQL>startup mount;SQL>alter database archive log;SQL>alter database open;

    tnsnames/listener.ora configuration:

  • 7/27/2019 Data Guard Project Details

    4/8

    # Tnsnames.ora Network Configuration File:/u01/app/oracle/product/10.2.0/db10g/network/admin/tnsnames.ora # Generated by Oracle configuration tools.

    STNDBY =(DESCRIPTION =

    (ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = node2-prv)(PORT = 10521)))(CONNECT_DATA =(SERVICE_NAME = STNDBY)

    ))

    PRIM =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = node1-prv)(PORT = 10521)))

    PRIMARY =

    (DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = node1-prv)(PORT = 10521))

    )(CONNECT_DATA =(SERVICE_NAME = PRIMARY)

    ))

    EXTPROC_CONNECTION_DATA =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

    )(CONNECT_DATA =(SID = PLSExtProc)(PRESENTATION = RO)

    ))

    Copy the same file to the standby server and adjust it based on thelistener.ora file. Also update the listener.ora file so that it listen theSIDs mentioned in the tnsnames.ora file.

    # Listener.ora Network Configuration File:/u01/app/oracle/product/10.2.0/db10g/network/admin/listener.ora

    # Generated by Oracle configuration tools.

    SID_LIST_LISTENER_STBY =(SID_LIST =(SID_DESC =(SID_NAME = PLSExtProc)(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db10g)(PROGRAM = extproc)

    )

  • 7/27/2019 Data Guard Project Details

    5/8

    (SID_DESC =(SID_NAME = stndby)(GLOBAL_DBNAME = stndby_DGMGRL)(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db10g)

    ))

    LISTENER_STBY =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = node2-prv)(PORT = 10521))(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

    ))

    Standby Redo Logs (SLRs) Creation:

    In case of OMF:

    Get the max group# of online redo logs on PRIMARY database

    SELECT max (group#) from v$logfile;

    Create the standby redo logs on the primary database with the same size ofthat of online redo logs. If the above query retuns the value of 3 and eachlog file is 50M in size (from the below query) then, create atleast 4standbyredo logs of the size of 50M per thread.

    SELECT byte from v$log;

    Create the SRL's :

    ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 SIZE 50M/

    ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 SIZE 50M/

    ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 SIZE 50M/

    ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 SIZE 50M/

    Backup the primary DB:

    Take a cold/Hot/RMAN backup of the primary database. I used the coldbackup in this case.

    SQL>SHUTDOWN IMMEDIATE

    Backup the datafiles, online redologs and the standby logs if created andscp to the standby server in the corresponding directory. I used the same

  • 7/27/2019 Data Guard Project Details

    6/8

    directory structure as that with primary.The only differences was the name of the directory. For e.g.,

    On primary database, I have a path of/u01/app/oracle/oradata/PRIMARY/datafile whereas

    On standby server, I have a path of/u01/app/oracle/oradata/STNDBY/datafile,

    This is the reason, I have used the db_file_name_convert parameter in theprimary init.ora file with the value ofdb_file_name_convert=PRIMARY,STNDBY

    and in the standby init.ora file with the value of

    db_file_name_convert=STNDBY, PRIMARY

    Create the Standby Controlfile:On Primary Database:

    SQL>STARTUP MOUNT;SQL>ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/stndby01.ctl';SQL>ALTER DATABASE OPEN;

    scp the stndby01.ctl file to the standby site. I have multiplexed it in theinitstndby.ora file. So I SCPed the same file to both the locations mentionedin the initstndby.ora file.

    Also, SCPed the $ORACLE_HOME/dbs/orapwprimaryfile of the primary tothe same location on the standby with the name oforapwstndby.

    Starting and Verifying the standby DB:

    SQL>create spfile from pfile;SQL>STARTUP MOUNT;SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENTLOGFILE DISCONNECT;

    Verify the Standby:

    - Identify the existing files on the standby

    SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIMEFROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

    Switch a log on the primary database:

    SQL>ALTER SYSTEM SWITCH LOGFILE;

  • 7/27/2019 Data Guard Project Details

    7/8

    - Re-Run the same SQL to make sure that the logs are received and appliedto

    the standby server.

    Verify that these logs were applied:

    SELECT SEQUENCE#, APPLIED FROM V$ARCHIVED_LOGORDER BY SEQUENCE#;

    Testing Realtime Apply:

    On Primary Database: create a table 'test' and insert a record.

    INSERT INTO test VALUES (sysdate);COMMIT;

    Do not make a log switch because I set up the LGWR ASYNC option so that

    The redo should be transferred and applied to the standby server in realtime.

    On the STANDBY DB server:

    SELECT PROCESS, STATUS,SEQUENCE#,BLOCK#,BLOCKS, DELAY_MINS FROMV$MANAGED_STANDBY;

    ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;ALTER DATABASE OPEN READ ONLY;

    SELECT * FROM test;

    You should see the commited transaction.

    Place the standby back in managed recover mode

    ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILEDISCONNECT;

    This will take the standby directly from read only mode and place it inmanaged recovery mode.

    =========================================================================================

    Click HERE for Step By Step Process of Configuring RAC StandbyData guard for RAC Primary ON Red hat Linux.

    http://www.oracledba.org/10g/dr/10gR2_dataguard_RAC_to_RAC.htmlhttp://www.oracledba.org/10g/dr/10gR2_dataguard_RAC_to_RAC.html
  • 7/27/2019 Data Guard Project Details

    8/8

    http://www.oracledba.org/index.htmlhttp://www.oracledba.org/index.html