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.
The sample_freeze.bat script is used as an example. Pay attention to the following points:
C:\Agent \bin\thirdparty>set ORACLE_SID=dbFS C:\Agent \bin\thirdparty>sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Fri Mar 13 10:53:03 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
SQL> select * from v$backup;
FILE# STATUS CHANGE# TIME CON_ID
---------- ------------------ ---------- -------------- ----------
1 ACTIVE 4789490 18-3-16 0
3 ACTIVE 4789490 18-3-16 0
5 ACTIVE 4789490 18-3-16 0
6 ACTIVE 4789490 18-3-16 0
If STATUS is ACTIVE, hot standby has been enabled for the Oracle database, and the script has been executed successfully.
SQL> alter database end backup; Database altered.
SQL> select * from v$backup;
FILE# STATUS CHANGE# TIME CON_ID
---------- ------------------ ---------- -------------- ----------
1 NOT ACTIVE 4795771 18-3-16 0
3 NOT ACTIVE 4795771 18-3-16 0
5 NOT ACTIVE 4795771 18-3-16 0
6 NOT ACTIVE 4795771 18-3-16 0
If STATUS is NOT ACTIVE, hot standby has been disabled for the Oracle database.
The sample_unfreeze.bat script is used as an example. Pay attention to the following points:
C:\Agent \bin\thirdparty>set ORACLE_SID=dbFS C:\Agent \bin\thirdparty>sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Fri Mar 13 10:53:03 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
SQL> select * from v$backup;
FILE# STATUS CHANGE# TIME CON_ID
---------- ------------------ ---------- -------------- ----------
1 NOT ACTIVE 4794422 18-3-16 0
3 NOT ACTIVE 4794422 18-3-16 0
5 NOT ACTIVE 4794422 18-3-16 0
6 NOT ACTIVE 4794422 18-3-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.
The sample_queryfreezestate.bat script is used as an example. Pay attention to the following points:
#Query the frozen state. sample_freeze.bat<PID><AGENT_ROOT> sample_queryfreezestate.bat<PID><AGENT_ROOT> sample_unfreeze.bat<PID><AGENT_ROOT> #Query the unfrozen state. sample_queryfreezestate.bat<PID><AGENT_ROOT> #An example of querying the hot standby status. sample_freeze.bat 10000 "C:\Agent" sample_queryfreezestate.bat 10000 "C:\Agent" sample_unfreeze.bat 10000 "C:\Agent" #An example of querying whether hot standby is disabled for the Oracle database. sample_queryfreezestate.bat 10000 "C:\Agent"
C:\Agent \bin\thirdparty>type ..\..\tmp\RST10000.txt 0 C:\Agent \bin\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.
The sample_freeze.sh script is used as an example. It is used to enable hot standby for the Oracle database.
oracle@linux2:~> export ORACLE_SID=dbFS oracle@linux2:~> sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Fri Mar 13 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
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.
SQL> alter database end backup; Database altered.
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.
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.
oracle@linux2:~> export ORACLE_SID=dbFS oracle@linux2:~> sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Fri Mar 13 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
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.
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.
#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
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.