04 - 08 - 2021 Data Guard New Features and Best Practices
04 - 08 - 2021 Data Guard New Features and Best Practices
04 - 08 - 2021 Data Guard New Features and Best Practices
www.viscosityna.com @ViscosityNA
Charles Kim @racdba
GUI DBA (Right Click Late 90’s and Dot Com “It is not the strongest or the most intelligent
DBAs)
who will survive but those who can best
Google DBA Dot Com and 2000’s
(Developers)
manage [adapt to] change.”
iDBA Dot Com, IOUG iDBA Master Curriculum
RAC DBAs (MAA 2000+ after 9.2 (but major spike with 10.2) + Data Guard
DBAs)
DMA 2010+ Database Machine Administrator
vDBA / vRAC DBA 2010+ Evolving role of a DBA in the virtual world
Cloud DBA 2011+ Database Consolidation with Private Database Cloud The DBA role is not dying.
Oracle Database 12c Launches June 2013
Public Cloud DBA 2015+ Oracle Public Cloud with Database Cloud Service, Database
Backup Cloud Service, Storage Cloud Service, IaaS Cloud Service The DBA role has always been
PDBAs 2017+ Multi-Tenant with Oracle Database 12c Release 2 changing.
GA – March 2017
Oracle 21c January 2021 - Preview released in Oracle Cloud; Innovation Release
@ViscosityNA 4
Quarterly Tech Deep Dives
Q1 2017
What Happens Online in 60 Seconds?
Why it is more important to have a DR Strategy
6
Upgrade and Patching
Considerations
@ViscosityNA
PSUs are Very Important for Data Guard (N-1)
Note: 756671.1 - Oracle Recommended Patches - Oracle Database
http://www.dbaexpert.com/blog/master-reference-for-psus/
12.1.0.2
11.2.0.4
Data Guard Standby - First Patch Apply (11.2)
Doc ID 1265700.1 - Data Guard Standby-First Patch Apply
Candidates Patches:
• Database home interim patches
• Exadata bundle patches (e.g. Monthly and quarterly
database patches for Exadata)
• Database patch set updates (PSUs)
11
Oracle 19c Autonomous Database
Extra 9 from Data Guard
@ViscosityNA
Data Guard
dbca (12.2)
@ViscosityNA
Data Guard
dbca (12.2)
@ViscosityNA
19c: dbca silent enhancements
Duplicate an Oracle RAC database
@ViscosityNA
DML Redirection
@ViscosityNA
Read Mostly Physical Standby
@ViscosityNA
Active Data Guard
DML Re-Direction
@ViscosityNA
MIRA
@ViscosityNA
12.2: Data Guard
MIRA
• ALTER DATABASE RECOVER MANAGED STANDBY DATABASE command now accepts a new
INSTANCES [ ALL | integer] clause
• Cannot specify which RAC instance(s) will perform the redo apply
@ViscosityNA
Multi-Instance Redo Apply Supports Use of Block Change Tracking Files for
RMAN Backups
18c: MIRA + BCT = ADG (Best of both worlds)
@ViscosityNA
Additional 19c New Features
In previous releases, getting the secondary to the same point in time as the primary requires a manual procedure to flash back
Flashback physical standby when the primary standby databases. A new parameter is introduced which enables the standby database to be flashed back automatically when
Flashback Database is performed on the primary database.
database is flashed back
Propagate restore points to the standby Restore points and GRP is stored in the control file and not propagated to the standby site
With Failover, the standby becomes the new primary and restore point information is LOST
@ViscosityNA
Additional Data Guard 19c
New Features
@ViscosityNA
Observer and FSFO
Configure it to Observe only creating a 'test mode' to see when a failover or other
interaction would have occurred during the normal production processing
Dynamically Change FSFO target With 12.2, we can have multiple FSFO targets
With 19c, we can change the targets without FSFO being disabled
@ViscosityNA
Export and Import DG Broker Metadata File
19c
@ViscosityNA
Automatic Standby
Database Flashback
@ViscosityNA
Additional 19c New Features
Clear Flashback logs periodically to Starting in 19c, the management of space in the fast recovery area is simplified
increase FRA size predictability Oracle Database monitors flashback logs in the fast recovery area and automatically
deletes flashback logs that are beyond the retention period. When the retention
target is reduced, flashback logs that are beyond the retention period are deleted
immediately.
New Parameters for Tuning Automatic DATA_GUARD_MAX_IO_TIME sets the maximum number of seconds that can elapse
before a process is considered hung while performing a regular I/O operation in an
Outage Resolution Oracle Data Guard environment. Regular I/O operations include read, write, and
status operations.
@ViscosityNA
Data Guard 18c New
Features
@ViscosityNA
Oracle Database 18c
New Features
@ViscosityNA
Oracle Database 18c
New Features
Sharded RAC
Logically partition data across instances in RAC
User Defined Sharding
@ViscosityNA
Oracle Database 18c
Additional Features
• Reverses the roles between a refreshable clone PDB and a primary PDB.
• The former Refreshable clone PDB becomes the primary PDB, which can now be
opened in read write mode.
• The formerly primary PDB now is the refreshable clone and can only be opened in
READ ONLY mode.
• This command must be executed from the primary PDB.
• The dblink must point to the root CDB where the refreshable clone PDB resides.
@ViscosityNA
Data Guard 18c
Oracle
NoLogging Database
Database nologging extended for better use with Oracle Active Data Guard
environment (without significantly increasing the amount of redo generated).
39
Evolution of Data Guard
@ViscosityNA
Evolution of Data Guard
Oracle Version Big Feature Added
Oracle 7.3 Hot Standby
Oracle 8i Read-Only Physical Standby
Managed Recovery
Oracle 9i Logical Standby, Switchover/Failover
Automatic Gap Resolution
Cascaded Redo
Oracle 10g Real-time apply
Standby Redo Logs
FSFO
Flashback Database on DG
Oracle 11g Active Data Guard
Redo Compression
Snapshot Standby
Rolling Transient Upgrades
RMAN Duplicate from Active Database
Oracle 12.1.0.1 Far Sync
Fast Sync (LOG_ARCHIVE_DEST_n attributes SYNC and NOAFFIRM)
Data Guard Broker Switchover Enhancements
SYSDG Role
Online Standby Database File Rename
Significantly Improved Rolling Upgrades (DBMS_ROLLING) 41
Evolution of Data Guard
• Restriction
• Cannot use NoCache or Order for sequences
42
Evolution of Data Guard
Oracle Version Some Feature Added
More 12c Alter Database Move Datafile (New in 12c)
Release 1 Continued • Does not impact the standby database
Database altered.
FILE_NAME
----------------------------------------------------
+FRA/VCE/DATAFILE/mydata.279.932660601
43
Additional DG 12.1 New Features Overview
• Resumeable Switchover
44
Far Sync
Introduced in 12.1
@ViscosityNA
Oracle 12.1: Far Sync Instance
Common Use Case
Instance
Far Sync (12.1)
Zero Data Loss
• SYSDG (12.1)
• STARTUP
• SHUTDOWN
• ALTER DATABASE
Primary • ALTER SESSION
DB • ALTER SYSTEM
• CREATE RESTORE POINT (including
GUARANTEED Restore Points)
• CREATE SESSION
SYNC NOAFFIRM • DROP RESTORE POINT (including
Limited Distance GUARANTEED Restore Points)
• FLASHBACK DATABASE
• SELECT ANY DICTIONARY (DBA_ Views)
ASYNC • SELECT
Far Sync Any Distance Standby • X$ Tables
Instance DB • V$ and GV$ Views
Transport compression • APPQOSSYS.WLM_CLASSIFIER_PLAN
Over WAN • DELETE on APPQOSSYS.WLM_CLASSIFIER_PLAN
• EXECUTE SYS.DBMS_DRS
alter database create • dgmgrl
far sync instance controlfile as ‘/tmp/farsync.ctl’;
48
Far Sync Primary DB Server: vna85 - Primary DB Name: JIN01
Zero Data Loss FS Server: vna84 - Far Sync Server: JIN01fs
Physical Standby server: ika82 - Physical Standby Name: JIN01_DR
Standby
Configure primary to only ship to Far Sync and modify to SYNC
DB • EDIT DATABASE "JIN01" SET PROPERTY RedoRoutes ='(LOCAL:JIN01fs
ASYNC SYNC)';
Any
Distance
49
Data Guard 12.2 New
Features
@ViscosityNA
Evolution of Data Guard
Oracle Version Some Feature Added
Oracle 12.2 Block Comparison tool in DGMGRL
(Some of my favorites)
Multiple Observers
Multiple Automatic Failover Targets
Fast-Start Failover in Max Protection Mode
Support for Transparent Destinations of Different Endianess
• Cross Endian Data Guard (I.e AIX to ZDLRA)
52
Data Guard
Subset Standbys
• In 12.1, ENABLED_PDBS_ON_STANDBY initialization parameter only supported two values: all PDBs
or none
• The ENABLED_PDBS_ON_STANDBY parameter is only applicable on the physical standby database
– can accept a list of PDB names or a glob pattern such as “VNAPDB?” or “VNAPDB*a”,
“VNAPDB2”
– Glob pattern rules are similar to regular expression rules in common UNIX shells
– asterisk (*) and question mark (?) wildcard characters are supported.
• The question mark (?) represents a single unknown character;
– the asterisk (*) represents matches to any number of unknown characters.
– This parameter also accepts a minus sign (-) which can be used as the first character in a
PDB name to designate that the PDB should be excluded on the standby database
@ViscosityNA
Top 10 Common Data
Guard Failures
@ViscosityNA
Common Data Guard Issues
Day-To-Day Problems That DBAs Face
@ViscosityNA
OEM 13c Cloud Control to monitor and
Bulletproof DG Configuration manage a Data Guard environment:
Where Does It Start
Proactive
• File System Monitoring
• ASM Disk Group Monitoring
• DB_RECOVERY_FILE_DEST + DB_RECOVERY_FILE_DEST_SIZE
Enterprise Manager 13.4 Main Release Update List (Includes Plug-ins) (Doc ID 2647078.2)
OEM 13c Cloud Control to monitor and manage a Data Guard environment:
Send Alerts!
60
Best Practice Recommendations
And General Guidelines
• Download DG Toolkit
• DG Toolkit has all the best practices in-mind
62
Network Layer
SDU + BDP
• Set SDU to 32k (default 8k) for SYNC • Calculate BDP
• No performance gain for ASYNC - Set SEND_BUF_SIZE and
• Max Size = 64k (starting from RECV_BUF_SIZE Oracle Net
11.2.0.2) Parameters
- Set net.ipv4.tcp_wmem and
net.ipv4.tcp_rmem kernel parameters
Option #1:
Set default SDU to be 32k in the - Script: dg_bdp.ksh from DG Toolkit
SQLNET.ORA ❖ dg_bdp.conf
DEFAULT_SDU_SIZE=32767
VISK_PRI = LISTENER =
(DESCRIPTION = (DESCRIPTION_LIST =
(SEND_BUF_SIZE=2557500) (DESCRIPTION=(ADDRESS_LIST=
(RECV_BUF_SIZE=2557500) (ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
(ADDRESS_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)
(ADDRESS = (PROTOCOL = TCP) (HOST = rac561-vip) (PORT = 1521)
(HOST = rac561-vip) (SEND_BUF_SIZE=2557500)
(PORT = 1521)) (RECV_BUF_SIZE=2557500)))
)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
SID_LIST_LISTENER =
(SERVICE_NAME = VISK)
(SID_LIST =
)
) (SID_DESC =
(ORACLE_HOME = /app/oracle/product/11.2.0/db)
(SID_NAME = VISK1)
)
)
FRA Best Practices
FRA Best Practices
LOG_ARCHIVE_DEST_1 ’LOCATION=USE_DB_RECOVERY_FILE_DEST’
MAA Best Practices: Minimum 6 hours for protection from user errors,
DB_FLASHBACK_RETENTION_TARGET logical corruptions, and malicious users
You can enable BCT on the standby Does incur a license of Oracle Active Data Guard
database now
select filename,
status,
bytes
from v$block_change_tracking;
Standby Redo Logs (SRLs)
Date 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 1
------- ---- ---- ---- ---- ---- ---- ---- --- --- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
Feb 28 1 0 0 1 2 1 4 9 5 6 7 9 8 8 0 0 0 0
Feb 27 2 1 1 2 2 1 1 5 1 1 2 0 1 0 0 0 5 0
Feb 26 12 5 12 2 5 5 1 8 4 4 6 4 2 2 1 1 5 3
Feb 25 8 3 4 4 5 3 7 8 5 7 8 9 3 8 11 9 12 12
Feb 24 12 10 13 7 3 3 7 9 8 8 8 3 5 6 3 8 4 9 1
Feb 23 16 25 23 20 15 11 5 11 6 8 2 7 7 9 3 8 9 11 1
Feb 22 4 3 3 1 3 3 4 9 4 4 7 9 7 3 8 9 8 5 1
Feb 21 0 0 1 2 1 2 3 8 4 3 5 4 7 5 4 7 10 7
Feb 20 6 20 14 0 0 1 5 8 4 1 2 0 2 6 0 0 5 0
now Your Archive Generation Rate
SELECT
TO_CHAR(TRUNC(FIRST_TIME),'Mon DD') "Date",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'00',1,0)),'9999') "00",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'01',1,0)),'9999') "01",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'02',1,0)),'9999') "02",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'03',1,0)),'9999') "03",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'04',1,0)),'9999') "04",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'05',1,0)),'9999') "05",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'06',1,0)),'9999') "06",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'07',1,0)),'9999') "07",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'08',1,0)),'9999') "08",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'09',1,0)),'9999') "09",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'10',1,0)),'9999') "10",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'11',1,0)),'9999') "11",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'12',1,0)),'9999') "12",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'13',1,0)),'9999') "13",
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'14',1,0)),'9999') "14",
...
TO_CHAR(SUM(DECODE(TO_CHAR(FIRST_TIME,'HH24'),'23',1,0)),'9999') "23"
FROM V$LOG_HISTORY GROUP BY TRUNC(FIRST_TIME)
ORDER BY TRUNC(FIRST_TIME) DESC;
RMAN Image Copy
Backups
@ViscosityNA
RMAN Image Copy Backup Strategy
Backup files to Direct NFS
1. Database Image Copy Database Architecture
2. Incremental backups
DB Server 3. Archive Log backups
4. Nightly No Rows Full database
exports
5. Autobackup of controlfiles
ORAPRD DOCPRD 6. SPFILE backup
Notes: 84
1. -r option can only be used with Copy Backups 75
2. -r must find a baseline tag in the $SH directory; otherwise, the script will perform a full level 0 copy
RMAN To Disk Backups #2
rman2disk.ksh from http://dbaexpert.com/rman2disk/
@ViscosityNA
Build Physical Standby Menu
Duplicate Database (From Active Database)
Execute ./dg_duplicate_database.ksh manually or from DG Toolkit
echo "";
echo "# ------------------------------------------------------------- #”
echo "# -- Scripts are generated in the /tmp/dba directory #";
echo "# ------------------------------------------------------------- #”
ls -l /tmp/dba
echo "";
export TMPDIR=/tmp/dba
[ ! -d "$TMPDIR" ] && mkdir -p /tmp/dba
# ---------------------------------------------------------------------------------------
# -- Create the following initialization file for the JIN01_DR instance:
# -- /u01/app/oracle/product/12.1.0/dbhome_1/dbs/initJIN01_DR.ora
# ---------------------------------------------------------------------------------------
cat <<EOF > /u01/app/oracle/product/12.1.0/dbhome_1/dbs/initJIN01_DR.ora
db_name=JIN01
db_unique_name=JIN01_DR
cluster_database=false
EOF
# ---------------------------------------------------------------------------------------
# -- Execute the following RMAN script on the standby database server
# --
# -- First startup nomount the database with either SQL*PLUS or RMAN>
# ---------------------------------------------------------------------------------------
echo "startup nomount;
Duplicate Database From Active Database #2
rman <<EOF
connect target sys/oracle123@JIN01;
connect auxiliary sys/oracle123@JIN01_DR;
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database
dorecover
spfile
parameter_value_convert 'JIN01','JIN01_DR'
set 'db_unique_name'='JIN01_DR'
set control_files='+FRA'
set log_archive_max_processes='5'
set fal_client='JIN01_DR'
set fal_server='JIN01'
set standby_file_management='AUTO'
set db_create_file_dest='+DATA'
set db_create_online_log_dest_1='+DATA'
set log_archive_config='dg_config=(JIN01,JIN01_DR)'
set log_archive_dest_1='service=JIN01 LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)
db_unique_name=JIN01'
set cluster_database='FALSE'
set parallel_execution_message_size='8192'
set db_lost_write_protect='TYPICAL'
set db_block_checking='TRUE'
set db_block_checksum='FULL'
nofilenamecheck
;
Duplicate Database From Active Database #3
sql channel stby "alter database recover managed standby database using
current logfile disconnect";
}
EOF
Monitoring Data Guard
With Scripts
@ViscosityNA
Monitoring
From the $SH directory, invoke the prep_alertlog.ksh script for each database
Oracle Database Alert Log Monitoring 1. Change ORACLE_SID to database you want to setup alert log monitoring
2. Execute prep_alertlog.ksh (checks v$diag_info to determine trace directory)
3. Create the OFA directory structure: $ORACLE_BASE/admin/$ORACLE_SID/bdump
4. Creates symbolic link for alert_$ORACLE_SID.log
export TRACE_DIR=$(
1. prep_alertlog.ksh alertlog.pl sqlplus -s / as sysdba <<EOF
set head off ver off lines 2000 trims on pages 0 feed off
1. Leverages the Tiny.pm perl module select value from v\$diag_info where name='Diag Trace' ;
• This is located in the $SH/lib/Config directory exit;
2. wrapper_alertlog.ksh (please note that Config is a Capital C) EOF
• Must copy the contents of the lib subdirectory to )
every node export ALERT_LOG=$TRACE_DIR/alert_$ORACLE_SID.log
alertlog.pl 2. Leverages the alertlog.conf file echo "Trace Dir: $TRACE_DIR"
cat alertlog.conf echo "-> Alert Log: $ALERT_LOG"
ORACLE_BASE=/app/oracle
export BDUMP=$ORACLE_BASE/admin/$ORACLE_SID/bdump
SH=/app/oracle/general/sh echo "-->BDUMP is: $BDUMP"
SQL=/app/oracle/general/sql if [ ! -d $BDUMP ]; then
echo "$BDUMP directory does not exist! Creating directory: $BDUMP"
mkdir $BDUMP
oraping.ksh Note: fi
• alertlog.conf file is leveraged by Tiny.pm perl module and
cannot have any variables cd $BDUMP
• All parameters must be hard-coded
blockmon.ksh if [ -h "alert_$ORACLE_SID.log" ]; then
echo "--->Alert Log for Oracle SID Exists... removing symbolic link for
3. Add ORA- error messages that you want the alertlog.pl $alert_$ORACLE_SID.log"
alerting to ignore to the $SH/ignore.dat file rm alert_$ORACLE_SID.log
fi
long_running_sql.ksh wrapper_alertlog.ksh
ln -s $ALERT_LOG alert_$ORACLE_SID.log
#!/bin/ksh [ ! -d "$SH/log" ] && ( echo "----> $SH/log directory does not exist.. making dir
$SH/log"; mkdir -p $SH/log )
----------------------------------------------------------
[ ! -f "$SH/ignore.dat" ] && ( echo "-----> $SH/ignore.dat file does not exist...
. $HOME/.ORACLE_BASE
vmstat.ksh . $ORACLE_BASE/general/sh/functions.ksh touching $SH/ignore.dat"; touch $SH/ignore.dat )
[ ! -f "$SH/errLogAlert.dat" ] && ( echo "------> $SH/errLogAlert.dat file does
export PATH=/usr/local/bin:$PATH
cd $SH not exist... touching $SH/errLogAlert.dat"; touch $SH/errLogAlert.dat )
./alertlog.pl emrepos
85
Monitoring
export PATH=$PATH:/usr/sbin
export CONF_DIR=$SH/logrotate
[ ! -d "$CONF_DIR" ] && ( echo $CONF_DIR does not exist .. issuing mkdir; mkdir -p $CONF_DIR )
export CONF=$CONF_DIR/$CONFIG_FILE
• Monitoring MRP
dg_check_mrp.sql
set time on
set lines 132
set pagesize 9999
col client_pid format a12
SELECT PID, PROCESS, STATUS,
CLIENT_PROCESS, CLIENT_PID,
THREAD#, SEQUENCE#, BLOCK#,
BLOCKS, DELAY_MINS
FROM V$MANAGED_STANDBY;
Monitoring • Need to be on the latest
• PSU
Or
• RU / RUR
• Monitoring Transport and Apply Lag
dg_lag.sql
col name for a13
col value for a20
col unit for a30
set lines 122
SELECT NAME, VALUE, UNIT, TIME_COMPUTED
FROM V$DATAGUARD_STATS
WHERE NAME IN ('transport lag', 'apply lag');
Monitoring
@ViscosityNA
Poor Man’s EBS DR
RSYNC
rsync -avz -e ssh --stats --progress /appsvr/CM applmgr@dr_app_server:/apps702 >
$LOGFILE 2>&1
function rsync_appstmp {
APPLCSF=/apps/tmp/PROD/APPLCSF
rsync -avz -e ssh --del --stats --progress ${APPLCSF}/log applmgr@dr_app_server:/apps702 >
$LOGFILE 2>&1
rsync -avz -e ssh --del --stats --progress ${APPLCSF}/out applmgr@dr_app_server:/apps702 >
$LOGFILE 2>&1
}
Data Guard (Switchover)
(P) ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
(S)ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;
(S) ALTER DATABASE OPEN;
(P)ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE
DISCONNECT;
93
www.viscosityna.com
Poor Man’s EBS DR
Failover Complete Loss Primary Database (Start Here)
• SQL> ALTER DATABASE RECOVER MANAGED STANDBY
DATABASE CANCEL;
Data Guard (Primary) Database altered.
SQL> SHUTDOWN IMMEDIATE; Finish applying all received redo data.
SQL> STARTUP MOUNT; • SQL> ALTER DATABASE RECOVER MANAGED STANDBY
SQL> ALTER SYSTEM FLUSH REDO TO DATABASE FINISH;
'<target_db_name>'; Database altered.
Repeat for Each Thread Verify that the target standby database is ready to become a Primary
• SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
Data Guard (Standby - Resolve Gaps if • SWITCHOVER_STATUS
-----------------
Possible)
TO PRIMARY
SQL> ALTER DATABASE REGISTER PHYSICAL
LOGFILE 'filespec1'; Switch the physical standby database to the primary role.
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY
WITH SESSION SHUTDOWN;
SQL> ALTER DATABASE OPEN;
94
www.viscosityna.com
Broker Configuration
@ViscosityNA
Broker Configuration
SPFILE Setup
Configuration Status:
WARNING (status updated 45 seconds ago)
Observer
Start Observer
# --
# -- You can use the following script to start the observer
#!/usr/bin/ksh
dgmgrl <<___EOF >/tmp/observer_`hostname`.log
connect sys/oracle123@VISK_PRI
start observer
___EOF
Archive Log Retention
@ViscosityNA
Archive Log Retention
@ViscosityNA
109
110
At the heart of it is the dg.conf configuration file
DG Toolkit Simplified
Simplified Configuration File for non-RAC (12 Parameters To Instantiate Data Guard)
# --------------------------------------------------------------------------- #
PRIMARY_HOST=vnadb01
PRIMARY_DB=VNA
PRIMARY_PORT=1521
# --
STANDBY_HOST=vnadr01
STANDBY_DB=VNADR
STANDBY_PORT=1523
# --------------------------------------------------------------------------- #
# - File System information (for duplicate database, rman restore, dbca)
# --------------------------------------------------------------------------- #
PRIMARY_FS=/oradata01
PRIMARY_ARCH=/oraarch
STANDBY_FS=/oradata01
STANDBY_ARCH=/oraarch
# --------------------------------------------------------------------------- #
PRIMARY_ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
STANDBY_ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
112
Useful DG Toolkit Scripts
@ViscosityNA
Misc DG Toolkit Simple Built-Ins
On the Standby Database:
• dg_start.sql Start MRP (with SRL) disconnect
alter database recover managed standby database
using current logfile disconnect;
dg_lag.sql Check transport and apply lag for the Data Guard environment
korn shell script to backup the database to the FRA or file system disk
rman2disk.ksh
group
For old timers who are still using Logical Standby – Submenu for Logical
dg_logical_menu.ksh
Standby database maintenance and monitoring
Follow Us Online!
Facebook.com/ViscosityNA
Linkedin.com/company/Viscosity-North-America
@ViscosityNA
Facebook.com/ViscosityNA
@Viscosity_NA
117