Thursday, November 21, 2024

Perform switchover in heterogenous dataguard setup oracle 19c

 

Objective: Perform switchover in heterogenous dataguard setup in 19c


Youtube Video:



Precheck Steps:

1. Version oracle between primary and DG should be same


select * from v$version;


2. Ensure you use spfile


sho parameter pfile;


3. Value for broker start init ora should be true


sho parameter DG_BROKER_START


4. Esnure DG_BROKER_CONFIG_FILEn => parameter is set to a correct location (for a RAC, the file location is shared, ensure one file is in +DATA and other in +FRA)


sho parameter dg_broker_config_file


5. Ensure tnsnames.ora contains the tns entries for all the DBs involved


tnsping ORACL19C

tnsping ORACL19CSB1


step 1 to 5 output:


primary:


13:27:44 SQL> /


BANNER                                                                          ,BANNER_FULL                                                                                 ,BANNER_LEGACY                                                            ,    CON_ID

--------------------------------------------------------------------------------,----------------------------------------------------------------------------------------------------------------------------------------------------------------,--------------------------------------------------------------------------------,----------

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production          ,Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production                      ,Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production   ,         0

                                                                                ,Version 19.3.0.0.0                                                                          ,                                                                                 ,



Elapsed: 00:00:00.00

13:27:45 SQL> sho parameter pfile;


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

spfile                              ,string     ,+DATA/ORACL19C/PARAMETERFILE/s

                                    ,           ,pfile.270.1138114305

13:28:01 SQL> sho parameter DG_BROKER_START


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

dg_broker_start                     ,boolean    ,TRUE

13:28:19 SQL> sho parameter dg_broker_config_file


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

dg_broker_config_file1              ,string     ,+DATA/ORACL19C/DG1/dr1oracl19c

                                    ,           ,.dat

dg_broker_config_file2              ,string     ,+DATA/ORACL19C/DG2/dr2oracl19c

                                    ,           ,.dat

13:28:32 SQL> !tnsping ORACL19C


TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 02-NOV-2024 13:28:49


Copyright (c) 1997, 2019, Oracle.  All rights reserved.


Used parameter files:



Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = centosoraclecl1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACL19C)))

OK (3330 msec)


13:28:52 SQL> !tnsping ORACL19CSB1


TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 02-NOV-2024 13:28:54


Copyright (c) 1997, 2019, Oracle.  All rights reserved.


Used parameter files:



Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.194.11)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACL19CSB1)))

OK (1510 msec)


13:28:55 SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0



standby:

  1* select * from v$version

13:27:52 SQL> /


BANNER                                                                          ,BANNER_FULL                                                                                 ,BANNER_LEGACY                                                            ,    CON_ID

--------------------------------------------------------------------------------,----------------------------------------------------------------------------------------------------------------------------------------------------------------,--------------------------------------------------------------------------------,----------

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production          ,Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production                      ,Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production   ,         0

                                                                                ,Version 19.3.0.0.0                                                                          ,                                                                                 ,



Elapsed: 00:00:00.00

13:27:53 SQL> sho parameter pfile;


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

spfile                              ,string     ,/u01/app/oracle/product/19.0.0

                                    ,           ,/db_1/dbs/spfileORACL19CSB1.or

                                    ,           ,a

13:28:07 SQL> sho parameter DG_BROKER_START


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

dg_broker_start                     ,boolean    ,TRUE

13:28:23 SQL> sho parameter dg_broker_config_file


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

dg_broker_config_file1              ,string     ,/oradata/ORACL19CSB1/DG1/dr1OR

                                    ,           ,ACL19CSB1.dat

dg_broker_config_file2              ,string     ,/oradata/ORACL19CSB1/DG2/dr2OR

                                    ,           ,ACL19CSB2.dat

13:28:38 SQL> !tnsping ORACL19CSB1


TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 02-NOV-2024 13:28:56


Copyright (c) 1997, 2019, Oracle.  All rights reserved.


Used parameter files:



Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.194.11)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACL19CSB1)))

OK (10 msec)


13:28:56 SQL> !tnsping ORACL19C


TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 02-NOV-2024 13:28:59


Copyright (c) 1997, 2019, Oracle.  All rights reserved.


Used parameter files:



Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = centosoraclecl1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACL19C)))

OK (10 msec)


13:28:59 SQL> select process,status,client_process,sequence# from gv$managed_standby;


PROCESS  ,STATUS      ,CLIENT_P, SEQUENCE#

---------,------------,--------,----------

ARCH     ,CONNECTED   ,ARCH    ,         0

DGRD     ,ALLOCATED   ,N/A     ,         0

DGRD     ,ALLOCATED   ,N/A     ,         0

ARCH     ,CONNECTED   ,ARCH    ,         0

ARCH     ,CONNECTED   ,ARCH    ,         0

ARCH     ,CONNECTED   ,ARCH    ,         0

MRP0     ,APPLYING_LOG,N/A     ,        22

RFS      ,IDLE        ,Archival,         0

RFS      ,IDLE        ,LGWR    ,        24

RFS      ,IDLE        ,LGWR    ,        18

RFS      ,IDLE        ,UNKNOWN ,         0


11 rows selected.


Elapsed: 00:00:00.00





6. Ensure a DBConnectIdentifer is properly set to allow all the DBs can reach among themselves and among all the instances.


dgmgrl

show database verbose <dbname>;


Output:


DGMGRL> show database verbose ORACL19C;


Database - ORACL19C


  Role:               PRIMARY

  Intended State:     TRANSPORT-ON

  Instance(s):

    ORACL19C1

    ORACL19C2

      Error: ORA-16737: the redo transport service for member "ORACL19CSB1" has an error


  Properties:

    DGConnectIdentifier             = 'oracl19c'



DGMGRL> show database verbose ORACL19CSB1;


Database - ORACL19CSB1


  Role:               PHYSICAL STANDBY

  Intended State:     APPLY-ON

  Transport Lag:      5 hours 52 minutes 33 seconds (computed 11 seconds ago)

  Apply Lag:          20 hours 15 minutes 6 seconds (computed 11 seconds ago)

  Average Apply Rate: 1.00 KByte/s

  Active Apply Rate:  36.00 KByte/s

  Maximum Apply Rate: 1.50 MByte/s

  Real Time Query:    OFF

  Instance(s):

    ORACL19CSB1


  Database Warning(s):

    ORA-16853: apply lag has exceeded specified threshold

    ORA-16855: transport lag has exceeded specified threshold


  Properties:

    DGConnectIdentifier             = 'oracl19csb1'




7. Ensure SID_LIST_LISTENER entry is there to let DGMGRL has access to restart the instance.The StaticConnectIdentifier should be in sync with the SID_LIST_LISTENER entry. (we can use netmgr to do it - open netmgr, click on listener and expand it, go select Database service, and then add database to enter the relevant details


lsnrctl status


prmry:

    (SID_DESC =

     (GLOBAL_DBNAME = ORACL19C)

     (ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)

     (SID_NAME = ORACL19C1)



sby:

    (SID_DESC =

     (GLOBAL_DBNAME = ORACL19CSB1)

     (ORACLE_HOME = /u01/app/oracle/product/19.0.0/db_1)

     (SID_NAME = ORACL19CSB1)




8. Verify primary is in archivelog mode


archive log list


prmry:


SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     23

Next log sequence to archive   24

Current log sequence           24

SQL>





9. Ensure compatible parameter is equal to or greater than 10.2.0.1.0


sho parameter compatible


prmry:

SQL> sho parameter compatible


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

compatible                           string      19.0.0


sby:

13:32:17 SQL> sho parameter compatible


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

compatible                          ,string     ,19.0.0




10. Ensure the primary/standby init ora parameter files are set properly.


sho parameter DB_NAME

sho parameter DB_UNIQUE_NAME

sho parameter LOG_ARCHIVE_CONFIG

sho parameter CONTROL_FILES

sho parameter LOG_ARCHIVE_DEST_1

sho parameter LOG_ARCHIVE_DEST_2

sho parameter REMOTE_LOGIN_PASSWORDFILE

sho parameter LOG_ARCHIVE_FORMAT

sho parameter FAL_SERVER

sho parameter STANDBY_FILE_MANAGEMENT


prmry:

SQL> sho parameter DB_NAME


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_name                              string      ORACL19C

SQL> sho parameter DB_UNIQUE_NAME


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_unique_name                       string      ORACL19C

SQL> sho parameter LOG_ARCHIVE_CONFIG


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

log_archive_config                   string      DG_CONFIG=(ORACL19C,ORACL19CSB

                                                 1)

SQL> sho parameter CONTROL_FILES


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

control_files                        string      +DATA/ORACL19C/CONTROLFILE/cur

                                                 rent.259.1138111547

SQL> sho parameter LOG_ARCHIVE_DEST_1


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

log_archive_dest_1                   string      LOCATION=USE_DB_RECOVERY_FILE_

                                                 DEST VALID_FOR=(ALL_LOGFILES,A

                                                 LL_ROLES) DB_UNIQUE_NAME=ORACL

                                                 19C

log_archive_dest_10                  string

log_archive_dest_11                  string

log_archive_dest_12                  string

log_archive_dest_13                  string

log_archive_dest_14                  string

log_archive_dest_15                  string

log_archive_dest_16                  string


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

log_archive_dest_17                  string

log_archive_dest_18                  string

log_archive_dest_19                  string

SQL> sho parameter LOG_ARCHIVE_DEST_2


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

log_archive_dest_2                   string      service="oracl19csb1", ASYNC N

                                                 OAFFIRM delay=0 optional compr

                                                 ession=disable max_failure=0 r

                                                 eopen=300 db_unique_name="ORAC

                                                 L19CSB1" net_timeout=30, valid

                                                 _for=(online_logfile,all_roles

                                                 )

log_archive_dest_20                  string

log_archive_dest_21                  string

log_archive_dest_22                  string

log_archive_dest_23                  string


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

log_archive_dest_24                  string

log_archive_dest_25                  string

log_archive_dest_26                  string

log_archive_dest_27                  string

log_archive_dest_28                  string

log_archive_dest_29                  string

SQL> sho parameter REMOTE_LOGIN_PASSWORDFILE


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

remote_login_passwordfile            string      EXCLUSIVE

SQL> sho parameter LOG_ARCHIVE_FORMAT


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

log_archive_format                   string      %t_%s_%r.arc

SQL> sho parameter FAL_SERVER


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

fal_server                           string

SQL> sho parameter STANDBY_FILE_MANAGEMENT


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

standby_file_management              string      AUTO

SQL> exit



sby:

13:33:49 SQL> sho parameter DB_NAME


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

db_name                             ,string     ,ORACL19C

13:36:10 SQL> sho parameter DB_UNIQUE_NAME


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

db_unique_name                      ,string     ,ORACL19CSB1

13:36:14 SQL> sho parameter LOG_ARCHIVE_CONFIG


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

log_archive_config                  ,string     ,DG_CONFIG=(ORACL19C,ORACL19CSB

                                    ,           ,1)

13:36:18 SQL> sho parameter CONTROL_FILES


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

control_files                       ,string     ,/oradata/ORACL19CSB1/controlfi

                                    ,           ,le/control_ORACL19CSB1_01.ctl

13:36:22 SQL> sho parameter LOG_ARCHIVE_DEST_1


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

log_archive_dest_1                  ,string     ,LOCATION=USE_DB_RECOVERY_FILE_

                                    ,           ,DEST VALID_FOR=(ALL_LOGFILES,A

                                    ,           ,LL_ROLES)  DB_UNIQUE_NAME=ORAC

                                    ,           ,L19CSB1

log_archive_dest_10                 ,string     ,

log_archive_dest_11                 ,string     ,

log_archive_dest_12                 ,string     ,

log_archive_dest_13                 ,string     ,

log_archive_dest_14                 ,string     ,

log_archive_dest_15                 ,string     ,

log_archive_dest_16                 ,string     ,

log_archive_dest_17                 ,string     ,

log_archive_dest_18                 ,string     ,

log_archive_dest_19                 ,string     ,

13:36:26 SQL> sho parameter LOG_ARCHIVE_DEST_2


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

log_archive_dest_2                  ,string     ,

log_archive_dest_20                 ,string     ,

log_archive_dest_21                 ,string     ,

log_archive_dest_22                 ,string     ,

log_archive_dest_23                 ,string     ,

log_archive_dest_24                 ,string     ,

log_archive_dest_25                 ,string     ,

log_archive_dest_26                 ,string     ,

log_archive_dest_27                 ,string     ,

log_archive_dest_28                 ,string     ,

log_archive_dest_29                 ,string     ,

13:36:31 SQL> sho parameter REMOTE_LOGIN_PASSWORDFILE


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

remote_login_passwordfile           ,string     ,EXCLUSIVE

13:37:06 SQL> sho parameter LOG_ARCHIVE_FORMAT


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

log_archive_format                  ,string     ,%t_%s_%r.arc

13:37:10 SQL> sho parameter FAL_SERVER


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

fal_server                          ,string     ,oracl19c

13:37:14 SQL> sho parameter STANDBY_FILE_MANAGEMENT


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

standby_file_management             ,string     ,AUTO




11. dgmgrl ->"Show configuration verbose" to check the health of the broker configuration


DGMGRL> show configuration verbose;


Configuration - ORACL19C_CONFIGURATION


  Protection Mode: MaxPerformance

  Members:

  ORACL19C    - Primary database

    ORACL19CSB1 - Physical standby database


  Properties:

    FastStartFailoverThreshold      = '30'

    OperationTimeout                = '30'

    TraceLevel                      = 'USER'

    FastStartFailoverLagLimit       = '30'

    CommunicationTimeout            = '180'

    ObserverReconnect               = '0'

    FastStartFailoverAutoReinstate  = 'TRUE'

    FastStartFailoverPmyShutdown    = 'TRUE'

    BystandersFollowRoleChange      = 'ALL'

    ObserverOverride                = 'FALSE'

    ExternalDestination1            = ''

    ExternalDestination2            = ''

    PrimaryLostWriteAction          = 'CONTINUE'

    ConfigurationWideServiceName    = 'ORACL19C_CFG'


Fast-Start Failover:  Disabled


Configuration Status:

SUCCESS





12. dgmgrl ->"Show database verbose" for primary and standby to ensure the transport - ON and apply -ON are active in a active configuration


DGMGRL> Show database verbose ORACL19C;


Database - ORACL19C


  Role:               PRIMARY

  Intended State:     TRANSPORT-ON

  Instance(s):

    ORACL19C1

    ORACL19C2


  Properties:

    DGConnectIdentifier             = 'oracl19c'

    ObserverConnectIdentifier       = ''

    FastStartFailoverTarget         = ''

    PreferredObserverHosts          = ''

    LogShipping                     = 'ON'

    RedoRoutes                      = ''

    LogXptMode                      = 'ASYNC'

    DelayMins                       = '0'

    Binding                         = 'optional'

    MaxFailure                      = '0'

    ReopenSecs                      = '300'

    NetTimeout                      = '30'

    RedoCompression                 = 'DISABLE'

    PreferredApplyInstance          = ''

    ApplyInstanceTimeout            = '0'

    ApplyLagThreshold               = '30'

    TransportLagThreshold           = '30'

    TransportDisconnectedThreshold  = '30'

    ApplyParallel                   = 'AUTO'

    ApplyInstances                  = '0'

    StandbyFileManagement           = ''

    ArchiveLagTarget                = '0'

    LogArchiveMaxProcesses          = '0'

    LogArchiveMinSucceedDest        = '0'

    DataGuardSyncLatency            = '0'

    LogArchiveTrace                 = '0'

    LogArchiveFormat                = ''

    DbFileNameConvert               = ''

    LogFileNameConvert              = ''

    ArchiveLocation                 = ''

    AlternateLocation               = ''

    StandbyArchiveLocation          = ''

    StandbyAlternateLocation        = ''

    InconsistentProperties          = '(monitor)'

    InconsistentLogXptProps         = '(monitor)'

    LogXptStatus                    = '(monitor)'

    SendQEntries                    = '(monitor)'

    RecvQEntries                    = '(monitor)'

    HostName(*)

    StaticConnectIdentifier(*)

    TopWaitEvents(*)

    SidName(*)

    (*) - Please check specific instance for the property value


  Log file locations(*):

    (*) - Check specific instance for log file locations.


Database Status:

SUCCESS


DGMGRL> Show database verbose ORACL19CSB1;


Database - ORACL19CSB1


  Role:               PHYSICAL STANDBY

  Intended State:     APPLY-ON

  Transport Lag:      0 seconds (computed 1 second ago)

  Apply Lag:          0 seconds (computed 1 second ago)

  Average Apply Rate: 12.00 KByte/s

  Active Apply Rate:  3.64 MByte/s

  Maximum Apply Rate: 3.65 MByte/s

  Real Time Query:    OFF

  Instance(s):

    ORACL19CSB1


  Properties:

    DGConnectIdentifier             = 'oracl19csb1'

    ObserverConnectIdentifier       = ''

    FastStartFailoverTarget         = ''

    PreferredObserverHosts          = ''

    LogShipping                     = 'ON'

    RedoRoutes                      = ''

    LogXptMode                      = 'ASYNC'

    DelayMins                       = '0'

    Binding                         = 'optional'

    MaxFailure                      = '0'

    ReopenSecs                      = '300'

    NetTimeout                      = '30'

    RedoCompression                 = 'DISABLE'

    PreferredApplyInstance          = ''

    ApplyInstanceTimeout            = '0'

    ApplyLagThreshold               = '30'

    TransportLagThreshold           = '30'

    TransportDisconnectedThreshold  = '30'

    ApplyParallel                   = 'AUTO'

    ApplyInstances                  = '0'

    StandbyFileManagement           = ''

    ArchiveLagTarget                = '0'

    LogArchiveMaxProcesses          = '0'

    LogArchiveMinSucceedDest        = '0'

    DataGuardSyncLatency            = '0'

    LogArchiveTrace                 = '0'

    LogArchiveFormat                = ''

    DbFileNameConvert               = ''

    LogFileNameConvert              = ''

    ArchiveLocation                 = ''

    AlternateLocation               = ''

    StandbyArchiveLocation          = ''

    StandbyAlternateLocation        = ''

    InconsistentProperties          = '(monitor)'

    InconsistentLogXptProps         = '(monitor)'

    LogXptStatus                    = '(monitor)'

    SendQEntries                    = '(monitor)'

    RecvQEntries                    = '(monitor)'

    HostName                        = 'vcentos79-oracle-ggtgt'

    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vcentos79-oracle-ggtgt)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORACL19CSB1_DGMGRL)(INSTANCE_NAME=ORACL19CSB1)(SERVER=DEDICATED)))'

    TopWaitEvents                   = '(monitor)'

    SidName                         = '(monitor)'


  Log file locations:

    Alert log               : /u01/app/oracle/diag/rdbms/oracl19csb1/ORACL19CSB1/trace/alert_ORACL19CSB1.log

    Data Guard Broker log   : /u01/app/oracle/diag/rdbms/oracl19csb1/ORACL19CSB1/trace/drcORACL19CSB1.log


Database Status:

SUCCESS


DGMGRL>





13. Do a archivelog switch and verify if that gets transported and applied smoothly


alter system archive log current;  -- to switch all the threads in one go.


####Actual switchover Task:


14. Comment out or cancel any scheduled jobs in primary/standby (like backup):


No jobs

13:52:06 SQL> !crontab -l

no crontab for oracle


13:55:38 SQL>



15. Ensure brok_val note checks are complete well in advance, just run through it once , if time permits.


> the prechecks are done


The precheck step 1 to 13 should be finished


16. Ensure the static connect id for dgmgrl is set in listener.ora file


We should have already verified this by now


>> the <dbname>_dgmgrl isnt set for now in sby where it showed up in the dgmgrl show command. Primary it didnt show the _dgmgrl value.


17. LOCAL_LISTENER parameter resolves to the listeners of the local host properly


>> primary all set but not in sby (since listener is default values)


13:55:38 SQL> sho parameter local


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

local_listener                      ,string     , (ADDRESS=(PROTOCOL=TCP)(HOST=

                                    ,           ,192.168.194.102)(PORT=1521))

parallel_force_local                ,boolean    ,FALSE

13:58:11 SQL>


13:56:56 SQL> sho parameter local


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

local_listener                      ,string     ,

parallel_force_local                ,boolean    ,FALSE

13:58:05 SQL>




18. Set the log_archive_max_process value to 4


create pfile=<> from spfile;

sho parameter log_Archive_max_process


prmry:


13:59:40 SQL> create pfile='/home/oracle/dba/SbySetup/pfileORACL19C_premod_02nov24.ora' from spfile;


File created.


Elapsed: 00:00:00.08

14:00:17 SQL> sho parameter log_Archive_max_process


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

log_archive_max_processes           ,integer    ,4

14:00:55 SQL>



sby:


14:00:37 SQL> create pfile='/home/oracle/dba/SBYSetup/pfileORACL19C_premod_02nov24.ora' from spfile;


File created.


Elapsed: 00:00:00.00

14:00:45 SQL> sho parameter log_Archive_max_process


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

log_archive_max_processes           ,integer    ,4

14:00:57 SQL>





19. Set the log_file_name_convert value relevently to ensure the online redolog gets cleared


sho parameter log_file_name_convert


>>> OMF is used in both source and target


20. Manually clear the online log in case needed


SELECT DISTINCT L.GROUP# FROM V$LOG L, V$LOGFILE LF 

     WHERE L.GROUP# = LF.GROUP# AND L.STATUS 

     NOT IN ('UNUSED','CLEARING','CLEARING_CURRENT');


ALTER DATABASE CLEAR LOGFILE GROUP <ORL GROUP# from the query above>;


>>> NA


21. Verify that there are no large gaps


SELECT THREAD#, SEQUENCE# FROM V$THREAD;






22. Validate it in standby


SELECT THREAD#, MAX(SEQUENCE#) FROM V$ARCHIVED_LOG

     WHERE APPLIED = 'YES'

     AND RESETLOGS_CHANGE# = (SELECT RESETLOGS_CHANGE#

     FROM V$DATABASE_INCARNATION

     WHERE STATUS = 'CURRENT')

     GROUP BY THREAD#;


prmry:

14:02:01 SQL> SELECT THREAD#, SEQUENCE# FROM V$THREAD;


   THREAD#, SEQUENCE#

----------,----------

         1,        26

         2,        20


Elapsed: 00:00:00.05

14:02:20 SQL>


sby:

   THREAD#,MAX(SEQUENCE#)

----------,--------------

         1,            25

         2,            19


Elapsed: 00:00:00.00

14:02:27 SQL>




23. Temp TS/file presence verification


SELECT TMP.NAME FILENAME, BYTES, TS.NAME TABLESPACE

     FROM V$TEMPFILE TMP, V$TABLESPACE TS WHERE TMP.TS#=TS.TS#;


Sby:

14:02:27 SQL> SELECT TMP.NAME FILENAME, BYTES, TS.NAME TABLESPACE

     FROM V$TEMPFILE TMP, V$TABLESPACE TS WHERE TMP.TS#=TS.TS#;14:03:00   2


FILENAME                                                                                                                                                                     ,     BYTES,TABLESPACE

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------,----------,------------------------------

/oradata/ORACL19CSB1/datafile/o1_mf_temp_ml9nvymr_.tmp                                                                                                                       ,  20971520,TEMP


Elapsed: 00:00:00.02

14:03:01 SQL>





24. Turn off the apply lag/delay


dgmgrl > SHOW DATABASE <standby-db_unique_name> DELAYMINS;

DGMGRL> EDIT DATABASE <standby-db_unique_name> SET PROPERTY 'DELAYMINS'='0';


sby:

    DelayMins                       = '0'


no need to edit this.


25. Check jobs running and stop them/disable them


SELECT * FROM DBA_JOBS_RUNNING;


SELECT OWNER, JOB_NAME, START_DATE, END_DATE, ENABLED 

     FROM DBA_SCHEDULER_JOBS WHERE ENABLED='TRUE' AND OWNER <> 'SYS';


SHOW PARAMETER job_queue_processes;

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

EXECUTE DBMS_SCHEDULER.DISABLE( <job_name> );


Prmry:


14:02:20 SQL> SELECT * FROM DBA_JOBS_RUNNING;


no rows selected


Elapsed: 00:00:00.08

14:03:39 SQL>



26. Stop any middle tier as apply


opmnctl stopall


>> None


27. Enable log archive tracing in both primary and standby


DGMGRL> SHOW INSTANCE <SID> LogArchiveTrace;


DGMGRL> EDIT INSTANCE * ON DATABASE <db_unique_name> SET PROPERTY LogArchiveTrace=8191;


DGMGRL> EDIT INSTANCE * ON DATABASE ORACL19C SET PROPERTY LogArchiveTrace=8191;

Property "logarchivetrace" updated

DGMGRL> EDIT INSTANCE * ON DATABASE ORACL19CSB1 SET PROPERTY LogArchiveTrace=8191;

Connected to "ORACL19CSB1"

Property "logarchivetrace" updated

DGMGRL>



prmry:


14:05:24 SQL> sho parameter log_Archive_trace


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

log_archive_trace                   ,integer    ,8191

14:06:47 SQL>


sby:

14:03:01 SQL> sho parameter log_Archive_trace


NAME                                ,TYPE       ,VALUE

------------------------------------,-----------,------------------------------

log_archive_trace                   ,integer    ,8191

14:07:14 SQL>




28. Tail alert log of both primary and standby


>> done


29. Additional fallback option (create flash back point)


On standby:

DGMGRL > EDIT DATABASE <standby-db-unique-name> SET STATE='APPLY-OFF';


Create a guaranteed restore point with SQL*Plus


DGMGRL > SQL "CREATE RESTORE POINT SWITCHOVER_START_GRP GUARANTEE FLASHBACK DATABASE";


DGMGRL> EDIT DATABASE <standby-db-unique-name> SET STATE='APPLY-ON';


On primary:

DGMGRL> CONNECT SYS/password@primary

DGMGRL> SQL "CREATE RESTORE POINT SWITCHOVER_START_GRP GUARANTEE FLASHBACK DATABASE";



After a successful switchover, drop the flashback point


sby:


DGMGRL> edit DATABASE ORACL19CSB1  SET STATE='APPLY-OFF';

Succeeded.

DGMGRL> show database ORACL19CSB1;


Database - ORACL19CSB1


  Role:               PHYSICAL STANDBY

  Intended State:     APPLY-OFF

  Transport Lag:      0 seconds (computed 0 seconds ago)

  Apply Lag:          15 seconds (computed 0 seconds ago)

  Average Apply Rate: (unknown)

  Real Time Query:    OFF

  Instance(s):

    ORACL19CSB1


Database Status:

SUCCESS


DGMGRL>



14:07:14 SQL> CREATE RESTORE POINT SWITCHOVER_START_GRP GUARANTEE FLASHBACK DATABASE;


Restore point created.


Elapsed: 00:00:01.56

14:09:22 SQL> select * from v$restore_point;


       SCN,DATABASE_INCARNATION#,GUA,STORAGE_SIZE,TIME                                                                       ,RESTORE_POINT_TIME                             ,PRE,NAME                                                                                                                             ,PDB,CLE,PDB_INCARNATION#,REP,    CON_ID

----------,---------------------,---,------------,---------------------------------------------------------------------------,---------------------------------------------------------------------------,---,--------------------------------------------------------------------------------------------------------------------------------,---,---,----------------,---,----------

   1770839,                    1,YES,   209715200,02-NOV-24 02.09.20.000000000 PM                                            ,                                               ,YES,SWITCHOVER_START_GRP                                                                                                             ,NO ,NO ,               0,NO ,         0


Elapsed: 00:00:00.03

14:09:31 SQL>


DGMGRL> edit DATABASE ORACL19CSB1  SET STATE='APPLY-ON';

Succeeded.

DGMGRL> show database ORACL19CSB1;


Database - ORACL19CSB1


  Role:               PHYSICAL STANDBY

  Intended State:     APPLY-ON

  Transport Lag:      0 seconds (computed 0 seconds ago)

  Apply Lag:          0 seconds (computed 0 seconds ago)

  Average Apply Rate: 361.00 KByte/s

  Real Time Query:    OFF

  Instance(s):

    ORACL19CSB1


Database Status:

SUCCESS


DGMGRL>



prmry:

14:14:14 SQL> CREATE RESTORE POINT SWITCHOVER_START_GRP GUARANTEE FLASHBACK DATABASE;


Restore point created.


Elapsed: 00:00:08.01

14:14:24 SQL> select * from v$restore_point;


       SCN,DATABASE_INCARNATION#,GUA,STORAGE_SIZE,TIME                                                                       ,RESTORE_POINT_TIME                             ,PRE,NAME                                                                                                                             ,PDB,CLE,PDB_INCARNATION#,REP,    CON_ID

----------,---------------------,---,------------,---------------------------------------------------------------------------,---------------------------------------------------------------------------,---,--------------------------------------------------------------------------------------------------------------------------------,---,---,----------------,---,----------

   1771914,                    1,YES,   419430400,02-NOV-24 02.14.16.000000000 PM                                            ,                                               ,YES,SWITCHOVER_START_GRP                                                                                                             ,NO ,NO ,               0,NO ,         0


Elapsed: 00:00:00.14

14:14:33 SQL>




30.Ensure sys passwords for both primary and sys are OK. By trying to connect to sys@<TnsEntry>



31. Switchover (Switchover to standby)

DGMGRL> CONNECT SYS/password@primary   <ensure @primary

DGMGRL> SWITCHOVER TO <standby database name>;


DGMGRL> SWITCHOVER TO ORACL19CSB1;

Performing switchover NOW, please wait...

Operation requires a connection to database "ORACL19CSB1"

Connecting ...

Connected to "ORACL19CSB1"

Connected as SYSDBA.

New primary database "ORACL19CSB1" is opening...

Oracle Clusterware is restarting database "ORACL19C" ...

Connected to "ORACL19C"

Connected to "ORACL19C"

Switchover succeeded, new primary is "oracl19csb1"

DGMGRL>


DGMGRL> show configuration;


Configuration - ORACL19C_CONFIGURATION


  Protection Mode: MaxPerformance

  Members:

  ORACL19CSB1 - Primary database

    ORACL19C    - Physical standby database


Fast-Start Failover:  Disabled


Configuration Status:

SUCCESS   (status updated 44 seconds ago)


DGMGRL> show database ORACL19CSB1;


Database - ORACL19CSB1


  Role:               PRIMARY

  Intended State:     TRANSPORT-ON

  Instance(s):

    ORACL19CSB1


Database Status:

SUCCESS


DGMGRL> show database ORACL19C;


Database - ORACL19C


  Role:               PHYSICAL STANDBY

  Intended State:     APPLY-ON

  Transport Lag:      0 seconds (computed 0 seconds ago)

  Apply Lag:          0 seconds (computed 0 seconds ago)

  Average Apply Rate: 56.00 KByte/s

  Real Time Query:    OFF

  Instance(s):

    ORACL19C1

    ORACL19C2 (apply instance)


Database Status:

SUCCESS


DGMGRL>


14:23:36 SQL> select name,open_mode,database_role,db_unique_name from v$database;


NAME     ,OPEN_MODE           ,DATABASE_ROLE   ,DB_UNIQUE_NAME

---------,--------------------,----------------,------------------------------

ORACL19C ,MOUNTED             ,PHYSICAL STANDBY,ORACL19C


Elapsed: 00:00:00.03


14:24:07 SQL> select inst_id,process,status,client_process,sequence# from gv$managed_standby;


   INST_ID,PROCESS  ,STATUS      ,CLIENT_P, SEQUENCE#

----------,---------,------------,--------,----------

         1,DGRD     ,ALLOCATED   ,N/A     ,         0

         1,ARCH     ,CONNECTED   ,ARCH    ,         0

         1,ARCH     ,CONNECTED   ,ARCH    ,         0

         1,ARCH     ,CONNECTED   ,ARCH    ,         0

         1,ARCH     ,CONNECTED   ,ARCH    ,         0

         1,DGRD     ,ALLOCATED   ,N/A     ,         0

         2,DGRD     ,ALLOCATED   ,N/A     ,         0

         2,ARCH     ,CONNECTED   ,ARCH    ,         0

         2,DGRD     ,ALLOCATED   ,N/A     ,         0

         2,ARCH     ,CONNECTED   ,ARCH    ,         0

         2,ARCH     ,CONNECTED   ,ARCH    ,         0

         2,ARCH     ,CONNECTED   ,ARCH    ,         0

         2,RFS      ,IDLE        ,Archival,         0

         2,RFS      ,IDLE        ,LGWR    ,        29

         2,RFS      ,IDLE        ,UNKNOWN ,         0

         2,RFS      ,IDLE        ,UNKNOWN ,         0

         2,RFS      ,IDLE        ,UNKNOWN ,         0

         2,MRP0     ,APPLYING_LOG,N/A     ,        29


18 rows selected.


Elapsed: 00:00:00.12

14:24:22 SQL> select * from v$restore_point;


no rows selected


Elapsed: 00:00:00.08

14:24:48 SQL>


SQL> select name,open_mode,database_role,db_unique_name from v$database;


NAME      OPEN_MODE            DATABASE_ROLE    DB_UNIQUE_NAME

--------- -------------------- ---------------- ------------------------------

ORACL19C  READ WRITE           PRIMARY          ORACL19CSB1


SQL>





Post switchover Task:


32. Adjust the lag time


DGMGRL> EDIT DATABASE <standby-db-unique-name> SET PROPERTY 'DELAYMINS'='<saved_value>'; ->default 0 (hence leave as is)


>>no lag added


33. Edit the logarchive trace andd put it to its previous value


DGMGRL> EDIT INSTANCE * ON DATABASE <db-unique-name> SET PROPERTY LogArchiveTrace=<prior_value>;


DGMGRL> EDIT INSTANCE * ON DATABASE ORACL19C SET PROPERTY LogArchiveTrace=0;

Property "logarchivetrace" updated

DGMGRL> EDIT INSTANCE * ON DATABASE ORACL19CSB1 SET PROPERTY LogArchiveTrace=0;

Connected to "ORACL19CSB1"

Property "logarchivetrace" updated

DGMGRL>


Manual verification in new sby:

*.log_archive_trace=0




34. Edit the job_queue_processes


SQL> ALTER SYSTEM SET job_queue_processes=<value saved> scope=both sid='*';


>> no need to revert, since we didnt change it


35. Enable any disabled job


EXECUTE DBMS_SCHEDULER.ENABLE(<for each job name captured>);


>> none, we didnt change it.


36. Drop the flash back point


DROP RESTORE POINT SWITCHOVER_START_GRP;


new prmry:

SQL> DROP RESTORE POINT SWITCHOVER_START_GRP;


Restore point dropped.


SQL> select * from v$restore_point;


no rows selected


SQL>




37. Ensure to reverse the rman settings manually


new standby:

RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;


old RMAN configuration parameters:

CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY;

new RMAN configuration parameters:

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;

new RMAN configuration parameters are successfully stored


RMAN>



new primary:

RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY;


using target database control file instead of recovery catalog

new RMAN configuration parameters:

CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY;

new RMAN configuration parameters are successfully stored



=================> So we finished the switchover of heterogenous oracle dataguard.


Thanks :)


Flashback data archive steps

 Objective: Ways to track DML changes in a table Detailed objective: We should be able to track the changes in the table at any point in tim...