Search This Blog

Total Pageviews

Sunday, 9 August 2026

oracle standby To activate the standby site if the primary site is not reachable.



To activate the standby site if the primary site is not reachable.


*****************************************************************************



dgmgrl /
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Sun Aug 9 14:15:22 2026
Version 19.31.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "orcl_stdy"
Connected as SYSDG.
DGMGRL> show configuration ;

Configuration - DG_CONF

  Protection Mode: MaxPerformance
  Members:
  orcl      - Primary database
    Error: ORA-1034: ORACLE not available   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 

    orcl_stdy - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
ERROR   (status updated 0 seconds ago)

DGMGRL> SHOW DATABASE VERBOSE orcl_stdy;

Database - orcl_stdy

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 172 seconds ago)
  Apply Lag:          0 seconds (computed 172 seconds ago)
  Average Apply Rate: 61.00 KByte/s
  Active Apply Rate:  0 Byte/s
  Maximum Apply Rate: 0 Byte/s
  Real Time Query:    OFF
  Instance(s):
    orcls

  Database Warning(s):
    ORA-16857: member disconnected from redo source for longer than specified threshold

  Properties:
    DGConnectIdentifier             = 'orcldstdy'
    ObserverConnectIdentifier       = ''
    FastStartFailoverTarget         = 'orcl'
    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)'
    UserManagedParams               = ''
    HostName                        = 'oracentd19c'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracentd19c)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl_stdy_DGMGRL)(INSTANCE_NAME=orcls)(SERVER=DEDICATED)))'
    TopWaitEvents                   = '(monitor)'
    SidName                         = '(monitor)'

  Log file locations:
    Alert log               : /u01/app/oracle/diag/rdbms/orcl_stdy/orcls/trace/alert_orcls.log
    Data Guard Broker log   : /u01/app/oracle/diag/rdbms/orcl_stdy/orcls/trace/drcorcls.log

Database Status:
WARNING



*********************************************************************************************************************

DGMGRL> FAILOVER TO orcl_stdy;               <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Performing failover NOW, please wait...
Failover succeeded, new primary is "orcl_stdy"



Configuration Status:
SUCCESS   (status updated 46 seconds ago)

DGMGRL> show configuration ;

Configuration - DG_CONF

  Protection Mode: MaxPerformance
  Members:
  orcl_stdy - Primary database
    orcl      - Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 38 seconds ago)




DGMGRL> DGMGRL> [oracle@oracentd19c ~]$ sqlme

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Aug 9 14:27:47 2026
Version 19.31.0.0.0

Copyright (c) 1982, 2026, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.0.0

[-PRIMARY-]sys@ORCL_STDY> SELECT db_unique_name, database_role, open_mode, switchover_status
FROM v$database;  2

DB_UNIQUE_NAME                 DATABASE_ROLE    OPEN_MODE
------------------------------ ---------------- --------------------
SWITCHOVER_STATUS
--------------------
orcl_stdy                      PRIMARY          READ WRITE
NOT ALLOWED


[-PRIMARY-]sys@ORCL_STDY> 
SELECT db_unique_name,
       database_role,
       open_mode,
       resetlogs_change#,
       resetlogs_time
FROM v$database;  



DB_UNIQUE_NAME                 DATABASE_ROLE    OPEN_MODE
------------------------------ ---------------- --------------------
RESETLOGS_CHANGE# RESETLOGS
----------------- ---------
orcl_stdy                      PRIMARY          READ WRITE
          4771662 09-AUG-26


[-PRIMARY-]sys@ORCL_STDY> SELECT current_scn FROM v$database;

CURRENT_SCN
-----------
    4777481

[-PRIMARY-]sys@ORCL_STDY> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.0.0





On failed node 

SQL> startup ;
ORACLE instance started.

Total System Global Area 6710883904 bytes
Fixed Size                  9193024 bytes
Variable Size            1677721600 bytes
Database Buffers         5016387584 bytes
Redo Buffers                7581696 bytes
Database mounted.
ORA-16649: possible failover to another database prevents this database from
being opened


SQL>
SQL>
SQL>
SQL>
SQL>
SQL> select * from dual;

ADDR                   INDX    INST_ID     CON_ID D
---------------- ---------- ---------- ---------- -
0000000015940ADC          0          1          0 X



Database Status:
DISABLED - ORA-16623: member detected role change

DGMGRL> DGMGRL> [oracle@oracent19c ~]$
[oracle@oracent19c ~]$
[oracle@oracent19c ~]$
[oracle@oracent19c ~]$
[oracle@oracent19c ~]$ !sql
sqlme

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Aug 9 14:27:37 2026
Version 19.31.0.0.0

Copyright (c) 1982, 2026, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.0.0

SQL> SELECT db_unique_name, database_role, open_mode, switchover_status
FROM v$database;  2

DB_UNIQUE_NAME                 DATABASE_ROLE    OPEN_MODE
------------------------------ ---------------- --------------------
SWITCHOVER_STATUS
--------------------
orcl                           PRIMARY          MOUNTED
NOT ALLOWED


SQL> SELECT flashback_on
FROM v$database;  2

FLASHBACK_ON
------------------
YES





[oracle@oracentd19c ~]$ dgmgrl /
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Sun Aug 9 14:34:37 2026
Version 19.31.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "ORCL_STDY"
Connected as SYSDG.

DGMGRL> SHOW DATABASE VERBOSE orcl

Database - orcl

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Active Apply Rate:  (unknown)
  Maximum Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    orcl

  Properties:
    DGConnectIdentifier             = 'orcl'
    ObserverConnectIdentifier       = ''
    FastStartFailoverTarget         = 'orcl_stdy'
    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)'
    UserManagedParams               = ''
    HostName                        = 'oracent19c'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracent19c)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
    TopWaitEvents                   = '(monitor)'
    SidName                         = '(monitor)'

  Log file locations:
    (Unknown)

Database Status:
DISABLED - ORA-16661: the standby database needs to be reinstated



on old primary




SQL> startup ;
ORACLE instance started.

Total System Global Area 6710883904 bytes
Fixed Size                  9193024 bytes
Variable Size            1677721600 bytes
Database Buffers         5016387584 bytes
Redo Buffers                7581696 bytes
Database mounted.
ORA-16649: possible failover to another database prevents this database from
being opened


on failed node !!


SQL> startup ;
ORACLE instance started.

Total System Global Area 6710883904 bytes
Fixed Size                  9193024 bytes
Variable Size            1677721600 bytes
Database Buffers         5016387584 bytes
Redo Buffers                7581696 bytes
Database mounted.
ORA-16649: possible failover to another database prevents this database from
being opened


SQL>
SQL>
SQL>
SQL>
SQL>
SQL> select * from dual;

ADDR                   INDX    INST_ID     CON_ID D
---------------- ---------- ---------- ---------- -
0000000015940ADC          0          1          0 X

SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.0.0






from active node !!!!!!!!!! from new prod REINSTATE DATABASE orcl

DGMGRL> REINSTATE DATABASE orcl;
Reinstating database "orcl", please wait...
Reinstatement of database "orcl" succeeded

DGMGRL> SHOW DATABASE VERBOSE orcl

Database - orcl

  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: 979.00 KByte/s
  Active Apply Rate:  0 Byte/s
  Maximum Apply Rate: 0 Byte/s
  Real Time Query:    OFF
  Instance(s):
    orcl

  Properties:
    DGConnectIdentifier             = 'orcl'
    ObserverConnectIdentifier       = ''
    FastStartFailoverTarget         = 'orcl_stdy'
    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)'
    UserManagedParams               = ''
    HostName                        = 'oracent19c'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracent19c)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
    TopWaitEvents                   = '(monitor)'
    SidName                         = '(monitor)'

  Log file locations:
    Alert log               : /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log
    Data Guard Broker log   : /u01/app/oracle/diag/rdbms/orcl/orcl/trace/drcorcl.log

Database Status:
SUCCESS





DGMGRL> show configuration ;

Configuration - DG_CONF

  Protection Mode: MaxPerformance
  Members:
  orcl_stdy - Primary database
    orcl      - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 44 seconds ago)


on new standby !!!

SELECT recovery_mode
FROM v$archive_dest_status
WHERE dest_id = 1;  2    3

RECOVERY_MODE
----------------------------------
MANAGED REAL TIME APPLY

Sunday, 2 August 2026

grid get_groups.sh




from below down load the script 
curl -s -o get_groups.sh "https://raw.githubusercontent.com/maiconcarneiro/blog-dibiei/main/get_groups.sh"; chmod +x get_groups.sh



## script: get_groups.sh v1.3
## syntax: "./get_groups.sh" or  "./get_groups.sh -home " or "./get_groups.sh -home all"
##  ./get_groups.sh use the current $ORACLE_HOME as default path.
##
## https://dibiei.blog/2024/01/30/script-get_groups-sh-listando-os-grupos-de-so-de-um-oracle_home/
##
## Maicon Carneiro - dibiei.blog
## 11/01/2024 - v1.0 with FPP format standard
## 27/01/2024 - v1.1 support for multiple Oracle Home reading /etc/oratab
## 29/01/2024 - v1.2 support for OUI (Oracle Universal Installer) format
# 1) Execution without parameter use the current ORACLE_HOME
# 2) Execution with the PATH provided by user get the groups for the specified ORACLE_HOME
# 3) Execution with option "all" get the groups for all ORACLE_HOME listed in /etc/oratab file.
USER_OPTION=""
# Default format of the output (FPP or OUI)
#  FPP = Fleet Patching and Provisioning
#  OUI = Oracle Universal Installer
RESULT_TYPE="FPP"
# show script help usage
show_help() {
    echo "Uso: $0 [-home ] [-oui]"
    echo "  -home    : Oracle Home Patch. Example: /u01/app/oracle/product/19.0.0/dbhome_1"
    echo "  -oui     : Get the result with OUI format instead of FPP format"
    exit 1
}
# check parameters
while [[ $# -gt 0 ]]; do
    case $1 in
        -home)
            shift
            if [[ $# -eq 0 || $1 == -* ]]; then
                show_help
            fi
            USER_OPTION=$1
            ;;
        -oui)
            RESULT_TYPE="OUI"
            ;;
        *)
            show_help
            ;;
    esac
    shift
done
# Default Binary type (RDBMS or GRID)
BINARY_TYPE="RDBMS"
# YES for Fleet Patching and Provisioning (FPP) standard
FORCE_OSPER_GRP="YES"
addGroupValueFPP()
{
  GRP_NAME=$1
  GRP_VALUE=$2
  if [ -z $GRP_LIST_FPP ]; then
   GRP_LIST_FPP="$GRP_NAME=$GRP_VALUE"
  else
   GRP_LIST_FPP="${GRP_LIST_FPP},$GRP_NAME=$GRP_VALUE"
  fi
}
addGroupValueOUI()
{
  GROUP_NAME=$1
  GROUP_VALUE=$2
  GROUP_OUI=$GROUP_NAME
  if [ "$BINARY_TYPE" == "GRID" ]; then
   OUI_LINE="oracle.install.asm.${GROUP_OUI}=$GROUP_VALUE"
  else 
   
    if [ "$GROUP_NAME" != "OSDBA" ] && [ "$GROUP_NAME" != "OSOPER" ]; then
      GROUP_OUI="${GROUP_NAME}DBA"
    fi
    OUI_LINE="oracle.install.db.$GROUP_OUI"_GROUP="$GROUP_VALUE"
  fi
  GRP_LIST_OUI+=($OUI_LINE)
}
runGetGroups(){
if [ ! -z "$2" ]; then
 LIST_TYPE=$2
fi
# set the source Oracle Home
SOURCE_ORACLE_HOME=""
OH_PARAM=$1
if [ ! -z "$OH_PARAM" ]; then
 SOURCE_ORACLE_HOME=$OH_PARAM
 elif [ ! -z $ORACLE_HOME ]; then
  SOURCE_ORACLE_HOME=$ORACLE_HOME
 else
  echo "ORACLE_HOME is required."
  exit 1
fi
# check if the ORACLE_HOME exists
if [ ! -f "$SOURCE_ORACLE_HOME/rdbms/lib/config.c" ]; then
 echo "Invalid ORACLE_HOME: $SOURCE_ORACLE_HOME"
 exit 1
fi
# check binary type
if [ -f "$SOURCE_ORACLE_HOME/crs/install/rootcrs.sh" ]; then
 BINARY_TYPE="GRID"
fi
# function to read the "config.c" file and return the group value to the specific group name.
addGroupValue(){
 GRP_DEFINE=$1
 GRP_NAME=$2
 GRP_FORCE=$3
 GRP_VALUE=$(grep "#define $GRP_DEFINE" $SOURCE_ORACLE_HOME/rdbms/lib/config.c | awk -F '"' '{print $2}')
 if [[ ! -z "$GRP_VALUE" || $GRP_FORCE == "YES" ]]; then
  
  if [ "$RESULT_TYPE" == "FPP" ]; then
   addGroupValueFPP $GRP_NAME $GRP_VALUE
  else
   addGroupValueOUI $GRP_NAME $GRP_VALUE
  fi
 fi
}
# get all possible OS Groups value
GRP_LIST_FPP=""
GRP_LIST_OUI=()
addGroupValue "SS_DBA_GRP" "OSDBA"
addGroupValue "SS_OPER_GRP" "OSOPER" "$FORCE_OSPER_GRP"
# these groups are specific to RDBMS binary
if [ "$BINARY_TYPE" == "RDBMS" ]; then
 addGroupValue "SS_DGD_GRP"  "OSDG"
 addGroupValue "SS_KMT_GRP"  "OSKM"
 addGroupValue "SS_RAC_GRP"  "OSRAC"
 addGroupValue "SS_BKP_GRP"  "OSBACKUP"
fi;
addGroupValue "SS_ASM_GRP"  "OSASM"
if [ "$RESULT_TYPE" == "FPP" ]; then
  echo "$GRP_LIST_FPP"
 else
  for OUI_GROUP in "${GRP_LIST_OUI[@]}"; do
    echo "$OUI_GROUP"
  done
fi
}
# call the runGetGroups function based on the USER Option
if [ "$USER_OPTION" == "all" ]; then
 echo ""
 for OH_PATH in $(grep -v "^#" /etc/oratab | awk -F ":" '{print $2}' | sort -u | grep "^/"); do
  echo "Oracle Home: $OH_PATH"
  echo "$(runGetGroups $OH_PATH)"
  echo ""
 done
else
 runGetGroups "$USER_OPTION"
fi;






[grid@ora26 ~]$ ./get_groups.sh -home /u01/app/26.0.0/grid -oui
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin

[grid@ora26 ~]$ ./get_groups.sh -home /u01/app/26.1.0/grid -oui   <<< new 
oracle.install.asm.OSDBA=dba
oracle.install.asm.OSOPER=
oracle.install.asm.OSASM=dba
[grid@ora26 ~]$

Oracle DBA

anuj blog Archive