Oracle OCP 1Z0-050(141-150题)解析

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/seagal890/article/details/83003005

Oracle OCP 1Z0-050(141-150题)解析

QUESTION 141:

The Database Resource Manager is automatically enabled in the maintenance window that runs the Automated Maintenance Task. What is the reason for this?

A. to prevent the Automated Maintenance Tasks from consuming excessive amounts of system resources

B. to prevent the creation of an excessive number of scheduler job classes

C. to allow resource sharing only among the Automated Maintenance Tasks in the maintenance window

D. to allow the Automated Maintenance Tasks to use system resources without any restriction

Answer: A

解析:

自动维护任务依赖于在维护窗口期间启用的资源管理器。维护窗口打开时,会自动设置DEFAULT_MAINTENANCE_PLAN资源管理器计划,以控制自动维护任务使用的CPU 数量。

A答案:防止自动维护任务消耗过多的系统资源,正确。

 

QUESTION 142:

You plan to control the sessions performing a huge number of I/O operations. Your requirement is to kill the session when it exceeds a specified number of I/Os. Which statement describes a solution to the above?

A. Add directives to the Automatic Database Diagnostic Monitor (ADDM).

B. Modify the profile for the targeted users for which control needs to be imposed.

C. Implement the database resource manager to add the SWITCH_IO_REQS and SWITCH_GROUP directives.

D. Set a threshold for the default system-defined moving window baseline.

Answer: C

解析:参考Oracle官方文档:


http://docs.oracle.com/cd/E11882_01/server.112/e25494/dbrm.htm#ADMIN11868

SWITCH_IO_REQS

Specifies the number of I/O requests that a session can execute before an action is taken. Default is UNLIMITED. The action is specified by SWITCH_GROUP.

 

 
 

SWITCH_GROUP

Specifies the consumer group to which a session is switched if switch criteria are met. If the group name is 'CANCEL_SQL', then the current call is canceled when switch criteria are met. If the group name is 'KILL_SESSION', then the session is killed when switch criteria are met. Default isNULL.

If the group name is 'CANCEL_SQL', the SWITCH_FOR_CALL parameter is always set to TRUE, overriding the user-specified setting.

BEGIN
  DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE (
   PLAN             => 'DAYTIME',
   GROUP_OR_SUBPLAN => 'OLTP',
   COMMENT          => 'OLTP group',
   MGMT_P1          => 75,
   SWITCH_GROUP     => 'KILL_SESSION',
   SWITCH_TIME      => 60);
END;
/

QUESTION 143:

Examine the following PL/SQL block:

DECLARE

my_plans pls_integer;

BEGIN

my_plans := DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE (sql_id => ?9twu5t2dn5xd?;

END;

Which statement is true about the plan being loaded into the SQL plan baseline by the above command?

A. It is loaded with the ACCEPTED status.

B. It is loaded with the FIXED status.

C. It is not loaded with the ACCEPTED status.

D. It is not loaded with the ENABLED status.

Answer: A

解析:参考Oracle官方文档

http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_spm.htm#ARPLS68158

LOAD_PLANS_FROM_CURSOR_CACHE Functions

Loads one or more plans present in the cursor cache for a SQL statement

 

LOAD_PLANS_FROM_CURSOR_CACHE Functions

This function loads one or more plans present in the cursor cache for a SQL statement, or a set of SQL statements. It has four overloads: using SQL statement text, using SQL handle, using SQL ID, or using attribute_name and attribute_value pair.

Syntax

DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE (

   sql_id            IN  VARCHAR2,

   plan_hash_value   IN  NUMBER   := NULL,

   sql_text          IN  CLOB,

   fixed             IN  VARCHAR2 := 'NO',

   enabled           IN  VARCHAR2 := 'YES')

RETURN PLS_INTEGER;

 

DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE (

   sql_id            IN  VARCHAR2,

   plan_hash_value   IN  NUMBER   := NULL,

   sql_handle        IN  VARCHAR2,

   fixed             IN  VARCHAR2 := 'NO',

   enabled           IN  VARCHAR2 := 'YES')

RETURN PLS_INTEGER;

 

DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE (

   sql_id            IN  VARCHAR2,

   plan_hash_value   IN  NUMBER   := NULL,

   fixed             IN  VARCHAR2 := 'NO',

   enabled           IN  VARCHAR2 := 'YES')

RETURN PLS_INTEGER;

 

DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE (

   attribute_name   IN VARCHAR2,

   attribute_value  IN VARCHAR2,

   fixed            IN VARCHAR2 := 'NO',

   enabled          IN VARCHAR2 := 'YES')

  RETURN PLS_INTEGER;

Parameters

Table 136-10 LOAD_PLANS_FROM_CURSOR_CACHE Function Parameters

Parameter

Description

sql_id

SQL statement identifier. Identifies a SQL statement in the cursor cache. Note: In the third overload the text of identified SQL statement is extracted from cursor cache and is used to identify the SQL plan baseline into which the plan(s) are loaded. If the SQL plan baseline doesn't exist it is created.

plan_hash_value

Plan identifier. Default NULL means capture all plans present in the cursor cache for the SQL statement identified by SQL_ID.

sql_text

SQL text to use in identifying the SQL plan baseline into which the plans are loaded. If the SQL plan baseline does not exist, it is created. The use of text is crucial when the user tunes a SQL statement by adding hints to its text and then wants to load the resulting plan(s) into the SQL plan baseline of the original SQL statement.

sql_handle

SQL handle to use in identifying the SQL plan baseline into which the plans are loaded. The sql_handlemust denote an existing SQL plan baseline. The use of handle is crucial when the user tunes a SQL statement by adding hints to its text and then wants to load the resulting plan(s) into the SQL plan baseline of the original SQL statement.

fixed

Default 'NO' means the loaded plans are used as non-fixed plans. Value 'YES' means the loaded plans are used as fixed plans and the SQL plan baseline will not be evolved over time.

attribute_name

One of possible attribute names:

  • SQL_TEXT''
  • 'PARSING_SCHEMA_NAME'
  • 'MODULE'
  • 'ACTION'

attribute_value

Attribute value is used as a search pattern of LIKE predicate if attribute name is 'SQL_TEXT'. Otherwise, it is used as an equality search value. (for example, for specifying attribute_name => 'SQL_TEXT', andattribute_value => '% HR-123 %' means applying SQL_TEXT LIKE '% HR-123 %' as a selection filter. Similarly, specifying attribute_name => 'MODULE', and attribute_value => 'HR' means applying 'MODULE = 'HR' as a plan selection filter). The attribute value is upper-cased except when it is enclosed in double quotes or attribute name is 'SQL_TEXT'.

enabled

Default 'YES' means the loaded plans are enabled for use by the optimizer, It may be used depending on accepted status.

Return Values

Number of plans loaded

Usage Notes

Invoking this subprogram requires the ADMINISTER SQL MANAGEMENT OBJECT privilege.

 

QUESTION 144:

You performed the RMAN database backup having a backupset key number 231 with the KEEP FOREVER option. After some days, you want to change the status of the database backup and you issued the following command:

RMAN>CHANGE BACKUPSET 231 NOKEEP;

What is the implication of this command?

A. The backup overrides the backup retention policy.

B. the backup becomes eligible for deletion according to the existing retention policy

C. The backup is marked unavailable.

D. The backup is deleted.

Answer: B

解析:参考Oracle官方文档

http://docs.oracle.com/cd/E11882_01/backup.112/e10643/rcmsubcl011.htm#RCMRF90453

你执行RMAN数据库备份带一个键号231的、永远保持选项的备份集。过了些日子,你要更改的数据库备份的状态,并发出以下命令:

RMAN>CHANGE BACKUPSET 231 NOKEEP;

D,备份变为适合根据已有的保持策略来进行删除

NOKEEP

Specifies that any KEEP attributes no longer apply to the backup. Thus, the backup is a normal backup that is subject to the configured backup retention policy. This is the default behavior if no KEEP option is specified.

 

QUESTION 145:

The Oracle Database 11g database is running in the ARCHIVELOG mode. The archived redo log files are stored on three locations. The Flash Recovery Area is one of the locations. The details are given below:

LOG_ARCHIVE_DEST_1 = 'LOCATION = /disk1/archive'

LOG_ARCHIVE_DEST_2 = 'SERVICE = stdb1'

DB_RECOVERY_FILE_DEST = '/u01/oradata'

Examine the following RMAN command issued to set the deletion policy for archived log files:

RMAN> CONFIGURE ARCHIVELOG DELETION POLICY

TO BACKED UP 2 TIMES TO sbt;

Which statement is true regarding what this command accomplishes?

A. All archived redo log files backed up at least twice to tape are deleted from the flash recovery area.

B. All archived redo log files in local archiving destinations and the flash recovery area backed up at least twice to tape are eligible for deletion.

C. All archived redo log files backed up at least once to tape are eligible for deletion.

D. All archived redo log files backed up at least twice to tape are deleted.

Answer: B

解析:

可以使用CONFIGURE ARCHIVELOG DELETION POLICY命令指定归档重做日志何时才能删除。该删除策略适用于所有归档目标,包括FRA

归档重做日志可由数据库自动删除,或因用户启动的RMAN 命令而删除:

• 只有FRA 中的日志可由数据库自动删除。对于FRA 中的归档重做日志文件,数据库将尽可能长地保留这些文件,并在需要额外磁盘空间时自动删除符合条件的日志。

• 发出BACKUP ... DELETE INPUT或DELETE ARCHIVELOG时,可以从任何位置(无论在FRA 内部还是外部)手动删除符合条件的日志。

• 默认值为:CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;

简化了多组件环境中的归档日志管理

当归档日志由多个组件(例如Streams)使用时,此功能简化了归档日志管理。它还提高了当快速恢复区中的归档日志丢失或无法访问时,备份归档日志时的可用性。

增强了删除策略的配置

仅当任何必需的组件(如Data Guard、Streams、Flashback Database,等等)都不需要归档重做日志时,才能将归档重做日志删除。配置了归档日志删除策略后,该配置会应用到所有归档目标,包括FRA。BACKUP... DELETE INPUT和DELETE... ARCHIVELOG都使用

此配置,FRA 也是。

备份恢复区时,如果FRA 中的归档重做日志无法访问或已损坏,则RMAN 可故障转移到其它归档重做日志目标位置。

 

QUESTION 146:

Examine the following PL/SQL block:

SET SERVEROUTPUT ON

SET LONG 10000

ECLARE report clob;

BEGIN

report := DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE();

DBMS_OUTPUT.PUT_LINE(report);

END;

Which statement describes the effect of the execution of the above PL/SQL block?

A. The nonaccepted plans in the SQL Management Base are verified with the existing plan baselines.

B. The plan baselines are verified with the SQL profiles.

C. All fixed plan baselines are converted into nonfixed plan baselines.

D. All the nonaccepted SQL profiles are accepted into the plan baseline.

Answer: A

参考Oracle官方文档:

http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_spm.htm#ARPLS68168

EVOLVE_SQL_PLAN_BASELINE Function

This function evolves SQL plan baselines associated with one or more SQL statements. A SQL plan baseline is evolved when one or more of its non-accepted plans is changed to an accepted plan or plans. If interrogated by the user (parameter verify = 'YES'), the execution performance of each non-accepted plan is compared against the performance of a plan chosen from the associated SQL plan baseline. If the non-accepted plan performance is found to be better than SQL plan baseline performance, the non-accepted plan is changed to an accepted plan provided such action is permitted by the user (parameter commit = 'YES').

The second form of the function employs a plan list format.

Syntax

DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE (

   sql_handle   IN VARCHAR2 := NULL,

   plan_name    IN VARCHAR2 := NULL,

   time_limit   IN INTEGER  := DBMS_SPM.AUTO_LIMIT,

   verify       IN VARCHAR2 := 'YES',

   commit       IN VARCHAR2 := 'YES')

  RETURN CLOB;

 

DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE (

   plan_list    IN DBMS_SPM.NAME_LIST,

   time_limit   IN INTEGER  := DBMS_SPM.AUTO_LIMIT,

   verify       IN VARCHAR2 := 'YES',

   commit       IN VARCHAR2 := 'YES')

  RETURN CLOB;

Parameters

Table 136-9 EVOLVE_SQL_PLAN_BASELINE Function Parameters

Parameter

Description

sql_handle

SQL statement identifier. Unless plan_name is specified, NULL means to consider all statements with non-accepted plans in their SQL plan baselines.

plan_name

Plan identifier. Default NULL means to consider all non- accepted plans in the SQL plan baseline of either the identified SQL statement or all SQL statements if sql_handle is NULL.

plan_list

A list of plan names. Each plan in the list can belong to same or different SQL statement.

time_limit

Time limit in number of minutes. This applies only if verify = 'YES'. The time limit is global and it is used as follows: The time limit for first non-accepted plan verification is set equal to the input value; the time limit for second non-accepted plan verification is set equal to (input value - time spent in first plan verification); and so on.

  • DBMS_SPM.AUTO_LIMIT (Default) lets the system choose an appropriate time limit based on the number of plan verifications required to be done.
  • DBMS_SPM.NO_LIMIT means there is no time limit.
  • A positive integer value represents a user specified time limit.

verify

Specifies whether to execute the plans and compare the performance before changing non-accepted plans into accepted plans. A performance verification involves executing a non-accepted plan and a plan chosen from corresponding SQL plan baseline and comparing their performance statistics. If non-accepted plan shows performance improvement, it is changed to an accepted plan.

  • 'YES' (Default) - verifies that a non-accepted plan gives better performance before changing it to an accepted plan
  • 'NO' - directs not to execute plans but only to change non-accepted plans into accepted plans

commit

Specifies whether to update the ACCEPTED status of non-accepted plans from 'NO' to 'YES'.

  • 'YES' (Default) - perform updates of qualifying non-accepted plans and generate a report that shows the updates and the result of performance verification when verify = 'YES'.
  • 'NO' - generate a report without any updates. Note that commit = 'NO' together with verify = 'NO' represents a no-op.

 

Return Values

CLOB containing a formatted text report showing non-accepted plans in sequence, each with a possible change of its ACCEPTED status, and if verify = 'YES' the result of their performance verification.

Usage Notes

Invoking this subprogram requires the ADMINISTER SQL MANAGEMENT OBJECT privilege.

 

QUESTION 147:

Which two are the prerequisites to enable Flashback Data Archive? (Choose two.)

A. Database must be running in archivelog mode.

B. Automatic undo management must be enabled.

C. Undo retention guarantee must be enabled.

D. The tablespace on which the Flashback Data Archive is created must be managed with Automatic Segment Space Management (ASSM).

Answer: B,D

参考Oracle官方文档:

http://docs.oracle.com/cd/E11882_01/appdev.112/e41502/adfns_flashback.htm#ADFNS01001

Oracle Flashback features use the Automatic Undo Management (AUM) system to obtain metadata and historical data for transactions. They rely on undo data, which are records of the effects of individual transactions. For example, if a user runs an UPDATE statement to change a salary from 1000 to 1100, then Oracle Database stores the value 1000 in the undo data.

Undo data is persistent and survives a database shutdown. By using flashback features, you can use undo data to query past data or recover from logical damage.

 

QUESTION 148:

The following command is executed to create the baseline template:

SQL> EXECUTE

DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE_TEMPLATE(START_TIME=>

TO_TIMESTAMP(SYSDATE+2),

END_TIME=>TO_TIMESTAMP(SYSDATE+10),

BASELINE_NAME=>'Mybase4',

TEMPLATE_NAME=>'Mytemp4',

EXPIRATION=>NULL);

Which statement is true about the effect of the above command?

A. It produces an error because no snapshot information is provided to create the baseline.

B. It creates a baseline template that expires after the Automatic Workload Repository (AWR) retention period.

C. It creates a baseline template that never expires.

D. It creates a repeating baseline template that repeats after the Automatic Workload Repository (AWR) retention period.

Answer: C

解析:参考Oracle官方文档

http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_workload_repos.htm#ARPLS69131

Parameters

Table 162-24 CREATE_BASELINE_TEMPLATE Procedure Parameters

Parameter

Description

start_time

Start Time for the baseline to be created'

end_time

End Time for the baseline to be created

baseline_name

Name of baseline to be created

template_name

Name for the template

expiration

Expiration in number of days for the baseline. If NULL, then expiration is infinite, meaning do not drop baseline ever. Defaults to NULL

dbid

Database Identifier for baseline. If NULL, this takes the database identifier for the local database. Defaults toNULL.

day_of_week

Day of week that the baseline should repeat on. Specify one of the following values: SUNDAYMONDAYTUESDAY,WEDNESDAYTHURSDAYFRIDAYSATURDAY.

hour_in_day

Value of 0-23 to specify the Hour in the Day the baseline should start

duration

Duration (in number of hours) after hour in the day that the baseline should last

baseline_name_prefix

Name for baseline prefix. When creating the baseline, the name of the baseline will be the prefix appended with the date information.

 

QUESTION 149:

An index called ORD_CUSTNAME_IX has been created on the CUSTNAME column in the ORDERS table using the following command:

SQL>CREATE INDEX ord_custname_ix ON orders(custname);

The ORDERS table is frequently queried using the CUSTNAME column in the WHERE clause.

You want to check the impact on the performance of the queries if the index is not available. You do not want the index to be dropped or rebuilt to perform this test. Which is the most efficient method of performing this task?

A. making the index invisible

B. making the index unusable

C. disabling the index

D. using the MONITORING USAGE clause for the index

Answer: A

 

Creating an Invisible Index

An invisible index is an index that is ignored by the optimizer unless you explicitly set the OPTIMIZER_USE_INVISIBLE_INDEXES initialization parameter to TRUE at the session or system level.

To create an invisible index: 

  • Use the CREATE INDEX statement with the INVISIBLE keyword.

 

QUESTION 150:

In your database, the RESULT_CACHE_MODE parameter has been set to MANUAL in the initialization parameter file.

You issued the following command:

SQL>SELECT /*+ RESULT_CACHE */ sale_category, sum(sale_amt)

FROM sales

GROUP BY sale_category;

Where would the result of this query be stored?

A. database buffer cache

B. shared pool

C. PGA

D. large pool

Answer: B

解析:参考Oracle官方文档

https://docs.oracle.com/database/121/REFRN/GUID-DEC2BDE4-8CF4-4378-A04C-6EE50A0FA250.htm#REFRN10270

RESULT_CACHE_MODE specifies when a Result Cache operator is spliced into a query's execution plan.

Values:

  • MANUAL

The Result Cache operator is added only when the query is annotated (that is, hints).

  • FORCE

The Result Cache operator is added to the root of all SELECT statements (provided that it is valid to do so).

Controls whether the database uses the SQL query result cache for all queries, or only for the queries that are annotated with the result cache hint. When set to MANUAL (the default), you must use the RESULT_CACHE hint to specify that a specific result is to be stored in the cache. When set to FORCE, the database stores all results in the cache.

When setting this parameter, consider how the result cache handles PL/SQL functions. The database invalidates query results in the result cache using the same mechanism that tracks data dependencies for PL/SQL functions, but otherwise permits caching of queries that contain PL/SQL functions. Because PL/SQL function result cache invalidation does not track all kinds of dependencies (such as on sequences, SYSDATE, SYS_CONTEXT, and package variables), indiscriminate use of the query result cache on queries calling such functions can result in changes to results, that is, incorrect results. Thus, consider correctness and performance when choosing to enable the result cache, especially when setting RESULT_CACHE_MODE to FORCE.

 

Shared Pool Concepts

The main components of the shared pool are the library cache, the dictionary cache, and, depending on your configuration, the server result cache. The library cache stores the executable (parsed or compiled) form of recently referenced SQL and PL/SQL code. The dictionary cache stores data referenced from the data dictionary. The server result cache stores the results of queries and PL/SQL function results.

Many of the caches in the shared pool automatically increase or decrease in size, as needed, including the library cache and the dictionary cache. Old entries are aged out to accommodate new entries when the shared pool does not have free space.

A cache miss on the data dictionary cache or library cache is more expensive than a miss on the buffer cache. For this reason, the shared pool should be sized to ensure that frequently used data is cached.

Several features make large memory allocations in the shared pool: for example, the shared server, parallel query, or Recovery Manager. Oracle recommends segregating the SGA memory used by these features by configuring a distinct memory area, called the large pool.

Allocation of memory from the shared pool is performed in chunks. This chunking enables large objects (over 5 KB) to be loaded into the cache without requiring a single contiguous area. In this way, the database reduces the possibility of running out of enough contiguous memory due to fragmentation.

Infrequently, Java, PL/SQL, or SQL cursors may make allocations out of the shared pool that are larger than 5 KB. To allow these allocations to occur most efficiently, Oracle Database segregates a small amount of the shared pool. This memory is used if the shared pool does not have enough space. The segregated area of the shared pool is called the reserved pool.

猜你喜欢

转载自blog.csdn.net/seagal890/article/details/83003005
今日推荐