Thursday, September 27, 2007

OCP Oracle 10g Admin II - Ch12: Using the Scheduler to Automate Tasks

Chapter 12: Using the Scheduler to Automate Tasks


Review Questions

1. When setting arguments for a job, which procedure do you use for types that
cannot be implicitly converted to and from a VARCHAR2 datatype?
A. SET_JOB_ARGUMENT_VALUE
B. SET_JOB_VALUE_ANYDATA
C. SET_JOB_ANYDATA_VALUE
D. SET_SPECIAL_JOB_VALUE
E. SET_JOB_ANYTYPE_VALUE
-----
Ans: C.
The SET_JOB_ANYDATA_VALUE procedure allows you to set job arguments that
don't easily convert to and from a string (VARCHAR2) datatype.

2. Which DBMS_SCHEDULER procedures can be used to enable a program? (Choose
all that apply.)
A. ENABLE
B. ENABLE_PROGRAM
C. VALIDATE_PROGRAM
D. SET_ATTRIBUTE
E. SET_ENABLED
----
Ans: A, D.
Programs (as well as jobs) can be enabled in two ways: by using the ENABLE
procedure or by using the SET_ATTRIBUTE procedure to set the ENABLED attribute to
TRUE.


3. Which of the following is not a valid calendaring syntax element?
A. FREQ
B. BYHOUR
C. RUNDATE
D. INTERVAL
E. BYMINUTE
---
Ans: C.
The calendaring syntax does not support an element named RUNDATE. It does not
support the concept of specifying a single run date at all. The purpose of the
calendaring syntax is to define repeat intervals that will be used to calculate run
dates.


4. Which Scheduler view(s) can be queried to see which jobs are currently
executing? (Choose all that apply.)
A. DBA_SCHEDULER_JOB_RUN_DETAILS
B. DBA_SCHEDULER_RUNNING_JOBS
C. DBA_SCHEDULER_CURRENT_JOBS
D. DBA_SCHEDULER_JOBS
E. DBA_SCHEDULER_EXECUTING_JOBS
---
Ans: B, D.
The DBA_SCHEDULER_RUNNING_JOBS view shows detailed information about all
jobs currently executing. The DBA_SCHEDULER_JOBS view contains the STATE
column, which shows a value of RUNNING for an executing job.



5. A schedule defined entirely within the confines of a Scheduler job object is
known as a(n) ____ _______________.
A. Fixed schedule
B. Inline schedule
C. Stored schedule
D. Hard-coded schedule
E. None of the above
---
Ans: B.
A schedule defined within a job object is known as an inline schedule, whereas an
independent schedule object is referred to as a stored schedule. Inline schedules
cannot be referenced by other objects.


6. Which DBMS_SCHEDULER procedure(s) can be used to alter an existing job?
(Choose all that apply.)
A. SET_ATTRIBUTE_NULL
B. ALTER_JOB
C. ALTER_JOB_PARAMETERS
D. ALTER
E. SET_ATTRIBUTE
----
Ans: A, E.
A job can be altered only by changing the value of one or more of its attributes.
This is accomplished by using the SET_ATTRIBUTE and SET_ATTRIBUTE_NULL
procedures.

7. What is the default value for the ENABLED attribute of a job or program when it
is created?
A. TRUE
B. FALSE
C. There is no default. It must be defined at creation time.
D. PENDING
E. NULL
---
Ans: B.
Jobs and programs are created in a disabled state by default. They must be enabled
by setting the ENABLE parameter to TRUE in their respective CREATE statements, or by
altering the object after creation.

8. To set the history retention period for either window logging or job logging
individually, which two parameters of the SET_SCHEDULER_ATTRIBUTE
procedure need to be used?
A. LOG_HISTORY
B. JOB_LOG_RETENTION
C. WINDOW_LOG_RETENTION
D. WHICH_LOG
E. LOG_NAME
---
Ans: A, D.
The LOG_HISTORY parameter defines the retention period for both job logging
and window logging by default. However, the WHICH_LOG parameter can be used to
specify either JOB_LOG or WINDOW_LOG.


9. Consider the following code snippet:
begin
dbms_scheduler.run_job('COLA_JOB',TRUE);
end;

If this code were executed, which of the following statements would be true?
(Choose all that apply.)
A. The COLA_JOB job would be executed asynchronously.
B. The COLA_JOB job would be executed synchronously.
C. The COLA_JOB job would run in the user's current session.
D. The COLA_JOB job would run with the FORCE option.
E. The user could continue to issue SQL statements in the session while
the COLA_JOB job was executing.
----
Ans: B, C.
The RUN_JOB procedure accepts two parameters: JOB_NAME and
USE_CURRENT_SESSION. In this example, the USE_CURRENT_SESSION parameter is set
to a value of TRUE. This causes the job to be executed synchronously in the user's
current session. Because the job runs synchronously, control would not return to the
user until the job was completed. Therefore, the user could not continue to execute
SQL statements while the job was running.

10. Which of the following calendaring syntax expressions would evaluate to the
last day of every month?
A. FREQ = MONTHLY; BYMONTHDAY = 31
B. FREQ = MONTHLY; BYMONTHDAY = -1
C. FREQ = DAILY; BYDAY = -1
D. FREQ = MONTHLY; BYDAY = 31
E. FREQ = DAILY; BYMONTHDAY = LAST_DAY
---
Ans: B.
The BYMONTHDAY element accepts negative values that represent a specific count of
days from the end of the month. Also, the FREQ parameter must be set to MONTHLY,
because it will execute every month.

11. Which of the following tasks is not performed by the job coordinator?
A. Update job log when a job completes
B. Spawn and remove job slaves
C. Write/read job info to/from memory cache
D. Query job table
E. Pass job information to job slaves
---
Ans: A. The job coordinator does not update the job log when a job completes. That
function is performed by the job slave that has been assigned to the job.


12. Which of the following objects can be directly referenced by a window object?
(Choose all that apply.)
A. Schedule object
B. Program object
C. Job object
D. Resource plan
E. Resource Consumer Group
---
Ans: A, D.
A window does not execute programs or jobs. It specifies a resource plan that
will be enabled based on a schedule. Therefore, it can reference both a schedule
object and a resource plan object. And while the resource plan may reference one or
more resource consumer groups, the window object does not directly reference them.


13. Which DBMS_SCHEDULER procedure is available for testing repeat intervals
produced by calendaring syntax expressions?
A. EVALUATE_REPEAT_INTERVAL
B. VALIDATE_CALENDAR_EXPRESSION
C. EVALUATE_CALENDAR_STRING
D. VALIDATE_CALENDAR_STRING
E. EVALUATE_INTERVAL_EXPRESSION
---
Ans: C.
The EVALUATE_CALENDAR_STRING procedure will generate execution dates from a
calendaring syntax expression.

14. Which of the following is not a valid setting for the PROGRAM_TYPE parameter
in a program object or the JOB_TYPE parameter in a job object?
A. PLSQL_BLOCK
B. JAVA_STORED_PROCEDURE
C. STORED_PROCEDURE
D. EXECUTABLE
E. None of the above are invalid settings.
---
Ans: B.
Java stored procedures cannot be executed by the job Scheduler unless they are
called from within a PL/SQL procedure wrapper. This can be done in a stored
procedure using PL/SQL's external procedure feature. Therefore, the job or program
type setting would be STORED_PROCEDURE.

15. Which of the following Scheduler elements encourage object reuse? (Choose
all that apply.)
A. Schedule objects
B. Program arguments
C. Job classes
D. Job arguments
E. All of the above
---
Ans: A, B, D.
Schedule objects do not specify any action to be performed; they simply
generate execution dates that any job can use. Program and job arguments allow the
jobs and programs to be reused by simply changing the arguments that are passed in.
Job classes simplify the management of jobs, but they do not specifically encourage
job reuse.


16. What is the danger associated with stopping a running job by using the
STOP_JOB procedure?
A. The job will need to be re-enabled before it will execute again.
B. The job may hold locks on objects referenced within the job.
C. All jobs within the job group will also be stopped.
D. The job may leave data in an inconsistent state.
E. There is no danger in using the STOP_JOB procedure.
---
Ans: D.
The Scheduler will attempt to wrap the job within a transaction and will execute a
rollback if a job is stopped. However, if the job has performed commits, the rollback
will only roll back any uncommitted changes. This could result in inconsistent data.

17. If a job references a schedule that has been disabled, what will be the result?
A. The job will be automatically disabled.
B. The job will never execute.
C. The job will attempt to execute, but will fail.
D. The job will inherit the DEFAULT_SCHEDULE schedule.
E. A schedule object cannot be disabled.
---
Ans: E.
A schedule object does not possess the ENABLED attribute. It is therefore enabled
upon creation and can never be disabled.

18. When a job exceeds the date specified in its END_DATE attribute, which of the
following will happen? (Choose all that apply.)
A. The job will be dropped automatically if the value of the AUTO_DROP
attribute is TRUE.
B. The job will be disabled if the value of the AUTO_DROP attribute is
FALSE.
C. The STATE attribute of the job will be set to COMPLETED if the value of
the AUTO_DROP attribute is FALSE.
D. All objects referenced by the job will be dropped if the value of the
AUTO_DROP attribute is TRUE and the value of the CASCADE attribute is
TRUE.
E. The STATE column of the job table will be set to COMPLETED for the job.
---
Ans: A, B, E.
When a job exceeds its end date, it will be dropped only if the AUTO_DROP
attribute is set to TRUE. Otherwise, it will be disabled. In either case, the STATE
column will be set to COMPLETED in the job table. A job object does not possess a
CASCADE attribute or a STATE attribute.


19. Which view can you query to see information on Scheduler windows?
A. DBA_WINDOWS
B. DBA_SCHEDULER_WINDOWS
C. DBA_WINDOW_OBJECTS
D. DBA_SCHEDULER_WINDOW_OBJECTS
E. DBA_ALL_SCHEDULER_WINDOWS
----
Ans: B. The DBA_SCHEDULER_WINDOWS view shows information on window objects
defined in the Scheduler.

20. If two windows overlap, which window attribute will determine if one should
be chosen over the other?
A. WINDOW_PRIORITY
B. PRIORITY
C. PRIORITY_LEVEL
D. WINDOW_PRIORITY_LEVEL
E. OVERLAP_RULE
---
Ans: A.
The WINDOW_PRIORITY attribute can be set to either HIGH or LOW for a window. If
two windows overlap and only one of the windows has a priority of HIGH, it will be
chosen.

No comments: