This is an old revision of the document!
Table of Contents
Dataguard
Start up the apply on a physical standby
startup nomount alter database mount standby database; alter database recover managed standby database disconnect;
Stop the apply on a physical standby
alter database recover managed standby database cancel;
Register a missing logfile
alter database register physical logfile '<fullpath/filename>';
Show apply activity on the standby
0@@
shows something like this
1@@
See Dataguard error log messages
If data guard is not functioning correctly, check the errors in this log.
2@@
and
3@@
Check which logs are missing
Assuming dest_2 is the standby select local.thread# , local.sequence# from
(select thread#
, sequence#
from v$archived_log
where dest_id=1) local
where local.sequence# not in
(select sequence#
from v$archived_log
where dest_id=2 and
thread# = local.thread#);
Stop/Start log file shipping
On the primary alter system set log_archive_dest_state_2 = 'defer'; alter system set log_archive_dest_state_2 = 'enable';
Start FAL tracing on the primary
alter system set LOG_ARCHIVE_TRACE = 128;
Stop the DataGuard broker
alter system set dg_broker_start=false;
Are we a standby?
select database_role from v$database;
Show various details on health of standby database
4@@
See how up-to-date a standby is
On the primary
5@@
On the standby
6@@
or
7@@
See how up-to-date a standby is (another version)
8@@
Show info on all log destinations
On the primary
9@@
Display log destinations options
On the standby
10@@
Show any standby logs
set lines 100 set pages 999 col member format a70 select st.group# , st.sequence# , ceil(st.bytes/1048576) mb , lf.member from v$standby_log st , v$logfile lf where 1=1 and st.group# = lf.group#
Dataguard broker (dgmgrl) setup for management of physical standby databases
Assuming primary and standby already exist and have standby redologs setup, force logging etc…<br /> Example: server1 - db_primary, server2 - db_standby<br />
Preparation
On both systems…
11@@
Create a configuration
From server1
12@@
Configuration created, add the physical standby to it
13@@
Configuration complete, enable it
14@@
Show configuration
15@@
Show individual database information
16@@
Switchover primary to standby and vice versa
From server1
17@@
Switch back to the original situation
From server2
18@@
Failover
The difference between switchover and failover is that you control a switchover, a failover happens bacause the primary db is no longer available<br /> From server2
19@@
Backup this database immediately as it is now the only database and has no standby. This can be done with RMAN while it is running.<br /> If flashback was not enabled, the old primary is now useless and will need to be recreated as a standby.<br /> If, however flashback was enabled, we can use this to restart the old primary as a standby.<br /> From server1
20@@
If flashback was not enabled, recreate old primary as a standby something like this
21@@
22@@
23@@
24@@
25@@
Dataguard broker managed standby (dgmgrl) not applying logs after restart
After restarting the Primary and Standby databases manually, the redo logs were not being applied on the standby.<br /> The command used to start the standby database was:
26@@
It seems this is not good enough, we see a problem in the broker configuration… (0) OTMPRODS oracle@ravotm14:/home/oracle] dgmgrl DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright © 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type “help” for information. DGMGRL> connect sys/@otmprod Connected. DGMGRL> show configuration
Configuration - dg_otmprod
Protection Mode: MaxPerformance
Databases: otmprod - Primary database otmprods - **Physical standby database (disabled)**
Fast-Start Failover: DISABLED
Configuration Status: SUCCESS
DGMGRL> We need to re-enable the Standby database in the broker configuration DGMGRL> enable database OTMPRODS; Enabled. DGMGRL> show configuration
Configuration - dg_otmprod
Protection Mode: MaxPerformance
Databases: otmprod - Primary database otmprods - **Physical standby database**
Fast-Start Failover: DISABLED
Configuration Status: SUCCESS Now check alert log. All is working again.
(Re)Build a physical standby from an active primary database
Run from the standby server. Trivial mods to parameterise it soon!
27@@
Recover a physical standby from an gap using SCN based incremental (catch up) backup
Essential steps using nfs mounted filesystem (/shared_backups) shared between both primary and secondary nodes to avoid scp copies
28@@
