04 - 08 - 2021 Data Guard New Features and Best Practices

Download as pdf or txt
Download as pdf or txt
You are on page 1of 106
At a glance
Powered by AI
The presentation discusses the evolution of the DBA role over time from CLI DBAs to Cloud DBAs. It also covers various Oracle database releases and features of Data Guard.

The presentation discusses how the DBA role has evolved from early CLI DBAs in the 1990s to current roles like Cloud DBAs. It provides a timeline of different types of DBAs that have emerged like RAC DBAs, vDBAs, and PDBAs.

The presentation discusses several useful SQL and shell scripts that are part of the Data Guard toolkit, including scripts to start and stop managed recovery process, check redo logs and lag, and register and backup archive logs.

Data Guard Configuration

12.2 / 18c /19c

New Features & Best Practices

Oracle Platinum Partner April 2021


[email protected]

Charles Kim, Oracle ACE Director

www.viscosityna.com @ViscosityNA
Charles Kim @racdba

• Founder and CEO of Viscosity


• Oracle ACE Director, Author of 10 books
• Expertise in Mission Critical Databases and Engineered Systems
RAC, Data Guard, ASM, RMAN, Shareplex/GG
• Specialize in “Complex Data Replication & Integration” with SharePlex & GG

• Oracle Exadata Certified Implementation Specialist


• Oracle Management Cloud Certified
• Oracle Certified RAC Expert
• Oracle Certified Linux Expert
http://viscosityna.com/resources/dba-resources/twelve-days-12-2/
Evolution of the Oracle DBA
Kind of DBA Timeline

CLI DBA Early 90’s DBAs

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 18c February 2018 in Oracle Cloud, July 2018 On-Premise

Oracle 19c January 2019 - LiveSQL


February 2019 for on-premises Exadata; April 2019 General Release
(Terminal Release or Long Term Release)
Oracle 20c Dead! Made preview in the cloud but did not go GA.

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

Starting in Oracle Database 11.2.0.1 and later What is allowed:


• Apply candidate patch(see below) first on the standby • 11.2.0.4 JulPSU to 11.2.0.4 OctPSU
• 12.1.0.2 JulPSU to 12.1.02 OctPSU
database (Binary Only)
• Evaluate candidate patch What is NOT allowed:
• Switchover • 11.2.0.3 JulPSU to 11.2.0.4
• Apply patch(es) on old primary database including • 11.2.0.4 JulPSU to 12.1.0.2
DataPatch
• Switchover (Switch Back)

Candidates Patches:
• Database home interim patches
• Exadata bundle patches (e.g. Monthly and quarterly
database patches for Exadata)
• Database patch set updates (PSUs)

Read the README.html file

11
Oracle 19c Autonomous Database
Extra 9 from Data Guard

• Continuous Adaptive Performance Tuning


• Fully Automated Hardware Resource Elasticity

• SLA: 99.995 % Uptime leveraging


– Exadata/RAC/ASM
– Active Data Guard
– RAC Rolling Upgrade
– Transient Logical Standby
– Online and Edition Based Re-definiition
– Flashback transaction, table, or database

– KSplice on the server side

@ViscosityNA Text “12C” to 444999 for the session slides! 12


99.995% Uptime

Availability % Downtime per year Downtime per month

99.95% ("three and a half


4.38 hours 21.56 minutes
nines")

99.99% ("four nines") 52.56 minutes 4.38 minutes

99.995% ("four and a half


26.28 minutes 2.16 minutes
nines")

99.999% ("five nines") 5.26 minutes 25.9 seconds


@ViscosityNA
DBCA in Silent Mode

@ViscosityNA
Data Guard
dbca (12.2)

• Create standby databases with DBCA • -createAsStandby followed by


– Must use command line dbca interface dbUniqueName For Standby
– Can only create from Non Multi-tenant primary
database • [-customScripts scripts_list]
– Cannot do RAC • List of scripts to be executed
– dbca -createDuplicateDB
• Oracle will execute the scripts in the
-gdbName global_database_name order they are listed
-primaryDBConnectionString
easy_connect_string_to_primary
– No Need for TNSNAMES.ORA entry
-sid database_system_identifier
[-createAsStandby – Can use easy connect string
[-dbUniqueName – "host[:port][/service_name][:serv
db_unique_name_for_standby]] er][/instance_name]"
[-customScripts scripts_list]

@ViscosityNA
Data Guard
dbca (12.2)

$ dbca -silent -createDuplicateDB \


-gdbName viscorcl \
-primaryDBConnectionString rac01:1521/viscorcl \
-sid viscorcl -createAsStandby \
-dbUniqueName sviscorc
Enter SYS user password:
Listener config step
33% complete
Auxiliary instance creation 66% complete
RMAN duplicate 100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/sviscorc/viscorc.log" for further
details.

@ViscosityNA
19c: dbca silent enhancements
Duplicate an Oracle RAC database

• DBCA Silent Mode New features in Database 19C (Doc ID 2477805.1)


• DBCA silent mode command "createDuplicateDB" will create a duplicate of a Non-
CDB or an Oracle RAC database.

• The createDuplicateDB command can be used to duplicate the following types of


databases:
Duplicate an Oracle RAC database as a non-multitenant container database (non-
CDB)
Duplicate an Oracle RAC database as a pluggable database (PDB)
Duplicate an Oracle RAC database as an Oracle RAC database
Duplicate an Oracle RAC database as an Oracle RAC standby database

Duplicate a non-CDB as a non-CDB
Duplicate a non-CDB as a non-CDB standby database
Duplicate a non-CDB as an Oracle RAC database

@ViscosityNA
DML Redirection

@ViscosityNA
Read Mostly Physical Standby

October 7, 2019 @ViscosityNA


19c: Data Guard DML Redirection

• RUN DML on Active Data Guard

• Re-Direct DML statement back to the primary database


• Data changes will happen on the primary database
• Changed blocks will ship to ADG
• ADG wil be in sync to maintain redundancy

Set ADG_REDIRECT_DML initialization parameter = TRUE


SQL> ALTER SESSION ENABLE ADG_REDIRECT_DML;

@ViscosityNA
Active Data Guard
DML Re-Direction

@ViscosityNA
MIRA

@ViscosityNA
12.2: Data Guard
MIRA

Multiple Instance Redo Apply (MIRA)


• Can run Redo Apply in some or all of the standby instances

• Redo Apply scales as wide as standby RAC configuration

• ALTER DATABASE RECOVER MANAGED STANDBY DATABASE command now accepts a new
INSTANCES [ ALL | integer] clause

• All the instances must be in the same mounted or open mode

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

• RMAN block change tracking file can now be


enabled on an Oracle Active Data Guard standby
that is using multi-instance Redo Apply

• Fastest redo apply technology + incremental


backup technology on the same Oracle Active
Data Guard
18c
Oracle
Database

@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

Now, the restore points are preserved after a failover

MIRA + In-Memory ADG

It its one or the other before

Now you can have best of both

@ViscosityNA
Additional Data Guard 19c
New Features

@ViscosityNA
Observer and FSFO

Observer in Observe Only Mode

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

- Can tune FSFO for finer granularity


- Can see IF FSFO would have actually occurred without production impact
- Improve failover validation

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

DGMGRL> export configuration to 'dg11.txt'; # cat /opt/oracle/diag/rdbms/dg11/DG11/trace/dg11.txt


<?xml version="1.0" encoding="UTF-8"?>
Succeeded. <DRC Version="19.0.0.0.0" CurrentPath="True" Name="dg1">
<DefaultState>ONLINE</DefaultState>
<DRC_UNIQUE_ID>1499567441</DRC_UNIQUE_ID>
<IntendedState>ONLINE</IntendedState>
<FastStartFailoverOBID1>191512127</FastStartFailoverOBID1>
<FastStartFailoverOBID2>191512128</FastStartFailoverOBID2>
<FastStartFailoverOBID3>191512129</FastStartFailoverOBID3>
DGMGRL> import configuration file from ‘dg11.txt’ <Configuration_Name>dg1</Configuration_Name>
<Member MemberID="1" CurrentPath="True" Enabled="True" MultiIn
<DefaultState>PRIMARY</DefaultState>
<IntendedState>PRIMARY</IntendedState>
<Status>
<Severity>Success</Severity>
<Error>0</Error>
<Timestamp>1601355896</Timestamp>
</Status>
<StandbyType>PhysicalStandby</StandbyType>
<DGConnectIdentifier>dg11</DGConnectIdentifier>
<DbDomain/>
@ViscosityNA
Restore Point Replication

@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.

DATA_GUARD_MAX_LONGIO_TIME sets the maximum number of seconds that can


elapse before a process is considered hung while performing a long I/O operation in
an Oracle Data Guard environment. Long I/O operations include open and close
operations.

@ViscosityNA
Data Guard 18c New
Features

@ViscosityNA
Oracle Database 18c
New Features

Sharded RAC Per-PDB Switchover


Logically partition data across instances in RAC
Transportable Backups Rolling patches for OJVM
Integration with Active Directory Per PDB Key storage
Authorization to database through Active Password-less schema creation
Directory user/group mappings to database No default passwords
schema users and roles
In-Memory for external tables Automatic propagation of nologging data to
standby
Alter Table Merge Partition Online Private Temporary Tables

@ViscosityNA
Oracle Database 18c
New Features

Zero Impact Grid Infrastructure Patching Per-PDB Switchover

Sharded RAC
Logically partition data across instances in RAC
User Defined Sharding

@ViscosityNA
Oracle Database 18c
Additional Features

Shadow Lost Write Protection Transportable Backups


-DB, TS or Datafile
Backups from non-CDBs are usable after migration to CDB

- Backups on source DB are PREPLUGIN backups

RMAN duplicate PDB into existing CDB Backup to archive storage

- Enhances Oracle SBT Library to Archive Storage Cloud

Manual termination of run-away queries


Manually kill a statement without breaking the session:
ALTER SYSTEM CANCEL SQL.
ALTER SYSTEM CANCEL SQL ‘SID, SERIAL, @INST_ID, SQL_ID’;

New parallel statement queue timeout and dequeue actions


@ViscosityNA
PDB Switchover Clause 18c
Oracle
Database

• 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.

• alter pluggable database refresh mode auto every 2 minutes


from new_pdb@dblink switchover;
Standby Nologging

@ViscosityNA
Data Guard 18c
Oracle
NoLogging Database

NoLogging on Primary Standby Nologging tells the database not to log


operations that qualify to be done without logging.
• Nologging blocks are recorded in the
control file on the physical standby Standby Nologging tells the database to send the
database data blocks created by the Nologging operation to
• On the Standby each qualifying standby database in Data Guard
RMAN RECOVER DATABASE configuration
NONLOGGED BLOCK
This typically results in those standbys NOT having
• After switchover, the old primary invalid blocks.
database must be in a mounted state
You can set standby no logging for load
performance or data availability in the following
statements:
– ALTER DATABASE
– ALTER PLUGGABLE DATABASE
– CREATE DATABASE
– CREATE CONTROLFILE
18c
Standby Nologging Oracle
Database

Database nologging extended for better use with Oracle Active Data Guard
environment (without significantly increasing the amount of redo generated).

There are two new nologging modes:


• Standby Nologging for Load Performance – Standbys receive non-logged
data changes (minimum impact on loading speed at). Non-logged blocks
automatically resolved by managed standby recovery.
• Standby Nologging for Data Availability - Standbys have data when
primary load commits (at the cost of throttling the speed of loading data at
the primary), which means the standbys never have any non-logged blocks
to worry about.
• Nologging can be used when loading data into your production
databases without compromising the integrity of Data Guard standby
databases, pick your level of synchronization between primary & standby
databases.

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

Oracle Version Sequences in Oracle Active Data Guard


Oracle 12.1 Sequences on the primary database must be defined with:
• Cache
• NoOrder

• Set Cache Size appropriately like we do in RAC


• Goes back to the primary database when requesting next set

• 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

1* alter database move datafile


'+DATA/VCE/DATAFILE/mydata.301.932660559' to '+FRA’
SQL> /

Database altered.

SQL> select file_name from dba_data_files where


tablespace_name='MYDATA';

FILE_NAME
----------------------------------------------------
+FRA/VCE/DATAFILE/mydata.279.932660601

• DML Operations on Temporary Tables on Oracle Active Data Guard


Instances

43
Additional DG 12.1 New Features Overview

• Resumeable Switchover

• Can do DML operations on Temporary tables on ADG instances

• Do not need using current logfile for real-time apply


• DEFAULT: alter database recover managed standby database using current logfile disconnect;

• Can move location of an online data file … moves on the primary


database do not affect the standby

• Can do Incremental Updates over TNS from the standby database

• Can use sequences on ADG


• Cache
• NoOrder

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

• create configuration JIN01_DGCONFIG as primary database is "JIN01"


connect identifier is JIN01;
Primary • add database "JIN01_DR" as connect identifier is JIN01_DR maintained as
DB physical;
Far Sync • enable configuration;
SYNC NOAFFIRM Instance
Limited Distance
• add far_sync "JIN01fs" as connect identifier is JIN01fs;
Transport compression • enable far_sync "JIN01fs";
Over WAN

Configure DR to receive from Far Sync using RedoRoutes


• EDIT FAR_SYNC "JIN01fs" SET PROPERTY
RedoRoutes='(JIN01:JIN01_DR ASYNC)';

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)

In-Memory in Active Data Guard


• Offload even more

Support for Diagnostic Pack (AWR) on Active DG


Support for Tuning Pack Features and SQL Plan Analyzer

OEM Support for Database Rolling Upgrades


DG Broker Support for Active DG Rolling Upgrades

DG Broker will take over session draining (switchover to DALLAS_DR wait;)


51
Evolution of Data Guard
Oracle Version Some Feature Added
Oracle 12.2 Create standby databases with DBCA
More Favorites
Multiple Instance Redo Apply (MIRA)

Subset Standby Databases


* Can do GRP at PDB Level now

Password Automatic Sync

Duplicate Database command to create farsync instance


with RMAN

Data Guard Broker can do Scripting like SQL*Plus

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

Common Data Guard Failures


Removal of archivelogs by accident before applied on the For RAC, databases, add datafile to ASM without the + sign
physical standby for +DATA diskgroup

Primary DB file system or ASM Disk Group space db_recovery_file_dest_size


exhaustion • Self inflicted outage

standby_file_management: Default: Manual No PSUs applied


Dealing with UNNAMED datafiles
Primary Database Archive Log Destination 100% full Forget to re-start MRP after reboot or outage
More Common: Standby Archive Log Destination 100%
full
SYS Password Change Broker changes
Alter System changes
Other things to consider: Other things to monitor:
Take GRPs before maintenance tasks NOLOGGING transactions on the primary database
Bulletproof Tips and Tricks

@ViscosityNA
OEM 13c Cloud Control to monitor and
Bulletproof DG Configuration manage a Data Guard environment:
Where Does It Start

» Data Guard status


Monitoring » Transport Lag
• Monitoring Alert Logs on both Primary » Apply Lag
» Estimated Database Role Transition Time
and Standby Databases
» Primary or standby is or is not accessible
• Monitoring Archive Gaps or Deviances
• Monitoring Transport Lag Send Alerts!
• Monitoring Apply Lag

Proactive
• File System Monitoring
• ASM Disk Group Monitoring
• DB_RECOVERY_FILE_DEST + DB_RECOVERY_FILE_DEST_SIZE

• Latest PSU Patches (N – 1 Consideration)


• OEM Full Integration and Lights-out Monitoring
• Quarterly Switchover Testing
59
Best Practice for Monitoring DG
OEM 13c Cloud Control Monitoring and Maintenance

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:

» Data Guard status


» Transport Lag
» Apply Lag
» Estimated Database Role Transition Time
» Primary or standby is or is not accessible

Send Alerts!

60
Best Practice Recommendations
And General Guidelines

• Download DG Toolkit
• DG Toolkit has all the best practices in-mind

• Ping [email protected] for a copy

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

• Impacts all databases that share the Oracle


Home
Option #2:
Or in listener.ora and tnsnames.ora together
Bandwidth-Delay Product = $ ./dg_bdp.ksh
Bandwidth * Latency * 3 BANDWIDTH is: 155000000
LATENCY is: .04400
cat dg_bdp.conf BDP = 2557500
WAN=OC3
RTT_RESPONSE=44
TNSNAMES.ORA ENTRY LISTENER.ORA ENTRY

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’

Always enable Flashback Database on primary and standby database

60 for just flashback re-instantiation

MAA Best Practices: Minimum 6 hours for protection from user errors,
DB_FLASHBACK_RETENTION_TARGET logical corruptions, and malicious users

Can also be used for Snapshot Standby


Block Change Tracking

Block Change Tracking


alter database enable block change tracking using file
'+DATA';

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)

Do not multiplex SRL


Best practices equation for the number for SRL is:
• # of SRL = (# of ORL + 1 ) X Threads

Recommend SRL for even Maximum Performance


Execute: ./dg_generate_standby_redo.ksh
Generates:
- Execute SQL Script: cr_standby_redo_p.sql on VISK
- Execute SQL Script: cr_standby_redo_s.sql on VISK_DR
Logging

At Database Level – Best Practice


SQL> alter database force logging;

Some opt to enforce logging at tablespace level:


- SQL> alter tablespace TS_NAME force logging;
- MV tablespace
- Temp tablespace for reports and stage data

Need to enable force logging monitoring


Execute dg_check_force_logging.sql to check Force Logging
Execute dg_check_unrecoverable.sql to check Unrecoverable
Activity
Know Your Archive Generation Rate

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

DWPRD ODSPRD Storage that support snapshots

DATA: Datafiles, Redo Log, Control


File, BCT
Replication
/dNFS/
RECO: Redo Log, Control File, Archive 10GigE Network
Log, Flashback Logs, spfile, Datapump dumps,
Backups
Daily Snapshots

1st Sat/Sun of the month - RMAN


Daily Incremental Backups Updated copy of the
Image Copy (Once Per month or 1. recover copy of database database that is in sync
with PROD DB
Quarter or Once Ever) 2. backup incremental level 1 for
* backup as copy incremental level 0 recover of copy Similar to EMC’s Sync and
Split
3. Backup archivelogs

/dNFS/bkup: L0 /dNFS/bkups: L1 /dNFS/bkups – Updated L0


RMAN To Disk Backups
rman2disk.ksh from http://dbaexpert.com/rman2disk/

Cron Job Examples:


## RMAN backups ##
00 23 * * 0 /app/oracle/general/sh/rman2disk.ksh -d DATABASE -l 0 -n 2 -c catalog > /tmp/rman_full_D
00 23 * * 1-6 /app/oracle/general/sh/rman2disk.ksh -d DATABASE -l 1 -n 2 -c catalog > /tmp/rman_incr_D
01 12,18 * * 1-6 /app/oracle/general/sh/rman2disk.ksh -d DATABASE -a y > /tmp/rman_arch_DATABASE.log 2

Usage Information for rman2disk.ksh:


Regular Usage with RMAN Backupsets:
1. Perform a full level 0 backup: rman2disk.ksh -d DATABASE -l 0 -c catalog > /tmp/rman2disk_DATABASE.L0.log 2>&1
2. Perform an incremental backup: rman2disk.ksh -d DATABASE -l 1 -c catalog > /tmp/rman2disk_DATABASE.L1.log 2>&1

Compressed Backups with RMAN Backupsets


1. Perform a full level 0 compressed backup: rman2disk.ksh -d DATABASE -l 0 -c catalog -z y > /tmp/rman2disk_DATABASE.L0Z.log 2>&1
2. Perform a compressed incremental backup: /rman2disk.ksh -d DATABASE -l 1 -c catalog -z y > /tmp/rman2disk_DATABASE.L1Z.log 2>&1

Advanced Usage with Database Copies:


1. Perform a baseline level 0 backup: rman2disk.ksh -d DATABASE -l baseline > /tmp/rman2disk_DATABASE.baseline.log 2>&1
2. Perform an incremental backup: rman2disk.ksh -d DATABASE -l 1 -r merge > /tmp/rman2disk_DATABASE.L1.log 2>&1

Archivelog only backups: rman2disk.ksh -d DATABASE-a y > /tmp/rman_arch_emrepos.log 2>&1

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/

Pertinent Information for each database being backed up:


1. Symbolic link for $ORACLE_BASE/admin/$ORACLE_SID/bkups must be created to a backup file system
directory
2. $ORACLE_BASE/admin/$ORACLE_SID/log directory must be created
3. For RMAN catalog backups, the .rman.pw file must exist in the $SH directory

RMAN To Disk Backup scripts:


-rwxr-xr-x. 1 oracle oinstall 1018 Nov 6 10:49 rman2disk.arch.sql
-rwxr-xr-x. 1 oracle oinstall 9978 Nov 26 09:12 rman2disk.ksh
-rwxr-xr-x. 1 oracle oinstall 1963 Nov 26 09:43 rman2disk.sql
-rwxr-xr-x. 1 oracle oinstall 1232 Jan 21 2015 rman2disk.sql.baseline
-rwxr-xr-x. 1 oracle oinstall 1275 Jan 21 2015 rman2disk.sql.cold
-rwxr-xr-x. 1 oracle oinstall 963 Jan 21 2015 rman2disk.sql.cold.noarchivelog
-rwxr-xr-x. 1 oracle oinstall 1544 Nov 26 09:42 rman2disk.sql.compression
-rwxr-xr-x. 1 oracle oinstall 1370 Jan 21 2015 rman2disk.sql.for_recover
-rwxr-xr-x. 1 oracle oinstall 1506 Jan 21 2015 rman2disk.sql.nocompression
-rwxr-xr-x. 1 oracle oinstall 227 Jan 21 2015 rman2disk.tag.history
85
76
Duplicate Database for
Standby Instantiation

@ViscosityNA
Build Physical Standby Menu
Duplicate Database (From Active Database)
Execute ./dg_duplicate_database.ksh manually or from DG Toolkit

./dg_duplicate_database.ksh |tee dg_duplicate_database_out.ksh


chmod 755 dg_duplicate_database_out.ksh
./dg_duplicate_database_out.ksh

echo "";
echo "# ------------------------------------------------------------- #”
echo "# -- Scripts are generated in the /tmp/dba directory #";
echo "# ------------------------------------------------------------- #”
ls -l /tmp/dba
echo "";

Here’s what it generated:


# ------------------------------------------------------------- #
# -- Scripts are generated in the /tmp/dba directory #
# ------------------------------------------------------------- #
total 12
-rwxr-xr-x. 1 oracle oinstall 1594 Apr 12 03:41 01_dg_oratab_listener_ps.ksh
-rwxr-x---. 1 oracle oinstall 881 Apr 12 03:41 02_dg_tnsnames_all.ksh
-rw-r--r--. 1 oracle oinstall 3334 Apr 12 03:41 10_dg_duplicate_database_ps.ksh
Duplicate Database From Active Database #1
. /home/oracle/dg/dg.conf
# ---------------------------------------------------------------------------------------
# -- scp password file to the standby database server: # ika82 from primary server: vna85
# ---------------------------------------------------------------------------------------
scp vna85:/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwJIN01
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwJIN01_DR

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 prmy1 "alter system set


log_archive_config=''dg_config=(JIN01,JIN01_DR)''";
sql channel prmy1 "alter system set log_archive_dest_2=
''service=JIN01_DR LGWR ASYNC valid_for=(online_logfiles,primary_role)
db_unique_name=JIN01_DR''";
sql channel prmy1 "alter system set log_archive_max_processes=5";
sql channel prmy1 "alter system set fal_client=JIN01";
sql channel prmy1 "alter system set fal_server=JIN01_DR";
sql channel prmy1 "alter system set standby_file_management=auto";
sql channel prmy1 "alter system set log_archive_dest_state_2=enable";
sql channel prmy1 "alter system set
parallel_execution_message_size=8192 scope=spfile sid=''*''";
sql channel prmy1 "alter system archive log current";

sql channel stby "alter database recover managed standby database using
current logfile disconnect";
}
EOF
Monitoring Data Guard
With Scripts

@ViscosityNA
Monitoring

• Alert Log Monitoring


• Monitoring MRP
• Monitoring Archive Lag Gaps
• Monitoring Transport and Apply Lag
• Monitoring Apply Rate
• How Far Are We Really Behind
Database Alert Log Monitoring prep_alertlog.ksh:

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

• Alert Log Monitoring


- Looks at entries in /etc/oratab
- Can customize ignore list
- Performs diff and compares since last
execution
- Sends alerts based on Alert Notifications

- Contact me for a copy


LogRotate
function rotate {
export LOGFILE=$1
export CONFIG_FILE=$2

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

cat <<!! >$CONF


$LOGFILE {
rotate 4
dateext
copytruncate
compress
size 100M
}
!!

echo Executing: logrotate -s $CONF_DIR/log_rotate_status.$CONFIG_FILE -f $CONF


logrotate -s $CONF_DIR/log_rotate_status.$CONFIG_FILE -f $CONF
Monitoring

• 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

• Monitoring Apply Rate


dg_apply_rate.sql
col type for a15
set lines 122
set pages 33
col item for a20
col units for a15
select to_char(start_time, 'DD-MON-RR HH24:MI:SS')
start_time,
item, sofar, units
from v$recovery_progress
where (item='Active Apply Rate'
or item='Average Apply Rate'
or item='Redo Applied')
EBS Considerations

@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

# -- Execute the following on the Primary Database: VISK


alter system set dg_broker_config_file1='+DATA/VISK/broker1.dat' scope=both sid='*';
alter system set dg_broker_config_file2='+FRA/VISK/broker2.dat' scope=both sid='*';
alter system set dg_broker_start=true scope=both sid='*';

# -- Execute the following on the Standby Database: VISK_DR


alter system set dg_broker_config_file1='+DATA2/VISK_DR/broker1.dat' scope=both sid='*';
alter system set dg_broker_config_file2='+FRA/VISK_DR/broker2.dat' scope=both sid='*';

alter system set dg_broker_start=true scope=both sid='*';


Broker Configuration
Listener Setup

Broker Configuration – Listener Setup


2
# -- Primary Database Server
# --
LISTENER_VISK =
.
..
SID_LIST_LISTENER_VISK =
(SID_LIST =
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = VISK_DGMGRL.DOMAIN)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db)
(SID_NAME = VISK1)
Broker Configuration
Create Configuration

create configuration VISK_DGCONFIG as primary database is "VISK" connect identifier is VISK_PRI;


add database "VISK_DR" as connect identifier is VISK_STDBY maintained as physical;
enable configuration;

Broker Configuration – Create FSFO


edit database 'VISK' set property 'LogXptMode'='SYNC';
edit database 'VISK_DR' set property 'LogXptMode'='SYNC';
edit database 'VISK' set property FastStartFailoverTarget='VISK_DR';
edit database 'VISK_DR' set property FastStartFailoverTarget='VISK';
edit configuration set protection mode as maxavailability;
enable fast_start failover;
show fast_start failover;
Broker Configuration
Create Configuration

DGMGRL> create configuration JIN01_DGCONFIG as primary database is "JIN01"


connect identifier is JIN01;
Configuration "jin01_dgconfig" created with primary database "JIN01"
DGMGRL> add database "JIN01_DR" as connect identifier is JIN01_DR maintained
as physical;
Database "JIN01_DR" added
DGMGRL> enable configuration;
Enabled.

DGMGRL> show configuration


Configuration - jin01_dgconfig

Protection Mode: MaxPerformance


Members:
JIN01 - Primary database
Warning: ORA-16789: standby redo logs configured incorrectly

JIN01_DR - Physical standby database


Warning: ORA-16809: multiple warnings detected for the database

Fast-Start Failover: DISABLED

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

Archive Log Retention

Primary Database Standby Database

configure archivelog deletion policy to shipped to all standby;


configure archivelog deletion policy to
------------------------ OR -----------------------------
applied on standby;
configure archivelog deletion policy to applied on all standby;
DG Toolkit

@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_stop.sql Stop MRP


alter database recover managed standby database cancel;

On the Primary Database


• dg_client_start.sql Enabled archive dest #2
alter system set log_archive_dest_state_2='enable' sid='*’;
• dg_client_stop.sql Disable archive dest #2
alter system set log_archive_dest_state_2='defer' sid='*';
SQL Script Description

dg_redo.sql Check Redo Log information

dg_sredo.sql Check Standby Redo Log information

dg_lag.sql Check transport and apply lag for the Data Guard environment

dg_check_mrp.sql Check MRP process and status

dg_client_start.sql Enabled archive dest #2

dg_client_stop.sql Disable archive dest #2

dg_register_archivelog_from_primary.sql Register archivelogs from primary

rman2disk.sql RMAN template to backup the database to FRA disk group

dg_database_info.sql PL/SQL to view DG related database information

dg_prim_diag.sql Troubleshooting script from Metalink ID: 241374.1


Shell Script Description

./dg Launches the DG Toolkit

dg_bdp.ksh Calculate Bandwidth Delay Product – leverages dg_bdp.conf

dg_adr_menu.ksh Submenu to setup Automatic Diagnostic Repository

dg_physical_standby_menu.ksh Submenu for checking/monitoring on the physical standby database


dg_prepare_standby_menu.ksh Primary Submenu for creating the physical standby database
Submenu for validating the environment prior to creating the physical
dg_preliminary_check_menu.ksh
standby database

dg_rman2disk_menu.ksh Submenu for launching RMAN backups and restore activities

korn shell script to backup the database to the FRA or file system disk
rman2disk.ksh
group

dg_broker_menu.ksh Submenu for Broker tasks

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

Viscosity North America

Facebook.com/ViscosityNA

@Viscosity_NA

117