DBA’s Guide to Physical Dataguard Part II. DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st 2009 2 / 43 Overview.

Slides:



Advertisements
Similar presentations
DBA’s Guide to Physical Dataguard. DBA’s Guide to Physical Dataguard, NoCOUG Feb 12 th / 21 Overview:
Advertisements

INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Oracle High Availability Solutions RAC and Standby Database Copyright System Managers LLC 2008.
Chapter 14 Handling Online Redo Log Failures. Background RMAN doesn’t back up online redo logs You don’t use RMAN to recover from online redo log failures.
Oracle Architecture. Instances and Databases (1/2)
PRESENTOR:- KAMRAN SIDDIQUE SENIOR CONSULTANT/ARCHITECT (HA EXPERT) CGI DON’T WAIT OPPORTUNITY TO CREATE TECHNOLOGY…USE TECHNOLOGY TO CREATE OPPORTUNITY.
Thomas E. Canty ServerCare, Inc. Session #126 Data Guard Best Practices & Tuning.
Disaster Recovery with Oracle Data Guard
Oracle9i Data Guard Darl Kuhn Sun Microsystems
Backup The flip side of recovery. Types of Failures Transaction failure –Transaction must be aborted System failure –Hardware or software problem resulting.
Managing an Oracle Instance
Oracle Data Guard 11g Release 2 with Oracle Enterprise Manager 10g Grid Control
ITEC474 Redo Log Files.
CHAPTER 5 Managing Control Files, Online Redo Logs, and Archiving.
Oracle9i Database Administrator: Implementation and Administration
7 Maintaining Redo Log Files. 7-2 Objectives Explaining the use of online redo log files Obtaining log and archive information Controlling log switches.
1 © 2006 Julian Dyke Logical Standby Julian Dyke Independent Consultant juliandyke.com Web Version.
CERN - IT Department CH-1211 Genève 23 Switzerland t Oracle Data Guard for RAC migrations WLCG Service Reliability Workshop CERN, November.
Using RMAN to Perform Recovery
1 Data Guard Basics Julian Dyke Independent Consultant Web Version - February 2008 juliandyke.com © 2008 Julian Dyke.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Client-Server – Lecture 4 Copyright System Managers LLC 2007 all rights reserved.
Oracle Database Administration
5 Copyright © 2007, Oracle. All rights reserved. Configuring the Oracle Network Environment.
12 Copyright © 2004, Oracle. All rights reserved. Oracle Net Services.
Presentation #32050 Presentation #32050 Implementing Oracle9i Data Guard For Higher Availability By Daniel T. Liu First American Real Estate Solutions.
CHAPTER 2 Implementing a Database. Introduction to Creating Databases After you’ve installed the Oracle software, the next logical step is to create a.
ORACLE 10g DATA GUARD BROKER Ritesh Chhajer Sr. Oracle DBA.
Load Balancing & Failover (RAC) RAC 负载均衡和失效接管. About ACOUG  ACOUG: All China Oracle User Group 
Oracle DataGuard Concepts and Architecture
Chapter 9 Scripting RMAN. Background Authors felt that scripting was a topic not covered well Authors wanted to cover both Unix/Linux and Windows environments.
ORACLE 10g DATAGUARD Ritesh Chhajer Sr. Oracle DBA.
4 Copyright © 2006, Oracle. All rights reserved. Recovering from Noncritical Losses.
11g(R1/R2) Data guard Enhancements Suresh Gandhi
DB-2: OpenEdge® Replication: How to get Home in Time … Brian Bowman Sr. Solutions Engineer Sandy Caiado Sr. Solutions Engineer.
Specview 32 Release 2.5 Enhancements
6 Copyright © 2009, Oracle. All rights reserved. Configuring the Oracle Network Environment.
Daniela Anzellotti Alessandro De Salvo Barbara Martelli Lorenzo Rinaldi.
1 Data Guard. 2 Data Guard Reasons for Deployment  Site Failures  Power failure  Air conditioning failure  Flooding  Fire  Storm damage  Hurricane.
IT Database Administration SECTION 01. Starting Up and Shutting Down the Database Database Administration Facilities – A number of tools are available.
Week 3 Lecture 1 The Redo Log Files and Diagnostic Files.
3 Copyright © Oracle Corporation, All rights reserved. Basic Oracle Net Server Side Configuration.
8 Copyright © Oracle Corporation, All rights reserved. Configuring the Database Archiving Mode.
10 Copyright © Oracle Corporation, All rights reserved. User-Managed Backups.
Configuring the Database Archiving Mode
CERN IT Department CH-1211 Genève 23 Switzerland t Using Data Guard for hardware migration.
Implementing Oracle9i Data Guard Michael New Senior Technical Consultant ThinkSpark Session id:
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
CERN IT Department CH-1211 Genève 23 Switzerland 1 Active Data Guard Svetozár Kapusta Distributed Database Operations Workshop November.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Basic Oracle Net Services Client-Side Configuration
Agenda Data Guard Architecture & Features
SETA Central 2006 Crashes Happen - Downtime Won't with Data Guard Stephen Rea Tuesday, October 10, :30 AM.
© Puget Sound Oracle Users Group Education Is Our Passion PSOUG Education Education Is Our Passion Hands-on Workshop Series Oracle DataGuard 10gR2.
1 Copyright © 2007, Oracle. All rights reserved. Realistic Testing Setting Up the Test Environment.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
Copyright  Oracle Corporation, All rights reserved. 3 Oracle Backup and Recovery Configuration.
5 Copyright © 2005, Oracle. All rights reserved. Managing the Oracle Instance.
CERN IT Department CH-1211 Genève 23 Switzerland t Using Data Guard for hardware migration UKOUG RAC & HA SIG, Feb 2008 Miguel Anjo, CERN.
1 Implementing Oracle Data Guard for the RLS database Kasia Pokorska CERN, IT-DB 30 th March 2004.
3 Copyright © Oracle Corporation, All rights reserved. 管理数据库事例.
Oracle 12c Data Guard – Far Sync and what’s new
Configuring the Database Archiving Mode
Is 221: Database Administration
Oracle9i Database Administrator: Implementation and Administration
Understanding the Oracle Data Guard Architecture
Chapter 5 The Redo Log Files.
Arkansas Banner Users Group (ABUG) 2006
Oracle Data Guard Broker Session-3
Oracle Data Guard Session-4
Presentation transcript:

DBA’s Guide to Physical Dataguard Part II

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Overview

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 DB PRIMARY DB Standby Database DB STANDBY DB apply Archive Logs a1a1 a1a1 a2a2 a2a2 TRANSPORT scp, ftp, nfs Archive Logs arc0 a1a1 a1a1 a2a2 a2a2 a3a3 a3a3 Redo logs r1r1 r1r1 lgwr r4r4 r4r4 r3r3 r3r3 r2r2 r2r2

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Dataguard::Overview

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 VMware::Overview

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 VMware::Network Setup # Windows Host Entries localhost ::1 localhost # Linux VM Host (Guest) Entries / Listener fails to start without this entry localhost.localdomain localhost # Dataguard VMware Configuration on all hosts meme.ahgvm.me tintintintin.ahgvm.me haddockhaddock.ahgvm.me me-prime-pri.ahgvm.me tintin-pritintin-pri.ahgvm.mesnowy-a snowy-a.ahgvm snowy-a.ahgvm.me haddock-pri haddock-pri.ahgvm.mesnowy-b snowy-b.ahgvm snowy-b.ahgvm.me

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Dataguard::Transports MAX PERFMAX AVAILMAX PROT REDO ARCH LGWR SYNC ASYNC SYNC WRITE AFFIRM NOAFFIRM AFFIRM STBY REDO NOYES

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Dataguard::Transport Parameters

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 DB STANDBY DB Dataguard::LGWR Transport DB PRIMARY DB Archive Logs ARCn a1a1 a1a1 a2a2 a2a2 a3a3 a3a3 Redo logs r1r1 r1r1 LGWR r3r3 r3r3 r2r2 r2r2 Archive Logs ARCn a1a1 a1a1 a2a2 a2a2 a3a3 a3a3 Standby Redo logs r1r1 r1r1 RFS r3r3 r3r3 r2r2 r2r2 LNSnMRP

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 FSFO Architecture DB PRIMARY Redo logs LGWR LNSn DB STANDBY MRP Real-Time Apply Standby Redo logs RFS OBSERVER DMON Broker Cfg. Broker Cfg. spfile

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 FSFO Requirements

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 DGMGRL listener service

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 DGMGRL listener service lsnr_snowy_dg_001 = (description = (address_list= (address=(protocol=tcp) (host=snowy-a.ahgvm.me) (port=5701)) ) sid_list_lsnr_snowy_dg_001 = (sid_list= (sid_desc=(sdu=32767) (sid_name = snowy) (oracle_home = /orah/oracle/10204) ) sid_list_lsnr_snowy_dg_001 = (sid_list= (sid_desc=(sdu=32767) (sid_name = snowy) (oracle_home = /orah/oracle/10204) ) (sid_desc=(sdu=32767) (sid_name = snowy) (oracle_home = /orah/oracle/10204) (global_dbname = snowy_a_DGMGRL.ahgvm) ) lsnr_snowy_dg_001 = (description = (address_list= (address=(protocol=tcp) (host=snowy-b.ahgvm.me) (port=5703)) ) sid_list_lsnr_snowy_dg_001 = (sid_list= (sid_desc=(sdu=32767) (sid_name = snowy) (oracle_home = /orah/oracle/10204) ) sid_list_lsnr_snowy_dg_001 = (sid_list= (sid_desc=(sdu=32767) (sid_name = snowy) (oracle_home = /orah/oracle/10204) ) (sid_desc=(sdu=32767) (sid_name = snowy) (oracle_home = /orah/oracle/10204) (global_dbname = snowy_b_DGMGRL.ahgvm) )

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 DGMGRL listener registration db_unique_name=snowy_a local_listener='(address_list= (address= (protocol=tcp) (host=snowy-a.ahgvm.me) (port=5701) ) (address= (protocol=tcp) (host=snowy-a.ahgvm.me) (port=5702) ) )' db_unique_name=snowy_b local_listener='(address_list= (address= (protocol=tcp) (host=snowy-b.ahgvm.me) (port=5703) ) (address= (protocol=tcp) (host=snowy-b.ahgvm.me) (port=5704) ) )‘

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Application listener FQDN lsnr_snowy_general = (address= (protocol=tcp) (host=snowy-cname.ahgvm.me) (port=1526) ) lsnr_snowy_general = (address= (protocol=tcp) (host=snowy-a.ahgvm.me) (port=1526) ) lsnr_snowy_general = (address= (protocol=tcp) (host=snowy-cname.ahgvm.me) (port=1526) ) lsnr_snowy_general = (address= (protocol=tcp) (host=snowy-b.ahgvm.me) (port=1526) )

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 DGMGRL TNS uses service snowy_a.ahgvm = (DESCRIPTION = (SDU = 32767) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = snowy-a.ahgvm.me) (PORT = 5701) ) (ADDRESS = (PROTOCOL = TCP) (HOST = snowy-a.ahgvm.me) (PORT = 5702) ) (CONNECT_DATA = (SERVICE_NAME = snowy_a_DGMGRL.ahgvm) (SERVER = DEDICATED) ) snowy_b.ahgvm = (DESCRIPTION = (SDU = 32767) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = snowy-b.ahgvm.me) (PORT = 5703) ) (ADDRESS = (PROTOCOL = TCP) (HOST = snowy-b.ahgvm.me) (PORT = 5704) ) (CONNECT_DATA = (SERVICE_NAME = snowy_b_DGMGRL.ahgvm) (SERVER = DEDICATED) )

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Application TNS snowy.ahgvm = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = snowy-cname.ahgvm.me) (PORT = 1526) ) (CONNECT_DATA = (SERVICE_NAME = snowy) (SERVER = DEDICATED) ) snowy.ahgvm = (DESCRIPTION = (FAILOVER = ON)(LOAD_BALANCE=OFF) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = snowy-a.ahgvm.me) (PORT = 1526) ) (ADDRESS = (PROTOCOL = TCP) (HOST = snowy-b.ahgvm.me) (PORT = 1526) ) (CONNECT_DATA = (SERVICE_NAME = snowy) (SERVER = DEDICATED) ) UNTESTED

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Standby Redo Logs

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Standby Redo Logs SQL> select type as "Types", count(distinct group#) as "Groups" from v$logfile group by type; Types Groups ONLINE 3 SQL> select a.group#, a.type, b.status, a.member, b.bytes/power(2,20) from v$logfile a, v$log b where a.group# = b.group# ; Group Type Status Log File Size/MB ONLINE CURRENT /dbh/snowy/redo1/redo1a.log 50 1 ONLINE CURRENT /dbh/snowy/redo2/redo1b.log 50 2 ONLINE INACTIVE /dbh/snowy/redo2/redo2a.log 50 2 ONLINE INACTIVE /dbh/snowy/redo3/redo2b.log 50 3 ONLINE INACTIVE /dbh/snowy/redo3/redo3a.log 50 3 ONLINE INACTIVE /dbh/snowy/redo1/redo3b.log 50

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Standby Redo Logs alter database add standby logfile group 4 '/dbh/snowy/redo1/red04a.log' size 50M; alter database add standby logfile group 5 '/dbh/snowy/redo1/red05a.log' size 50M; alter database add standby logfile group 6 '/dbh/snowy/redo1/red06a.log' size 50M; alter database add standby logfile group 7 '/dbh/snowy/redo1/red07a.log' size 50M; alter database add standby logfile group 8 '/dbh/snowy/redo1/red08a.log' size 50M; alter database add standby logfile group 9 '/dbh/snowy/redo1/red09a.log' size 50M;

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Flashback Database

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Prot. Level: MAX AVAILABILITY db_unique_name=snowy_a log_archive_dest_2 = 'db_unique_name=snowy_b SERVICE=snowy_b valid_for=(online_logfile, primary_role) REOPEN=60 OPTIONAL LGWR SYNC AFFIRM' db_unique_name=snowy_b log_archive_dest_2 = 'db_unique_name=snowy_a SERVICE=snowy_a valid_for=(online_logfile, primary_role) REOPEN=60 OPTIONAL LGWR SYNC AFFIRM'

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Prot. Level: MAX AVAILABILITY

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Real Time Apply

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Broker Configuration

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Conversion to spfile SQL> create spfile=‘/orah/oracle/admin/snowy/pfile/spfilesnowy.ora’ from pfile; SQL> SHUTDOWN IMMEDIATE; $ cd $ORACLE_HOME/dbs $ mv initsnowy.ora initsnowy.pfile $ echo “spfile=/orah/oracle/admin/snowy/pfile/spfilesnowy.ora” > initsnowy.ora SQL> /* STARTUP OPEN on PRIMARY, STARTUP MOUNT on STANDBY */ SQL> alter system set dg_broker_start= true scope=both;

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Create DGMGRL Configuration $ORACLE_HOME/bin/dgmgrl / DGMGRL for Linux: Version – Production Copyright (c) 2000, 2005, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. Connected. DGMGRL> create configuration 'FSFOsnowy' as > primary database is 'snowy_a' > connect identifier is snowy_a.ahgvm; Configuration "FSFOsnowy" created with primary database "snowy_a" DGMGRL> add database 'snowy_b' as > connect identifier is snowy_b.ahgvm > maintained as physical; Database "snowy_b" added

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Show DGMGRL Configuration DGMGRL> show configuration Configuration Name: FSFOsnowy Enabled: NO Protection Mode: MaxPerformance Fast-Start Failover: DISABLED Databases: snowy_a - Primary database snowy_b - Physical standby database Current status for "FSFOsnowy": DISABLED

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Show snowy_a Configuration I DGMGRL> show database verbose snowy_a Database Name: snowy_a Role: PRIMARY Enabled: NO Intended State: OFFLINE Instance(s): snowy Properties: InitialConnectIdentifier = 'snowy_a.ahgvm' ObserverConnectIdentifier = '' LogXptMode = 'ASYNC' Dependency = '' DelayMins = '0' Binding = 'OPTIONAL' MaxFailure = '0' MaxConnections = '1' ReopenSecs = '300' NetTimeout = '180' LogShipping = 'ON' PreferredApplyInstance = '' ApplyInstanceTimeout = '0' ApplyParallel = 'AUTO' StandbyFileManagement = 'auto' ArchiveLagTarget = '0’ Continues on Next Slide

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Show snowy_a Configuration II ArchiveLagTarget = '0' LogArchiveMaxProcesses = '2' LogArchiveMinSucceedDest = '1' DbFileNameConvert = '' LogFileNameConvert = ', ' FastStartFailoverTarget = '' StatusReport = '(monitor)' InconsistentProperties = '(monitor)' InconsistentLogXptProps = '(monitor)' SendQEntries = '(monitor)' LogXptStatus = '(monitor)' RecvQEntries = '(monitor)' HostName = 'tintin.ahgvm.me' SidName = 'snowy' LocalListenerAddress = '(address=(protocol=tcp)(host=snowy-a.ahgvm.me)(port=5701))' StandbyArchiveLocation = 'dgsby_snowy_a' AlternateLocation = '' LogArchiveTrace = '0' LogArchiveFormat = 'snowy-%t_%s_%r.arc' LatestLog = '(monitor)' TopWaitEvents = '(monitor)' Current status for "snowy_a": DISABLED Continued from Last Slide

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Edit snowy_a Properties DGMGRL> edit database snowy_a set property 'LogXptMode'='SYNC'; Property "LogXptMode" updated DGMGRL> edit database snowy_a set property 'NetTimeout'='10'; Property "NetTimeout" updated DGMGRL> edit database snowy_a set property 'StandbyArchiveLocation'='/dbh/snowy/arch'; Property "StandbyArchiveLocation" updated DGMGRL> show database verbose snowy_a Database Name: snowy_a Role: PRIMARY Enabled: NO Intended State: OFFLINE Instance(s): snowy Properties:.... LogXptMode = 'SYNC‘.... NetTimeout = '10‘.... StandbyArchiveLocation = '/dbh/snowy/arch‘.... Current status for "snowy_a": DISABLED

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Edit snowy_b Properties DGMGRL> edit database snowy_b set property 'LogXptMode'='SYNC'; Property "LogXptMode" updated DGMGRL> edit database snowy_b set property 'NetTimeout'='10'; Property "NetTimeout" updated DGMGRL> show database verbose snowy_b Database Name: snowy_b Role: PHYSICAL STANDBY Enabled: NO Intended State: OFFLINE Instance(s): snowy Properties:.... LogXptMode = 'SYNC'.... NetTimeout = '10‘.... StandbyArchiveLocation = '/dbh/snowy/arch/'.... Current status for "snowy_b": DISABLED

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Enable Configuration DGMGRL> enable configuration Enabled. DGMGRL> show configuration Configuration Name: FSFOsnowy Enabled: YES Protection Mode: MaxAvailability Fast-Start Failover: DISABLED Databases: snowy_a - Primary database snowy_b - Physical standby database Current status for "FSFOsnowy": SUCCESS Current status for "FSFOsnowy": Warning: ORA-16610: command 'Broker automatic health check' in progress Current status for "FSFOsnowy": Warning: ORA-16610: command 'ENABLE DATABASE snowy_b' in progress

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Enable Fast Start Failover DGMGRL> enable fast_start failover; Enabled. DGMGRL> show configuration Configuration Name: FSFOsnowy Enabled: YES Protection Mode: MaxAvailability Fast-Start Failover: ENABLED Databases: snowy_a - Primary database snowy_b - Physical standby database - Fast-Start Failover target Current status for "FSFOsnowy": SUCCESS

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Check Fast Start Failover Fast Start Failover Status: ============================================================ DB_UNIQUE_NAME : snowy_a SWITCHOVER_STATUS : SESSIONS ACTIVE FORCE_LOGGING : YES PROTECTION_MODE : MAXIMUM AVAILABILITY PROTECTION_LEVEL : MAXIMUM AVAILABILITY FLASHBACK_ON : YES FS_FAILOVER_STATUS : SYNCHRONIZED FS_FAILOVER_OBSERVER_HOST : hulk.ilmtech.com FS_FAILOVER_CURRENT_TARGET : snowy_b FS_FAILOVER_THRESHOLD : 30 FS_FAILOVER_OBSERVER_PRESENT : NO Fast Start Failover Status: ============================================================ DB_UNIQUE_NAME : snowy_b SWITCHOVER_STATUS : SESSIONS ACTIVE FORCE_LOGGING : YES PROTECTION_MODE : MAXIMUM AVAILABILITY FLASHBACK_ON : YES FS_FAILOVER_STATUS : SYNCHRONIZED FS_FAILOVER_OBSERVER_HOST : hulk.ilmtech.com FS_FAILOVER_CURRENT_TARGET : snowy_b FS_FAILOVER_THRESHOLD : 30 FS_FAILOVER_OBSERVER_PRESENT : NO

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Observer dgmgrl DGMGRL for Linux: Version Production Copyright (c) 2000, 2005, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. Connected. DGMGRL> start observer Observer started

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Failover 14:44:29.28 Tuesday, May 19, 2009 Initiating fast-start failover to database “snowy_b"... Performing failover NOW, please wait... Failover succeeded, new primary is “snowy_b" 14:45:04.03 Tuesday, May 19, :46:40.77 Tuesday, May 19, 2009 Initiating reinstatement for database “snowy_a"... Reinstating database “snowy_a", please wait... Operation requires shutdown of instance “snowy" on database “snowy_a" Shutting down instance “snowy"... ORA-01109: database not open Database dismounted. ORACLE instance shut down. Operation requires startup of instance “snowy" on database “snowy_a" Starting instance “snowy"... ORACLE instance started. Database mounted. Continuing to reinstate database “snowy_a"... Reinstatement of database “snowy_a" succeeded 14:47:51.45 Tuesday, May 19, 2009

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Switchover DGMGRL> switchover to snowy_a Performing switchover NOW, please wait... Operation requires shutdown of instance "snowy" on database "snowy_b" Shutting down instance "snowy"... ORA-01109: database not open Database dismounted. ORACLE instance shut down. Operation requires shutdown of instance "snowy" on database "snowy_a" Shutting down instance "snowy"... ORA-01109: database not open Database dismounted. ORACLE instance shut down. Operation requires startup of instance "snowy" on database "snowy_b" Starting instance "snowy"... ORACLE instance started. Database mounted. Operation requires startup of instance "snowy" on database "snowy_a" Starting instance "snowy"... ORACLE instance started. Database mounted. Switchover succeeded, new primary is "snowy_a"

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Role Trigger : DB_ROLE_CHANGE

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Thank You Ahbaid Gaffoor

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 References

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 declare cursor cdb is select FORCE_LOGGING, PROTECTION_MODE, PROTECTION_LEVEL, FLASHBACK_ON, DB_UNIQUE_NAME, SWITCHOVER_STATUS, FS_FAILOVER_STATUS, FS_FAILOVER_CURRENT_TARGET, FS_FAILOVER_THRESHOLD, FS_FAILOVER_OBSERVER_PRESENT, FS_FAILOVER_OBSERVER_HOST from v$database; procedure print(s varchar2) is begin dbms_output.put_line(s); end print; procedure cr is begin print(chr(10)); end cr; procedure line(l number := 60, c varchar2 := '=') is begin print(rpad(c,l,c)); end line; begin for db in cdb loop cr; print('Fast Start Failover Status:'); line; print(rpad('DB_UNIQUE_NAME',31)||': '||db.DB_UNIQUE_NAME); print(rpad('SWITCHOVER_STATUS',31)||': '||db.SWITCHOVER_STATUS); print(rpad('FORCE_LOGGING',31)||': '||db.FORCE_LOGGING); print(rpad('PROTECTION_MODE',31)||': '||db.PROTECTION_MODE); print(rpad('PROTECTION_LEVEL',31)||': '||db.PROTECTION_LEVEL); print(rpad('FLASHBACK_ON',31)||': '||db.FLASHBACK_ON); print(rpad('FS_FAILOVER_STATUS',31)||': '||db.FS_FAILOVER_STATUS); print(rpad('FS_FAILOVER_OBSERVER_HOST',31)||': '||db.FS_FAILOVER_OBSERVER_HOST); print(rpad('FS_FAILOVER_CURRENT_TARGET',31)||': '||db.FS_FAILOVER_CURRENT_TARGET); print(rpad('FS_FAILOVER_THRESHOLD',31)||': '||db.FS_FAILOVER_THRESHOLD); print(rpad('FS_FAILOVER_OBSERVER_PRESENT',31)||': '||db.FS_FAILOVER_OBSERVER_PRESENT); cr; end loop; end; / Appendix: fsfo_check.sql

DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 create or replace trigger T_FLIP_CNAME after db_role_change on database declare FLIP_DBCNAME_SCRIPT constant varchar2(100) := '/utilities/flip_dbcname'; DBCNAME_JOB constant varchar2(10) := 'DB_CNAME_FLIP'; dbrole VARCHAR2(30); dbname VARCHAR2(30); e_flip_dbcname_script EXCEPTION; PRAGMA EXCEPTION_INIT (e_flip_dbcname_script, ); begin select database_role into dbrole from v$database; if (dbrole = 'PRIMARY') then begin dbms_scheduler.drop_job(ROLE_JOB); exception when others then null; end; dbms_scheduler.create_job( job_name => DBCNAME_JOB, job_type => 'EXECUTABLE', number_of_arguments => 1, job_action => FLIP_DBCNAME_SCRIPT, enabled => false, auto_drop => true ); select instance_name into dbname from v$instance; dbms_scheduler.set_job_argument_value( job_name => DBCNAME_JOB, argument_position => 1, argument_value => dbname); begin dbms_scheduler.run_job(DBCNAME_JOB); exception when e_flip_dbcname_script then raise_application_error(-20001, 'flip failed in ' ||FLIP_DBCNAME_SCRIPT); end; end if; exception when others then raise_application_error(-20002, 'DB_ROLE_CHANGE trigger failed '||SQLERRM); end; Appendix: role_change_trigger.sql