P. 1
DataGaurd10Gsheet

DataGaurd10Gsheet

|Views: 0|Likes:
Published by Jon Glickman

More info:

Published by: Jon Glickman on Feb 23, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

02/23/2013

pdf

text

original

Oracle 10g Data Guard

(Summary Sheets) v. 1.0 Edited By: Ahmed Baraka

1. INTRODUCTION TO ORACLE DATA GUARD 3 1.1 DATA GUARD CONFIGURATIONS ...........................3 1.2 DATA GUARD SERVICES ........................................3 1.3 DATA GUARD BROKER ..........................................3 1.4 DATA GUARD PROTECTION MODES ......................3 1.5 DATA GUARD AND COMPLEMENTARY TECHNOLOGIES 1.6 SUMMARY OF DATA GUARD BENEFITS .................3 2. GETTING STARTED WITH DATA GUARD ......3 2.1 STANDBY DATABASE TYPES .................................3 2.3 DATA GUARD OPERATIONAL PREREQUISITES .......4 2.4 STANDBY DATABASE DIRECTORY STRUCTURE CONSIDERATIONS 4 2.5 ONLINE REDO LOGS, ARCHIVED REDO LOGS, AND STANDBY REDO LOGS 4 3. CREATING A PHYSICAL STANDBY DATABASE 4 3

3.1 PREPARING THE PRIMARY DATABASE FOR STANDBY DATABASE CREATION 4 3.2 CREATING A PHYSICAL STANDBY DATABASE .......5 3.3 FURTHER PREPARATIONS ......................................7 4. CREATING A LOGICAL STANDBY DATABASE 7 7

4.1 PREPARING FOR LOGICAL STANDBY DATABASE CREATION 4.2 CREATING A LOGICAL STANDBY DATABASE ........8 4.3 FURTHER PREPARATIONS ....................................10

1

Oracle 10g Data Guard Summary Sheets

please send the request to info@ahmedbaraka. • If any one wishes to correct a statement or a typing error or add a new piece of information.2) Part Number B14239-01 2 Oracle 10g Data Guard Summary Sheets . 2006 Initial document.0 Sept. the version of the document will be incremented and the modifier name will be listed in the version history list. The editor is not responsible for any loses or damage resulted from using the information or executing the code in this document.Usage Terms • Anyone is authorized to copy this document to any means of storage and present it in any format to any individual or organization for non-commercial purpose free. • There is no warranty of any type for the code or information presented in this document. • No individual or organization may use this document for commercial purpose without a written permission from the editor.com . If the modification is acceptable. it will be added to the document. Version History Version Date Updates 1. Document Purpose This document is edited to be a quick hand book reference on using Oracle Data Guard in Oracle 10g Database. It is simply a summary of the Oracle documentation. Resources Resource Name Oracle® Data Guard Concepts and Administration 10g Release 2 (10.

1. and monitoring of Data Guard configurations using either GUI (by intergration with EM) or CLI (in DGMGRL prompt). 1.3 Data Guard Broker The Data Guard broker is a distributed management framework that automates and centralizes the creation. data protection. maintenance.2 Data Guard Services • Log Transport Services • Log Apply Services: Redo Apply or SQL Apply • Role Management Services 1. • Complete data protection • Efficient use of system resources • Automatic gap detection and resolution • Centralized and simple management • Integration with Oracle Database 2. Introduction to Oracle Data Guard 1. Getting Started with Data Guard 2. It has some restrictions on datatypes. and types of DDL and DML operations. and high availability.1.4 Data Guard Protection Modes • Maximum protection • Maximum availability • Maximum performance 1.1 Data Guard Configurations • Primary Database • Standby Databases o Physical standby database o Logical standby database 1.1 Physical Standby Databases It works in two modes: Redo Apply and Open Read-Only. Benefits of a Physical Standby Database • Efficient disaster recovery and high availability • Data protection • Reduction in primary database workload Performance 2.1 Standby Database Types 2. you can switch between them.5 Data Guard and Complementary Technologies • Oracle Real Application Clusters (RAC) • Flashback Database • Recovery Manager (RMAN) 1. types of tables. Benefits of a Logical Standby Database • It has same benefits as in a physical standby database. Although the physical standby database cannot perform both Redo Apply and be opened in read-only mode at the same time. • Efficient use of standby hardware resources.1.2 Logical Standby Databases The logical standby database can be used concurrently for data protection and reporting operations.6 Summary of Data Guard Benefits • Disaster recovery. • Reduction in primary database workload 3 Oracle 10g Data Guard Summary Sheets .

storage configuration) can be different between the primary and standby systems. you can either manually rename files or set up the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT initialization parameters on the standby database to automatically update the path names for primary database datafiles and archived redo log files and standby redo log files in the standby database control file. Archived Redo Logs.3. • The primary database must run in ARCHIVELOG mode. 2. 3. • Oracle recommends that when you set up Oracle Automatic Storage Management (ASM) and Oracle Managed Files (OMF) in a Data Guard configuration. • Keep the database in FORCE LOGGING mode as long as the standby database is required. memory size. 2. although you can still do so if you want a new naming scheme. • Consider setting the time zone for the primary and remote standby systems to be the same. Standby database on a separate system from the primary database and different directory structure • For physical standby database.2 User Interfaces for Administering Data Guard Configurations • Oracle Enterprise Manager • Command-line interface: SQL*Plus and some initialization parameters • Data Guard broker command-line 2. • Primary databases.4 Standby Database Directory Structure Considerations Standby database on the same system as the primary database • You must use a different directory structure.1 Online Redo Logs and Archived Redo Logs • Online Redo Logs apply in the primary database and does not apply in the physical standby database. and Standby Redo Logs Redo data transmitted from the primary database is received by the remote file server (RFS) process on the standby system where the RFS process writes the redo data to archived log files or standby redo log files.1 Hardware and Operating System Requirements • The operating system and platform architecture on the primary and standby locations must be the same. • Disasters recovery is not supported by switchover is supported for planned maintenance.may take long time 4 Oracle 10g Data Guard Summary Sheets . 2. -. archived redo log files.1 Preparing the Primary Database for Standby Database Creation 3.5. 2. set it up symmetrically on the primary and standby database.1 Enable Forced Logging ALTER DATABASE FORCE LOGGING. and standby redo log files in the standby database control file.1. • The hardware (for example.2. 2. the number of CPUs.2 Standby Redo Logs • A standby redo log is similar in all ways to an online redo log.5 Online Redo Logs. except that a standby redo log is used only when the database is running in the standby role to store redo data received from the primary database. and both physical and logical standby databases each have an archived redo log.3 Data Guard Operational Prerequisites 2. • You can either manually rename files or set up the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT initialization parameters on the standby database to automatically update the path names for primary database datafiles and archived redo log files and standby redo log files in the standby database control file.3.5.2 Oracle Software Requirements • The same release of Oracle Database Enterprise Edition must be installed on the primary database and all standby databases in a Data Guard configuration. • You must set the DB_UNIQUE_NAME initialization parameter. It is highly recommended to configure. Creating a Physical Standby Database 3. Standby database on a separate system from the primary database but same directory structure • You do not need to rename primary database files. • You must explicitly set up unique service names for the primary and standby databases with the SERVICE_NAMES initialization parameter.

or NORECEIVE keywords LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago.'/arch1/chicago/'.'/arch2/chicago/' STANDBY_FILE_MANAGEMENT=AUTO 3.ctl'.boston)' CONTROL_FILES='/arch1/chicago/control1. ALTER DATABASE ARCHIVELOG. use the same name DB_NAME=chicago # should be unique for all databases DB_UNIQUE_NAME=chicago SERVICE_NAMES=chicago # list the DB_UNIQUE_NAME of the primary and standby databases # after a role transition. 3. 3.2.'/arch2/boston/'. Note: check the other directory dependent parameters (like USER_DUMP_DEST) to make their values the same in the standby database.1.arc If you specify the LGWR process to transmit redo data to both the local and remote destinations.2 Creating a Physical Standby Database 3. 5 Oracle 10g Data Guard Summary Sheets . NOSEND. Primary Database: Standby Role Initialization Parameters FAL_SERVER=boston FAL_CLIENT=chicago DB_FILE_NAME_CONVERT='/arch1/boston/'. ALTER DATABASE OPEN. 3.2 Create a Control File for the Standby Database Create control files for standby database using the following commands: STARTUP MOUNT.PRIMARY_ROLE) DB_UNIQUE_NAME=boston' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE LOG_ARCHIVE_FORMAT=%t_%s_%r. 3.3.2 Create a Password File Create a password file if one does not already exist.2.ALL_ROLES) DB_UNIQUE_NAME=chicago' LOG_ARCHIVE_DEST_2= 'SERVICE=boston VALID_FOR=(ONLINE_LOGFILES. you may need to specify SEND. RECEIVE.3 Setting Primary Database Initialization Parameters Primary Database: Primary Role Initialization Parameters # below is the primary db name # for all standby databases.ctl' LOG_ARCHIVE_DEST_1= 'LOCATION=/arch1/chicago/ VALID_FOR=(ALL_LOGFILES.'/arch2/boston/'. also include the NET_TIMEOUT attribute on the LOG_ARCHIVE_DEST_2 initialization parameter.4 Enable Archiving SHUTDOWN IMMEDIATE. STARTUP MOUNT. ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/boston.1 Create a Backup Copy of the Primary Database Datafiles You can use any backup copy of the primary database to create the physical standby database.1. as long as you have the necessary archived redo log files to completely recover the database. ALTER DATABASE OPEN.2.1. '/arch2/chicago/control2.ctl'.'/arch2/chicago/' LOG_FILE_NAME_CONVERT= '/arch1/boston/'.'/arch1/chicago/'. The password for the SYS user must be identical on every system for redo data transmission to succeed.ora' FROM SPFILE.3 Prepare an Initialization Parameter File for the Standby Database CREATE PFILE='/tmp/initboston.

'/arch1/boston/'. Ensure the COMPATIBLE initialization parameter is set to the same value on both the primary and standby databases. • Create a new temporary file for the physical standby database: SELECT TABLESPACE_NAME FROM DBA_TABLESPACES WHERE CONTENTS = 'TEMPORARY'. 3.6 Start the Physical Standby Database • A physical standby database must be in the mounted state (or open in read-only mode) to receive redo data.2. • Configure listeners for the primary and standby databases.PRIMARY_ROLE) DB_UNIQUE_NAME=chicago' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE STANDBY_FILE_MANAGEMENT=AUTO # used when the primary and standby # databases reside on the same system.2.2.EXPIRE_TIME parameter to 2 (minutes) in the SQLNET.2.5 Set Up the Environment to Support the Standby Database • WINNT> oradim -NEW -SID boston -INTPWD password -STARTMODE manual • Create a password file.1 o Standby control file created in Section 3.ctl'.3 3.4 Copy Files from the Primary System to the Standby System • Copy the following files to the standby system: o Backup datafiles created in Section 3. The connect descriptor must also specify that a dedicated server be used.'/arch2/chicago/'.boston)' CONTROL_FILES='/arch1/boston/control1.'/arch1/boston/'. 3.ORA file on the standby system. • On both the primary and standby systems.ctl' DB_FILE_NAME_CONVERT= '/arch1/chicago/'.'/arch2/boston/' LOG_ARCHIVE_FORMAT=log%t_%s_%r.ALL_ROLES) DB_UNIQUE_NAME=boston' # this parameter does not take effect # when the db is on standby mode LOG_ARCHIVE_DEST_2= 'SERVICE=chicago VALID_FOR=(ONLINE_LOGFILES. STARTUP OPEN READ ONLY.ora'. also include the NET_TIMEOUT attribute on the LOG_ARCHIVE_DEST_2 initialization parameter. orapwd file=<fname> password=<password> entries=<users> Note: password file may be automatically created by the previous step. 6 Oracle 10g Data Guard Summary Sheets .'/arch2/boston/' LOG_FILE_NAME_CONVERT= '/arch1/chicago/'.Initialization Parameters for a Physical Standby Database DB_NAME=chicago DB_UNIQUE_NAME=boston SERVICE_NAMES=boston LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago.2. and set the password for the SYS user to the same password used by the SYS user on the primary database. '/arch2/boston/control2. • CREATE SPFILE FROM PFILE ='initboston. INSTANCE_NAME=boston # Oracle Net service name of the FAL server FAL_SERVER=chicago FAL_CLIENT=boston If you specify the LGWR process to transmit redo data to both the local and remote destinations.2.'/arch2/chicago/'.2 o Initialization parameter file created in Section 3.arc LOG_ARCHIVE_DEST_1= 'LOCATION=/arch1/boston/ VALID_FOR=(ALL_LOGFILES. use Oracle Net Manager to create a network service name for the primary and standby databases that will be used by log transport services. • Enable broken connection detection by setting the SQLNET.

-. NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#.DATA_TYPE FROM DBA_LOGSTDBY_UNSUPPORTED WHERE OWNER='OE' AND TABLE_NAME = 'CUSTOMERS'. 3. Creating a Logical Standby Database 4. It is in the maximum performance mode by default. Then on the standby: SELECT SEQUENCE#. or views on the primary database will not be propagated to the logical standby database and no error message will be returned.dbf' SIZE 40M REUSE. the standby database. sequences. NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#. FIRST_TIME.1. Sequences. and Views • Most schemas that ship with the Oracle database are skipped by SQL Apply • Tables with unsupported datatypes • Tables using table compression Changes made to unsupported datatypes. • You can change the Oracle database service to Auto instead of manual. or both. FIRST_TIME.TABLE_NAME.on primary db 3.1 Determine Support for Datatypes and Storage Attributes for Tables Unsupported Datatypes: • BFILE • ROWID • UROWID Unsupported • varrays • nested tables • XMLType Unsupported Tables.ALTER TABLESPACE TEMP1 ADD TEMPFILE '/arch1/boston/temp01. also verify new archived redo log files were applied: SELECT SEQUENCE#.APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#. Skipped SQL Statements on a Logical Standby Database ALTER DATABASE ALTER SESSION ALTER MATERIALIZED VIEW ALTER MATERIALIZED VIEW LOG ALTER SYSTEM CREATE CONTROL FILE CREATE DATABASE CREATE DATABASE LINK CREATE PFILE FROM SPFILE CREATE SCHEMA AUTHORIZATION CREATE MATERIALIZED VIEW 7 user-defined types: • object types REFs Oracle 10g Data Guard Summary Sheets .TABLE_NAME FROM DBA_LOGSTDBY_UNSUPPORTED ORDER BY OWNER.3 Further Preparations You can further apply the following: • Upgrade the data protection mode. SELECT DISTINCT OWNER. SELECT COLUMN_NAME. 4. • You can enable Flashback Database on the primary database. • Configure standby redo logs. • Start Redo Apply: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION.2.7 Verify the Physical Standby Database Is Performing Properly On the standby: SELECT SEQUENCE#. • Test archival operations to the physical standby database: ALTER SYSTEM SWITCH LOGFILE. table.1 Preparing for Logical Standby Database Creation 4. On the primary: ALTER SYSTEM ARCHIVE LOG CURRENT.

If your application ensures the rows in a table are unique. add an index to the columns that uniquely identify the row on the logical standby database.PRIMARY_ROLE) DB_UNIQUE_NAME=boston' -. Note: To improve the performance of SQL Apply.2 Prepare the Primary Database for Role Transitions Modify the parameters: LOG_ARCHIVE_DEST_1= 'LOCATION=/arch1/chicago/ VALID_FOR=(ONLINE_LOGFILES. Job execution is suspended on a logical standby database and jobs cannot be scheduled directly on the standby database.1 Create a Physical Standby Database You create a logical standby database by first creating a physical standby database and then transitioning it into a logical standby database. TABLE_NAME.2.1.CREATE MATERIALIZED VIEW LOG CREATE SPFILE FROM PFILE DROP DATABASE LINK DROP MATERIALIZED VIEW DROP MATERIALIZED VIEW LOG EXPLAIN LOCK TABLE SET CONSTRAINTS SET ROLE SET TRANSACTION DBMS_JOB Support Specific support for DBMS_JOB has been provided.2 Creating a Logical Standby Database 4. then you must issue the ALTER DATABASE ADD SUPPLEMENTAL LOG DATA statement on each physical standby database to ensure future switchovers work correctly.ignored when db in secondary role LOG_ARCHIVE_DEST_2= 'SERVICE=boston VALID_FOR=(ONLINE_LOGFILES. ALTER TABLE mytab ADD PRIMARY KEY (id. 4. Redo Apply will fail.ignored when db in primary role LOG_ARCHIVE_DEST_3= 'LOCATION=/arch2/chicago/ VALID_FOR=(STANDBY_LOGFILES. jobs scheduled on the original primary database will automatically begin running on the new primary database.2 Prepare the Primary Database to Support a Logical Standby Database Ensure Supplemental Logging Is Enabled SELECT SUPPLEMENTAL_LOG_DATA_PK AS PK_LOG. 4. jobs submitted on the primary database are replicated in the standby database. Note: Some of the tables displayed in the DBA_LOGSTDBY_NOT_UNIQUE view can still be supported because supplemental logging adds information that uniquely identifies the row containing the redo data.2. name) RELY DISABLE. you can create a disabled primary key RELY constraint on the table.STANDBY_ROLE) DB_UNIQUE_NAME=chicago' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE LOG_ARCHIVE_DEST_STATE_3=ENABLE 8 Oracle 10g Data Guard Summary Sheets .BAD_COLUMN FROM DBA_LOGSTDBY_NOT_UNIQUE WHERE TABLE_NAME NOT IN (SELECT TABLE_NAME FROM DBA_LOGSTDBY_UNSUPPORTED). 4. Note: If you enable supplemental logging on a primary database in a Data Guard configuration that also contains physical standby databases. Note: if data in constraint columns are not unique.2. SUPPLEMENTAL_LOG_DATA_UI AS UI_LOG FROM V$DATABASE. 4. ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY. In the event of a switchover or failover.2 Ensure Table Rows in the Primary Database Can Be Uniquely Identified The following query displays a list of tables that SQL Apply might not be able to uniquely identify: SELECT OWNER. However. UNIQUE INDEX) COLUMNS.ALL_ROLES) DB_UNIQUE_NAME=chicago' -.2.

minimum 9 PARALLEL_MAX_SERVERS=9 UNDO_RETENTION=3600 • Shutdown the database SHUTDOWN IMMEDIATE. • create a new temporary file for the logical standby database same tempfile as in the primary db SELECT TABLESPACE_NAME FROM DBA_TABLESPACES WHERE CONTENTS = 'TEMPORARY'.ora.. STARTUP MOUNT.UNDO_RETENTION=3600 4.In the primary db ALTER DATABASE CREATE LOGICAL STANDBY CONTROLFILE AS '/tmp/boston.2. • Create a Control File for the Logical Standby Database -.ora. • Prepare for SQL Apply. ALTER DATABASE RECOVER MANAGED STANDBY DATABASE. SHUTDOWN IMMEDIATE. • Restart the logical standby database.ALL_ROLES) DB_UNIQUE_NAME=boston' LOG_ARCHIVE_DEST_2= 'SERVICE=chicago VALID_FOR=(ONLINE_LOGFILES.STANDBY_ROLE) DB_UNIQUE_NAME=boston' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE LOG_ARCHIVE_DEST_STATE_3=ENABLE -.ctl /arch1/boston/control1.ctl Change database ID and database name chicago to boston? (Y/[N]) => y . • Activate the logical standby database.ctl /arch2/boston/control2.ora. ALTER DATABASE RENAME GLOBAL_NAME TO boston. • Change the logical standby database name in the parameter file DB_NAME=boston • Create a server parameter file for the logical standby database CREATE SPFILE FROM PFILE=initboston. STARTUP MOUNT PFILE=initboston.PRIMARY_ROLE) DB_UNIQUE_NAME=chicago' LOG_ARCHIVE_DEST_3= 'LOCATION=/arch2/boston/ VALID_FOR=(STANDBY_LOGFILES. nid TARGET=SYS/password@boston DBNAME=boston Connected to database chicago (DBID=1456557175) Control Files in database: /arch1/boston/control1.ctl'. • Copy the control file to the logical standby system cp /tmp/boston. ALTER DATABASE OPEN RESETLOGS.2.4 Start the Logical Standby Database STARTUP MOUNT PFILE=initboston.. 9 Oracle 10g Data Guard Summary Sheets .ctl 4.ctl cp /tmp/boston.3 Prepare to Transition to a Logical Standby Database • Ensure Supplemental Logging Is Enabled • Create a PFILE and prepare it for the Logical Standby Database: LOG_ARCHIVE_DEST_1= 'LOCATION=/arch1/boston/ VALID_FOR=(ONLINE_LOGFILES. ALTER DATABASE ACTIVATE STANDBY DATABASE. • Reset the database name of the logical standby database.

4. DICT_END FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#. ALTER SYSTEM ARCHIVE LOG CURRENT. • see current SQL Apply activity COLUMN STATUS FORMAT A50 COLUMN TYPE FORMAT A12 SELECT TYPE. FIRST_TIME.2. • verify the logical standby database is performing: go to section 4. HIGH_SCN.2. In the standby db ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YY HH24:MI:SS'. INITIALIZING means log apply services are preparing to begin SQL Apply.2 • Enable Flashback Database 10 Oracle 10g Data Guard Summary Sheets . VALUE FROM V$LOGSTDBY_STATS WHERE NAME = 'coordinator state'.5 Verify the Logical Standby Database Is Performing Properly • Verify the archived redo log files were registered COLUMN DICT_BEGIN FORMAT A10 COLUMN DICT_END FORMAT A8 SELECT SEQUENCE#. • Verify redo data is being applied correctly COLUMN NAME FORMAT A30 COLUMN VALUE FORMAT A30 SELECT NAME. DICT_END FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#.ALTER TABLESPACE TEMP1 ADD TEMPFILE '/arch1/boston/temp01. In the primary db ALTER SYSTEM ARCHIVE LOG CURRENT.2 4.3 Further Preparations • Upgrade the data protection mode • Configure standby redo logs: Section 5. NEXT_TIME. • start SQL Apply ALTER DATABASE START LOGICAL STANDBY APPLY.6. STATUS FROM V$LOGSTDBY. DICT_BEGIN.5 • configure Standby Redo Log Files: go to section 5. COLUMN DICT_BEGIN FORMAT A10 COLUMN DICT_END FORMAT A8 SELECT SEQUENCE#. • Check the overall progress of SQL Apply SELECT APPLIED_SCN. FIRST_TIME.6. NEWEST_SCN FROM DBA_LOGSTDBY_PROGRESS. DICT_BEGIN. NEXT_TIME.dbf' SIZE 40M REUSE.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->