Sie sind auf Seite 1von 43

DBAs Guide to Physical Dataguard Part II

amazon.com a9.com att.net

Overview
Recap from Part I Standby Database Physical Standby Dataguard Configuration Protection Levels Dataguard Config & Recap Switchover Fast Start Failover MAXIMUM AVAILABILITY Flashback Database Broker Configuration Anything else

Part II Requirements Protection Levels VMware Setup & Recommendations

2 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Standby Database
Archive Logs

a1 a2

apply

DB

Redo logs

Archive Logs

STANDBY DB

r1
r2

a1
a2
arc0

DB
lgwr

r3 r4

a3

TRANSPORT scp, ftp, nfs

PRIMARY DB 3 / 43
DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Dataguard::Overview
Manual Transport Manual Apply Disconnected Manual Switch/Fail over Oracle Transport ARCH LGWR Automatic Apply Connected Broker FSFO Faster Switch/Fail over Protection Levels MAX PERFORMANCE MAX AVAILABILITY MAX PROTECTION

4 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

VMware::Overview
DataStore Directory Create / Import VM in DataStore Use an Administrator account Web based: localhost 8222 and 8333 (SSL)

Host OS: XP Pro 32-bit SP3, 64-bit Vista SP1 Guest OS: Oracle Enterprise Linux 5 32-bit Host: localhost Guest Machines: tintin and haddock Database: snowy, Oracle 10.2.0.4 32-bit

5 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

VMware::Network Setup
c:\windows\system32\drivers\etc\hosts /etc/hosts

# Windows Host Entries 127.0.0.1 localhost ::1 localhost # Linux VM Host (Guest) Entries / Listener fails to start without this entry 127.0.0.1 localhost.localdomain localhost # Dataguard VMware Configuration on all hosts 192.168.196.1 me 192.168.196.2 tintin 192.168.196.3 haddock 10.0.0.1 10.0.0.2 10.0.0.3 me-pri tintin-pri haddock-pri me-pri.ahgvm.me tintin-pri.ahgvm.me haddock-pri.ahgvm.me me.ahgvm.me tintin.ahgvm.me haddock.ahgvm.me snowy-a snowy-a.ahgvm snowy-a.ahgvm.me snowy-b snowy-b.ahgvm snowy-b.ahgvm.me

6 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Dataguard::Transports
log_archive_dest_n SERVICE ARCH or LGWR SYNC, ASYNC=[size] AFFIRM, NOAFFIRM log_archive_dest_state_n enable defer reset alternate
MAX PERF
REDO

MAX AVAIL LGWR SYNC AFFIRM YES

MAX PROT LGWR SYNC AFFIRM YES

ARCH LGWR SYNC ASYNC AFFIRM NOAFFIRM NO

SYNC

WRITE

STBY REDO

MAXIMUM PERFORMANCE Transport: ARCH or LGWR Transmission: ASYNC if using LGWR If using ASYNC standby redo logs needed Standby Disk writes: NOAFFIRM Primary does not stop if standby unavailable MAXIMUM AVAILABILITY Transport: LGWR Transmission: SYNC Standby Disk writes: AFFIRM (1 standby) Requires Standby Redo Logs (online redo group count + 1)*threads Does not stop if redo not written to >= 1 standby Downgrades to MAXIMUM PERFORMANCE MAXIMUM PROTECTION Transport: LGWR Transmission: SYNC Standby Disk Writes: AFFIRM Requires Standby Redo Logs (online redo group count + 1)*threads Hangs if redo not written to >= 1 standby Eventual Shutdown

7 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Dataguard::Transport Parameters
MANDATORY, OPTIONAL ALTERNATE=[log_archive_dest_n], NOALTERNATE DEPENDENCY=[log_archive_dest_n], NODEPENDENCY MAX_FAILURE=[number_of_retries], NOMAX_FAILURE REOPEN=[seconds] default 60, NOREOPEN DELAY=[minutes], default 30, NODELAY NET_TIMEOUT=[seconds], NONET_TIMEOUT VERIFY, NOVERIFY (with ARCH transport only) DB_UNIQUE_NAME=[targetdb unique name], NODB_UNIQUE_NAME VALID_FOR=(redo_log_type, database_role) redo_log_type: online_logfile, standby_logfile, all_logfiles database_role: primary_role, standby_role, all_roles log_archive_config='dg_config=(snowy_a,snowy_b) archive_lag_target=(x+y) x: current redo log created x seconds ago y: estimated archival time for current logs redo redo log switch when ((x+y) > archive_lag_target) and (redo entries exist)) fal_client fal_server Add standby redo logs for MAX PROTECTION & MAX AVAILABILITY STARTUP MOUNT; ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE {PROTECTION | AVAILABILITY | PERFORMANCE}; Open DB

8 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Dataguard::LGWR Transport
LGWR LNSn (LGWR Network Server Process)
RFS
MRP

RFS (Remote File Server Process) MRP (Managed Recovery Process) ARCn

DB
r1 a1 a2
ARCn

LNSn

r2
r3

DB

LGWR

r1 r2
r3
ARCn

a1 a2 a3
Archive Logs

Standby Redo logs

a3
Archive Logs

STANDBY DB

Redo logs

PRIMARY DB 9 / 43
DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

FSFO Architecture
DMON OBSERVER DMON

Broker Cfg.

OBSERVER

Broker Cfg.

DB
LGWR

spfile

spfile

DB

LNSn

RFS

MRP

Real-Time Apply Redo logs Standby Redo logs

PRIMARY

STANDBY

10 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

FSFO Requirements

11 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

DGMGRL listener service

12 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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) ) )

13 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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) ) )

14 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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) )

15 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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) ) )

16 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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

17 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Standby Redo Logs

18 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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 ----- ---------1 ONLINE 1 ONLINE 2 ONLINE 2 ONLINE 3 ONLINE 3 ONLINE Status Log File Size/MB ---------- ------------------------------ ------CURRENT /dbh/snowy/redo1/redo1a.log CURRENT /dbh/snowy/redo2/redo1b.log INACTIVE /dbh/snowy/redo2/redo2a.log INACTIVE /dbh/snowy/redo3/redo2b.log INACTIVE /dbh/snowy/redo3/redo3a.log INACTIVE /dbh/snowy/redo1/redo3b.log

50 50 50 50 50 50

19 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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;

20 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Flashback Database
db_recovery_file_dest=/dbh/flashback db_recovery_file_dest_size=3G db_flashback_retention_target=60

Redo generated in db_flashback_retention_target seconds Sufficient space in db_recovery_file_dest_size db_unique_name sub-directory automatically created under db_recovery_file_dest

FLASHBACK_ON

STARTUP MOUNT ALTER DATABASE FLASHBACK ON

21 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Prot. Level: MAX AVAILABILITY


LGWR SYNC AFFIRM ARCHIVER TRANSMIT_MODE 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' 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'

22 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Prot. Level: MAX AVAILABILITY


STARTUP MOUNT ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY;

PROTECTION_MODE

23 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Real Time Apply

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE PARALLEL n USING CURRENT LOGFILE DISCONNECT FROM SESSION; Managed Standby Recovery not using Real Time Apply Managed Standby Recovery starting Real Time Apply

24 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Broker Configuration
dg_broker_start=false Change to true after spfile conversion and restart Setting to true starts DMON process DMON log in background_dump_dest -> drc<SID>.log snowy -> drcsnowy.log

dg_broker_config_file1='/orah/oracle/admin/snowy/pfile/snowy_a_broker_1.dat dg_broker_config_file2='/orah/oracle/admin/snowy/pfile/snowy_a_broker_2.dat'

dg_broker_config_file1='/orah/oracle/admin/snowy/pfile/snowy_b_broker_1.dat dg_broker_config_file2='/orah/oracle/admin/snowy/pfile/snowy_b_broker_2.dat'

25 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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;

26 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Create DGMGRL Configuration

$ORACLE_HOME/bin/dgmgrl / DGMGRL for Linux: Version 10.2.0.4.0 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

27 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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

28 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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

29 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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

30 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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 .... NetTimeout .... StandbyArchiveLocation ....

= 'SYNC = '10 = '/dbh/snowy/arch

Current status for "snowy_a": DISABLED

31 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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 .... NetTimeout .... StandbyArchiveLocation ....

= 'SYNC' = '10 = '/dbh/snowy/arch/'

Current status for "snowy_b": DISABLED

32 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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

33 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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

34 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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

35 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Observer

dgmgrl sys/oracle@snowy DGMGRL for Linux: Version 10.2.0.4.0 - Production Copyright (c) 2000, 2005, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. Connected. DGMGRL> start observer Observer started

36 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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, 2009

14: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

37 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

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"

38 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Role Trigger : DB_ROLE_CHANGE

39 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Thank You
Ahbaid Gaffoor ahbaid@{amazon.com|a9.com|att.net}

40 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

References
http://tahiti.oracle.com Dataguard Concepts and Administration

Oracle Database High Availability with RAC, Flashback & Data Guard Matthew Hart & Scott Jesse, Oracle Press Oracle Data Guard Bipul Kumar, Rampant Oracle on VMware Bert Scalzo, Rampant

otn.oracle.com ocpdba.net orafaq.com psoug.org vmware.com

Oracle-L

41 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Appendix: fsfo_check.sql
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; /

42 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Appendix: role_change_trigger.sql
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, -27369); 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;

43 / 43

DBAs Guide to Physical Dataguard Part II, NoCOUG May 21st 2009

Das könnte Ihnen auch gefallen