Starting and Stopping PSUB

In this section:

Starting and Stopping PSUB Manually in UNIX

In this section:

Starting PSUB Manually in UNIX

To start the PSUB service on UNIX:

  1. Log in as the opapps user. By default, the opapps uses the C shell.

  2. Set environment variables for the database name and code environment; see Setting Environment Variables on the Command Line

  3. Start the PSUB service:

    start_psub database_name code_environment wallet_alias

    For example:

    start_psub prod 52 prod

    where prod is the connect string for the database instance to which the PSUB service connects;

    where 52 is the name of the code environment;

    where wallet_alias is the name of the Wallet specified during installation. By default it is the same as the database name.

  4. If there are any errors, check the following log files in the $RXC_CENTRAL_LOG directory:

    • rxcpsd_instance_environment_1.log

    • rxcpsd_instance_environment_2.log

Stopping PSUB Manually in UNIX

The preferred way to stop the PSUB service is with the following utility, from the opapps account, after setting the correct environment. You need to be sure the TNS_ADMIN environment variable is set to the location of the sqlnet.ora file. The Installer puts sqlnet.ora in the opapps Home directory; see Setting TNS_ADMIN on UNIX.

Use the echo command to check the setting, then stop PSUB.

echo $TNS_ADMIN
setenv TNS_ADMIN $HOME
stop_psub database_name][environment Wallet_alias

Starting and Stopping PSUB Automatically in UNIX

On UNIX systems, you can automate the process of starting and stopping PSUB. See the following:

Starting PSUB Automatically in UNIX

The following example shell scripts for Sun Solaris show how to make the process start automatically at system startup:

# File: /etc/init.d/dbora
ORA_HOME=/u01/app/oracle/product/12.1.0.2
ORA_OWNER=oracle 
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
   echo 'Oracle startup: cannot start'
   exit
fi
case "$1" in
'start')
echo 'Starting Oracle...'
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
su - $ORA_OWNER -c "lsnrctl start"
su - opapps -c start_psub
;;
'stop')
echo 'Stopping Oracle...'
su - opapps -c stop_psub 
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;
esac
# File: start_psub
# Start database 1
start_psub db_name1 code_environment wallet_alias
# Start database 2
start_psub db_name2 code_environment wallet_alias

For example:

# Start database 1
start_psub venus 52 wallet_alias
# Start database 2
start_psub pluto 52 wallet_alias

where the database names are venus and pluto and you have installed Oracle Clinical 5.2.

Stopping PSUB Automatically in UNIX

You can automate the shutdown of the PSUB service on UNIX so that it does not require the entry of a password.

The following example shell scripts for Sun Solaris show how.

# File: /etc/init.d/dbora
ORA_HOME=/u01/app/oracle/product/12.1.0.2
ORA_OWNER=oracle 
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
  echo 'Oracle startup: cannot start'
  exit
fi
case "$1" in
'start')
echo 'Starting Oracle...'
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
su - $ORA_OWNER -c "lsnrctl start"
su - opapps -c start_psub
;;
'stop')
echo 'Stopping Oracle...'
su - opapps -c stop_psub 
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;
esac
# File: stop_psub
# Stop database 1
set TNS_ADMIN= opapps_home_dir
export TNS_ADMIN
stop_psub venus 52 wallet_alias
# Stop database 2
stop_psub pluto 52 wallet_alias

where the database names are venus and pluto and you have installed Oracle Clinical 5.2.

Starting and Stopping PSUB Manually in Windows

In this section:

Installing PSUB in Windows

On Windows, you must first install the PSUB process as a service:

  1. Log in to the Windows server as Administrator or as a user with administrative privileges.

  2. Open a Command Prompt window:

    • If you logged in as Administrator, click Start, then Run, then enter cmd.

    • If you logged in as a different user with administrative privileges, click Start, type cmd in the Start search box, then right-click cmd in the list and click Run as administrator.

  3. Enter the following commands:

    set p1=database-connect-string
    set p2=code-environment
    opa_setup
    cd %RXC_BIN%
    rxcpsdps -install database-connect-string database-instance-name
    
  4. Navigate to Start, then Administrative Tools, then Services.

  5. In the Services window, right-click on the PSUB service, then click Properties. The PSUB Service Properties window opens.

  6. In the General tab, set the Startup Type to Manual.

  7. In the Log On tab, select This Account, then click Browse.

  8. Enter: opapps, then click Check Names. The system enters the relative location to opapps.

  9. Click OK. The system returns to the PSUB Service Properties window.

  10. Enter and confirm the opapps password, and click OK.

  11. Log out from this Administrator session.

Starting PSUB Manually in Windows

To start the PSUB service on Windows:

  1. Log in as opapps. (You set up the PSUB service to start as the opapps user, but in Windows you can start the service when logged on as another user.)

  2. Set the PSUB service parameters:

    1. In the Start menu, navigate to Administrative Tools, then Services.

    2. From the list of services in the Services dialog box, double-click the name of the database for this service. It is in this form:

      PSUB Service database

    3. Enter values for the Log On parameters:

      database code_environment [verbose | noverbose] value-of-RXC_ROOT wallet_alias

      For example: prod 52 verbose c:\\opapps\\oc\\52 <Wallet_name>

      where prod is the connect string for the database instance to which the PSUB service connects;

      where 52 is the name of the code environment;

      where wallet_alias is the name of the Wallet specified during installation.

      Note:

      If your entry requires a backslash (\), you must enter two (\\). Alternatively, you can enter the path using single forward slashes, for example, c:/OPA_HOME/oc/52.

  3. Click Start.

  4. Exit from the Services dialog box.

  5. Check the PSUB service log file in <RXC_ROOT>/log for any warning or error messages.

Stopping PSUB Manually in Windows

Do not use Enterprise Manager to stop opapps sessions on Windows; instead, use the Control Panel on the appropriate local machines.

To stop the PSUB service:

  1. Log in as the PSUB user; in this case, opapps.

  2. Open the Services control panel.

  3. In the Services dialog box, select the PSUB service for the particular database and open the Properties window. The PSUB service for the venus database, for example, might appear as:

    psub service venus
    
  4. In the Properties window, click Stop.

Starting PSUB Automatically in Windows

You must first install PSUB; see Installing PSUB in Windows.

The batch file is required in large databases that take so much time to come up during a server reboot so that the system tries to start PSUB before the database is fully up. In this case the PSUB service does not start and an error like the following appears in the PSUB log file (found in the drive:\opapps\oc\52\log directory):

ERROR:Daemon error while connecting:/@devoc
ORA-1033: ORACLE initialization or shutdown in progress

For more information, see:

Creating a System Environment Variable

You can specify that the PSUB service starts automatically when the Windows PSUB server re-boots. The service parameters are read from a system environment variable whose name concatenates PSUBSERVICE with the database name.

To create a system environment variable in Windows:

  1. Navigate from Start to the Control Panel, then click on the System and Security link. The System and Security window opens.

  2. Click the System link. The System window opens.

  3. Click the Advanced System Settings link at the top left corner. The System Properties window opens.

  4. Select the Advanced tab, then click Environment Variables.

  5. Click New under System Variables in the lower portion of the window to define the variable.

    For the variable name, enter the string PSUBSERVICE concatenated with the database name; for example, for the database sun6x2:

    PSUBSERVICESUN6X2

    For the variable value, use the format: database_id code_environment verbose RXC_ROOT wallet_alias; for example:

    pluto 52 verbose t:\\opapps\\oc\\52 wallet_alias

    where pluto is the database ID and RXC_ROOT is t:\opapps\oc\52.

    Note that if you need a backslash (\) in the text box, you must double it (\\).

Creating a Batch File

Create a batch file called 'psub_start1.bat' in the %RXC_ROOT%/log directory (for example, D:\opapps\oc\52\log) with the following contents.

cmd /c echo Current Date/time= %DATE% %TIME% > psub_start1.log 
cmd /c echo Starting Time Delay > psub_start1.log
ping localhost -n 180 > nul 
cmd /c net start "PSUB Service database_id" > psub_start1.log 

Notes:

  • "PSUB Service database_id" is the PSUB service name that appears in the Services window (under Administrative Tools from the Control Panel).

  • You can repeat the following command for different databases if needed:

    cmd /c net start "PSUB Service database_id" > psub_start1.log 
    
  • The 'ping localhost' command introduces a time delay to ensure that the database is up before starting PSUB. You can increase this value—set to 180 seconds (3 minutes) in the example above—if required.

Scheduling the Batch File and Testing the Setup

To schedule batch file execution:

  1. Navigate to Start, then Administrative Tools, then Services. Scroll down and make sure that the Task Scheduler service is started.

  2. Navigate to Start, then Administrative Tools, then Task Scheduler. The Task Scheduler window opens.

  3. Click the Create Basic Task link on the right. The Create Basic Task wizard appears.

  4. Enter a Name and Description and click Next.

  5. In the Task Trigger window, select When the computer starts and click Next. The Action window appears.

  6. In the Action window select Start a program and click Next. The Start a Program window appears.

  7. In the Start a Program window, click Browse. The Browse window appears.

  8. In the Browse window, browse to the directory where psub_start1.bat is saved and then select psub_start1.bat. Leave the other boxes empty and click Next.

  9. Select Open the Properties dialog for this task when I click Finish and click Finish. The Properties dialog box opens.

  10. In the Properties dialog box, General tab, Security options section, click Change User or Group and select Administrator.

    To test, shut down the service if necessary (see Stopping PSUB Manually in Windows) and double-click on file psub_start1.bat to test that it starts the PSUB service. Verify that the log file psub_start1.log is created in the same directory unless a different path was specified.

  11. In the Services window under Administrative Tools in the Control Panel, right-click the PSUB Service, click Properties, and change its Startup Type to Manual.

    To test, restart the computer and check the Services window to see if the PSUB service has started. If it has, submit a PSUB job such as Batch Validation and check if it runs.

Adding a Shortcut

For convenience add a shortcut for psub_start1.bat on the desktop to manually start PSUB by double-clicking the icon.