Data Gaurd Implementation Steps

Embed Size (px)

Citation preview

  • 8/3/2019 Data Gaurd Implementation Steps

    1/7

    Implementing Data Guard on same machine:

    Here I use:

    Primary database name: primary

    Standby database name: standby

    Requirements:

    1. Primary database should be in archive log mode:

    2. Primary database should be in force logging.

    Enabling fore logging will force any change in the database will go tothe redolog file making use for the recovery.

    3. Create Password file for primary database.

    orapwdfile=/u01/app/oracle/product/10.2.0/db_1/dbs/orapw$ORACLE_SID.orapassword=oracle entries=5

    4. Ensure that the MAXLOGFILES value for the primarydatabase is one more than

    twice the actual number of redo log groups in the primarydatabase. To check this run this sql query on primary database.

    Select records_used "Current Groups", records_total "Max Groups",decode(sign(records_total-(records_used*2+1)),-1,LPAD('YES',21),LPAD('NO',21))"Recreate MAXLOGFILES?"

  • 8/3/2019 Data Gaurd Implementation Steps

    2/7

    from v$controlfile_record_section where type = 'REDO LOG';

    If MAXLOGFILES value set as low we need to recreate control file tochange this maxlogfiles value.

    Configuring Physical standby database:

    1. Put primary database in mount stage. Create standby controlfile for

    physical standby database.$ORACLE_SID=primary$sqlplus /as sysdbaSql>startup mountSql>alter database create standby controlfile as/u01/app/oracle/oradata/standby/standby.ctlSql>exit

    2. Copy all primary database datafile redologfiles, archive logfiles ifany to standby database destination.

    3. If primary database using spfile convert this spfile into pfile.Sql>create pfile from spfile;

    4. To configure physical standby database we have to edit the init file.What are all the parameters should be included in both primary andstandby database init file listed below

    Db_name=primarydb_unique_name=primaryLOG_ARCHIVE_CONFIG='DG_CONFIG=(primary, standby)'LOG_ARCHIVE_DEST_1='location=/u01/app/oracle/oradata/primary/archive

    valid for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=primary'

    LOG_ARCHIVE_DEST_2='service=standby lgwr async affirm net_timeout=30valid_for=(ONLINE_LOGFILES,ALL_ROLES) db_unique_name=standby'

    standby_archive_dest=/u01/app/oracle/oradata/primary/archivelog_archive_dest_state_1='ENABLE'log_archive_dest_state_2='ENABLE'fal_server=standbyfal_client=primary

  • 8/3/2019 Data Gaurd Implementation Steps

    3/7

    db_file_name_convert='/u01/app/oracle/oradata/standby','/u01/app/oracle/oradata/primary/'

    log_file_name_convert='/u01/app/oracle/oradata/standby','/u01/app/oracle/oradata/primary/'

    STANDBY_FILE_MANAGEMENT=AUTO

    Note: These are all the parameters should be included onprimary and standby database while implementing thephysical standby database.

    This is the primary database init file:

  • 8/3/2019 Data Gaurd Implementation Steps

    4/7

    db_name=primaryinstance_name=primarybackground_dump_dest='/u01/app/oracle/admin/primary/bdump'user_dump_dest='/u01/app/oracle/admin/primary/udump'control_files='/u01/app/oracle/admin/primary/ctl1.dbf'undo_management='auto'

    sga_target=581506668db_unique_name=primaryLog_archive_config=DG_CONFIG=(primary,standby)Log_archive_dest_1=Location=/u01/app/oracle/oradata/primary/archiveVALID_FOR=(ALL_LOGFILES,ALL_ROLES)db_unique_name=primary'Log_archive_dest_2=Service=standby lgwr async affirmnet_timeout=30 valid_for=(ONLINE_LOGFILES,ALL_ROLES)db_unique_name=standby'standby_archive_dest=/u01/app/oracle/oradata/primary/archiveLog_archive_dest_state_1='ENABLE'Log_archive_dest_state_2='ENABLE'FAL_Server=standbyFAL_Client=primarydb_file_name_convert='/u01/app/oracle/oradata/standby','/u01/app/oracle/oradata/primary'log_file_name_convert='/u01/app/oracle/oradata/standby','/u01/app/oracle/oradata/primary'Standby_File_Management=AUTO

    5. Copy this primary init file into standby location and edit the standbyinit file according to the standby database parameters like udump,bdump parameters.

    6. Here I marked as a red these parameter should be changed onstandby init file and save like initstandby.ora in$ORACLE_HOME/dbs/ location.

  • 8/3/2019 Data Gaurd Implementation Steps

    5/7

    7. Configure tnsnames.ora and listener.ora file in$ORACLE_HOME/network/admin

    8. Include the service name of standby database in tnsnames.ora file.

    9. Include the standby SID value in listener.ora file

  • 8/3/2019 Data Gaurd Implementation Steps

    6/7

    10. Now we configure everything to implement physical standbydatabase.

    11. Set ORACLE_SID in linux prompt$ORACLE_SID=standby

    12. Invoke sqlplus and connect to the standby database.Sqlplus /as sysdbaSql>startup nomountSql>alter database mount standby database;Database altered.

    13. Now standby database mounted and physical standby databaseis ready.

    Check the physical standby database is working or not:

    14. On primary database switch the logfile.

    15. On standby database execute this sql query to check whether itis archiving are not

    16. Now its working, redo is transferred on standby database. It willnot apply to redo on standby database

    17. for this we need to run another command

  • 8/3/2019 Data Gaurd Implementation Steps

    7/7

    Sql>recover managed standby database disconnect fromsession;

    18. If we want to stop redo apply run this commandsSql>recover managed standby database cancel;

    Sql>recover managed standby database cancel immediate;

    19. Now successfully configure physical standby database.

    20. Reference:http://uaex.edu/srea/DataGuard.htmhttp://www.dbazine.com/oracle/or-articles/foot7http://www.orafaq.com/wiki/Data_Guard_implementation_for_Oracle_10gR2#START_PHYSICAL_LOG_APPLY_SERVICE

    http://uaex.edu/srea/DataGuard.htmhttp://www.dbazine.com/oracle/or-articles/foot7http://www.orafaq.com/wiki/Data_Guard_implementation_for_Oracle_10gR2#START_PHYSICAL_LOG_APPLY_SERVICEhttp://www.orafaq.com/wiki/Data_Guard_implementation_for_Oracle_10gR2#START_PHYSICAL_LOG_APPLY_SERVICEhttp://uaex.edu/srea/DataGuard.htmhttp://www.dbazine.com/oracle/or-articles/foot7http://www.orafaq.com/wiki/Data_Guard_implementation_for_Oracle_10gR2#START_PHYSICAL_LOG_APPLY_SERVICEhttp://www.orafaq.com/wiki/Data_Guard_implementation_for_Oracle_10gR2#START_PHYSICAL_LOG_APPLY_SERVICE