Tuesday, January 17, 2023

Error: ORA-16662: network timeout when contacting a member : DGMGRL

 

Error: ORA-16662: network timeout when contacting a member


DGMGRL>

DGMGRL> show configuration


Configuration - prod_ddb


  Protection Mode: MaxPerformance

  Members:

  ddb_dr - Primary database

    ddb    - Physical standby database

      Error: ORA-16662: network timeout when contacting a member


Fast-Start Failover:  Disabled


Configuration Status:

ERROR   (status updated 47 seconds ago)


DGMGRL>



SQL> select

dest_name,

status,

error

from

v$archive_dest

where

status='ERROR'

;  2    3    4    5    6    7    8    9


DEST_NAME

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

STATUS    ERROR

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

LOG_ARCHIVE_DEST_2

ERROR     ORA-16198: Timeout incurred on internal channel during remote

          archival



Workaround 

EDIT DATABASE 'ddb' SET PROPERTY NetTimeout = 60; 


EDIT DATABASE 'ddb_dr' SET PROPERTY NetTimeout = 60; 

Switchover with Data Guard Broker : DGMGRL

 Switchover with Data Guard Broker 



DGMGRL>

DGMGRL>

DGMGRL> show configuration;


Configuration - prod_ddb


  Protection Mode: MaxPerformance

  Members:

  ddb    - Primary database

    ddb_dr - Physical standby database


Fast-Start Failover:  Disabled


Configuration Status:

SUCCESS   (status updated 11 seconds ago)


DGMGRL>

DGMGRL>

DGMGRL>

DGMGRL>

DGMGRL> switchover to ddb_dr

Performing switchover NOW, please wait...

Operation requires a connection to database "ddb_dr"

Connecting ...

Connected to "ddb_dr"

Connected as SYSDBA.

New primary database "ddb_dr" is opening...

Operation requires start up of instance "ddb" on database "ddb"

Starting instance "ddb"...

Connected to an idle instance.

ORACLE instance started.

Connected to "ddb"

Database mounted.

Connected to "ddb"

Switchover succeeded, new primary is "ddb_dr"

DGMGRL>



DGMGRL>

DGMGRL> show configuration


Configuration - prod_ddb


  Protection Mode: MaxPerformance

  Members:

  ddb_dr - Primary database

    ddb    - Physical standby database


Fast-Start Failover:  Disabled


Configuration Status:

SUCCESS   (status updated 78 seconds ago)


DGMGRL>

DGMGRL>

DGMGRL> switchover to ddb

Performing switchover NOW, please wait...

Operation requires a connection to database "ddb"

Connecting ...

Connected to "ddb"

Connected as SYSDBA.

New primary database "ddb" is opening...

Operation requires start up of instance "ddb_dr" on database "ddb_dr"

Starting instance "ddb_dr"...

Connected to an idle instance.

ORACLE instance started.

Connected to "ddb_dr"

Database mounted.

Connected to "ddb_dr"

Switchover succeeded, new primary is "ddb"

DGMGRL>



DGMGRL>

DGMGRL>

DGMGRL> show configuration


Configuration - prod_ddb


  Protection Mode: MaxPerformance

  Members:

  ddb    - Primary database

    ddb_dr - Physical standby database


Fast-Start Failover:  Disabled


Configuration Status:

SUCCESS   (status updated 77 seconds ago)


DGMGRL>




Sunday, January 15, 2023

How to resolve ORA error like ORA-16058 during oracle datagaurd setup .

How to resolve ORA error like ORA-16058  during oracle datagaurd setup .



Execute below steps on primary database 


SQL> alter system set log_archive_dest_state_2='DEFER';

SQL> alter system set log_archive_dest_state_2='ENABLE';


SQL> select dest_id, status, destination, error from v$archive_dest where dest_id<=2;


   DEST_ID STATUS    DESTINATION                    ERROR

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

         1 VALID     USE_DB_RECOVERY_FILE_DEST

         2 VALID     ddb_dr


SQL>


Client Connectivity in Data Guard Configuration | HA service

Client Connectivity in Data Guard Configuration





create database service on primary database server


exec DBMS_SERVICE.CREATE_SERVICE (service_name => 'ddb_ha', network_name => 'ddb_ha');



create or replace procedure start_db_ha_service

is

v_role VARCHAR(30);

begin

select DATABASE_ROLE into v_role from V$DATABASE;

if v_role = 'PRIMARY' then

DBMS_SERVICE.START_SERVICE('ddb_ha');

else

DBMS_SERVICE.STOP_SERVICE('ddb_ha');

end if;

end;

/





TRIGGER TO START SERVICE ON DB STARTUP:


create or replace TRIGGER db_hasrv_on_startup

after startup on database

begin

start_db_ha_service;

end;

/


TRIGGER TO START SERVICE ON DB ROLECHANGE:


create or replace TRIGGER db_hasrv_on_role_change

after db_role_change on database

begin

start_db_ha_service;

end;

/


Start the new service on primary


SQL> exec start_db_ha_service;

SQL> alter system archive log current;






SQL>

SQL>

SQL> exec DBMS_SERVICE.CREATE_SERVICE (service_name => 'ddb_ha', network_name => 'ddb_ha');


PL/SQL procedure successfully completed.


SQL> create or replace procedure start_db_ha_service

is

v_role VARCHAR(30);

begin

select DATABASE_ROLE into v_role from V$DATABASE;

if v_role = 'PRIMARY' then

DBMS_SERVICE.START_SERVICE('ddb_ha');

else

DBMS_SERVICE.STOP_SERVICE('ddb_ha');

end if;

end;

/  2    3    4    5    6    7    8    9   10   11   12


Procedure created.


SQL> create or replace TRIGGER db_hasrv_on_startup

after startup on database

begin

start_db_ha_service;

end;

/

  2    3    4    5    6

Trigger created.


SQL>

SQL> create or replace TRIGGER db_hasrv_on_role_change

after db_role_change on database

begin

start_db_ha_service;

end;

/  2    3    4    5    6


Trigger created.


SQL>

SQL>

SQL> exec start_db_ha_service;


PL/SQL procedure successfully completed.


SQL>

SQL> alter system archive log current;


System altered.


SQL> alter system archive log current;


System altered.


SQL> /


System altered.


SQL> /


System altered.


SQL>

SQL>



tnsnames.ora (client site)




DDB =

  (DESCRIPTION =

    (ADDRESS_LIST=

      (ADDRESS = (PROTOCOL = TCP)(HOST = 9.82.83.159)(PORT = 1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = 72.471.436.842)(PORT = 1521))

    )

   (CONNECT_DATA = (SERVICE_NAME = ddb_ha)

     (FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=60)(DELAY=20))

   )

  )