Pages

Monday, 19 June 2017

DR Dril


GRACEFUL SWITCH OVER:
++++++++++++++++++++++++

verify on Standby and Primary:
==============================

select name,database_role,switchover_status from v$database;
select process from v$managed_standby where process like 'MRP%';
select thread#, max(sequence#) from v$archived_log alog, 
 v$database db where alog.resetlogs_change#=db.resetlogs_change# group by thread#;
 select sequence#,thread#,process,status from gv$managed_standby

select max(sequence#) from v$archived_log;
select max(sequence#) from v$log_history;
select sequence#,applied,completion_time from v$archived_log;


PRIMARY: (ORIGINAL PRIMARY)
======================


SWITCHOVER_STATUS (TO STANDBY)

1. Capture current job state on the primary:
select name,database_role,switchover_status from v$database;

SQL> select * from dba_jobs_running; [depending on what the running job is, be ready to terminate]
SQL> select owner,JOB_NAME,STATE,ENABLED,LAST_START_DATE,LAST_RUN_DURATION from dba_scheduler_jobs where enabled='TRUE';
SQL> select * from dba_scheduler_running_jobs;
SQL> show parameter job_queue_processes

Note: Cron job candidates to be disabled among others! 

2. Block further job submissions:

SQL> alter system set job_queue_processes=0 scope=both sid=’*’;
SQL> execute dbms_scheduler.disable(job_name);

3. Disable any cron jobs that may interfere if any
. Query the SWITCHOVER_STATUS column of the V$DATABASE view on the primary database, for example:

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

4. Shutdown all but one database instance.

 5. Switch the current primary over to the standby role.
alter database commit to switchover to physical standby with session shutdown;

6. Mount the database & put in Managed Mode.
shutdown immediate;

startup nomount;

alter database mount standby database;

recover managed standby database using current logifile disconnect;

SELECT SWITCHOVER_STATUS,database_role FROM V$DATABASE

SWITCHOVER_STATUS (TO PRIMARY)

Standby:
======================


7. Initiate the switchover:

alter database commit to switchover to primary with session shutdown;

8. Next, open all of the database instances:

ALTER DATABASE OPEN;

9. Enable database job submissions:

ALTER SYSTEM SET job_queue_processes=1000 SCOPE=BOTH SID='*';

Ensure that the new primary and standby are syncing properly by reviewing the alert logs and doing some log switches


============================================================================================================

GRACEFUL SWITCH BACKU:
++++++++++++++++++++++++

SWITCHOVER_STATUS (TO STANDBY)

verify:
========


1. Capture current job state on the Standby:
select max(sequence#) from v$archived_log;

select max(sequence#) from v$log_history; ----Primary

select sequence#,applied,completion_time from v$archived_log; -----> Standby

select name,database_role,switchover_status from v$database;
select process from gv$managed_standby where process like 'MRP%';
select thread#, max(sequence#) from v$archived_log alog, 
 v$database db where alog.resetlogs_change#=db.resetlogs_change# group by thread#;
 select sequence#,thread#,process,status from gv$managed_standby


PRIMARY: (OLD STANDBY)
======================


2. Capture current job state on the primary:
select name,database_role,switchover_status from v$database;

SQL> select * from dba_jobs_running; [depending on what the running job is, be ready to terminate]
SQL> select owner,JOB_NAME,STATE,ENABLED,LAST_START_DATE,LAST_RUN_DURATION from dba_scheduler_jobs where enabled='TRUE';
SQL> select * from dba_scheduler_running_jobs;
SQL> show parameter job_queue_processes

Note: Cron job candidates to be disabled among others! 

2. Block further job submissions:

SQL> alter system set job_queue_processes=0 scope=both sid=’*’;
SQL> execute dbms_scheduler.disable(job_name);

3. Disable any cron jobs that may interfere if any
. Query the SWITCHOVER_STATUS column of the V$DATABASE view on the primary database, for example:

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

4. Shutdown all but one database instance.

5. Switch the current primary over to the standby role.

alter database commit to switchover to physical standby with session shutdown;

6. Mount the database & put in Managed Mode.
shutdown immediate;

startup nomount;

alter database mount standby database;

recover managed standby database using current logifile disconnect;

SELECT SWITCHOVER_STATUS,database_role FROM V$DATABASE

SWITCHOVER_STATUS (TO PRIMARY)
Standby;( OLD PRIMRY)
======================


7. Initiate the switchover:
select name,database_role,switchover_status from v$database;
alter database commit to switchover to primary with session shutdown;

8. Next, open all of the database instances:

ALTER DATABASE OPEN;

9. Enable database job submissions:

ALTER SYSTEM SET job_queue_processes=1000 SCOPE=BOTH SID='*';

Ensure that the new primary and standby are syncing properly by reviewing the alert logs and doing some log switches

No comments:

Post a Comment