Está en la página 1de 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 to the redolog file making use for the recovery.

3. Create Password file for primary database. orapwd file=/u01/app/oracle/product/10.2.0/db_1/dbs/orapw$ORACLE_SID.ora password=oracle entries=5

4. Ensure that the MAXLOGFILES value for the primary database is one more than twice the actual number of redo log groups in the primary database. 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?"

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

If MAXLOGFILES value set as low we need to recreate control file to change 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 sysdba Sql>startup mount Sql>alter database create standby controlfile as /u01/app/oracle/oradata/standby/standby.ctl Sql>exit 2. Copy all primary database datafile redologfiles, archive logfiles if any 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 and standby database init file listed below
Db_name=primary db_unique_name=primary LOG_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=30 valid_for=(ONLINE_LOGFILES,ALL_ROLES) db_unique_name=standby' standby_archive_dest=/u01/app/oracle/oradata/primary/archive log_archive_dest_state_1='ENABLE' log_archive_dest_state_2='ENABLE' fal_server=standby fal_client=primary

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 on primary and standby database while implementing the physical standby database. This is the primary database init file:

db_name=primary instance_name=primary background_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=581506668 db_unique_name=primary Log_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=30 valid_for=(ONLINE_LOGFILES,ALL_ROLES) db_unique_name=standby' standby_archive_dest=/u01/app/oracle/oradata/primary/archive Log_archive_dest_state_1='ENABLE' Log_archive_dest_state_2='ENABLE' FAL_Server=standby FAL_Client=primary db_file_name_convert='/u01/app/oracle/oradata/standby','/u01/app/oracl e/oradata/primary' log_file_name_convert='/u01/app/oracle/oradata/standby','/u01/app/orac le/oradata/primary' Standby_File_Management=AUTO

5. Copy this primary init file into standby location and edit the standby init file according to the standby database parameters like udump, bdump parameters. 6. Here I marked as a red these parameter should be changed on standby init file and save like initstandby.ora in $ORACLE_HOME/dbs/ location.

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

10. Now we configure everything to implement physical standby database. 11. 12. Set ORACLE_SID in linux prompt $ORACLE_SID=standby Invoke sqlplus and connect to the standby database. Sqlplus /as sysdba Sql>startup nomount Sql>alter database mount standby database; Database altered.

13. Now standby database mounted and physical standby database is 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 it is archiving are not

16. Now its working, redo is transferred on standby database. It will not apply to redo on standby database 17. for this we need to run another command

Sql>recover managed standby database disconnect from session; 18. If we want to stop redo apply run this commands Sql>recover managed standby database cancel; Sql>recover managed standby database cancel immediate; Now successfully configure physical standby database. Reference: http://uaex.edu/srea/DataGuard.htm http://www.dbazine.com/oracle/or-articles/foot7 http://www.orafaq.com/wiki/Data_Guard_implementation_for_Ora cle_10gR2#START_PHYSICAL_LOG_APPLY_SERVICE

19. 20.

También podría gustarte