Enabling and Disabling Remote External Jobs

Oracle Scheduler (the Scheduler) can schedule and run external jobs on a remote host. The remote host does not need an Oracle database installed; however, a Scheduler agent must be installed on the remote host so that the scheduling database can start remote external jobs on that host and receive job output and error information. The agent must register with every database that must start remote external jobs on the agent's host computer. An initial setup is also required for each database that must run remote external jobs. This setup enables secure communications between the database and remote Scheduler agents.

Enabling remote external jobs involves the following steps:

  1. Setting Up the Database for Remote External Jobs

  2. Installing, Configuring, and Starting the Scheduler Agent

This section also contains the following topics:

Setting Up the Database for Remote External Jobs

Before a database can run jobs using a remote Scheduler agent, the database must be properly configured, and the agent must be registered with the database. To make the registration of remote Scheduler agents secure, you must set up an agent registration password the database. You can limit the number of Scheduler agents that can register, and you can set the password to expire after a specified duration.

Complete the following steps once for each database that must run remote external jobs.

To set up the database to run remote external jobs:

  1. Using SQL*Plus, connect to the database as the SYS user.

    See "Connecting to the Database with SQL*Plus" for instructions.

  2. Enter the following command to verify that the XML DB option is installed:

    SQL> DESC RESOURCE_VIEW
    

    If XML DB is not installed, this command returns an "object does not exist" error.

    Note:

    If XML DB is not installed, you must install it before continuing.
  3. Enable HTTP connections to the database by submitting the following PL/SQL block:

    BEGIN
      DBMS_XDB.SETHTTPPORT(port);
    END;
    

    where port is the TCP port number on which you want the database to listen for HTTP connections.

    port must be an integer between 1 and 65536, and for UNIX and Linux must be greater than 1023. Choose a port number that is not already in use.

  4. Run the script prvtrsch.plb with following command:

    SQL> @?/rdbms/admin/prvtrsch.plb
    
  5. Set a registration password for the Scheduler agents using the SET_AGENT_REGISTRATION_PASS procedure.

    The following example sets the agent registration password to mypassword.

    BEGIN
      DBMS_SCHEDULER.SET_AGENT_REGISTRATION_PASS('mypassword');
    END;
    

    Note:

    The MANAGE SCHEDULER privilege is required to set an agent registration password. See Oracle Database PL/SQL Packages and Types Reference for more information on the SET_AGENT_REGISTRATION_PASS procedure.

Installing, Configuring, and Starting the Scheduler Agent

Before you can run remote external jobs on a particular host, you must install, configure, and start the Scheduler agent on that host. The Scheduler agent must be installed in its own Oracle home.

On the Windows, Linux, and UNIX platforms, the Scheduler agent software is available on the Oracle Database Gateways media included in the Database Media Pack, and online at:

http://www.oracle.com/technology/software/products/database

The agent software for other platforms, such as IBM z/OS and IBM iSeries OS/400, is available on the Oracle Scheduler Agent media for those platforms. To install the agents on these platforms, consult the platform-specific documentation.

To install, configure, and start the Scheduler agent on a remote Windows, Linux, or UNIX host:

  1. Log in to the remote host.

    • For Windows, log in as an administrator.

    • For UNIX and Linux, log in as the user that you want the Scheduler agent to run as. This user requires no special privileges.

  2. Run the Oracle Universal Installer (OUI) from the installation media for Oracle Database Gateway.

    • For Windows, run setup.exe.

    • For UNIX and Linux, use the following command:

      /directory_path/runInstaller
      

    where directory_path is the path to the Oracle Database Gateway installation media.

  3. On the OUI Welcome page, click Next.

  4. On the product selection page, select Oracle Scheduler Agent, and then click Next.

  5. On the Specify Home Details page, enter a name and path for a new Oracle home for the agent, and then click Next.

  6. On the Oracle Scheduler Agent page:

    1. In the Scheduler Agent Host Name field, enter the host name of the computer on which the Scheduler agent is to run, or accept the default host name.

    2. In the Scheduler Agent Port Number field, enter the TCP port number on which the Scheduler agent is to listen for connections, and then click Next.

      Choose an integer between 1 and 65535. On UNIX and Linux, the number must be greater than 1023. Ensure that the port number is not already in use.

  7. On the Summary page, click Install.

  8. (UNIX and Linux only) When the Oracle Universal Installer prompts you to run the script root.sh, enter the following command as the root user:

    script_path/root.sh
    

    The script is located in the directory that you chose for agent installation.

  9. Exit OUI when installation is complete.

  10. Use a text editor to review the agent configuration parameter file schagent.conf, which is located in the Scheduler agent home directory, and verify the port number in the PORT= directive.

    You will need this port number when creating remote external jobs. Change any other agent configuration parameters as required.

  11. Ensure that any firewall software on the remote host or any other firewall that protects that host has an exception to accommodate the Scheduler agent.

  12. Register the Scheduler agent with a database that is to run remote external jobs on the agent's host computer. Use the following command:

    AGENT_HOME/bin/schagent -registerdatabase db_host db_http_port
    

    where:

    • db_host is the host name or IP address of the host on which the database resides.

    • db_http_port is the port number that the database listens on for HTTP connections. You set this parameter previously in "Setting Up the Database for Remote External Jobs". You can check the port number by submitting the following SQL statement to the database:

      SELECT DBMS_XDB.GETHTTPPORT() FROM DUAL;
      

      A port number of 0 means that HTTP connections are disabled.

    The agent prompts you to enter the agent registration password that you set in "Setting Up the Database for Remote External Jobs".

  13. Repeat the previous step for each database that is to run remote external jobs on the agent's host.

  14. (UNIX and Linux only) Start the Scheduler agent with the following command:

    AGENT_HOME/bin/schagent -start
    

    Note:

    On Windows, a Scheduler agent service is automatically created and started during installation. The name of the service ends with OracleSchedulerExecutionAgent. Do not confuse this service with the OracleJobScheduler service, which runs on a Windows computer on which an Oracle database is installed, and manages the running of local external jobs without credentials.

Stopping the Scheduler Agent

Stopping the Scheduler agent prevents the host on which it resides from running remote external jobs.

To stop the Scheduler agent:

  • Do one of the following:

    • On UNIX and Linux, run the following command:

      AGENT_HOME/bin/schagent -stop
      
    • On Windows, stop the service whose name ends with OracleSchedulerExecutionAgent.

Disabling Remote External Jobs

You can disable the capability of a database to run remote external jobs by dropping the REMOTE_SCHEDULER_AGENT user.

To disable remote external jobs:

  • Submit the following SQL statement:

    DROP USER REMOTE_SCHEDULER_AGENT CASCADE;
    

Registration of new scheduler agents and execution of remote external jobs is disabled until you run prvtrsch.plb again.