Using the Scheduler. Oracle Database provides database job capabilities through Oracle Scheduler (the Scheduler). This chapter explains how to use the various Scheduler components, and discusses the following topics: Scheduler Objects and Their Naming.
Each Scheduler object is a complete database schema object of the form . Scheduler objects exactly follow the naming rules for database objects and share the SQL namespace with other database objects. When names for Scheduler objects are used in the DBMS. By default, Scheduler object names are uppercase unless they are surrounded by double quotes. For example, when creating a job, job. These naming rules are also followed in those cases where comma- delimited lists of Scheduler object names are used within the DBMS. This section introduces you to basic job tasks, and discusses the following topics: See Also.
Many companies design their software to run on a specific version of Windows. When a new Windows version, like Windows 8, appears a few years later, some older programs feel threatened by their new. 29 Scheduling Jobs with Oracle Scheduler. You create programs by using the CREATE
How do I create my own computer program? Other popular languages include C, C++.
When creating a job, you specify an action, a schedule, and other attributes. For example, the following statement creates a job called update. The creator of a job is, therefore, not necessarily the job owner. The job owner is the user in whose schema the job is created, while the job creator is the user who is creating the job. Jobs are executed with the privileges of the schema in which the job is created.
The NLS environment of the job when it runs is that which was present at the time the job was created. After a job is created, it can be queried using the *.
Jobs are created disabled by default and need to be enabled to run. Jobs are set to be automatically dropped by default after they complete. Note that repeating jobs are not auto- dropped unless the job end date passes, the maximum number of runs (max.
The following code example sets the end date job argument, which is the second argument expected by the reporting program. DBMS. You can set argument values using either the argument name or the argument position. To use argument name, the job must reference a named program object, and the argument must have been assigned a name in the program object.
If a program is inlined, only setting by position is supported. Arguments are not supported for jobs of type plsql.
This procedure can be used for both regular and ANYDATA arguments. See Oracle Database PL/SQL Packages and Types Reference for information about the SET. Because this procedure is overloaded, there are several different ways of using it. In addition to inlining a job during the job creation, you can also create a job that points to a named program and schedule. This is discussed in the following sections: Creating Jobs Using a Named Program.
You can also create a job by pointing to a named program instead of inlining its action. To create a job using a named program, you specify the value for program. An example of using the CREATE. To create a job using a named schedule, you specify the value for schedule. An example of using the CREATE.
An example of using the CREATE. This call copies all the attributes of the old job to the new job except the new job is created disabled and has another name. See Oracle Database PL/SQL Packages and Types Reference for detailed information about the COPY. All jobs can be altered, and, with the exception of the job name, all job attributes can be changed. If there is a running instance of the job when the SET. The change is only seen in future runs of the job.
In general, you should not alter a job that was automatically created for you by the database. Jobs that were created by the database have the column SYSTEM set to TRUE in job views. The attributes of a job are available in the *. The user creates a job and the API immediately returns and indicates whether the creation was successful. To find out whether the job succeeded, the user has to query the job table or the job log. While this is the expected behavior, for special cases, the database also allows users to run jobs synchronously.
Running Jobs Asynchronously. You can schedule a job to run asynchronously based on the schedule defined when the job is created. In this case, the job is submitted to the job coordinator and is picked up by the job slaves for execution. Running Jobs Synchronously. After a job has been created, you can run the job synchronously using the RUN. In this case, the job will run within the user session that invoked the RUN.
Running a job with RUN. The job run will, however, be reflected in the job log. Runtime errors generated by the job are passed back to the invoker of RUN. External OS roles are not supported. Given sufficient privileges, users can create jobs in other users' schemas. The creator and the owner of the job can, therefore, be different. For example, if user jim has the CREATEANYJOB privilege and creates a job in the scott schema, then the job will run with the privileges of scott.
The NLS environment of the session in which the job was created is saved and is used when the job is being executed. To alter the NLS environment in which a job runs, a job must be created in a session with different NLS settings. Running External Jobs. An external job is a job that runs outside the database. All external jobs run as a low- privileged guest user, as has been determined by the database administrator while configuring external job support. Because the executable will be run as a low- privileged guest account, you should verify that it has access to necessary files and resources.
Most, but not all, platforms support external jobs. For platforms that do not support external jobs, creating or setting the attribute of a job or a program to type EXECUTABLE returns an error. See your operating system- specific documentation for more information. For an external job, job. For example, /usr/local/bin/perl or C: \perl\bin\perl.
The program or job arguments for type EXECUTABLE must be a string type such as CHAR, VARCHAR2, or VARCHAR. Some additional post- installation steps might be required to ensure that external jobs run as a low- privileged guest user.
See your operating system- specific documentation for any post- installation configuration steps. Note. The owner of an external job must have the CREATE EXTERNAL JOB system privilege before the job can be enabled or run. Capturing Standard Error Output for External Jobs. When an external job writes output to stderr, the first 2. The information is in the following name/value pair format.
STANDARD. If a job class is supplied, all running jobs in the job class are stopped. For example, the following statement stops job job. After stopping a job, the state of a one- time job is set to STOPPED, and the state of a repeating job is set to SCHEDULED (because the next run of the job is scheduled). In addition, an entry is made in the job log with OPERATION set to 'STOPPED', and ADDITIONAL. This method gives control back to the slave process, which can collect statistics of the job run. If the force option is set to TRUE, the job is abruptly terminated and certain runtime statistics might not be available for the job run.
Stopping a job that is running a chain automatically stops all running steps (by calling STOP. This can cause data inconsistency. Stopping External Jobs. The Scheduler offers implementors of external jobs a mechanism to gracefully clean up after their external jobs when STOP.
On Unix, this is done by sending a SIGTERM signal to the process launched by the external job agent. The implementor of the external job is expected to trap the SIGTERM in an interrupt handler, clean up whatever work the job has done, and exit. On those platforms, the process launched by the external job agent is a console process. To stop it, the Scheduler sends a CTRL- BREAK to the process. If a job class is supplied, all jobs in the job class are dropped, although the job class itself is not dropped. Dropping a job results in the job being removed from the job table, its metadata being removed, and it no longer being visible in the *. Therefore, no more runs of the job will be executed.
If an instance of the job is running at the time of the call, the call results in an error. You can still drop the job by setting the force option in the call to TRUE.
Setting the force option to TRUE first attempts to stop the running job instance (by calling STOP. By default, force is set to FALSE. For example, the following statement drops jobs job. DBMS. A job can also become disabled for other reasons. For example, a job will be disabled when the job class it belongs to is dropped. A job is also disabled if either the program or the schedule that it points to is dropped. Note that if the program or schedule that the job points to is disabled, the job will not be disabled and will therefore result in an error when the Scheduler tries to run the job.
Disabling a job means that, although the metadata of the job is there, it should not run and the job coordinator will not pick up these jobs for processing. When a job is disabled, its state in the job table is changed to disabled. When a job is disabled with the force option set to FALSE and the job is currently running, an error is returned. When force is set to TRUE, the job is disabled, but the currently running instance is allowed to finish. You can also disable several jobs in one call by providing a comma- delimited list of job names or job class names to the DISABLE procedure call. For example, the following statement combines jobs with job classes.
DBMS. The effect of using this procedure is that the job will now be picked up by the job coordinator for processing. Jobs are created disabled by default, so you need to enable them before they can run. When a job is enabled, a validity check is performed.
If the check fails, the job is not enabled. You can enable several jobs in one call by providing a comma- delimited list of job names or job class names to the ENABLE procedure call. For example, the following statement combines jobs with job classes. DBMS. This section introduces you to basic program tasks, and discusses the following topics: Program Tasks and Their Procedures.
How to Create Packages and Programs in Configuration Manager. For each program specified in the Programs entry in the . Each Program section provides the following information: Name: The name of the program, up to. This entry must be unique within a package. This name is used when defining advertisements.
On client computers, the name of the program is shown in Run Advertised Programs in Control Panel. This entry is required. Icon: Optionally specifies the file containing the icon to use for this program.
If specified, this icon will replace the default program icon in the Configuration Manager console and will be displayed on client computers when the program is advertised. Comment: An optional comment about the program, up to. Command. Line: Specifies the command line for the program, up to. The command is relative to the package source folder. This entry is required.
Start. In: Specifies the working folder for the program, up to. This entry can be an absolute path on the client computer or a path relative to the package source folder. This entry is required. Run: Specifies the program mode in which the program will run. You can specify Minimized, Maximized, or Hidden. If this entry is not included, the program will run in normal mode. After. Running: Specifies any special action that occurs after the program is successfully completed.
Options available are SMSRestart, Program. Restart, or SMSLogoff. If this entry is not included, the program will not run a special action. Estimated. Disk. Space: Specifies the amount of disk space that the software program requires to be able run on the computer.
This can be specified as Unknown (the default setting) or as a whole number greater than or equal to zero. If a value is specified, the units for the value must also be specified. Example: Estimated. Disk. Space=3. 8MBEstimated. Run. Time: Specifies the estimated duration (in minutes) that the program is expected to run on the client computer.
This can be specified as Unknown (the default setting) or as a whole number greater than zero. Example: Estimated. Run. Time=2. 5Supported.
Clients: Specifies the processors and operating systems on which this program will run. The specified platforms must be separated by commas. If this entry is not included, supported platform checking will be disabled for this program. Supported. Client. Min. Version. X, Supported.
Client. Max. Version. X: Specifies the beginning- to- ending range for version numbers for the operating systems specified in the Supported. Clients entry. Example.
Supported. Clients=Win NT (I3. Win NT (IA6. 4),Win NT (x.
Win NT (I3. 86) Min. Version. 1=5. 0. 0.
Win NT (I3. 86) Max. Version. 1=5. 0. 0.
Win NT (I3. 86) Min. Version. 2=5. 1. 0. Win NT (I3. 86) Max. Version. 2=5. 1. 0. Win NT (I3. 86) Min. Version. 3=5. 2. 0. Win NT (I3. 86) Max.
Version. 3=5. 2. 0. Win NT (I3. 86) Min. Version. 4=5. 2. 0. Win NT (I3. 86) Max. Version. 4=5. 2. 0. Win NT (I3. 86) Min. Version. 5=6. 0. 0.
Win NT (I3. 86) Max. Version. 5=6. 0. 0. Win NT (IA6. 4) Min. Version. 1=5. 2. 0. Win NT (IA6. 4) Max.
Version. 1=5. 2. 0. Win NT (x. 64) Min. Version. 1=5. 2. 0. Win NT (x. 64) Max. Version. 1=5. 2. 0. Win NT (x. 64) Min. Version. 2=5. 2. 0.
Win NT (x. 64) Max. Version. 2=5. 2. 0.
Win NT (x. 64) Min. Version. 3=5. 2. 0. Win NT (x. 64) Max.
Version. 3=5. 2. 0. Win NT (x. 64) Min. Version. 4=6. 0. 0. Win NT (x. 64) Max. Version. 4=6. 0. 0.
Additional. Program. Requirements: Optionally provide any other information or requirements for client computers, up to. Available values are User. Logged. On, No. User.
Logged. On, or Any. User. Status. The default value is User. Logged. On. User. Input. Required: Specifies whether the program requires interaction with the user.
Available values are True or False. The default value is True.
This entry is set to False if Can. Run. When is not set to User. Logged. On. Admin. Rights. Required: Specifies whether the program requires administrative credentials on the computer to be able to run. Available values are True or False. The default value is False. This entry is set to True if Can.
Run. When is not set to User. Logged. On. Use. Install. Account: Specifies whether the program uses the Client Software Installation Account when it runs on client computers. By default, this value is False. This value is also False if Can.
Run. When is set to User. Logged. On. Drive. Letter. Connection: Specifies whether the program requires a drive letter connection to the package files that are located on the distribution point. You can specify True or False.
The default value is False, which allows the program to use a Universal Naming Convention (UNC) connection. When this value is set to True, the next available drive letter will be used (starting with Z: and proceeding backward).
Specify. Drive: Optionally, specifies a drive letter that the program requires to connect to the package files on the distribution point. This specification forces the use of the specified drive letter for client connections to distribution points. Reconnect. Drive.
At. Logon: Specifies whether the computer reconnects to the distribution point when the user logs on. Available values are True or False.
The default value is False. Dependent. Program: Specifies a program in this package that must run before the current program.
This entry uses the format Dependent. Program=< Program. Name> , where < Program. Name> is the Name entry for that program in the package definition file. If there are no dependent programs, leave this entry empty. Example: Dependent. Program=Admin. Dependent.
Program=Assignment: Specifies how the program is assigned to users. This value can be: First. User, only the first user who logs on runs the program; or Every.
User, every user who logs on to the client runs the program. When Can. Run. When is not set to User.
Logged. On, this entry is set to First. User. Disabled: Specifies whether this program can be advertised to clients. Available values are True or False. The default value is False.