
- •About the Authors
- •Contents at a Glance
- •Contents
- •Table of Exercises
- •Introduction
- •Assessment Test
- •Answers to Assessment Test
- •What Is ASM?
- •Working with the ASM Instance
- •Overview of ASM Data Dictionary Views
- •Using ASM Storage
- •Using RMAN with ASM
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Understanding the Oracle Database as It Relates to Backup and Recovery
- •Performing Oracle Offline Backups
- •Performing Oracle Online Backups
- •Backing Up the Control File
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Performing Incomplete Recoveries
- •Performing Other Types of Recoveries
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Why Use RMAN?
- •Exploring the RMAN Architecture
- •Connecting to RMAN
- •Configuring RMAN for Use
- •Backing Up Your Database with RMAN
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Introducing the Recovery Catalog
- •Creating the Recovery Catalog User and Schema Objects
- •Using a Recovery Catalog
- •Maintaining the Recovery Catalog
- •Using the RMAN Virtual Private Catalog
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •RMAN Database-Recovery Basics
- •Using Image Copies to Recover Your Database
- •Other Basic Recovery Topics
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Switching Between RMAN Incarnations
- •Overview of RMAN Database Duplication
- •Performing an RMAN Tablespace Point-in-Time Recovery
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Overview of Flashback Technology
- •Using Automatic Undo Management
- •Using Flashback Technologies
- •Using Additional Flashback Operations
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Diagnosing the Database
- •Managing Database Performance
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Managing Memory
- •Managing Space
- •Managing Resources
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Automating Tasks with the Scheduler
- •Exploring the Scheduler Architecture
- •Exploring Common Administration Tools
- •Using Scheduler Jobs
- •Using Scheduler Programs
- •Using Schedules
- •Creating Lightweight Jobs
- •Using Job Chains
- •Using Scheduler Windows
- •Creating and Using Job Classes
- •Using Advanced Scheduler Concepts to Prioritize Jobs
- •Using Scheduler Views
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •An Overview of Globalization Support
- •Using NLS Parameters
- •Using Datetime Datatypes
- •Using Linguistic Sorts and Searches
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Lab 1.1: Creating an ASM Instance
- •Lab 1.2: Creating ASM Disk Groups
- •Lab 1.3: Using ASM Disk Groups from a Database
- •Lab 2.2: Putting the Database in ARCHIVELOG Mode
- •Lab 2.3: Executing a Manual Online (Hot) Backup
- •Lab 3.1: Executing a Time-Based Point-in-Time Recovery
- •Lab 3.2: Recovering from Control-File Loss with a Backup Control File
- •Lab 3.3: Recovering from Loss of the Current Online Redo Log
- •Lab 4.1: Creating an RMAN Offline Backup
- •Lab 4.2: Creating an RMAN Incremental Backup
- •Lab 4.3: Creating an Image-Copy Backup
- •Lab 5.1: Implementing RVPC
- •Lab 6.1: Restoring a Datafile Online
- •Lab 6.2: Performing a Change-Based Recovery with RMAN
- •Lab 6.3: Restoring a Control File from an Autobackup
- •Lab 7.1: Monitoring RMAN Backups
- •Lab 7.2: One of My Backups Is Missing!
- •Lab 8.1: Duplicating a Database Using Active Database Duplication
- •Lab 8.2: Duplicating a Database Using Backup-Based Duplication to a Different Point in Time
- •Lab 9.1: Using the Recycle Bin
- •Lab 9.3: Using Flashback Data Archive
- •Lab 10.1: Using Support Workbench to Report a Problem to Oracle Support
- •Lab 11.1: Exporting a Transportable Tablespace
- •Lab 11.2: Testing Resumable Space Allocation
- •Lab 11.3: Manually Configuring the SGA
- •Lab 12.1: Creating a Local External Job
- •Lab 12.2: Creating a Job Window
- •Lab 13.1: Using the Locale Builder to Create a New Linguistic Sort
- •Lab 13.2: Setting NLS Parameters
- •Lab 13.3: Performing Linguistic Sorts
- •What You’ll Find on the CD
- •System Requirements
- •Using the CD
- •Troubleshooting
- •Glossary
- •Index

Exploring Common Administration Tools |
567 |
Exploring Common Administration Tools
The Oracle Scheduler is implemented through a PL/SQL package named DBMS_SCHEDULER. This package offers a collection of procedures that are used to create and manage Scheduler objects (jobs, programs, schedules, windows, job classes, window groups, and chains). Each of these object types will be covered thoroughly in this chapter.
Most of the procedures in the DBMS_SCHEDULER package are specific to a certain object type. The object type can be derived from the name of the procedure. For example, the CREATE_PROGRAM procedure is obviously specific to program objects.
However, because all Scheduler objects share some common attributes, there are also procedures that work with any Scheduler object type. These procedures play an important role in the management of Scheduler objects, so they warrant thorough coverage. However, due to their “global” nature, they will be covered in the following sections, separate from any specific object type.
You will learn about the following DBMS_SCHEDULER procedures:
NN ENABLE
NN DISABLE
NN SET_ATTRIBUTE
NN SET_ATTRIBUTE_NULL
You will also learn about any special cases that may exist within the different Scheduler object types.
Using the ENABLE Procedure
With the exception of schedules, all Scheduler objects have a common attribute named ENABLED. The attribute is a Boolean (TRUE or FALSE) value that identifies whether the object is eligible for use by the Scheduler.
Because schedule objects do not have an ENABLED attribute, they cannot be enabled or disabled. They are always enabled by default.
Therefore, to be eligible for use in the Scheduler, the ENABLED attribute must be set to TRUE. By default, only schedule objects are enabled at creation time, because they cannot be disabled. All other objects will be disabled by default when they are created.
To enable an object, the DBMS_SCHEDULER.ENABLE procedure is used. The procedure accepts only one argument, NAME, which designates one of the following:
NN |
The name of one specific object |
NN |
A comma-separated list of objects |

568 Chapter 12 n Using the Scheduler to Automate Tasks
For example, here’s how to enable one specific object:
SQL> begin
2dbms_scheduler.enable(‘BACKUP_JOB’);
3 end;
4/
PL/SQL procedure successfully completed.
To enable multiple objects, a comma-separated list can be passed in. Note that the entire list is enclosed in single quotes. Therefore, the list is submitted as a single parameter, as shown here:
SQL> begin
2dbms_scheduler.enable(
3‘BACKUP_PROGRAM, BACKUP_JOB, STATS_JOB’);
4 end;
5/
PL/SQL procedure successfully completed.
The list of objects can also contain both groups and individual objects:
SQL> begin
2dbms_scheduler.enable(
3‘BACKUP_JOB_GROUP, STATS_JOB, SYS.WINDOW_GROUP_1’);
4 end;
5/
PL/SQL procedure successfully completed.
There are a couple of special cases that should be noted about enabling group objects:
NN |
When a job group is enabled, all members of that job group will be enabled. |
NNWhen a window group is enabled, only the window group object is enabled. Windows that are members of the group are not enabled.
NNWhen a window or window group is referenced in the ENABLE procedure, it must always be prefixed with the SYS schema name as shown in the preceding example (SYS.WINDOW_GROUP_1).
Using the DISABLE Procedure
When a Scheduler object is disabled, it is ineligible for use by the Scheduler. Disabling a Scheduler object is accomplished by setting the object’s ENABLED attribute to FALSE.

Exploring Common Administration Tools |
569 |
To disable an object, the DBMS_SCHEDULER.DISABLE procedure is used. This procedure accepts two parameters: NAME and FORCE. The NAME parameter designates one of the following:
NN |
The name of one specific object |
|
|
NN |
A comma-separated list of objects |
The FORCE parameter is a Boolean (TRUE or FALSE) value that tells the procedure how to handle the request if dependencies exist. The default value is FALSE.
There are two situations that could be classified as dependencies:
NN |
A job object that references a program object is considered to be dependent on that object. |
|
NNIf an instance of an object is currently running (for example, a window is open or a job is running), there may be a dependency issue.
If any dependencies are found, the value of the FORCE parameter will determine the ultimate outcome of the DISABLE procedure.
The purpose of the FORCE parameter is not to cascade the changes to dependent objects. The purpose is to make you aware of dependencies. No changes will be made to dependent objects.
The effect of the FORCE option varies between object types. The differences are listed in Table 12.1.
Ta b l e 12 .1 Effects of DISABLE with the FORCE Option
Object Type |
Effect |
|
|
Job |
If the FORCE attribute is FALSE: If an instance of the job is currently run- |
|
ning, the procedure will fail. If the FORCE attribute is TRUE: The job is dis- |
|
abled, but the currently running instance is allowed to finish. |
Schedule |
N/A |
Program |
If the FORCE attribute is FALSE: If the program is referenced by any job, |
|
the procedure will fail. If the FORCE attribute is TRUE: The program will be |
|
disabled. Jobs that reference the program will not be disabled but will |
|
fail at runtime if the program is still disabled. |
Window |
If the FORCE attribute is FALSE: If the window is open or referenced by |
|
any job, the procedure will fail. If the FORCE attribute is TRUE: The proce- |
|
dure will succeed in disabling the window. If that window is open at the |
|
time the DISABLE procedure is called, it will not be affected. Jobs that |
|
reference the window will not be disabled. |
Window group |
If the FORCE attribute is FALSE: If any member windows are open or if any |
|
member windows are referenced by a job object, the DISABLE procedure |
|
will fail. If the FORCE attribute is TRUE: The window group will be disabled. |
|
Any open window that is a member of the group will continue to its end. |
|
Jobs that reference the window group as their schedule will not be disabled. |
|
|

570 Chapter 12 n Using the Scheduler to Automate Tasks
If an object has no dependencies, using the DISABLE procedure will disable any valid Scheduler object regardless of the value of the FORCE parameter.
For example, use the following command to disable one specific object:
SQL> begin
2dbms_scheduler.disable(‘BACKUP_JOB’);
3 end;
4/
PL/SQL procedure successfully completed.
To disable multiple objects, a comma-separated list can be passed in. Note that the entire list is enclosed in single quotes. Therefore, the list is submitted as a single parameter. In this example, the FORCE option is also set to TRUE:
SQL> begin
2dbms_scheduler.disable(
3‘BACKUP_PROGRAM, BACKUP_JOB, STATS_JOB’,TRUE);
4 end;
5/
PL/SQL procedure successfully completed.
The list of objects can also contain both groups and individual objects:
SQL> begin
2dbms_scheduler.disable(
3‘BACKUP_JOB_GROUP, STATS_JOB, SYS.WINDOW_GROUP_1’);
4 end;
5/
PL/SQL procedure successfully completed.
There are a couple of special cases that should be noted about disabling group objects:
NNDisabling a window group does not disable jobs that reference the group. However, those jobs will fail when they try to execute.
NNDisabling a window group does not affect members of the group. They will continue to function normally.
Setting Attributes
You might be surprised to find that the DBMS_SCHEDULER package does not have an ALTER procedure of any kind. This is because Scheduler objects are collections of attributes. To

Exploring Common Administration Tools |
571 |
make a change to an object requires setting its attributes. Therefore, to alter a Scheduler object, the DBMS_SCHEDULER.SET_ATTRIBUTE and DBMS_SCHEDULER.SET_ATTRIBUTE_NULL procedures are used.
In the following sections, you will learn to use these procedures with all types of Scheduler objects.
The SET_ATTRIBUTE procedure sets an attribute for any type of Scheduler object. The SET_ATTRIBUTE_NULL procedure, on the other hand, sets any attribute to NULL for any type of Scheduler object. This is useful for “unsetting” an attribute.
The only attribute that cannot be altered (for any type of Scheduler object) is the name of the object.
When the attributes on an object are changed, Oracle will attempt to disable the object before making the changes. When the attribute has been successfully altered, Oracle will reenable the object automatically. If the SET_ATTRIBUTE procedure fails, the object will remain disabled (and an error message is returned).
Using the SET_ATTRIBUTE procedure does not affect instances of the object that are currently executing. Changes made will affect only future instantiations of the object.
The SET_ATTRIBUTE procedure accepts three parameters: NAME The name of the Scheduler object.
ATTRIBUTE The name of the attribute to be changed.
VALUE The new value for the attribute. The procedure is overloaded to accept a value of any applicable datatype, so no conversion is necessary when setting values for different datatypes.
The SET_ATTRIBUTE_NULL procedure accepts only two parameters: NAME The name of the Scheduler object.
ATTRIBUTE The name of the attribute, which should be set to NULL.
In the preceding section, you learned that an object was considered enabled when the ENABLED attribute was set to a value of TRUE. Therefore, you can enable or disable an object by using the SET_ATTRIBUTE procedure, as shown here:
SQL> begin
2 dbms_scheduler.set_attribute (
3name => ‘TEST_JOB’,
4 attribute => ‘ENABLED’,
5 value => TRUE);
6 end;
7 /
PL/SQL procedure successfully completed.