Skip to main content

ORACLE DATAGUARD

Some day to day commands for Datagaurd:

➤How to start log apply service in standby database?

SQL>Alter database recover managed standby database disconnect from session;

Here, "disconnect from session" to instruct the session to come out of the current SQL session else it will be hung until the recovery is completed

➤How to check the log apply service is working fine or not?

SQL>select process,status,sequence# from v$managed_standby;

Note: Never check the archive sync with the command "archive log list" , it may give the wrong details. Always check it using v$managed_standby view.


➤To stop the log apply service?

SQL>Alter database recover managed standby database cancel;

Verify it by running below command
 SQL>select process,status,sequence# from v$managed_standby; 

Alternatively,  you can verify the mrp process.It will show no mrp process running for the instance. 

ps -ef|grep mrp

Stop log apply using DGBROKER

DGMGRL>edit database <standby_dbname> set state=apply-off;


➤How to start the redo apply in real time in foreground?

SQL>alter database recover managed standby database;

Note: In above command delay attribute is ignored

If you want to start with delay, use below command:

SQL>alter database recover managed standby database using archived logfile disconnect;

Note:Delay attribute must be set at primary and standby database

Start using Broker

DGMGRL>edit database <standby_dbname>  set state=apply-on;

Redo apply delay parameter

edit database <standby_dbname> set DelayMins=10;


➤ What happens when delay is mentioned?
#MRP waits for a specified time before it applies the redo
# can be used to protect corrupted data to be applied from primary to standby
# report will get generated until the apply is done with real time data
# set parmeter DELAY in log_archive_dest_n parameter 

➤ How to opverride the delay service and apply redo:

SQL>alter database recover managed standby database nodelay;



Comments

Popular posts from this blog

Can we open a pluggable database if CDB is in mount state?

We cannot open a pluggable database if the CDB is in mount state. Demo: SQL> show con_name; CON_NAME ------------------------------ CDB$ROOT SQL> select name,open_mode from v$database; NAME      OPEN_MODE --------- -------------------- ORCL1210  MOUNTED SQL> alter session set container=pdb1; Session altered. SQL> show con_name; CON_NAME ------------------------------ PDB1 SQL> alter database open; alter database open * ERROR at line 1: ORA-65054: Cannot open a pluggable database in the desired mode. Now, I'm opening the container Database first and then running the same command SQL> alter session set container=CDB$ROOT; Session altered. SQL> sho con_name CON_NAME ------------------------------ CDB$ROOT SQL> alter database open; Database altered. SQL> select name,open_mode from v$database; NAME      OPEN_MODE --------- -------------------- ORCL1210  READ WRITE SQL>...

How to backup a container database using RMAN?

To backup the container database , connect RMAN to the root using sysdba or sysbackup. Note: sysdbackup is a new user introduced in 12c. After setting the environment variables for the CDB I'm connecting using OS level  authentication   (sysdba is already the part of OS group)  as below. -bash-4.1$ rman target / Recovery Manager: Release 12.1.0.2.0 - Production on Sat Aug 4 16:50:18 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved. connected to target database: ORCL1210 (DBID=2368395079) Now you can take the backup in the same way you take it for non -CDB databases. RMAN> backup database; Starting backup at 04-AUG-18 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=21 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set *********************excerpts********************* Starting Control File and SPFILE Autobackup at...