0% found this document useful (0 votes)
7 views9 pages

DR Dril Steps

Uploaded by

rahul tambe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views9 pages

DR Dril Steps

Uploaded by

rahul tambe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 9

1.

Ensure log_archive_dest_2 is configured on PRIMARY and STANDBY databases

=> Show parameter log_archive_dest_2

2. Media Recovery Process (MRP) is active on STANDBY and in sync with PRIMARY
database

=> This already shown to you .

3. Create STANDBY REDO logs on PRIMARY, if not exists

=> Ask DBA to check it on production. if it is there then need to create on


standby.

select * from v$standby_log;

4. FAL_CLIENT & FAL_SERVER parameters set on both databases

==> show parameter fal

Production :- fal_server = standby


fal_client = primary

Standby :- fal_server=primary
fal_client = standby

5. Verify TEMP tablespaces on STANDBY, add them if required, as TEMPFFILES created


after STANDBY creation won’t be propagated to STANDBY site.

=> select name from v$tempfile;

6. Also check the connectivity from DR to production using TNS entry mentioned in
log_archive_dest_2 parameter.

7. Also check memory related parameters. SGA , Memory ,

Pre- Req
Ensure BCV is complete.

###################################################################################
#######################
Implementation Plan:
###################################################################################
#######################

CHANGE PARAMETER Value:

show parameter compatible


Alter system set compatible='11.2.0' scope=both sid='*';
shutdown immediate;
startup nomount
show parameter compatible
alter database mount;
alter database open;
###################################################################################
#######################

MOCK DR DRILL

On Primay:
=============

alter system switch logfile;


alter system archive log current;
alter system checkpoint;

alter database open read only;

-----alter system set local_listener='' scope=both sid='*';


----alter system set remote_listener='' scope=both sid='*';

!date;hostname
1)Check whether managed recovery is running on the standby database
!date;hostname
select process,status,thread#,sequence# from v$managed_standby;

set lines 200 pages 50000


select PROCESS,PID,STATUS,CLIENT_PROCESS,THREAD#,SEQUENCE#,BLOCKS from
v$managed_standby where process like 'MRP%';

2)At primary site check the max archive log sequence that is generated
!date;hostname
select inst_id,max(sequence#) from gv$archived_log group by inst_id;
select thread#,max(sequence#) from v$archived_log group by thread#;

set lines 200 pages 50000


col NAME for a75
select /*+ RULE(a) */ thread#,SEQUENCE#,name,to_char(completion_time,'dd-mon-
hh24:mi') from v$archived_log a where (THREAD#,SEQUENCE#) in (select
THREAD#,max(SEQUENCE#) from v$archived_log group by THREAD#) and dest_id=1;

3) At DR site check the max archive log sequence that is applied


!date;hostname
select max(sequence#) from v$archived_log where applied='YES';
select thread#,max(sequence#) from v$archived_log where applied='YES' group by
thread#;

4) Verify the size of temp tablespace in primary and standby database


set lines 200 pages 50000
col FILENAME for a60
select file#,tmp.name filename,bytes/1024/1024 MB,ts.name tablespace from
v$tempfile tmp, v$tablespace ts where tmp.ts#=ts.ts# order by 1;
!date;hostname

5) Verify whether all datafiles are online prior to swithover on both primary and
standby database

select name from v$datafile where status='OFFLINE';


!date;hostname

Below steps are to be performed on primary database:


6) Ensure that no jobs are running on the database
!date;hostname
select * from dba_jobs_running;

7) set job_queue_processes to zero


!date;hostname
set lines 200 pages 50000
col value for a60
select inst_id,name,value from gv$parameter where name like '%job_q%';
alter system set job_queue_processes=0 scope=spfile;

shut immediate;
startup;

alter system switch logfile;


alter system checkpoint;
/
/

8) Verify whether primary database can be switched over to standby


!date;hostname
select switchover_status from v$database;

CREATE TABLE ON_PRIMARY_24072016_B4_SWITCH as select


instance_name,host_name ,status, open_mode, database_role,sysdate Dt from
v$database,gv$instance,dual;

9) Switchover the primary database to standby


!date;hostname
alter database commit to switchover to physical standby with session shutdown;
shut abort;
!date;hostname

---CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;

10) Switchover From standbydatabase

!date;hostname
select switchover_status from v$database;
!date;hostname
alter database commit to switchover to primary with session shutdown;

alter database open;


!date;hostname
select instance_name,host_name ,status, open_mode, startup_time,database_role from
v$database,gv$instance;

alter session set nls_date_format='dd-mon-yyyy hh24-mi';


select * from ON_PRIMARY_24072016_B4_SWITCH;

CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY;


select force_logging from v$database;

11) Check database role in new primary database(DR site)


!date;hostname
select instance_name,host_name ,status, open_mode, startup_time,database_role from
v$database,gv$instance;

12) Restart the new standby database(primary site)


!date;hostname
shutdown abort;
startup mount;
alter database open read only;
!date;hostname

alter system register;

13) Start managed recovery process on the new standby(primary site)


!date;hostname
recover managed standby database disconnect from session parallel 5;

14) Reset the job_queue_processes parameter to its original value in new primary
database(DR site)
alter system set job_queue_processes=100 scope=both;
!date;hostname

15) Verify whether archivelog shipping is happening automatically or not


a)At primary site check the max archive log sequence that is generated
select max(sequence#) from v$archived_log;
!date;hostname

b) At DR site check the max archive log sequence that is applied


select max(sequence#) from v$archived_log where applied='YES';
!date;hostname

SWITCHBAK
1)
!date;hostname
select process,status,sequence# from v$managed_standby;
set lines 200 pages 50000
select PROCESS,PID,STATUS,CLIENT_PROCESS,THREAD#,SEQUENCE#,BLOCKS from
v$managed_standby where process like 'MRP%';

2)
!date;hostname
select inst_id,max(sequence#) from gv$archived_log group by inst_id;
select thread#,max(sequence#) from v$archived_log group by thread#;

set lines 200 pages 50000


col NAME for a75
select /*+ RULE(a) */ thread#,SEQUENCE#,name,to_char(completion_time,'dd-mon-
hh24:mi') from v$archived_log a where (THREAD#,SEQUENCE#) in (select
THREAD#,max(SEQUENCE#) from v$archived_log group by THREAD#) and dest_id=1;

3)
!date;hostname
select max(sequence#) from v$archived_log where applied='YES';
select thread#,max(sequence#) from v$archived_log where applied='YES' group by
thread#;

4)
!date;hostname
select * from dba_jobs_running;

5) NEW Primary (AHM)


!date;hostname
select switchover_status from v$database;

CREATE TABLE ON_Z5DR_B4_SWITCHBACK_2507 as select instance_name,host_name ,status,


open_mode, database_role,sysdate DT from v$database,gv$instance,dual;

alter system switch logfile;


alter system switch logfile;
alter system switch logfile;

alter system archive log current;

alter system checkpoint;


alter system checkpoint;
alter system checkpoint;

Shutdown immediate;

startup
!date;hostname
alter database commit to switchover to physical standby with session shutdown;
shut abort;
startup mount;

alter session set nls_date_format='dd-mon-yyyy hh24-mi';


select instance_name,host_name ,status, open_mode, startup_time,database_role from
v$database,gv$instance;

Orig Primary
!date;hostname
alter database commit to switchover to primary with session shutdown;
alter database open;
!date;hostname

alter session set nls_date_format='dd-mon-yyyy hh24-mi';


select instance_name,host_name ,status, open_mode, startup_time,database_role from
v$database,gv$instance;

alter system set job_queue_processes=100 scope=both sid='*';


select * from ON_Z5DR_B4_SWITCHBACK_1605 ;

CREATE TABLE PRIM_24072016_POST_SWITCHBACK as select


instance_name,host_name ,status, open_mode, startup_time,database_role from
v$database,gv$instance;

Orig DR

select * from PRIM_24072016_POST_SWITCHBACK;

###################################################################################
###################################################################################

alter session set nls_date_format='dd-mon-yyyy hh24-mi';

alter system set LOG_ARCHIVE_DEST_state_2=defer scope=both sid='*';


alter system set LOG_ARCHIVE_DEST_state_2=enable scope=both sid='*';

Primary:

select thread#,max(sequence#) from v$archived_log group by thread#;

set lines 200 pages 50000


col NAME for a75
select /*+ RULE(a) */ thread#,SEQUENCE#,name,to_char(completion_time,'dd-mon-
hh24:mi') from v$archived_log a where (THREAD#,SEQUENCE#) in (select
THREAD#,max(SEQUENCE#) from v$archived_log group by THREAD#) and dest_id=1;

set lines 200 pages 50000


col DEST_NAME for a25
select
inst_id,DEST_ID,DEST_NAME,STATUS,ERROR,ARCHIVED_THREAD#,ARCHIVED_SEQ#,APPLIED_THREA
D#,APPLIED_SEQ# from gv$archive_dest_status where DESTINATION is not null and
DEST_NAME='LOG_ARCHIVE_DEST_2';

DR:

select thread#,max(sequence#) from v$archived_log where applied='YES' group by


thread#;
select thread#,max(sequence#) from v$log_history group by thread#;

set lines 200 pages 50000


select PROCESS,PID,STATUS,CLIENT_PROCESS,THREAD#,SEQUENCE#,BLOCKS from
v$managed_standby where process like 'MRP%';

=============================================================================
=> Convert To SNAPSHOT Standby:

select inst_id, name, opne_mode, guard_status, database_role from gv$database;


ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
select PROCESS,CLIENT_PROCESS,THREAD#,SEQUENCE#,BLOCK# from v$managed_standby where
process = 'MRP0' or client_process='LGWR';
alter database flashback on;
SELECT flashback_on FROM v$database;
alter system set db_recovery_file_dest='';
alter system set db_recovery_file_dest_size=5G;

select INST_ID,NAME, OPEN_MODE, GUARD_STATUS, DATABASE_ROLE from gv$database;


Check the DB is in mount mode
ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;
ALTER DATABASE OPEN;

==> Convert From SNAPSHOT Standby:

SHUT IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
alter database flashback off;
ALTER DATABASE OPEN read only;
RECOVER MANAGED STANDBY DATABASE DISCONNECT from SESSION ;
SELECT flashback_on FROM v$database;
select inst_id, name, opne_mode, guard_status, database_role from gv$database;

+++++++
+================================================================================
Script to collect Diagnostic Information in a Dataguard Environment

On Primary -->
set linesize 300
set pages 70
col name for a30
col value for a60
col message for a90
col destination for a35
col dest_name for a40
select name,value from gv$parameter where name in
('db_name','db_unique_name','db_domain','db_file_name_convert','log_file_name_conve
rt','fal_server','fal_client','remote_login_passwordfile',
'standby_file_management','dg_broker_start','dg_broker_config_file1','dg_broker_con
fig_file2');
select
status,instance_name,database_role,open_mode,protection_mode,switchover_status from
gv$instance,gv$database;
select name,(space_limit/1024/1024/1024) "Limit in GB",(space_used/1024/1024/1024)
"Used in GB" from v$recovery_file_dest;
select thread#,max(sequence#) from gv$archived_log group by thread#;
select inst_id,dest_id, dest_name, status, target, archiver , destination from
GV$ARCHIVE_DEST where destination IS NOT NULL;
select * from (select severity,error_code,message,to_char(timestamp,'DD-MON-YYYY
HH24:MI:SS') from v$dataguard_status where dest_id=2 order by rownum DESC) where
rownum <= 7;
select group#,thread#,status,members,(bytes/1024/1024)"Each ORL File Size in MB"
from gv$log;
select group#,thread#,status,(bytes/1024/1024)"Each SRL File Size in MB" from
gv$standby_log;

On StandBy ---->
set linesize 300
set pages 70
col name for a30
col value for a60
col message for a90
col destination for a35
col dest_name for a40
select name,value from gv$parameter where name in
('db_name','db_unique_name','db_domain','db_file_name_convert','log_file_name_conve
rt','fal_server','fal_client','remote_login_passwordfile','standby_file_management'
,'dg_broker_start','dg_broker_config_file1','dg_broker_config_file2');
select
status,instance_name,database_role,open_mode,protection_mode,switchover_status from
gv$instance,gv$database;
select name,(space_limit/1024/1024/1024) "Limit in GB",(space_used/1024/1024/1024)
"Used in GB" from v$recovery_file_dest;
select thread#,max(sequence#) from gv$archived_log group by thread#;
select thread#,max(sequence#) from gv$archived_log where applied='YES' group by
thread#;
select dest_id, dest_name, status, target, archiver , destination from
GV$ARCHIVE_DEST where destination IS NOT NULL;
select inst_id,process,status,sequence#,thread#,client_process from
gv$managed_standby;
select group#,thread#,status,members,(bytes/1024/1024)"Each ORL File Size in MB"
from gv$log;
select group#,thread#,status,(bytes/1024/1024)"Each SRL File Size in MB" from
gv$standby_log;

To gather Standby Sync Details:

select rec.thread#, rec.last_rec "Last Sequence Received", app.last_app "Last


Sequence Applied"
from
(select thread#, max(sequence#) last_rec
from v$archived_log
where resetlogs_id = (select max(resetlogs_id) from v$archived_log)
group by thread#) rec,
(select thread#, max(sequence#) last_app
from v$archived_log
where resetlogs_id = (select max(resetlogs_id) from v$archived_log)
and applied='YES' and registrar='RFS'
group by thread#) app
where rec.thread#=app.thread#
and rec.thread# != 0
order by rec.thread#
/

To monitor Standby Recovery:

select to_char(START_TIME,'DD-MON-YYYY HH24:MI:SS') "Recovery Start


Time",to_char(item)||' = '||to_char(sofar)||' '||to_char(units) "Progress"
from v$recovery_progress where start_time=(select max(start_time) from
v$recovery_progress);

You might also like