Start and Stop the PSUB Service

The Installer automatically installs the PSUB service on the database server. You must start it using the instructions below.

Instructions for stopping PSUB manually are included in the Oracle Clinical Administrator's Guide.

For more information, see:

Start and Stop PSUB Automatically in UNIX and Windows

On UNIX and Windows systems, you can automate the process of starting and stopping PSUB.

For more information, see:

Start 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/19.3.0.0/dbhome_1 
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 54 venus
# Start database 2
start_psub pluto 54 pluto

where the database names are venus and pluto and your code environment is 54.

Stop 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/19.3.0.0/dbhome_1
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 54 wallet_alias
# Stop database 2
stop_psub pluto 54 wallet_alias

where the database names are venus and pluto and your code environment is 54.

Start PSUB Automatically 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\54\log directory):

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

Perform the following actions:

Create 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 54 verbose t:\\opapps\\oc\\54 wallet_alias

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

    Note:

    If your entry requires a backslash (\), you must enter two (\\). Alternatively, you can enter the path using single forward slashes, for example, t:/opapps/oc/54.
Schedule 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 (instructions are in the Oracle Clinical Administrator's Guide) 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.
Create a Batch File
  1. Create a batch file called 'psub_start1.bat' in the %RXC_ROOT%/log directory (for example, D:\opapps\oc\54\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 
    

Note:

  • "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.
Add a Shortcut

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

Start 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 up the environment:
    opa_setup <database_name> <code_environment>
    

    For example, where prod is the database name:

    opa_setup prod 54

  3. Go to the PSUB location:
    cd $RXC_PSUB
  4. Start the PSUB service:
    start_psub database_name code_environment wallet_alias

    For PSUB, wallet_alias is the same as the database name. For example:

    start_psub prod 54 prod

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

    where 54 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.

  5. 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

Start 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 54 verbose c:\\opapps\\oc\\54 <wallet_alias>

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

      where 54 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:/opapps/oc/54.
  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.