HP StorageWorks Storage Mirroring application notes - High availability for Oracle 10g (T2558-88088, April 2008)
Storage Mirroring High availability for Oracle 10g application notes 9
Sample_postover.bat
rem ##
***
SAMPLE*** Oracle post-failover script
rem ## This sample batch file is provided as an example only. Because no two
rem ## environments or configurations are exactly the same, you MUST modify
rem ## this script in order to make the solution work in your environment.
rem ## This script makes the following two assumptions:
rem ## 1. You have created a directory c:\oracle_fo
rem ## 2. The dbx_start.sql file referenced in this script is located in the Oracle failover
rem ## directory c:\oracle_fo
rem ## Note: %%a is a constant recognized in the command line mode and should NOT be
rem ## substituted.
rem ## This script demonstrates a multiple (2) Oracle instance environment
rem ## The next two lines establish the working directories. Specify the location of your
rem ## Oracle program files in the first line. Make sure to update the home directory path
rem ## for your version of Oracle. Do not leave any spaces around the equal (=) sign.
set ORACLE_HOME=E:\oracle\product\10.x.x
set ORACLE_FO=C:\ORACLE_FO
rem ## The following line CREATES the Oracle instance(s). In the event where a database
rem ## instance has not been created on the target it will need to be created here. An
rem ## example is if the database was created on the source server after the Storage
Mirroring
rem ## connection is established and that instance was not created on the target. The
rem ## command is given below. Substitute your Oracle instance names for instance_name1
rem ## and instance_name2. Multiple instances are separated by a space.
rem ## for %%a IN (instance_name1 instance_name2) DO %ORACLE_HOME%\db_1\bin\oradim -new
-sid %%a -srvc oracleservice%%a -startmode auto -pfile
%ORACLE_HOME%\admin\instance_name\init.ora
rem ## The following line STARTS the Oracle instance(s). Substitute your Oracle instance
rem ## names for instance_name1 and instance_name2. Multiple instances are separated by a
rem ## space.
for %%a IN (instance_name1 instance_name2) DO NET START ORACLESERVICE%%a
rem ## The following line starts other Oracle services. The services specified are started
rem ## on an as-needed basis depending on the Oracle operations you are running. The
rem ## OracleDBConsole is started in the following example. Add additional services as
rem ## needed, separating the service name by a space. The outcome is redirected to a log
rem ## file in the failover directory. Check this log file for errors.
for %%a IN (OracleDBConsole) DO NET START %%a >>%ORACLE_FO%\start_services.log
rem ## The following lines mount and open the databases. Note that the same command is
rem ## repeated for each database. Also note that separate files (DB1_Start.sql and
rem ## DB2_Start.sql) are called for the different databases so that the correct path to
rem ## the parameter file (init.ora) is used. The outcome is redirected to a log file in
rem ## the failover directory. Check this log file for errors. Substitute your instance
rem ## names for instance_name1 and instance_name2.
set ORACLE_SID=instance_name1
%ORACLE_HOME%\db_1\bin\sqlplus.exe "/ AS SYSDBA"
<%ORACLE_FO%\db1_start.sql>%ORACLE_FO%\start_%ORACLE_SID%.log
set ORACLE_SID=instance_name2
%ORACLE_HOME%\db_1\bin\sqlplus.exe "/ AS SYSDBA"
<%ORACLE_FO%\db2_start.sql>%ORACLE_FO%\start_%ORACLE_SID%.log