Oracle OCP 1Z0-050(151-160题)解析

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

Oracle OCP 1Z0-050(151-160题)解析

QUESTION 151:

Exhibit:

View the Exhibit to examine the output for the V$DIAG_INFO view.

Which statements are true regarding the location of diagnostic traces? (Choose all that apply.)

A. The path to the location of the background as well as the foreground process trace

files is /u01/oracle/diag/rdbms/orclbi/orclbi/trace.

B. The location of the text alert log file is /u01/oracle/diag/rdbms/orclbi/orclbi/alert.

C. The location of the XML-formatted version of the alert log is

/u01/oracle/diag/rdbms/orclbi/orclbi/alert.

D. The location of the trace file for the current session is

/u01/oracle/diag/rdbms/orclbi/orclbi/trace.

Answer: A,C,D

解析:参考Oracle官方文档

http://docs.oracle.com/cd/E11882_01/server.112/e25494/diag.htm#ADMIN13483

B错,应该为 the text alert log file is /u01/oracle/diag/rdbms/orclbi/orclbi/trace

Subdirectory Name

Contents

alert

The XML-formatted alert log

cdump

Core files

incident

Multiple subdirectories, where each subdirectory is named for a particular incident, and where each contains dumps pertaining only to that incident

trace

Background and server process trace files, SQL trace files, and the text-formatted alert log

(others)

Other subdirectories of ADR home, which store incident packages, health monitor reports, and other information

Viewing ADR Locations with the V$DIAG_INFO View

The V$DIAG_INFO view lists all important ADR locations for the current Oracle Database instance.

The following table describes some of the information displayed by this view.

Table 9-3 Data in the V$DIAG_INFO View

SELECT * FROM V$DIAG_INFO;
 
INST_ID NAME                  VALUE
------- --------------------- -------------------------------------------------------------
      1 Diag Enabled          TRUE
      1 ADR Base              /u01/oracle
      1 ADR Home              /u01/oracle/diag/rdbms/orclbi/orclbi
      1 Diag Trace            /u01/oracle/diag/rdbms/orclbi/orclbi/trace
      1 Diag Alert            /u01/oracle/diag/rdbms/orclbi/orclbi/alert
      1 Diag Incident         /u01/oracle/diag/rdbms/orclbi/orclbi/incident
      1 Diag Cdump            /u01/oracle/diag/rdbms/orclbi/orclbi/cdump
      1 Health Monitor        /u01/oracle/diag/rdbms/orclbi/orclbi/hm
      1 Default Trace File    /u01/oracle/diag/rdbms/orclbi/orclbi/trace/orcl_ora_22769.trc
      1 Active Problem Count  8
      1 Active Incident Count 20

Name

Description

ADR Base

Path of ADR base

ADR Home

Path of ADR home for the current database instance

Diag Trace

Location of background process trace files, server process trace files, SQL trace files, and the text-formatted version of the alert log

Diag Alert

Location of the XML-formatted version of the alert log

Default Trace File

Path to the trace file for the current session

 

QUESTION 152:

Evaluate the following command and its output:

SQL>SELECT * FROM dba_temp_free_space;

TABLESPACE_NAME TABLESPACE_SIZE  ALLOCATED_SPACE  FREE_SPACE

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

LMTEMP                      250609664                  101048576                  149561088

Which two statements correctly interpret the output? (Choose two.)

A. FREE_SPACE indicates both the space that is currently allocated and available for reuse, and the space that is currently unallocated.

B. ALLOCATED_SPACE indicates only the space currently allocated and in use.

C. ALLOCATED_SPACE indicates both the space currently allocated and used, and the space that is available for reuse.

D. FREE_SPACE indicates only the space that is currently unallocated.

E. FREE_SPACE indicates only the space that is currently allocated and available for reuse.

Answer: A,C

解析:

参考Oracle官方文档:

http://docs.oracle.com/cd/E11882_01/server.112/e40402/statviews_5062.htm#REFRN23627

DBA_TEMP_FREE_SPACE displays temporary space usage information at tablespace level.

Column

Datatype

NULL

Description

TABLESPACE_NAME

VARCHAR2(30)

NOT NULL

Name of the tablespace

TABLESPACE_SIZE

NUMBER

 

Total size of the tablespace, in bytes

ALLOCATED_SPACE

NUMBER

 

Total allocated space, in bytes, including space that is currently allocated and used and space that is currently allocated and available for reuse

FREE_SPACE

NUMBER

 

Total free space available, in bytes, including space that is currently allocated and available for reuse and space that is currently unallocated

 

QUESTION 153:

Evaluate the following block of code:

BEGIN

DBMS_NETWORK_ACL_ADMIN.CREATE_ACL (

acl => 'mycompany-com-permissions.xml',

principal => 'ACCT_MGR',

is_grant => TRUE,

privilege => 'connect');

DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (

acl => 'mycompany-com-permissions.xml',

host => '*.mycompany.com');

END;

What is the outcome of the above code?

A. It creates an access control list (ACL) with the user ACCT_MGR who gets the CONNECT privilege but not the RESOLVE privilege.

B. It creates an access control list (ACL) with the user ACCT_MGR who gets the CONNECT and RESOLVE privileges.

C. It produces an error because a fully qualified host name needs to be specified.

D. It produces an error because the range of ports associated with the hosts has not been specified.

Answer: B

解析:

创建访问控制列表(ACL)。ACL 是在XML 文件中保存的用户和权限的列表。以acl参数命名的XML 文档与XML DB中的/sys/acl/文件夹相关。在题中例中,ACCT_MGR被授予connect权限。ACL 中的用户名区分大小写,而且必须与会话的用户名相匹配。只有resolve和connect权限,connect权限包含resolve权限。可选参数可以指定这些权限的开始和结束时间戳。要将更多用户和权限添加到此ACL 中,可使用ADD_PRIVILEGE过程。

 

QUESTION 154:

Which statement is true regarding the retention policy for the incidents accumulated in the Automatic Diagnostic Repository (ADR)?

A. The incident files are retained but the incident metadata is purged when the problem is resolved and the DBA closes the SR

B. The incident files and dumps are not retained in the ADR for the manually created incidents.

C. The incident metadata is purged when the problem is resolved and the DBA closes the SR.

D. The default setting is for one year after which the incident metadata is purged from the ADR and the files are retained for one month.

Answer: D

解析:

默认设置为事件元数据从自动诊断信息库中被清除之后一年,并且文件保留一个月。

 

QUESTION 155:

You need to create a partitioned table to store historical data and you issued the following

command:

CREATE TABLE purchase_interval

PARTITION BY RANGE (time_id)

INTERVAL (NUMTOYMINTERVAL(1,'month')) STORE IN (tbs1,tbs2,tbs3)

(

PARTITION p1 VALUES LESS THAN(TO_DATE('1-1-2005', 'dd-mm-yyyy')),

PARTITION p2 VALUES LESS THAN(TO_DATE('1-1-2007', 'dd-mm-yyyy')))

AS

SELECT *

FROM purchases

WHERE time_id < TO_DATE('1-1-2007','dd-mm-yyyy');

What is the outcome of the above command?

A. It creates two range partitions of varying range. For data beyond '1-1-2007,' it creates partitions with a width of one month each.

B. It returns an error because the number of tablespaces (TBS1,TBS2,TBS3)specified does not match the number of range partitions (P1,P2) specified.

C. It returns an error because the range partitions P1 and P2 should be of the same range.

D. It creates two range partitions (P1, P2). Within each range partition, it creates monthwise subpartitions.

Answer: A

解析:

INTERVAL Clause

Use this clause to establish interval partitioning for the table. Interval partitions are partitions based on a numeric range or datetime interval. They extend range partitioning by instructing the database to create partitions of the specified range or interval automatically when data inserted into the table exceeds all of the range partitions.

Interval Partitioning Example The following example creates a variation of the oe.customers table that is partitioned by interval on the credit_limit column. One range partition is created to establish the transition point. All of the original data in the table is within the bounds of the range partition. Then data is added that exceeds the range partition, and the database creates a new interval partition.

CREATE TABLE customers_demo (

  customer_id number(6),

  cust_first_name varchar2(20),

  cust_last_name varchar2(20),

  credit_limit number(9,2))

PARTITION BY RANGE (credit_limit)

INTERVAL (1000)

(PARTITION p1 VALUES LESS THAN (5001));

 

INSERT INTO customers_demo

  (customer_id, cust_first_name, cust_last_name, credit_limit)

  (select customer_id, cust_first_name, cust_last_name, credit_limit

  from customers);

Query the USER_TAB_PARTITIONS data dictionary view before the database creates the interval partition:

SELECT partition_name, high_value FROM user_tab_partitions  WHERE table_name = 'CUSTOMERS_DEMO';

 

PARTITION_NAME                 HIGH_VALUE

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

P1                             5001

Insert data into the table that exceeds the high value of the range partition:

INSERT INTO customers_demo

  VALUES (699, 'Fred', 'Flintstone', 5500);

Query the USER_TAB_PARTITIONS view again after the insert to learn the system-generated name of the interval partition created to accommodate the inserted data. (The system-generated name will vary for each session.)

SELECT partition_name, high_value FROM user_tab_partitions

  WHERE table_name = 'CUSTOMERS_DEMO'

  ORDER BY partition_name;

 

PARTITION_NAME                 HIGH_VALUE

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

P1                             5001

SYS_P44                        6001

 

QUESTION 156:

Which two statements are true regarding the SQL Repair Advisor? (Choose two.)

A. The SQL Repair Advisor is invoked by the Health Monitor when it encounters the problematic SQL statement.

B. The SQL Repair Advisor can be invoked even when the incident is not active for a SQL statement crash.

C. The DBA can invoke the SQL Repair Advisor when he or she receives an alert generated when a SQL statement crashes and an incident is created in the ADR.

D. The SQL Repair Advisor can be invoked to tune the performance of the regressed SQL statements.

Answer: B,C

解析:

SQL Repair Advisor 只能用来修改错误,不能用于优化,可修改not active的sql。
SQL Repair Advisor 不能用于修改语法错误的语句,只能用于修复”不良“sql引出的 ORA 0600 或 ORA 7445等问题

health check 不包括sql 的 critical error,见:

 http://docs.oracle.com/cd/E11882_01/server.112/e25494/diag.htm#ADMIN11270

Types of Health Checks

Health monitor runs the following checks:

  • DB Structure Integrity Check—This check verifies the integrity of database files and reports failures if these files are inaccessible, corrupt or inconsistent. If the database is in mount or open mode, this check examines the log files and data files listed in the control file. If the database is inNOMOUNT mode, only the control file is checked.
  • Data Block Integrity Check—This check detects disk image block corruptions such as checksum failures, head/tail mismatch, and logical inconsistencies within the block. Most corruptions can be repaired using Block Media Recovery. Corrupted block information is also captured in theV$DATABASE_BLOCK_CORRUPTION view. This check does not detect inter-block or inter-segment corruption.
  • Redo Integrity Check—This check scans the contents of the redo log for accessibility and corruption, as well as the archive logs, if available. The Redo Integrity Check reports failures such as archive log or redo corruption.
  • Undo Segment Integrity Check—This check finds logical undo corruptions. After locating an undo corruption, this check uses PMON and SMON to try to recover the corrupted transaction. If this recovery fails, then Health Monitor stores information about the corruption in V$CORRUPT_XID_LIST. Most undo corruptions can be resolved by forcing a commit.
  • Transaction Integrity Check—This check is identical to the Undo Segment Integrity Check except that it checks only one specific transaction.
  • Dictionary Integrity Check—This check examines the integrity of core dictionary objects, such as tab$ and col$. It performs the following operations:
    • Verifies the contents of dictionary entries for each dictionary object.
    • Performs a cross-row level check, which verifies that logical constraints on rows in the dictionary are enforced.
    • Performs an object relationship check, which verifies that parent-child relationships between dictionary objects are enforced.

The Dictionary Integrity Check operates on the following dictionary objects:

tab$clu$fet$uet$seg$undo$ts$file$obj$ind$icol$col$user$con$cdef$ccol$bootstrap$objauth$ugroup$tsq$syn$view$,typed_view$superobj$seq$lob$coltype$subcoltype$ntab$refcon$opqtype$dependency$access$viewcon$icoldep$dual$sysauth$objpriv$,defrole$, and ecol$.
http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_sqldiag.htm#ARPLS203

About the SQL Repair Advisor

You run the SQL Repair Advisor after a SQL statement fails with a critical error. The advisor analyzes the statement and in many cases recommends a patch to repair the statement. If you implement the recommendation, the applied SQL patch circumvents the failure by causing the query optimizer to choose an alternate execution plan for future executions.

Running the SQL Repair Advisor

You run the SQL Repair Advisor by creating and executing a diagnostic task using the CREATE_DIAGNOSIS_TASK and EXECUTE_DIAGNOSIS_TASK respectively. The SQL Repair Advisor first reproduces the critical error and then tries to produce a workaround in the form of SQL patch.

  1. Identify the problem SQL statement

Consider the SQL statement that gives a critical error:

DELETE FROM t t1 WHERE t1.a = 'a' AND ROWID <> (SELECT MAX(ROWID) FROM t t2 WHERE t1.a= t2.a AND t1.b = t2.b AND t1.d=t2.d)

You use the SQL Repair advisor to repair this critical error.

  1. Create a diagnosis task

Invoke DBMS_SQLDIAGCREATE_DIAGNOSIS_TASK. You can specify an optional task name, an optional time limit for the advisor task, and problem type. In the example below, we specify the SQL text, the task name as 'error_task' and a problem type as 'DBMS_SQLDIAG.PROBLEM_TYPE_COMPILATION_ERROR'.

DECLARE
    rep_out         CLOB;
    t_id            VARCHAR2(50);
  BEGIN
    t_id := DBMS_SQLDIAG.CREATE_DIAGNOSIS_TASK( 
      sql_text => 'DELETE FROM t t1 WHERE t1.a = ''a'' AND ROWID <> (SELECT MAX(ROWID) FROM t t2 WHERE t1.a= t2.a AND t1.b = t2.b AND t1.d=t2.d)',
      task_name => 'error_task',
      problem_type =>DBMS_SQLDIAG.PROBLEM_TYPE_COMPILATION_ERROR);
  1. Execute the diagnosis task

To execute the workaround generation and analysis phase of the SQL Repair Advisor, you call DBMS_SQLDIAG.EXECUTE_DIAGNOSIS_TASK with the task ID returned by the CREATE_DIAGNOSIS_TASK. After a short delay, the SQL Repair Advisor returns. As part of its execution, the SQL Repair Advisor keeps a record of its findings which can be accessed through the reporting facilities of SQL Repair Advisor.

DBMS_SQLDIAG.EXECUTE_DIAGNOSIS_TASK (t_id);
  1. Report the diagnosis task

The analysis of the diagnosis task is accessed through dbms_sqldiag.report_diagnosis_task. If the SQL Repair Advisor was able to find a workaround, it recommends a SQL Patch. A SQL Patch is similar to a SQL profile but unlike the SQL Profile, it is used to workaround compilation or execution errors.

rep_out := DBMS_SQLDIAG.REPORT_DIAGNOSIS_TASK (t_id, DBMS_SQLDIAG.TYPE_TEXT)
 
  DBMS_OUTPUT.PUT_LINE ('Report : ' ||  rep_out);
 
  END;
  /
  1. Applying the patch

If a patch recommendation is present in the report, you can run the ACCEPT_SQL_PATCH command to accept the patch by invokingDBMS_SQLDIAG.ACCEPT_SQL_PATCH. This procedure takes the task_name as an argument.

EXECUTE DBMS_SQLDIAG.ACCEPT_SQL_PATCH(task_name => 'error_task', task_owner => 'SYS', replace => TRUE);
  1. Test the patch

Now that you have accepted the patch, you can rerun the SQL statement. This time, it will not give you the critical error. If you run 'explain plan' for this statement, you will see that a SQL patch was used to generate the plan.

DELETE FROM t t1 WHERE t1.a = 'a' AND ROWID <> (select max(rowid) FROM t t2 WHERE t1.a= t2.a AND t1.b = t2.b AND t1.d=t2.d);

 

QUESTION 157:

You need to perform an online table redefinition of an existing SALES table to partition it into two tablespaces TBS1 and TBS2.

The SALES table has a materialized view, materialized log, indexes, referential integrity constraint, and triggers with the PRECEDES clause existing on it.

What action is required for dependent objects when you perform online table redefinition?

A. The dependent materialized view should have a complete refresh performed after the online table redefinition process.

B. Triggers with the PRECEDES clause should be disabled before the online table redefinition process.

C. Referential integrity constraints must be manually enabled after the online table redefinition process.

D. The materialized log should be dropped before the online table redefinition process.

Answer: A

 

QUESTION 158:

You are managing an Oracle Database 11g database with the ASM storage. The database is having big file tablespaces. You want files to open faster and less memory to be used in the shared pool to manage the extent maps. What configuration would you effect to achieve your objective? (Choose all that apply.)

A. Set the COMPATIBLE initialization parameter for the ASM instance to 11.1.0.

B. Set the COMPATIBLE initialization parameter for the database instance to 11.1.0.

C. Set the ASM compatibility attribute for the ASM disk group to 11.1.0.

D. Set the RDBMS compatibility attribute for the ASM disk group to 11.1.0.

Answer: B,C

 

QUESTION 159:

You issued the following RMAN command to back up the database:

RMAN> RUN{

ALLOCATE CHANNEL c1

DEVICE TYPE sbt

BACKUP DATABASE

TAG quarterly

KEEP FOREVER

RESTORE POINT FY06Q4;}

Which two statements are true regarding the backup performed? (Choose two.)

A. Archived redo log files are backed up along with data files.

B. Archived log files are backed up along with data files, and the archived log files are deleted.

C. The command creates a restore point named FY06Q4 to match the SCN at which this backup is consistent.

D. Only data files are backed up and a restore point named FY06Q4 is created.

Answer: A,C

 

QUESTION 160:

The OPTIMIZER_USE_PLAN_BASELINES parameter is set to TRUE. The optimizer generates a plan for a SQL statement but does not find a matching plan in the SQL plan baseline. Which two operations are performed by the optimizer in this scenario? (Choose two.)

A. The optimizer adds the new plan to the plan history.

B. The optimizer selects the new plan for the execution of the SQL statement.

C. The optimizer adds the new plan to the SQL plan baseline as an accepted plan.

D. The optimizer costs each of the accepted plans in the SQL plan baseline and picks the one with the lowest cost.

E. The optimizer adds the new plan to the SQL plan baseline but not in the ENABLED state.

Answer: A,D

 

猜你喜欢

转载自blog.csdn.net/seagal890/article/details/83004493