Dataguard :
https://dbakeeda.blogspot.com/2016/06/oracle-data-guard-interview-question.html
https://slmdba.blogspot.com/2017/10/data-guard-interview-questions-and.html
1) What is dataguard?
-> Dataguard provide the set of comprehensive set of services that can
create,Manages,maintain and monitor the standby databases to enable the production
database to survive disaster and data corruption.
-> Dataguard maintains this as the standby database as the copies of the
production database
-> Dataguard can use the tranditional backup,restoration and cluster techniques
to provide the high level of data protection and data availabilty.
=======================================================================
2) Advantages of the dataguard?
-> High availabilty
-> data protection
-> offloading the backup operation to standby
-> automatic GAP detection and resolution in standby DB
-> automatic Role transition using the data broker.
=========================================================================
Dataguard : DG apply the redo information directly then it is physical standby,if
the DG applies only the SQL then it is logical standby.
Physical standby -exact replica inprimary db in physical level, redo info directly
applied to standby,exact block to block ,this is received by the RFS and then move
it using the MRP, first its read the redo changes,mapping it and then apply the
redo changes directly,physical standby is the best choice for the disaster recovery
Logical standby - only the SQL will gets apply to the standby DB,as it applying the
SQL it is more complex and it required the extra resources to done this job.
one good advantages is that the DB will be in read/write mode ,which means you can
insert/read/write/delete in the logical db
snapshot standby - snapshot standby db allows the read/write to the standby db,but
these changes will not be apply to the primary DB.
============================================================================
what are the Process required on the primary and standby database?
1)Different Protection modes of dataguard?
>> Maximum protection:
1)guarantees no data loss if primary fails
2)redo data needed to be recover must be written to both local online redo
log and standby redo log before the transaction commits
3)primary db shuts down if the redo is not shipped to standby
>> Maximum availability
1)similarlylike max protection ,but the primary not shut it down if the redo
logs not shipped
2)it operates in unsynchronized mode,until the fault is correct and all the
gaps has been restored.
>> Maximum performance -default mode in DG
1) it will not wait for the acknowledgement (whether its shipped or not)
2)it allows the transaction to commit as soon as the redo data needed to
recover the transaction is written on the local online redo log.
============================================================================
2)different service available in Oracle Data guard?
redo transport
log apply
Role transition
=============================================================================
3) How to change the Protection mode in DG?
alter database set standby database to maximum (Protection|availability |
performance)
==============================================================================
4)How to check the dataguard protection mode?
select protection_mode from v$database;
===============================================================================
5)advantages of the physical standby server in DG?
Load balancing
high availability
data protection and disaster recovery
==================================================================================6
) reason for the archive log gaps?
>> ping the standby server from the primary abd try to ping,if the packet loss is
more that 50,70,100 then there may be the network issue
>> standby FS got filled
>> archive log corruption (copy the same archive log to primary and start the MRP
Process)
==================================================================================
7)What is DB_FILE_NAME_CONVERT Parameter?
It will be useful in the standby database ,this will used to update the DB file
location in the standby DB,when there is a differnece in the file directory
struture with the primary and standaby DB
=================================================================================
8)What is LOG_FILE_NAME_CONVERT parameter?
This also will used in the standby DB,this helps to convert the location of the
redo log file in the standby DB .These parameter are used when you are using
different directory structure in standby database compare to primary database redo
log file location.
================================================================================
9) how many standby DB we can create?
in 10g (upto 9 standby)
from 119 (upto 30 )
===============================================================================
10)What is the difference between (Physical standby,Logical standby,SDG and
snapshot standby)
Physical - Mount state - MRP will apply the archives
ADG - read-only - MRP will apply the archives
Logical - read only ,LSP will run
Snapshot - PS can be converted to SS which will be in Read and write mode can do
any kind of testing ,later it SS can be converted into physical SS and start the
MRP which all will apply the pending archives
Sanpshot standby will be read/write ,it will receives the redo logs but it not
getting applied,once it converted back to the physical standby the shipped redo log
which will get apply which was not applied earlier
to test the real-time application,we can use the snapshot standby to do the
testing,we often the clone of production to do the testing for this purpose we need
snapshot standby
===============================================================================
11)What are all the parameter we have to set in primary/standby?
DB_UNIQUENAME
LOG_ARCHIVE_CONFIG
LOG_ARCHIVE_MAX_PROCESS
LOG_ARCHIVE_DEST
LOG_ARCHIVE_DEST_STATE
LOG_FILE_NAME_CONVERT
DB_FILE_NAME_CONVERT
DB_CREATE_FILE_DEST
FAL_SERVER
FAL_CLIENT
STANDBY_FILE_MANAGEMENT
12)What is FAL_SERVER and FAL_CLIENT
Main purpose of this is to fetch the archive log
this help to fulfill the archive log gap for the standby server from the primary
through oracle net service,If any of the network fails it will helps to fetch the
missing archive logs.between the primary and standby database.
TNS entries:
OCPPR =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = PRIMARYSERVER)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ocppr)
)
)
OCPDR =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = STANDBYSEVRER)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ocpdr)
)
)
=======================================================================
Primary side configuration
---------------------------------
ALTER SYSTEM SET FAL_SERVER=OCPDR;
SQL>ALTER SYSTEM SET FAL_CLIENT=OCPPR;
secondary side config:
--------------------------------------
SQL>ALTER SYSTEM SET FAL_SERVER=OCPPR;
SQL>ALTER SYSTEM SET FAL_CLIENT=OCPDR;
========================================================================
13) What is RTS ( Redo Transport Service)
it control the automated transfer of redo from Primary DB to one or more archival
DB
>> It finds the misisng file and automatically try to retrive from the primary or
another standby DB
>> transmit redo from primary to standby
>>manages the process of resolving gaps in the archive redo log files
======================================================================
14) steps for Switch over:
https://oracledbwr.com/oracle-12c-step-by-step-manual-data-guard-switchover/
switch over will be helpful to minimize the downtime of the production DB,
Switching from the primary to standby db .During the planned activity regardless of
the time needed we can use the switch over activity,We dont need to worry about the
time but we just need the
switchover window (just about 60 min)
Primary DB will run in continuously without any interruption.
----- Below operation ----
--- Primary DB has been notifies that the switch over gonna happen
--- alll the user gets disconnected from the system
--- EOR ( end of redo will get generated)
-- Primary DB will be converted into the standby DB
-- the final EOR is going to apply in the standby DB,that the transition has been
applied to the standby database withoit any datalose.
==================================================================================
>> check the DB state in both primary and secondary
select name,open_mode , database_role from V$database
>>on Primary :
initiate the switch over:
alter database commit to switch over to physical standby with session shutdown
wait;
>> shut the db,
startup mount,
alter database mount standby database;
Start the MRP process (Managed Recovery Process)
SQL> alter database recover managed standby database disconnect;
Verify the switchover status in the v$database view. it should be SWITCHOVER
PENDING status.
SQL> select database_role from v$database;
Switch physical standby database role to the primary role.
SQL> alter database commit to switchover to primary with session shutdown wait;
g. Shutdown and restart the new primary database
SQL> shutdown
SQL> startup
h. Begin archiving logs to the physical standby database.
SQL> alter system archive log start;
SQL> alter system switch logfile;
===================================================================================
=
https://oracledbwr.com/oracle-12c-step-by-step-manual-data-guard-failover/
16) Failover ( dataguard )
Same like switch over but here there is no chances of the EOR file to get
generated,it is the unplanned activity,Failover data loss depends on the DG
protection mode,
Failover can be performed in two ways
1) Manual - admin has the complete control over the primary-secondary role
transition.Admin has to manually enter the failover commands
2) Automatic - Fast-start Failover features will be configured, DG aoutomatically
detects the failure and automatically failover the DB to the available standby
database.
>> on the standby DB
>> Check the role
>>cancel the MRP
1)alter database recover managed standby database cancel;
2)alter database recover managed standby database finish;
>>Make the standby as primary DB
alter database activate standby database;
>> Shut the DB (shut immediate) and start the DB
>>check the role now ( standby DB are now primary DB)
=================================================================================
17)What are the services required on the primary and standby database ?
LGWR - collects the redo info and updates the online redo logs
ARCHIVER - makes the copies of the redo logs
FAL server - service request of the archive redo logs from FAL clients running on
mutiple standby
FAL Client - pulls the archived redo log files from the primary sites
RFS - receives the archived /standby redo logs from the primary db
ARCHIEVER -archives the standby redo logs applied by the MRP
MRP- managed resource process ( applies the redo info to standby)
=================================================================================
18) How to delay the application of logs to a physical standby?
A standby database automatically applies the redo logs once we received the redo
logs in the primary,for some case we can make the applies of redo log get delay in
the standby,For that we need to change the "LOG_ARCHIVE_DEST" Parameter.
ex : 60 min Delay
alter system set LOG_ARCHIVE_DEST='SERVICE=stdby_srvc DELAY=60';
The archived redo logs are still automatically copied from the primary site to the
standby site, but the logs are not immediately applied to the standby database. The
logs are applied when the specified time interval expires.
19)Which tools can be used for Data Guard Management?
SQL * plus >> traditional method
dataguard broker - automates and centralise the creation,manages ,maintenance and
monitor the DG config ,it has been owned and manges by DGMRL
and simplifies the task of switch over and
failover,it provides the GUIand command line interface for managing DG
configuration
Enterprise manager - requires the data guard broker to be enabled,a GUI to the
dataguard broker ,replacing the DGMRL command line.
==================================================
20) Why we need force logging option in DG?
ALTER DATABASE FORCE LOGGING;
The force logging is the safest ways and it helps to ensure that whatever the
changes made to the DB that been stored in the redo logs .
=====================================================================
21) can we enable the force logging in DB level or tablespace level?
yes ,we can do both.
if we created the tablespace or altered the tablespace any changes made in the
tablespace that will be updated in the redo logs
similarly,
if we created the DB or alered with the force logging ,any changes across the DB
with the exemption of the temp tablepsace and temp segments
will be available for recovery.
views we can see whether the force logging is enabled or not
SQL > select * from V$database;
SQL > select * from dba_tablespaces;
also enabling the force logging also have some impact in the DB performance.
=======================================================================
22)what is the difference between logging and no logging in DG?
Logging mode : if it enabled , whenever the creation of objects and any insertion
into the objects will be logged in the redo log file.
(generates the redo data during index/table insertion,update & delete
No logging mode : if it enabled , whenever the creation of objects and any
insertion into the objects will not be logged in the redo log file.
=========================================================================
23) How many standby logs to be created ,What should be the size?
In physical standby if the number of redo log of primary is n=3,then the standby
should have the log creation of n+1= 3+1;
============================================================================
24) What should be the size?
the standby should have the same size as the Primary online redo logs.
select * from V$logfile;
============================================================================
25)how to convert the physical standby to snapshot standby?
>> verify the flashback is enabled
connect to DGMRL
DGMRL > conn sys/welcome12
connected.
DGMRL> edit database 'PROD' set state ='APPLY-ON';
DGMRL>convert database PROD to snapshot standby;
============================================================================
26)how to convert back to physical standby;
DGMRL > convert database PROD to physical standby;
============================================================================
27)what are the components of DG?
>> Primary DB -- Main production DB
>> standby databases - synchronised with the primary and have the copies of primary
>> DG Broker- which helps to monitor,maintain and configure the DG
=============================================================================
28)How do you configure DG?
>> using SQL* commands
>> DG Broker
basic steps :
set up the primary DB
configure the standby DB
establish the redo transport
establish the DG broker
================================================================================
29) How to troubleshoot the archive gaps in DG? and stanby is not is in syn ? why
we get that gap in b/w primary and secondary ? Where we need to check?
-> Check the alert log: DB alert log on both the primary and secondary
-> verify the log destination -check whether we have any space issue
->Monitor archive generation - size ,log switch,archive generated regularly
-> Check the network : check TNS ,speed,load
-> review DG Config: check Log
archive_dest,log_srcive_dest_state,standby_file_Management
-> investigate standby - Check the time gap,insufficient resource,slowness,load
->check missing archives - blw primary/secondary
-> sequence number -check SCN are synchronised
->rechronize standby DB -> reconfigure of standby
->check the switchover n failover events
->consult oracle support
================================================================================
30) Why we need the auto parameter in standby file management? (important)
default - Manual
for DR setup we keep - Automatic
When we set this standby DB automatically manages the datafiles,control files and
archived redo logs
when we set the standby DB whatever the physical DB files available in standby
DB,We dont need to manually create.
If it does set to auto we have manually create the physical files. ( db
files,control files,archived redo log files)
Archieved redo log - DG ensures that the all the redo logs generated on the primary
are automatically applied and be in sync with the standby DB
===================================================================================
=
31) RFS (Remote file server)
whatever archives are generated in primary will be transffered to standby side, RFS
will receives the REDO in standby.
if it is down archives will not receive in standby
-> replication interuption
->DATA lag
->Redo log accumulation
->delayed recovery
->alerts monitoring
===================================================================================
==
32)How to start the MRP process?
-> login to the standby
-> login to sql
-> to start the MRP ;
using DG BROKER :
DGMRL > EDIT DATABASE prod SET STATE='APPLY-ON';
using SQL :
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
TO stop the MRP :
DGMRL > EDIT DATABASE prod SET STATE='APPLY-OFF';
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
===================================================================================
33) starting and stopping the RFS:
start : you dont need to manually start once you configure the DG it wil
lautomatically start.
stop :There is no explicit stop when you shut the standby instance it will
automatically terminates the RFS Process.
===================================================================================
=