Oracle 11gOCP 053 v12.02 300--600题部分疑问答案更正

346 - RMAN report unrecoverable

What is the impact of the results of the output of the following command? 

RMAN> report unrecoverable database; 

Report of files that need backup due to unrecoverable operations 

File Type of Backup Required Name 

4 full or incremental C:\ORACLE\ORADATA\ORCL\USERS01.DBF 

A. There are no backup sets with any backups of the users01.dbf datafile. 

B. The users01.dbf datafile has had unrecoverable operations occur in it. It will need to be backed up or some data loss is possible during a recovery. 

C. The users01.dbf datafile is corrupted. 

D. The users01.dbf datafile backup exceeds the retention criteria. 

E. The last backup of the users01.dbf datafile failed and must be rerun.

解析:

http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmquick.htm#BRADV131

Reporting on Database Files and Backups

The REPORT command performs more complex analysis than LIST. Some main options are shown in Table 2-5.

Table 2-5 REPORT Options

Option

Example

Explanation

NEED BACKUP

REPORT NEED BACKUP DATABASE

Shows which files need backing up under current retention policy. Use optionalREDUNDANCY and RECOVERY WINDOW parameters to specify different criteria.

OBSOLETE

REPORT OBSOLETE

Lists backups that are obsolete under the configured backup retention policy. Use the optional REDUNDANCY and RECOVERY WINDOW parameters to override the default.

SCHEMA

REPORT SCHEMA

Reports the tablespaces and data files in the database at the current time (default) or a different time.

UNRECOVERABLE

REPORT UNRECOVERABLE

Lists all data files for which an unrecoverable operation has been performed against an object in the data file since the last backup of the data file.

 

To generate reports of database files and backups:

1. Start RMAN and connect to a target database.

2. Run the REPORT command at the RMAN prompt.

The following example reports backups that are obsolete according to the currently configured backup retention policy:

REPORT OBSOLETE;

The following example reports the data files and temp files in the database:

REPORT SCHEMA;

http://docs.oracle.com/cd/E11882_01/backup.112/e10643/rcmsynta2006.htm#RCMRF147

UNRECOVERABLE reportObject

Lists all unrecoverable data files. See Table 3-7 for description of output.

A data file is considered unrecoverable if an unrecoverable operation has been performed against an object residing in the data file since the last backup of the data file. In an unrecoverable operation, redo is not generated. Examples are direct load of table data and updates with the NOLOGGING option.

Note: The nonexistence of any backup of a data file is not sufficient reason to consider it unrecoverable. Such data files can be recovered through the use of the CREATE DATAFILE command, if redo logs starting from when the file was created still exist.

 

needBackupOption::=

reportObject::=

atClause::=

 

Answer:B




419.

In Oracle 11g, by default which one of the following conditions implicitly enables Automatic PGA 

Memory Management? 

A. Setting a nonzero value for SGA_TARGET 

B. Configuring Automatic Shared Memory Management 

C. Configuring Automatic Memory Management 

D. Setting a nonzero value for SGA_MAX_SIZE and PGA_AGGREGATE_TARGET 

E. None of the above 


Answer:C




498.

The database Is configured in ARCHIVELOG mode. The database needs to be up 24 X 7. You want 

to perform user managed backup for the data files of the HR_DATA tablespace. To accomplish the task, 

you issued the following command: 

SQL> ALTER TABLESPACE hi_data BEGIN BACKUP; 

Which two statements are true in this scenario? (Choose two.) 

A. No transaction on the tablespace is allowed but you can perform queries. 

B. The tablespace will automatically come out of backup mode when the file copy is complete. 

C. The checkpoint change number is frozen in headers of the data files until the file is removed from 

backup mode. 

D. The database writes the before image of an entire block to the redo stream before modifying. block tor 

the first time. 


Answer:CD




501.

Note the output of the following query; 

SQL> SELECT flashback_archieve_name, status FROM dba_flashback_archieve; 

FLASHBACK_ARCHIEVE_NAME STATUS 

FLA1 

You executed the following command to enable Flashback Data Archive on the EXCHANGB_PATE table: 

ALTER TABLE exchange_rate FLASHBACK ARCHIEVE; 

What is the outcome of this command? 

A. The table uses the default Flashback Data Archive. 

B. The Flashback Data Archive Is created In the SYSAUX tablespace. 

C. The Flashback Data Archive is created in the same tablespace where the tables are stored. 

D. The command generates an error because no flashback Data Archive name is specified and there is 

no default Flashback Data Achieve. 


Answer:D




505 - RMAN redundancy

You configured the default backup device type as disk for RMAN backups. In your database, because of business requirements, you have to take a simultaneous duplicate backup of the data files when the RMAN BACKUP command is used. What must you set using the RMAN CONFIGURE command to achieve this? 

A. MAXSETSIZE TO 2; 

B. DEVICE TYPE DISK PARALLELISM 2; 

C. RETENTION POLICY TO REDUNDANCY 2; 

D. DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2; 

解析:

http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmconfa.htm#BRADV139

Configuring Backup Duplexing

You can use the CONFIGURE ... BACKUP COPIES command to specify how many copies of each backup piece should be created on the specified device type for the specified type of file. This type of backup is known as a duplexed backup set. The CONFIGURE settings for duplexing only affect backups of data files, control files, and archived logs into backup sets, and do not affect image copies.

Note:

A control file autobackup is never duplexed.

RMAN can duplex backups to either disk or tape, but cannot duplex backups to tape and disk simultaneously. When backing up to tape, ensure that the number of copies does not exceed the number of available tape devices. The following examples show possible duplexing configurations:

# Makes 2 disk copies of each data file and control file backup set

# (autobackups excluded)

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

# Makes 3 copies of every archived redo log backup to tape

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE sbt TO 3;

To return a BACKUP COPIES configuration to its default value, run the same CONFIGURE command with the CLEAR option, as in the following example:

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE sbt CLEAR;

By default, CONFIGURE ... BACKUP COPIES is set to 1 for each device type.

http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmbckad.htm#BRADV89570

Duplexing Backup Sets with CONFIGURE BACKUP COPIES

As explained in "Configuring Backup Duplexing", the CONFIGURE ... BACKUP COPIES command specifies the number of identical backup sets to create on the specified device type. This setting applies to all backup sets except control file autobackups (because the autobackup of a control file always produces one copy) and backup sets when backed up with the BACKUP BACKUPSET command.

To duplex a backup with CONFIGURE ... BACKUP COPIES:

1. Configure the number of copies on the desired device type for datafiles and archived redo logs on the desired device types.

By default, CONFIGURE ... BACKUP COPIES is set to 1 for each device type. The following example configures duplexing for datafiles and archived logs on tape and also duplexing for datafiles (but not archived redo logs) on disk:

CONFIGURE DEVICE TYPE sbt PARALLELISM 1;

CONFIGURE DEFAULT DEVICE TYPE TO sbt;

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/disk1/%U', '/disk2/%U';

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE sbt TO 2;

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE sbt TO 2;

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

2. Execute the BACKUP command.

The following command backs up the database and archived logs to tape, making two copies of each data file and archived log:

BACKUP AS BACKUPSET DATABASE PLUS ARCHIVELOG;

Because of the configured formats for the disk channel, the following command backs up the database to disk, placing one copy of the backup sets produced in the /disk1 directory and the other in the /disk2 directory:

BACKUP DEVICE TYPE DISK AS BACKUPSET DATABASE;

If the FORMAT clause were not configured on CONFIGURE CHANNNEL, then you specify FORMAT on the BACKUP command itself. For example, you issue the following command:

BACKUP AS BACKUPSET DATABASE 

  FORMAT '/disk1/%U', 

         '/disk2/%U';

3. Issue a LIST BACKUP command to see a listing of backup sets and pieces.

For example, enter the following command:

LIST BACKUP SUMMARY;

The #Copies column shows the number of backup sets, which may have been produced by duplexing or by multiple backup commands.

See Also:

"Configuring Backup Duplexing" to learn about the CONFIGURE BACKUP COPIES command, and "Configuring the Environment for RMAN Backups" to learn about basic backup configuration options

 

Answer:D




510 - RMAN report need backup

You executed the following command in Recovery Manager (RMAN): 

RMAN> REPORT NEED BACKUP days 3; 

What is the output of this command? 

A. a list of files that require a backup within three days 

B. a list of files requiring more than 3 days of archive logs to apply 

C. a list of files that RMAN recommends be backed up only once in every three days, based on low volatility 

D. a list of files for which a backup has already been performed in the last three days and which is required to be backed up again based on the high number of transactions performed on them 

解析:

http://docs.oracle.com/cd/E18283_01/backup.112/e10642/rcmreprt.htm#

About Reports of RMAN Backups

You can use the REPORT command to answer important questions, such as:

· Which files need a backup?

· Which files have had unrecoverable operations performed on them?

· Which backups are obsolete and can be deleted?

· What was the physical schema of the target database or a database in the Data Guard environment at some previous time?

· Which files have not been backed up recently?

Reports enable you to confirm that your backup and recovery strategy is in fact meeting your requirements for database recoverability. The two major forms of REPORT used to determine whether your database is recoverable are:

· REPORT NEED BACKUP

Reports which database files need to be backed up to meet a configured or specified retention policy

· REPORT UNRECOVERABLE

Reports which database files require backup because they have been affected by some NOLOGGING operation such as a direct-path INSERT

The RMAN repository contains other information that you can access with the REPORT command. Table 11-3 summarizes the REPORT options.

Table 11-3 REPORT Options

Contents of Report

Command

Description

Obsolete backups

REPORT OBSOLETE

Full backups, datafile copies, and archived redo logs recorded in the RMAN repository that can be deleted because they are no longer needed

Database schema

REPORT SCHEMA

The names of all datafiles (permanent and temporary) and tablespaces for the target database at the specified point in time. If you use RMAN in a Data Guard environment, then you can report the schema for a specified DB_UNIQUE_NAME.

 

See Also:

Oracle Database Backup and Recovery Reference for a description of the REPORT command

Reporting on Files Needing a Backup Under a Retention Policy

Use the REPORT NEED BACKUP command to determine which database files need backup under a specific retention policy.

With no arguments, REPORT NEED BACKUP reports which objects need backup under the currently configured retention policy. The output for a configured retention policy of REDUNDANCY 1 is similar to this example:

RMAN> REPORT NEED BACKUP;

 

RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 1

Report of files with less than 1 redundant backups

File #bkps Name

---- ----- -----------------------------------------------------

2    0     /oracle/oradata/trgt/undotbs01.dbf

 

Using RMAN REPORT NEED BACKUP with Different Retention Policies

You can specify different criteria for REPORT NEED BACKUP, using one of the following forms of the command:

· REPORT NEED BACKUP RECOVERY WINDOW OF n DAYS

Displays objects requiring backup to satisfy a recovery window-based retention policy

· REPORT NEED BACKUP REDUNDANCY n

Displays objects requiring backup to satisfy a redundancy-based retention policy

· REPORT NEED BACKUP DAYS n

Displays files that require more than n days' worth of archived redo log files for recovery

· REPORT NEED BACKUP INCREMENTAL n

Displays files that require application of more than n incremental backups for recovery

Using RMAN REPORT NEED BACKUP with Tablespaces and Datafiles

The REPORT NEED BACKUP command can check the entire database, skip specified tablespaces, or check only specific tablespaces or datafiles against different retention policies, as shown in the following examples:

REPORT NEED BACKUP RECOVERY WINDOW OF 2 DAYS DATABASE SKIP TABLESPACE TBS_2;

REPORT NEED BACKUP REDUNDANCY 2 DATAFILE 1;

REPORT NEED BACKUP TABLESPACE TBS_3; # uses configured retention policy

REPORT NEED BACKUP INCREMENTAL 2; # checks entire database

See Also:

Oracle Database Backup and Recovery Reference for all possible options for REPORT NEED BACKUP and an explanation of the various column headings in the output

Using REPORT NEED BACKUP with Backups on Tape or Disk Only

You can limit the backups tested by the REPORT NEED BACKUP command to disk-based or tape-based backups only, as shown in these examples:

REPORT NEED BACKUP RECOVERY WINDOW OF 2 DAYS DATABASE DEVICE TYPE sbt;

REPORT NEED BACKUP DEVICE TYPE DISK;

REPORT NEED BACKUP TABLESPACE TBS_3 DEVICE TYPE sbt; 

 

Answer:B

511.

You have configured flash recovery area in your database and you set the following Initialization 

parameters for your database instance: 

LOG_ARCHIVE_DEST 1 = ,,LOCATION=/disk1/arch MANDATORY' 

LOG _ARCHIEVE_DEST 2 = ,,LOCATION=/disk2/arch' 

LOG_ARCHIVK_DEST_3 = ,,LOCATION=/diSk3/arch 

LOG_ARCH1VK_DEST_4 = ' LOCATION=/disk4/arch' 

LOG_ARCHIVE_MIN-SUCCEED_DEST = 2 

While the database instance is functional, you realized that the destination set by the 

LOG_ARCHIVE_DEST_I parameter Is not available for the archived redo log file to be created in. All redo 

log groups have been used. What happens in an event of log switch? 

A. The online redo log file Is not allowed to be overwritten. 

B. The archived redo log files are written to the flash recovery area until the MANDATORY destination is 

made available. 

C. The database instance will crash because the archived redo log file cannot be created in a destination 

set as MANDATORY. 

D. The destination set by the LOG_ARCHIVE_DEST_1 parameter is ignored and the archived redo log 

files are created in the next two available locations to guarantee archive log success. 


Answer:A


512 - Scheduler 

Which two statements correctly describe the relationship among the Scheduler components: job, program, and schedule? (Choose two) 

A. A job is specified as part of a program definition


B. A program can be used in the definition of multiple jobs 

C. A program and job can be specified as part of a schedule definition 

D. A program and schedule can be specified as part of a job definition 

解析:

http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_sched.htm#ARPLS72306

CREATE_PROGRAM Procedure

This procedure creates a program.

Syntax

DBMS_SCHEDULER.CREATE_PROGRAM (

   program_name             IN VARCHAR2,

   program_type             IN VARCHAR2,

   program_action           IN VARCHAR2,

   number_of_arguments      IN PLS_INTEGER DEFAULT 0,

   enabled                  IN BOOLEAN DEFAULT FALSE,

   comments                 IN VARCHAR2 DEFAULT NULL);

Parameters

Table 129-30 CREATE_PROGRAM Procedure Parameters

Parameter

Description

program_name

The name to assign to the program. The name must be unique in the SQL namespace. For example, a program cannot have the same name as a table in a schema. If no name is specified, then an error occurs.

program_type

This attribute specifies the type of program you are creating. If it is not specified then you get an error. There are three supported values for program_type:

· 'PLSQL_BLOCK'

This specifies that the program is a PL/SQL block. Job or program arguments are not supported when the job or program type is PLSQL_BLOCK. In this case, the number of arguments must be 0.

· 'STORED_PROCEDURE'

This specifies that the program is a PL/SQL or Java stored procedure, or an external C subprogram. Only procedures, not functions with return values, are supported. PL/SQL procedures with INOUT or OUT arguments are not supported.

· 'EXECUTABLE'

This specifies that the program is external to the database. External programs imply anything that can be executed from the operating system command line. AnyData arguments are not supported with job or program type EXECUTABLE.

program_action

This attribute specifies the action of the program. The following actions are possible:

· For a PL/SQL block, the action is to execute PL/SQL code. These blocks must end with a semicolon.

For example, my_proc(); or BEGIN my_proc(); END; or DECLARE arg pls_integer:= 10; BEGIN my_proc2(arg); END;.

Note that the Scheduler wraps job_action in its own block and passes the following to PL/SQL for execution: DECLARE ... BEGIN job_action END; This is done to declare some internal Scheduler variables. You can include any Scheduler metadata attribute except event_message in your PL/SQL code. You use the attribute name as you use any other PL/SQL identifier, and the Scheduler assigns it a value. See Table 129-39 for details on available metadata attributes.

If it is an anonymous block, special Scheduler metadata may be accessed using the following variable names: job_name,job_owner, job_start, window_start, window_end. For more information, see the "DEFINE_METADATA_ARGUMENT Procedure".

· For a stored procedure, the action is the name of the stored procedure. You have to specify the schema if the procedure resides in a schema other than the job.

If case sensitivity is needed, enclose the schema name and the store procedure name in double quotes. For example,program_action=>'"Schema"."Procedure"'.

· For an executable, the action is the name of the external executable, including the full path name, but excluding any command-line arguments. If the action starts with a single question mark ('?'), the question mark is replaced by the path to the Oracle home directory for a local job or to the Scheduler agent home for a remote job. If the action contains an at sign ('@') and the job is local, the at sign is replaced with the SID of the current Oracle instance.

If program_action is not specified, an error is generated

number_of_arguments

This attribute specifies the number of arguments the program takes. If this parameter is not specified, then the default is 0. A program can have a maximum of 255 arguments.

If the program_type is PLSQL_BLOCK, then this parameter is ignored.

enabled

This flag specifies whether the program should be created as enabled or not. If the flag is set to TRUE, then validity checks are made and the program is created as ENABLED if all the checks be successful. By default, this flag is set to FALSE, meaning not created enabled. You can also call the ENABLE procedure to enable the program before it can be used.

comments

A comment about the program. By default, this attribute is NULL.

 

Usage Notes

To create a program in their own schema, users need the CREATE JOB privilege. A user with the CREATE ANY JOB privilege can create a program in any schema. A program is created in a disabled state by default (unless the enabled parameter is set to TRUE). It cannot be executed by a job until it is enabled.

To use your programs, other users must have EXECUTE privileges, therefore once a program has been created, you have to grant EXECUTE privileges on it.

http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_sched.htm#ARPLS72308

CREATE_SCHEDULE Procedure

This procedure creates a schedule.

Syntax

DBMS_SCHEDULER.CREATE_SCHEDULE (

   schedule_name          IN VARCHAR2,

   start_date             IN TIMESTAMP WITH TIMEZONE DEFAULT NULL,

   repeat_interval        IN VARCHAR2,

   end_date               IN TIMESTAMP WITH TIMEZONE DEFAULT NULL,

   comments               IN VARCHAR2 DEFAULT NULL);

Parameters

Table 129-31 CREATE_SCHEDULE Procedure Parameters

Parameter

Description

schedule_name

The name to assign to the schedule. The name must be unique in the SQL namespace. For example, a schedule cannot have the same name as a table in a schema. If no name is specified, then an error occurs.

start_date

This attribute specifies the first date and time on which this schedule becomes valid. For a repeating schedule, the value forstart_date is a reference date. In this case, the start of the schedule is not the start_date; it depends on the repeat interval specified. start_date is used to determine the first instance of the schedule.

If start_date is specified in the past and no value for repeat_interval is specified, the schedule is invalid. For a repeating job or window, start_date can be derived from the repeat_interval if it is not specified.

If start_date is null, then the date that the job or window is enabled is used. start_date and repeat_interval cannot both be null.

repeat_interval

This attribute specifies how often the schedule repeats. It is expressed using calendaring syntax. See "Calendaring Syntax"for further information. PL/SQL expressions are not allowed as repeat intervals for named schedules.

end_date

The date and time after which jobs will not run and windows will not open.

A non-repeating schedule that has no end_date is valid forever.

end_date has to be after the start_date. If this is not the case, then an error is generated when the schedule is created.

comments

This attribute specifies an optional comment about the schedule. By default, this attribute is NULL.

 

Usage Notes

This procedure requires the CREATE JOB privilege to create a schedule in your own schema or the CREATE ANY JOB privilege to create a schedule in someone else's schema by specifying schema.schedule_name. Once a schedule has been created, it can be used by other users. The schedule is created with access toPUBLIC. Therefore, there is no need to explicitly grant access to the schedule.

http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_sched.htm#ARPLS72300

CREATE_JOB Procedure

This procedure creates a single job (regular or lightweight). If you create the job as enabled by setting the enabled attribute to TRUE, the Scheduler automatically runs the job according to its schedule. If you create the job disabled, the job does not run until you enable it with the SET_ATTRIBUTE Procedure.

The procedure is overloaded. The different functionality of each form of syntax is presented along with the syntax declaration.

Syntax

Creates a job in a single call without using an existing program or schedule:

DBMS_SCHEDULER.CREATE_JOB (

   job_name             IN VARCHAR2,

   job_type             IN VARCHAR2,

   job_action           IN VARCHAR2,

   number_of_arguments  IN PLS_INTEGER              DEFAULT 0,

   start_date           IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,

   repeat_interval      IN VARCHAR2                 DEFAULT NULL,

   end_date             IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,

   job_class            IN VARCHAR2                 DEFAULT 'DEFAULT_JOB_CLASS',

   enabled              IN BOOLEAN                  DEFAULT FALSE,

   auto_drop            IN BOOLEAN                  DEFAULT TRUE,

   comments             IN VARCHAR2                 DEFAULT NULL,

   credential_name      IN VARCHAR2                 DEFAULT NULL,

   destination_name     IN VARCHAR2                 DEFAULT NULL);

Creates a job using a named schedule object and a named program object:

DBMS_SCHEDULER.CREATE_JOB (

   job_name                IN VARCHAR2,

   program_name            IN VARCHAR2,

   schedule_name           IN VARCHAR2,

   job_class               IN VARCHAR2              DEFAULT 'DEFAULT_JOB_CLASS',

   enabled                 IN BOOLEAN               DEFAULT FALSE,

   auto_drop               IN BOOLEAN               DEFAULT TRUE,

   comments                IN VARCHAR2              DEFAULT NULL,

   job_style               IN VARCHAR2              DEFAULT 'REGULAR',

   credential_name         IN VARCHAR2              DEFAULT NULL,

   destination_name        IN VARCHAR2              DEFAULT NULL);

Creates a job using a named program object and an inlined schedule:

DBMS_SCHEDULER.CREATE_JOB (

   job_name             IN VARCHAR2,

   program_name        IN VARCHAR2,

   start_date          IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,

   repeat_interval     IN VARCHAR2                  DEFAULT NULL,

   end_date            IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,

   job_class            IN VARCHAR2                 DEFAULT 'DEFAULT_JOB_CLASS',

   enabled              IN BOOLEAN                  DEFAULT FALSE,

   auto_drop            IN BOOLEAN                  DEFAULT TRUE,

   comments             IN VARCHAR2                 DEFAULT NULL,

   job_style            IN VARCHAR2                 DEFAULT 'REGULAR',

   credential_name      IN VARCHAR2                 DEFAULT NULL,

   destination_name     IN VARCHAR2                 DEFAULT NULL);

Creates a job using a named schedule object and an inlined program:

DBMS_SCHEDULER.CREATE_JOB (

   job_name               IN VARCHAR2,

   schedule_name         IN VARCHAR2,

   job_type               IN VARCHAR2,

   job_action             IN VARCHAR2,

   number_of_arguments   IN PLS_INTEGER       DEFAULT 0,

   job_class               IN VARCHAR2          DEFAULT 'DEFAULT_JOB_CLASS',

   enabled                 IN BOOLEAN           DEFAULT FALSE,

   auto_drop               IN BOOLEAN           DEFAULT TRUE,

   comments                IN VARCHAR2          DEFAULT NULL,

   credential_name         IN VARCHAR2          DEFAULT NULL,

   destination_name        IN VARCHAR2          DEFAULT NULL);

Creates a job using an inlined program and an event:

DBMS_SCHEDULER.CREATE_JOB (

   job_name                IN VARCHAR2,

   job_type               IN VARCHAR2,

   job_action             IN VARCHAR2,

   number_of_arguments   IN PLS_INTEGER       DEFAULT 0,

   start_date             IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,

   event_condition       IN VARCHAR2          DEFAULT NULL,

   queue_spec             IN VARCHAR2,

   end_date               IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,

   job_class               IN VARCHAR2          DEFAULT 'DEFAULT_JOB_CLASS',

   enabled                 IN BOOLEAN           DEFAULT FALSE,

   auto_drop               IN BOOLEAN           DEFAULT TRUE,

   comments                IN VARCHAR2          DEFAULT NULL,

   credential_name         IN VARCHAR2          DEFAULT NULL,

   destination_name        IN VARCHAR2          DEFAULT NULL);

Creates a job using a named program object and an event:

DBMS_SCHEDULER.CREATE_JOB (

   job_name                IN VARCHAR2,

   program_name            IN VARCHAR2,

   start_date             IN TIMESTAMP WITH TIME ZONE,

   event_condition       IN VARCHAR2,

   queue_spec             IN VARCHAR2,

   end_date               IN TIMESTAMP WITH TIME ZONE,

   job_class               IN VARCHAR2          DEFAULT 'DEFAULT_JOB_CLASS',

   enabled                 IN BOOLEAN           DEFAULT FALSE,

   auto_drop               IN BOOLEAN           DEFAULT TRUE,

   comments                IN VARCHAR2          DEFAULT NULL,

   job_style               IN VARCHAR2          DEFAULT 'REGULAR',

   credential_name         IN VARCHAR2          DEFAULT NULL,

   destination_name        IN VARCHAR2          DEFAULT NULL);

Parameters

Table 129-27 CREATE_JOB Procedure Parameters

Parameter

Description

job_name

The name to assign to the job. The name must be unique in the SQL namespace. For example, a job cannot have the same name as a table in a schema. If the job being created will reside in another schema, it must be qualified with the schema name.

If job_name is not specified, an error is generated. If you want to have a name generated by the Scheduler, you can use theGENERATE_JOB_NAME procedure to generate a name and then use the output in the CREATE_JOB procedure. The GENERATE_JOB_NAMEprocedure generates a number from a sequence, which is the job name. You can prefix the number with a string. The job name will then be the string with the number from the sequence appended to it. See "GENERATE_JOB_NAME Function" for more information.

job_type

This attribute specifies the type of job that you are creating. If it is not specified, an error is generated. The supported values are:

· 'PLSQL_BLOCK'

This specifies that the job is an anonymous PL/SQL block. Job or program arguments are not supported when the job or program type is PLSQL_BLOCK. In this case, the number of arguments must be 0.

· 'STORED_PROCEDURE'

This specifies that the job is a PL/SQL or Java stored procedure, or an external C subprogram. Only procedures, not functions with return values, are supported.

· 'EXECUTABLE'

This specifies that the job is external to the database. External jobs are anything that can be executed from the command line of the operating system. Anydata arguments are not supported with a job or program type of EXECUTABLE. The job owner must have the CREATE EXTERNAL JOB system privilege before the job can be enabled or run.

· 'CHAIN'

This specifies that the job is a chain. Arguments are not supported for a chain, so number_of_arguments must be 0.

job_action

This attribute specifies the action of the job. If job_action is not specified for an inline program, then an error is generated when creating the job.

The following actions are possible:

· For a PL/SQL block:

The action is to execute PL/SQL code. These blocks must end with a semicolon. For example, my_proc(); or BEGIN my_proc(); END; or DECLARE arg pls_integer:= 10; BEGIN my_proc2(arg); END;.

Note that the Scheduler wraps job_action in its own block and passes the following to PL/SQL for execution: DECLARE ... BEGIN job_action END; This is done to declare some internal Scheduler variables. You can include any Scheduler metadata attribute except event_message in your PL/SQL code. You use the attribute name as you use any other PL/SQL identifier, and the Scheduler assigns it a value.

See Table 129-39 for details on available metadata attributes.

· For a stored procedure:

The action is the name of the stored procedure. You have to specify the schema if the procedure resides in another schema than the job. If case sensitivity is needed, enclose the schema name and the store procedure name in double quotes. For example, job_action_action=>'"Schema"."Procedure"'.

PL/SQL procedures with INOUT or OUT arguments are not supported as job_action when the job or program type isSTORED_PROCEDURE.

· For an executable:

The action is the name of the external executable, including the full path name, but excluding any command-line arguments. If the action starts with a single question mark ('?'), the question mark is replaced by the path to the Oracle home directory for a local job or to the Scheduler agent home for a remote job. If the action contains an at-sign ('@') and the job is local, the at-sign is replaced with the SID of the current Oracle instance.

· For a chain:

The action is the name of a Scheduler chain object. You must specify the schema of the chain if it resides in a different schema than the job.

number_of_arguments

This attribute specifies the number of arguments that the job expects. The range is 0-255, with the default being 0.

program_name

The name of the program associated with this job. If the program is of type EXECUTABLE, the job owner must have the CREATEEXTERNAL JOB system privilege before the job can be enabled or run.

start_date

This attribute specifies the first date and time on which this job is scheduled to start. If start_date and repeat_interval are left null, then the job is scheduled to run as soon as the job is enabled.

For repeating jobs that use a calendaring expression to specify the repeat interval, start_date is used as a reference date. The first time the job runs is the first match of the calendaring expression that is on or after the current date and time.

The Scheduler cannot guarantee that a job executes on an exact time because the system may be overloaded and thus resources unavailable.

event_condition

This is a conditional expression based on the columns of the event source queue table. The expression must have the syntax of an Advanced Queuing rule. Accordingly, you can include user data properties in the expression provided that the message payload is an object type, and that you prefix object attributes in the expression with tab.user_data. For more information on rules, see the DBMS_AQADM.ADD_SUBSCRIBER procedure.

queue_spec

This argument specifies either of the following:

· The source queue where events that start this particular job are enqueued. If it is secure, then the queue_spec argument is a pair of values of the form queue_name, agent name. If it is not secure, then only the queue name need be provided. If a fully qualified queue name is not provided, the queue is assumed to be in the job owner's schema. In the case of secure queues, the agent name provided should belong to a valid agent that is currently subscribed to the queue.

· A file watcher name. For more information on this option, see Oracle Database Administrator's Guide.

repeat_interval

This attribute specifies how often the job repeats. You can specify the repeat interval by using calendaring or PL/SQL expressions.

The expression specified is evaluated to determine the next time the job should run. If repeat_interval is not specified, the job runs only once at the specified start date. See "Calendaring Syntax" for further information.

schedule_name

The name of the schedule, window, or window group associated with this job.

job_class

The class this job is associated with.

end_date

This attribute specifies the date and time after which the job expires and is no longer run. After the end_date, if auto_drop is TRUE, the job is dropped. If auto_drop is FALSE, the job is disabled and the STATE of the job is set to COMPLETED.

If no value for end_date is specified, the job repeats forever unless max_runs or max_failures is set, in which case the job stops when either value is reached.

The value for end_date must be after the value for start_date. If it is not, an error is generated when the job is enabled.

comments

This attribute specifies a comment about the job. By default, this attribute is NULL.

job_style

Style of the job being created. This argument can have one of the following values:

· 'REGULAR' creates a regular job. This is the default.

· 'LIGHTWEIGHT' creates a lightweight job. This value is permitted only when the job references a program object. Use lightweight jobs when you have many short-duration jobs that run frequently. Under certain circumstances, using lightweight jobs can deliver a small performance gain.

credential_name

The default credential to use with the job. Applicable only to remote database jobs, remote external jobs, local external jobs, and event-based jobs that process file arrival events. The credential must exist.

For local database jobs, it must be NULL.

For local external jobs only, if this attribute is NULL (the default), then a preferred (default) credential is selected. See Oracle Database Administrator's Guide for information about preferred credentials for local external jobs.

See also: "CREATE_CREDENTIAL Procedure"

destination_name

The database destination or external destination for the job. Use for remote database jobs and remote external jobs only. Must be NULL for jobs running on the local database or for local external jobs (executables).

This attribute can be a single destination name or the name of a group of type 'EXTERNAL_DEST' or 'DB_DEST'. The single destination or group must already exist.

The following applies to this attribute:

· If it is a database destination, it must have been created by the CREATE_DATABASE_DESTINATION Procedure.

· If it is an external destination, it must have been implicitly created by registering a remote Scheduler agent with the local database.

· If it is a group, each member of the group must exist, and the job must run on all destinations named in the group. See"CREATE_GROUP Procedure".

destination_name cannot reference a destination group when:

· The job type is 'CHAIN'

· The job style is 'LIGHTWEIGHT'

If the credential_name argument of CREATE_JOB is NULL, each destination must be preceded by a credential, in the following format:

credential.destination

The credential must already exist. If the credential_name argument is provided, then it serves as the default credential for every destination that is not preceded by a credential.

You can query the views *_SCHEDULER_DB_DESTS and ALL_SCHEDULER_EXTERNAL DESTS for existing destinations and*_SCHEDULER_GROUP_MEMBERS for existing groups and their members.

*** destination_name supersedes the destination job attribute, which is deprecated in Oracle Database 11g Release 2 (11.2).

enabled

This attribute specifies whether the job is created enabled or not. The possible settings are TRUE or FALSE. By default, this attribute is set to FALSE and, therefore, the job is created as disabled. A disabled job means that the metadata about the job has been captured, and the job exists as a database object. However, the Scheduler ignores the job and the job coordinator does not pick it for processing. In order for the job coordinator to process the job, the job must be enabled. You can enable a job by setting this argument to TRUE or by using the ENABLE procedure.

auto_drop

This flag, if TRUE, causes a job to be automatically dropped after it has completed or has been automatically disabled. A job is considered completed if:

· Its end date (or the end date of the job schedule) has passed.

· It has run max_runs number of times. max_runs must be set with SET_ATTRIBUTE.

· It is not a repeating job and has run once.

A job is disabled when it has failed max_failures times. max_failures is also set with SET_ATTRIBUTE.

If this flag is set to FALSE, the jobs are not dropped and their metadata is kept until the job is explicitly dropped with the DROP_JOBprocedure.

By default, jobs are created with auto_drop set to TRUE.

 

Usage Notes

Jobs are created as disabled by default. You must explicitly enable them so that they will become active and scheduled. Before enabling a job, ensure that all program arguments, if any, are defined, either by defining default values in the program object or by supplying values with the job.

The JOB_QUEUE_PROCESSES initialization parameter specifies the maximum number of processes that can be created for the execution of jobs. Beginning with Oracle Database 11g Release 2 (11.2), JOB_QUEUE_PROCESSES applies to DBMS_SCHEDULER jobs. Setting this parameter to 0 disables DBMS_SCHEDULER jobs.

To create a job in your own schema, you need to have the CREATE JOB privilege. A user with the CREATE ANY JOB privilege can create a job in any schema. If the job being created will reside in another schema, the job name must be qualified with the schema name. For a job of type EXECUTABLE (or for a job that points to a program of type EXECUTABLE), the job owner must have the CREATE EXTERNAL JOB system privilege before the job can be enabled or run.

Associating a job with a particular class or program requires EXECUTE privileges for that class or program.

Not all possible job attributes can be set with CREATE_JOB. Some must be set after the job is created. For example, job arguments must be set with theSET_JOB_ARGUMENT_VALUE Procedure or the SET_JOB_ANYDATA_VALUE Procedure. Other job attributes, such as job_priority and max_runs, are set with the SET_ATTRIBUTE Procedure.

To create multiple jobs efficiently, use the CREATE_JOBS procedure.

Note:

The Scheduler runs event-based jobs for each occurrence of an event that matches the event condition of the job. However, events that occur while the job is already running are ignored; the event gets consumed, but does not trigger another run of the job.

Answer:BD


541 - ASM add disk

If you use ALTER DISKGROUP ... ADD DISK and specify a wildcard for the discovery string, what happens to disks that are already a part of the same or another disk group? 

A. The command fails unless you specify the FORCE option. 

B. The command fails unless you specify the REUSE option. 

C. The command must be reissued with a more specific discovery string. 

D. The other disks, already part of the disk group, are ignored

解析:

http://docs.oracle.com/cd/E11882_01/server.112/e18951/asmdiskgrps.htm#OSTMG10071

Adding Disks to a Disk Group

You can use the ADD clause of the ALTER DISKGROUP statement to add a disk or a failure group to a disk group. You can use the same syntax with the ALTER DISKGROUP statement that you use to add a disk or failure group with the CREATE DISKGROUP statement. For an example of the CREATE DISKGROUP SQL statement, refer to Example 4-1. After you add new disks, the new disks gradually begin to accommodate their share of the workload as rebalancing progresses.

Oracle ASM behavior when adding disks to a disk group is best illustrated through"Adding Disks to a Disk Group with SQL Statements". You can also add disks to a disk group with Oracle Enterprise Manager, described in "Adding Disks to Disk Groups".

Adding Disks to a Disk Group with SQL Statements

The statements presented in this example demonstrate the interactions of disk discovery with the ADD DISK operation.

Assume that disk discovery identifies the following disks in directory /devices:


/devices/diska1 -- member of data1
/devices/diska2 -- member of data1
/devices/diska3 -- member of data1
/devices/diska4 -- member of data1
/devices/diska5 -- candidate disk
/devices/diska6 -- candidate disk
/devices/diska7 -- candidate disk
/devices/diska8 -- candidate disk

/devices/diskb1 -- member of data1
/devices/diskb2 -- member of data1
/devices/diskb3 -- member of data1
/devices/diskb4 -- member of data2

/devices/diskc1 -- member of data2
/devices/diskc2 -- member of data2
/devices/diskc3 -- member of data3
/devices/diskc4 -- candidate disk

/devices/diskd1 -- candidate disk
/devices/diskd2 -- candidate disk
/devices/diskd3 -- candidate disk
/devices/diskd4 -- candidate disk
/devices/diskd5 -- candidate disk
/devices/diskd6 -- candidate disk
/devices/diskd7 -- candidate disk
/devices/diskd8 -- candidate disk

You can query the V$ASM_DISK view to display the status of Oracle ASM disks. See "Views Containing Oracle ASM Disk Group Information".

The following statement would fail because /devices/diska1 - /devices/diska4 already belong to the disk group data1.

ALTER DISKGROUP data1 ADD DISK

     '/devices/diska*';

The following statement successfully adds disks /devices/diska5 through /devices/diska8 to data1. Because no FAILGROUP clauses are included in the ALTER DISKGROUP statement, each disk is assigned to its own failure group. The NAME clauses assign names to the disks, otherwise they would have been assigned system-generated names.

ALTER DISKGROUP data1 ADD DISK

     '/devices/diska5' NAME diska5,

     '/devices/diska6' NAME diska6,

     '/devices/diska7' NAME diska7,

     '/devices/diska8' NAME diska8;

The following statement would fail because the search string matches disks that are contained in other disk groups. Specifically, /devices/diska4 belongs to disk group data1 and /devices/diskb4 belongs to disk group data2.

ALTER DISKGROUP data1 ADD DISK

     '/devices/disk*4';

The following statement would successfully add /devices/diskd1 through /devices/diskd8 to disk group data1. This statement runs with a rebalance power of 5, and does not return until the rebalance operation is complete.

ALTER DISKGROUP data1 ADD DISK

      '/devices/diskd*'

       REBALANCE POWER 5 WAIT;

If /devices/diskc3 was previously a member of a disk group that no longer exists, then you could use the FORCE option to add the disk as a member of another disk group. For example, the following use of the FORCE clause enables /devices/diskc3 to be added to data2, even though it is a current member of data3. For this statement to succeed, data3 cannot be mounted.

ALTER DISKGROUP data2 ADD DISK

     '/devices/diskc3' FORCE;

 

http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_1007.htm#SQLRF01113

Prerequisites

You must have an Oracle ASM instance started from which you issue this statement. The disk group to be modified must be mounted.

You can issue all ALTER DISKGROUP clauses if you have the SYSASM system privilege. You can issue specific clauses as follows:

· The SYSOPER privilege permits the following subset of the ALTER DISKGROUP operations: diskgroup_availability, rebalance_diskgroup_clause,check_diskgroup_clause (without the REPAIR option).

· If you are connected as SYSDBA, you have limited privileges to use this statement. The following operations are always granted to users connected asSYSDBA:

ALTER DISKGROUP ... ADD DIRECTORY

ALTER DISKGROUP ... ADD/ALTER/DROP TEMPLATE (nonsystem templates only)

ALTER DISKGROUP ... ADD USERGROUP

SELECT

SHOW PARAMETER

Table 10-1 shows additional privileges granted to users connected as SYSDBA under the conditions shown:

Table 10-1 Conditional Diskgroup Privileges for SYSDBA

ALTER DISKGROUP Operation

Condition

DROP FILE

User must have read-write permission on the file.

ADD ALIAS

User must have read-write permission on the related file.

RENAME ALIAS

User must have read-write permission on the related file.

DROP ALIAS

User must have read-write permission on the related file.

RENAME DIRECTORY

Directory must contain only aliases and no files. User must have DROP ALIAS permissions on all aliases under the directory.

DROP DIRECTORY

Directory must contain only aliases and no files. User must have DROP ALIAS permissions on all aliases under the directory.

DROP USERGROUP

User must be the owner of the user group.

MODIFY FILE

User must be the owner of the file.

MODIFY USERGROUP ADD MEMBER

User must be the owner of the user group.

MODIFY USERGROUP DROP MEMBER

User must be the owner of the user group.

SET PERMISSION

User must be the owner of the file.

SET OWNER GROUP

User must be the owner of the file and a member of the user group.

 

 

add_disk_clause

Use this clause to add one or more disks to the disk group and specify attributes for the newly added disk. Oracle ASM automatically rebalances the disk group as part of this operation.

You cannot use this clause to change the failure group of a disk. Instead you must drop the disk from the disk group and then add the disk back into the disk group as part of the new failure group.

To determine the names of the disks already in this disk group, query the V$ASM_DISK dynamic performance view.

QUORUM | REGULAR 

The semantics of these keyword are the same as the semantics in a CREATE DISKGROUP statement. See QUORUM | REGULAR for more information on these keywords.

You cannot change this qualifier for an existing disk or disk group. Therefore, you cannot specify in this clause a keyword different from the keyword that was specified when the disk group was created.

See Also:

Oracle Automatic Storage Management Administrator's Guide for more information about the use of these keywords

FAILGROUP Clause Use this clause to assign the newly added disk to a failure group. If you omit this clause and you are adding the disk to a normal or high redundancy disk group, then Oracle Database automatically adds the newly added disk to its own failure group. The implicit name of the failure group is the same as the operating system independent disk name (see "NAME Clause").

You cannot specify this clause if you are creating an external redundancy disk group.

ADD DIRECTORY Use this clause to create a new directory path for hierarchically named aliases. Use a slash (/) to separate components of the directory. Each directory component can be up to 48 bytes in length and must not contain the slash character. You cannot use a space for the first or last character of any component. The total length of the directory path cannot exceed 256 bytes minus the length of any alias name you intend to create in this directory (seediskgroup_alias_clauses).

DROP DIRECTORY Use this clause to drop a directory for hierarchically named aliases. Oracle ASM will not drop the directory if it contains any alias definitions unless you also specify FORCE. This clause is not valid for dropping directories created as part of a system alias. Such directories are labeled with the value Y in the SYSTEM_CREATED column of the V$ASM_ALIAS dynamic performance view.

RENAME DIRECTORY Use this clause to change the name of a directory for hierarchically named aliases. This clause is not valid for renaming directories created as part of a system alias. Such directories are labeled with the value Y in the SYSTEM_CREATED column of the V$ASM_ALIAS dynamic performance view.

 

Answer:A


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值