Verifying the LUN Protected Group Consistency Script (Oracle)

A self-defined script is not provided by eReplication, so the script provider must ensure the script correctness. Before configuring the script, ensure that the script has been verified.

During the script verification, the database is frozen and unfrozen repeatedly, which affects services. Therefore, you are advised to create a non-service Oracle database for the verification.

Freeze Script (Non-Windows)

The sample_freeze.sh script is used as an example. It is used to enable hot standby for the Oracle database.

  1. Log in to the production application server as user root.
  2. Run the cd /home/rdadmin/Agent/sbin/thirtparty command to access the directory for storing the script.
  3. Run the sh sample_freeze.sh <PID><AGENT_ROOT> command to run the freeze script.

    • PID: unique ID of the script execution. You are advised to enter a large number.
    • AGENT_ROOT: the installation root directory of the Agent. The directory is /home/rdadmin/Agent for a non-Solaris operating system.

  4. Run the su - oracle command to switch to user Oracle.
  5. Run the sqlplus / as sysdba command to connect to the database instance through OS authentication.

    oracle@linux2:~> export ORACLE_SID=dbFS 
    oracle@linux2:~> sqlplus / as sysdba 
     
    SQL*Plus: Release 12.1.0.1.0 Production on Fri Jun 26 14:20:18 2020 
     
    Copyright (c) 1982, 2013, Oracle.  All rights reserved. 
     
     
    Connected to: 
    Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 
    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options     

  6. Run the select * from v$backup command to check whether the script has been executed successfully.

    SQL> select * from v$backup; 
     
         FILE# STATUS CHANGE# TIME       CON_ID 
    ---------- ------------------ ---------- --------- ---------- 
     1 ACTIVE 3106121 18-MAR-16    0 
     3 ACTIVE 3106121 18-MAR-16    0 
     4 ACTIVE 3106121 18-MAR-16    0 
     6 ACTIVE 3106121 18-MAR-16    0     

    If STATUS is ACTIVE, hot standby has been enabled for the Oracle database, and the script has been executed successfully.

  7. Run the alter database end backup command to change the database.

    SQL> alter database end backup; 
     
    Database altered.     

  8. Run the select * from v$backup command to check whether the script has been executed successfully.

    SQL> select * from v$backup; 
     
         FILE# STATUS CHANGE# TIME       CON_ID 
    ---------- ------------------ ---------- --------- ---------- 
     1 NOT ACTIVE 3108004 18-MAR-16    0 
     3 NOT ACTIVE 3108004 18-MAR-16    0 
     4 NOT ACTIVE 3108004 18-MAR-16    0 
     6 NOT ACTIVE 3108004 18-MAR-16    0     

    If STATUS is NOT ACTIVE, hot standby has been disabled for the Oracle database.

Unfreeze Script (Non-Windows)

The sample_unfreeze.sh script is used as an example. It is used to disable hot standby for the Oracle database. Run this script only after sample_freeze.sh is executed successfully. Otherwise, executing sample_unfreeze.sh will fail.

  1. Log in to the production application server as user root.
  2. Run the cd /home/rdadmin/Agent/sbin/thirtparty command to access the directory for storing the script.
  3. Run the sh sample_freeze.sh <PID><AGENT_ROOT> command to run the freeze script.

    • PID: unique ID of the script execution. You are advised to enter a large number.
    • AGENT_ROOT: the installation root directory of the Agent. The directory is /home/rdadmin/Agent for a non-Solaris operating system.

  4. Run the sh sample_unfreeze.sh <PID><AGENT_ROOT> command to run the unfreeze script.

    • PID: unique ID of the script execution. You are advised to enter a large number.
    • AGENT_ROOT: the installation root directory of the Agent. The directory is /home/rdadmin/Agent for a non-Solaris operating system.

  5. Run the su - oracle command to switch to user Oracle.
  6. Run the sqlplus / as sysdba command to connect to the database instance through OS authentication.

    oracle@linux2:~> export ORACLE_SID=dbFS 
    oracle@linux2:~> sqlplus / as sysdba 
     
    SQL*Plus: Release 12.1.0.1.0 Production on Fri Jun 26 14:20:18 2020 
     
    Copyright (c) 1982, 2013, Oracle.  All rights reserved. 
     
     
    Connected to: 
    Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 
    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options     

  7. Run the select * from v$backup command to check whether the script has been executed successfully.

    SQL> select * from v$backup; 
     
         FILE# STATUS CHANGE# TIME       CON_ID 
    ---------- ------------------ ---------- --------- ---------- 
     1 NOT ACTIVE 3106121 18-MAR-16    0 
     3 NOT ACTIVE 3106121 18-MAR-16    0 
     4 NOT ACTIVE 3106121 18-MAR-16    0 
     6 NOT ACTIVE 3106121 18-MAR-16    0     

    If STATUS is NOT ACTIVE, hot standby has been disabled for the Oracle database, and the script has been executed successfully. If STATUS is ACTIVE, run the alter database end backup command and then disable hot standby for the Oracle database.

Frozen/Unfrozen State Query Script (Non-Windows)

The sample_queryfreezestate.sh script is used as an example. It is used to query the hot standby status of the Oracle database. The sample_freeze.sh and sample_unfreeze.sh scripts can be used to check the script execution result.

  1. Log in to the production application server as user root.
  2. Run the cd /home/rdadmin/Agent/sbin/thirtparty command to access the directory for storing the script.
  3. Run the frozen/unfrozen state query script.

    #Query the frozen state. 
    sh sample_freeze.sh<PID><AGENT_ROOT> 
    sh sample_queryfreezestate.sh<PID><AGENT_ROOT> 
    sh sample_unfreeze.sh<PID><AGENT_ROOT>  
     
      #Query the unfrozen state. 
    sh sample_queryfreezestate.sh<PID><AGENT_ROOT> 
    #An example of querying the hot standby status. 
    sh sample_freeze.sh 10000 /home/rdadmin/Agent 
    sh sample_queryfreezestate.sh 10000 /home/rdadmin/Agent 
    sh sample_unfreeze.sh 10000 /home/rdadmin/Agent 
     
      #An example of querying whether hot standby is disabled for the Oracle database. 
    sh sample_queryfreezestate.sh 10000 /home/rdadmin/Agent
    • PID: unique ID of the script execution. You are advised to enter a large number.
    • AGENT_ROOT: the installation root directory of the Agent. The directory is /home/rdadmin/Agent for a non-Solaris operating system.

  4. View the hot standby status of the Oracle database.

    linux2:/home/rdadmin/Agent/sbin/thirdparty # cat ../../tmp/RST10000.txt  
    0 
    linux2:/home/rdadmin/Agent/sbin/thirdparty #     

    View the RST10000.txt file. If 0 is displayed, hot standby has been enabled for the Oracle database. If 1 is displayed, hot standby has been disabled for the Oracle database.


Copyright © Huawei Technologies Co., Ltd.