042详解 1-50题

来源:互联网 发布:mac os 10.13下载地址 编辑:程序博客网 时间:2024/05/22 06:34

声明:所有解析都限于本人的水平,不具权威性


1. Which three pieces of information are considered while deciding the size of the undo tablespace in your database? (Choose three.) 

A) the size of an undo block 

B) the size of the redo log files 

C) undo blocks generated per second 

D) the size of the database buffer cache 

E) the value of the UNDO_RETENTION parameter

答案:A C E

解析:题目说的是决定UNDO表空间大小的三条这题定性分析就可以了,UNDO 表空间是用来记录事务数据的.

A.每个UNDO 块的大小 

B.不对与redo log 无关

C.每秒生成的UNDO块的量 这个越大UNDO 表空间就要越大

D.buffer cache无关

E.UNDO_retention : 在事务提交以后,UNDO 数据为一致性读还要保留多长时间.当然保留时间越长UNDO表空间就越大.


2. You executed the STARTUP MOUNT command to start your database. For which database operation do you need to start the database in the MOUNT state? 

A) renaming the control files 

B) dropping a user in your database 

C) enabling or disabling redo log archiving 

D) dropping a tablespace in your database 

E) re-creating the control files, after you lost all the control files in your database 

答案:C

解析:数据库启动顺序,首先是nomount--读取参数文件,mount--根据参数文件打开控制文件,open=根据控制文件打开数据文件,打开数据库.所以说在mount阶段是可以改变datafileredo log file的名称的。在mount阶段,你可以修改数据文件的名字,同时也可以把数据改为归档或者非归档模式


3. You want to create a new optimized database for your transactional production environment to be used by a financial application. While creating the database, you want the Oracle software to take care of all basic settings to optimize the database performance. Which method would you use to achieve this objective? 

A) Use the CREATE DATABASE.. command to create the database with Oracle-managed files. 

B) Use the Database Configuration Assistant (DBCA) to create the database with Oracle-managed files. 

C) Use Enterprise Manager to create a new database with the Online Transaction Processing (OLTP) option. 

D) Use Database Configuration Assistant (DBCA) to create the database with Transaction Processing template. 

E) Use the CREATE DATABASE.. command to create the database with Automatic Storage Management (ASM) file system. 

答案:D

解析:the key of this question is transactional production environment(交易生产环境)It seems to me that OLTP(on-line trasaction production) is needed. So ,you must create the OLTP db.Answer A/B/E does not meet the requirement of the question.Answer C is wrong.OEM cant create db.


4. Which three statements are true about the stages of database startup? (Choose three.) 

A) Data files and redo log files can be renamed at the MOUNT stage. 

B) Control files are read at the OPEN stage for the location of data files. 

C) Control files are required to bring the database to the NOMOUNT stage. 

D) Data files and redo log files are made available to users at the OPEN stage. 

E) Data files and online redo log files are checked for consistency while opening the database (一致性检查)

答案:A D E

解析:数据库开启和关闭详解


5. A constraint in a table is defined with the INITIALLY IMMEDIATE clause. You executed the ALTER TABLE command with the ENABLE VALIDATE option to enable the constraint that was disabled. 

What are the two effects of this command? (Choose two.) 

A) It fails if any existing row violates the constraint. 

B) It does not validate the existing data in the table. 

C) It enables the constraint to be enforced at the end of each transaction. 

D) It prevents insert, update, and delete operations on the table while the constraint is in the process of being enabled.

答案:A D

解析:约束状态--约束一共有四种状态 

a、enable validate-要求新旧数据必须同时满足约束规则-在规则正在进行中时是不容许在表上进行任何DML操作的 

b、enable novalidate-已存在数据可以不满足,但是新数据必须满足 

c、disable validate-不容许在表上进行任何DML操作,对主键和唯一约束来说,会删除相应的唯一索引,但约束规则仍然有效 

d、disable novalidate-数据不满足约束规则,对主键和唯一约束来说,会删除相应的唯一索引 

初始化立即执行--在每条语句执行结束时检验约束 

初始化延迟执行,一直等到事务完成后(或者调用set constraint immediate语句时)才检验约束 

SQL> create table t( x int constraint check_x check ( x > 0 ) deferrable initially immediate, 

y int constraint check_y check ( y > 0 ) deferrable initially deferred ) SQL> insert into t values ( -1,1); 

insert into t values ( -1,1);0ERROR at line 1: ORA-02290: check constraint (OPS$TKYTE.CHECK_X) violated 

由于CHECK_X是可延迟但初始化为立即执行的约束,所以这一行立刻被拒绝了。而CHECK_Y则不同,它不仅是可延迟的,而且初始化为延迟执行,这就意味着直到我用COMMIT命令提交事务或将约束状态设置为立即执行时才检验约束。 

SQL> insert into t values ( 1,-1); 现在它是成功的(总之到目前为止是成功的)。我将约束检验延迟到了执行COMMIT的时候: 

SQL> commit; 

0ERROR at line 1: ORA-02091: transaction rolled back 

ORA-02290: check constraint (OPS$TKYTE.CHECK_Y) violated 

此时数据库将事务回滚,因为违反约束导致了COMMIT语句的失败。这些语句说明了初始化立即执行与初始化延迟执行约束之间的区别。initially(初始化)部分指定Oracle什么时候会进行默认的约束检验--是在语句结束时[immediate(立即执行)],还是在事务结束时[deferred(延迟执行)]。我还要说明deferred(可延迟)子句有什么用。我可以发出命令,让所有可延迟的约束变为延迟执行的。注意,你也可以对一个约束使用该命令,你不必让所有可延迟的约束都变为延迟执行的: 

SQL>set constraints all deferred; 或者 SQL> set constraints all immediate; 

延迟约束有哪些实际用处呢? 有很多。它主要用于物化视图(快照)。这些视图会使用延迟约束来进行视图刷新。在刷新物化视图的过程中,可能会破坏完整性,而且将不能逐句检验约束。但到执行COMMIT时,数据完整性就没问题了,而且能满足约束。没有延迟约束,物化视图的约束可能会使刷新过程不能成功进行。使用延迟约束的另一个普遍原因是,当预测是否需要更新父/子关系中的主键时,它有助于级联更新。如果你将外键设为可延迟、但初始化为立即执行,那么你就可以将所有约束设置为可延迟。 将父键更新为一个新值--至此子关系的完整性约束不会被验证。将子外键更新为这个新值。 COMMIT--只要所有受更新影响的子记录都指向现有的父记录,这条命令就能成功执行。 


6. You received complaints about the degradation of SQL query performance. You identified top SQL queries that consume time. What would be your next step to find out recommendations about statistics collection and restructuring of the SQL statement to improve query performance? 

A) run Segment Advisor 

B) run SQL Tuning Advisor on top SQL statements 

C) run the Automatic Workload Repository (AWR) report 

D) run the Automatic Database Diagnostic Monitor (ADDM) on top SQL statements 

答案:B

解析:当你发现sql执行慢等sql问题时,你使用top sql发现耗费时间的sql语句。这是你需要使用SQL Tuning Advisor推荐数据收集和重建sql语句。 可以使用 SQL 优化指导分析 SQL 语句,并获得性能建议案。通常,会将此指导作为ADDM 性能判断工具来运行。 addm:auto database diagonstic(诊断) monitor 提供建议 


7. The UNDO_RETENTION parameter in your database is set to 1000 and undo retention is not guaranteed. 

Which statement regarding retention of undo data is correct? 

A) Undo data becomes obsolete after 1,000 seconds. 

B) Undo data gets refreshed after every 1,000 seconds. 

C) Undo data will be stored permanently after 1,000 seconds. 

D) Committed undo data would be retained for 1,000 seconds if free undo space is available. 

E) Undo data will be retained in the UNDO tablespace for 1,000 seconds, then it gets moved to the TEMPORARY tablespace to provide read consistency. 

答案:D

解析:UNDO_RETENTION=1000s undo retention is not guaranteed Committed的undo数据会在undo表空间中保留1000s,只要undo 表空间有空闲undo表空间够用 



8. View the Exhibit. 

Which statement regarding the dept and emp tables is true? 

A) When you delete a row from the emp table, you would receive a constraint violation error. 

B) When you delete a row from the dept table, you would receive a constraint violation error. 

C) When you delete a row from the emp table, automatically the corresponding rows are deleted from the dept table. 

D) When you delete a row from the dept table, automatically the corresponding rows are deleted from the emp table. 

E) When you delete a row from the dept table, automatically the corresponding rows are updated with null values in the emp table. 

F) When you delete a row from the emp table, automatically the corresponding rows are updated with null values in the dept table.

答案:D

解析:on delete cascade 级联删除  主表dept删除一条记录,则emp表相关联的记录也被删除

9. Which three statements are correct about temporary tables? (Choose three.) 

A) Indexes and views can be created on temporary tables. 

B) Both the data and the structure of temporary tables can be exported. 

C) Temporary tables are always created in a user's temporary tablespace. 

D) The data inserted into a temporary table in a session is available to other sessions. 

E) Data manipulation language (DML) locks are never acquired on the data of temporary tables.

答案:A C E

解析:可以对临时表创建索引,视图,触发器,可以用export和import工具导入导出表的定义,但是不能导出数据。表的定义对所有的会话可见。建立在临时表上的索引也是临时的,也是只对当前会话或者事务有效. 尽管对临时表的DML操作速度比较快,但同样也是要产生 Redo Log 。D,E都一个道理,不存在并发,就不存在锁,每个人看到的都是自己的东西 。临时表的数据只在一个transaction或session中有效,对数据操作不需要DML锁、速度快,对临时表可以创建索引、视图、触发器。 一个用户的临时表就放在当前用户的临时表空间中,创建临时表后并不产生任何segments分配,与普通表不同。 

10. Which statement regarding the contents of the V$PARAMETER view is true? 

A) displays only the list of default values 

B) displays only the list of all basic parameters 

C) displays the currently in effect parameter values 

D) displays only the list of all advanced parameters 

E) displays the list of all the parameter files of a database 

F) displays the current contents of the server parameter file 

答案:C

解析:V$PARAMETER只是显示现在起作用的参数(currently in effect parameter values)


11.According to your backup strategy, you performed an incremental level 0 backup of your database. Which 

statement regarding this backup is true? 

A) The backup is similar to image copy. 

B) The backup contains all used data blocks. 

C) The backup contains only unused data blocks. 

D) The backup contains all data blocks changed since the last incremental level 1 backup. 

答案:B

解析:备份分为完全备份和增量备份

完全备份:创建所备份的文件中包含数据的所有数据块的副本

增量备份:创建一个包含自以前某次备份以来更改过的所有数据块的副本(分为级别0和级别1两种)

级别0:等同于完全备份

级别1:

累积备份:备份自上次级别 0 备份以来的所有更改

差异备份:备份自上次增量备份以来的所有更改(可以采用级别 0 或级别1)

12.Which step do you need to perform to enable a user with the SYSDBA privilege to log in as SYSDBA in 

iSQL*Plus? 

A) The user must be granted the database administrator (DBA) privilege. 

B) The user must be listed in the password file for the authentication. 

C) No special setup is needed for the user to connect as SYSDBA in iSQL*Plus. 

D) Set up a user in the Oracle Application Server Containers for J2EE (OC4J) user manager, and grant the webDba 

role to the user 

答案:D

解析:isql*plus不能登录DBA身份,按D的步骤所做就可以了

13. Because of a power outage, instance failure has occurred. From what point in the redo log does recovery 

begin and where does it end? 

A) current redo log and inactive redo log 

B) checkpoint position to end of redo log 

C) beginning of redo log to end of redo log 

D) all redo logs before the point of last commit 

E) beginning of redo log to checkpoint position 

答案:B

解析:Checkpoint 之前的数据已经写入到数据文件。 所以用restore 就可以恢复。 而checkpoint之后的数据没有写入到数据文件,所以需要进行recovery。 Recovery时,对于已经commit的数据,前滚写入到数据文件,没有commit的数据,进行回滚。 

Oracle数据库中,对BUFFER CAHCE的修改操作是前台进程完成的,但是前台进程只负责将数据块从数据文件中读到BUFFER CACHE中,不负责BUFFER CACHE写入数据文件。BUFFER CACHE写入数据文件的操作是由后台进程DBWR来完成的。DBWR可以根据系统的负载情况以及数据块是否被其他进程使用来将一部分数据块回写到数据文件中。这种机制下,某个数据块被写回文件的时间可能具有一定的随机性的,有些先修改的数据块可能比较晚才被写入数据文件。而CHECKPOINT机制就是对这个机制的一个有效的补充,CHECKPOINT发生的时候,CKPT进程会要求DBWR进程将某个SCN以前的所有被修改的块都被写回数据文件。这样一旦这次CHECKPOINT完成后,这个SCN前的所有数据变更都已经存盘,如果之后发生了实例故障,那么做实例恢复的时候,只需要从这次CHECKPOINT已经完成后的变化量开始就行了,CHECKPOINT之前的变化就不需要再去考虑了。 

Commit仅仅写日志文件,而不写数据文件 

14. Which two statements are true regarding the database in ARCHIVELOG mode? (Choose two.) 

A) You have to shut down the database to perform the backups. 

B) Archiving information is written to the data files and redo log files. 

C) You can perform complete database backups without closing the database. 

D) Online redo log files have to be multiplexed before putting the database in ARCHIVELOG mode. 

E) All the previous database backups become invalid after you configure the database to ARCHIVELOG mode. 

答案:C  E

解析:使用archivelog mode可以进行联机备份,启动后使得之前的备份无效

15. User Scott has updated the salary of one of the employees in the EMPLOYEES table and has not committed 

the transaction. What are the two types of locks that this scenario would lead to? (Choose two.) 

A) null lock on the row being updated 

B) null lock on the table containing the row 

C) ROW SHARE lock for the row being updated 

D) ROW EXCLUSIVE lock for the row being updated 

E) shared row-exclusive lock for the row being updated 

F) a shareable table lock for the table containing the row 

G) exclusive table-level lock for the table containing the row 

答案:D  F

解析:D意思是被更新记录是Exclusive lock(排它锁),F是shared table lock。 

16. You notice this warning in the alert log file: 

ORA-19815: WARNING: db_recovery_file_dest_size of 3221225472 bytes is 100.00% used, and has 0 

remaining bytes available. 

What would you do to reclaim the used space in the Flash Recovery Area? 

A) Back up the Flash Recovery Area. 

B) Increase the retention time for the files. 

C) Decrease the retention time for the files. 

D) Manually delete all the archived log files from the Flash Recovery Area by using operating system (OS) commands. 

答案:A C

解析:

1. Add disk space and increase DB_RECOVERY_FILE_DEST_SIZE. 

2. Backup files to tertiary device using RMAN. 

3. Consider changing RMAN retention policy. 

4. Consider changing RMAN archivelog deletion policy. 

5. Delete files from recovery area using RMAN. 

6. 将归档设置到其他目录,修改alter system set log_archive_dest = 其他路径 可事先用show parameter log_archive_dest查看 

When you see the step 3,you will know why answer C is right. 

如果是归档到闪回区的,你在os上手工删除后,rman仍然认为是available,rman还是认为那文件存在,只有执行了crosscheck才会将available转成expired,delete expired后,rman就不会觉得那空间还没占用的 

crosscheck archivelog all; delete expired archivelog all; 


17. View the Exhibit and examine the output. 

Which statement describes the conclusion? 

A) The users should use bind variables instead of literals in the query. 

B) The dictionary cache is consuming more space than the library cache. 

C) The shared pool size should be increased to accommodate the SQL statements. 

D) Preparing indexes on the tables used in the SQL statements would improve the library cache performance. 

答案:A

解析:查询了多个单一变量,可以使用绑定变量


18. Which two operations require undo data? (Choose two.) 

A) committing a transaction 

B) rolling back a transaction 

C) recovering from failed transactions 

D) recording a transaction to redo log files 

E) rolling forward during instance recovery 

答案:B  C

解析:Undo 里保存的数据前镜像,即数据修改之前,先将原始数据保存在undo里。 而redo 记录的是事务。因为undo含有事务的数据,rollback的时候用到,事务恢复也会用到 

rolling forward during instance recovery 用的是redo 

老白的介质恢复和实例试验: 

对于介质恢复和实例恢复来说,第一个步骤都是通过REDO LOG的信息进行前滚,在做前滚的时候,通过REDO LOG文件里记录的数据库变化矢量(稍后我们会详细的介绍数据库变化矢量CV),根据SCN的比对,提交到相关的数据文件上,从而使数据文件的状态向前滚动。大家要注意的是,UNDO表空间的变化也被记录到REDO LOG里了,因此UNDO表空间相关的数据文件也会被前滚。当前滚到最后一个可用的REDO LOG或者归档日志的时候,所有的数据库恢复层面的工作就全部完成了。这个时候,数据库包含了所有的被记录的变化,这些变化中有些是已经提交,有些是

尚未提交的。在最新状态的UNDO表空间中,我们也可以看到一些尚未提交的事务。因此数据库下一步需要做的事情是事务层面的处理,回滚那些尚未提交的事务,以确保数据库的一致性。 

首先是在实例故障时,可能某些事物对数据文件的修改并没有完全写入磁盘,可能磁盘文件中丢失了某些已经提交事务对数据文件的修改信息。其次是可能某些还没有提交的事务对数据文件的修改已经被写入磁盘文件了。也有可能某个原子变更的部分数据已经被写入文件,而部分数据还没有被写入磁盘文件。实例恢复就是要通过ONLINE REDO LOG文件中记录的信息,自动的完成上述数据的修复工作。这个过程是完全自动的,不需要人工干预。 

ora-600说过:实例恢复的过程就是 前滚(redo)打开 回滚(undo) 

实例恢复: 启动的时候,从某个点把日志文件里内容完全写到数据文件,打开,把没有提交的rollback 


19. Your database is configured in NOARCHIVELOG mode. All the control files have been lost due to a hard 

disk failure but the data files are not lost. You have the closed whole database backup available to you. Which 

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

A) The instance aborts. 

B) The database cannot be recovered. 

C) The database can be recovered by restoring the control files from the backup. 

D) The database remains opened and you have to shut it down with the ABORT option. 

E) The database can be restored till the point of the last closed whole database backup. 

答案:A  E

解析:运行于非归档模式。所有控制文件丢失。数据库关闭。只有最近的一次数据库全库备份。那么数据库只能恢复到最后一次备份,尽管数据文件并未丢失 


20. Which is the correct description of the significance of the ORACLE_HOME environmental variable? 

A) It specifies the directory containing the Oracle software. 

B) It specifies the directory containing the Oracle-Managed Files. 

C) It specifies the directory for database files, if not specified explicitly. 

D) It specifies the base directory of Optimal Flexible Architecture (OFA) 

答案:

解析:ORACLE_HOME=$ORACLE_BASE/product/version 

ORACLE_BASE是oracle的根目录,ORACLE_HOME是oracle产品的目录。 


21. While running the Oracle Universal Installer on a Unix platform to install Oracle 

Database 10g software, you are prompted to run orainstRoot.sh script. What does this script accomplish? 

A) It creates the pointer file. 

B) It creates the base directory. 

C) It creates the Inventory pointer file. 

D) It creates the Oracle user for installation. 

E) It modifies the Unix kernel parameters to match Oracle's requirement. 

答案:C

解析:Inventory:详细目录 

可以查看$ORACLE_BASE/oraInventory/orainstRoot.sh 脚本的内容。该脚本实际上完成了以下工作: 

(1)创建software inventory location pointer file: /etc/oraInst.loc,内容为 

inventory_loc=$ORACLE_BASE/oraInventory inst_group=oinstall 

修改该文件属性:chmod 644 /etc/oraInst.loc 

(2)创建inventory directory: $ORACLE_BASE/oraInventory 

修改文件属性: chmod -R 770 $ORACLE_BASE/oraInventory 

chgrp oinstall $ORACLE_BASE/oraInventory 

oraInventory目录是用来存储oracle安装的所有软件组件的信息的,每个组件可能占用150k的空间. 

22. You find that the database performance degrades while you backup the PROD database using Recovery 

Manager (RMAN). The PROD database is running in shared server mode. The database instance is currently 

using 60% of total operating system memory. You suspect the shared pool fragmentation to be the reason. 

Which action would you consider to overcome the performance degradation? 

A) Configure Java Pool to cache the java objects. 

B) Configure Streams Pool to enable parallel processing. 

C) Increase Shared Pool size to cache more PL/SQL objects. 

D) Increase Database Buffer Cache size to increase cache hits. 

E) Configure Large Pool to be used by RMAN and shared server. 

F) Increase the total System Global Area (SGA) size to increase memory hits. 

答案:E

解析:使用RMAN备份数据库时,由于在共享服务器模式下,共享池已经不够用了,所以使用大池以供RAMN和共享服务使用。 

在磁盘上的备份会使用PGA内存空间作为备份缓冲区,PGA 内存空间从用于通道进程的内存空间中分配。如果操作系统没有配置本地异步I/O,可以利用DBWR_IO_SLAVES参数使用I/O从属来填充内存中的输入缓冲区。如果设置DBWR_IO_SLAVES 参数为任意的非零值,RMAN 会自动分配4个I/O 从属协调输入缓冲区内存中的数据块加载。为了实现这一功能,RMAN 必须利用一个共享内存区域。因此,用于磁盘备份的内存区会被推入共享池,如果存在large池,则被推入large池。 

如果没有使用磁带I/O从属,会在PGA中分配用于磁带输出缓冲区的内存。设置init.ora 参数BACKUP_TAPE_IO_SLAVES=TRUE,可以使用磁带I/O从属,必要时还可以在spfile里动态修改。 该参数设为true时,rman 会为每个通道创建一个从属进程来帮助备份工作。为了协调这一功能,RMAN 会将内存分配推进SGA。 

如果配置了任一种I/O从属选项并且没有配置large 池,则会在SGA的共享池中分配内存。如果没有配置large池又要使用I/O从属,建议最好创建一个large池,这个large池的大小基于为备份分配的通道总数(加上1MB用于开销)。 

RMAN 系列(一)---- RMAN 体系结构概述 

23. Your database is started with SPFILE. You want the database instance to be dynamically registered with a 

listener L2 with the following details: 

Protocol: TCP 

Host: indl151e 

Port: 1525 

Which is the correct order of the steps that you would follow to achieve this? 

1. Set the LOCAL_LISTENER parameter to L2 dynamically. 

2. Make an entry for L2 in tnsnames.ora on the database server. 

3. Restart L2. 

4. Modify the listener.ora file to add the instance name in SID_LIST of L2. 

A) 1, 2, 4, 3 

B) 1, 2, 3; 4 is not required. 

C) 2, 1; 3 and 4 are not required. 

D) 1, 2; 3 and 4 are not required. 

答案:C

解析:Dynamically register就是不需要修改listener.ora。DB Instance会自动通知listener。 

如果在listerer.ora中配置sid_llist,那就是静态注册了,而本题考的是动态注册。 

一、静态注册 

由于静态注册,参数是手动静态添加,与数据库无关。数据库无法确认监听是否正确配置。因此,lsnrctl中的status显示状态为unkown。即不保证能连通数据库。注意:静态注册监听,客户端在配置tnsnames.ora服务命名时,“(Oracle 8i或更高版本)服务名”里填写内容要与服务端静态注册监听器时的全局数据库名一致。否则,无法连通 

二、动态注册 

1、缺省的动态注册 

pmon在数据库启动到mount或open时,动态从参数文件中读取service_names值。service_names可以为多个值。service_names缺省为dbca建立数据库时的全局数据库名。 

注意:不管参数service_names为何值,pmon都会自动以全局数据库名(这里为mydata.ccddt.cn)为服务名,动态注册一个监听。缺省情况下,若启用动态注册监听,端口号必须为1521。若启用其他端口的动态监听注册,必须要做相关配置。通过查看v$session,状态为SYS$USERS的连接为通过静态注册监听连接到服务器。 

2、自定义端口的动态监听注册 

若要启用非默认端口1521的动态监听注册,缺省状态,Oracle不会进行动态注册。要启用动态注册,必须设置local_listener参数。并在服务端配置tnsnames.ora指定监听参数,或者直接通过修改local_listener指定监听参数。步骤如下: 

1)服务端: netmgr,配置监听程序,监听端口为1525(非默认端口),保存配置 

2)指定监听参数 

法1:直接通过修改local_listener参数指定 

SQL>alter system set LOCAL_LISTENER='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.23)(PORT=1525))'; 

SQL>alter system register 

法2:在Oracle服务器端建立$ORACLE_HOME/network/admin/tnsnames.ora。解析文件,位置并填入如下内容mytest =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS=(PROTOCOL=TCP)(HOST = 192.168.1.23)(PORT = 1525)) 这里的mytest也可以根据自己需要,修改为其他字符串。如a或b等。 

设置参数,指定通过tnsnames.ora内的信息指定监听参数SQL>alter system set local_listener=mytest; 

SQL>alter system register; 

3、查看监听器状态 LSNRCTL> status 

(warehouse)show parameter local_listener 

一定要配置服务端tns 让pmon自动注册其他端口 

a123= 

(address_list=(address=(prottocol=tcp)(host=xys)(port=1522)) 

tnsping a123; tnsping+服务命名 

alter system set local_listener=a123; 

24. The junior DBA in your organization has accidentally deleted the alert log file. What will 

you do to create 

new alert log file? 

A) Create the new text file file as ALERT.LOG. 

B) You have to recover the alert log file from the valid backup. 

C) Change the value for the BACKGROUND_DUMP_DEST parameter. 

D) No action required.The file would be created automatically by the instance. 

答案:D

解析:不小心删除alert文件没有关系,数据库会自己自动重建 

25. A user complains that he gets the following error message repeatedly after executing some SQL 

statements. The error message forces the user to log off from and log on to the database to continue his work. 

ORA-02392: exceeded session limit on CPU usage, you are being logged off 

Which action would you take to increase the session limit on CPU usage? 

A) Modify the profile assigned to the user. 

B) Modify the roles assigned to the users. 

C) Modify the object privileges assigned to the user. 

D) Modify the system privileges assigned to the users. 

E) Modify the value for the RESOURCE_LIMIT parameter in the parameter file. 

答案:A

解析:一个用户执行sql语句报错ORA-02393:exceeded call limit on CPU usage这时候可以在该用户的profile 里修给recourse limits 

当需要设置资源限制时,必须设置数据库系统启动参数RESOURCE_LIMIT,此参数默认值为FALSE可以使用如下命令来启动当前资源限制:alter system set RESOURCE_LIMIT=true; 

26. While setting up an Oracle database for one of your critical applications, you want to ensure that the 

database is backed up at regular intervals without your intervention.What should you do to achieve the 

objective? 

A) configure the database to run in ARCHIVELOG mode 

B) configure the Flash Recovery Area to enable automatic database backup 

C) schedule the database backup using DBMS_JOB package after creating the database 

D) schedule the database backup using Recovery Manager (RMAN) commands after creating the database 

E) schedule the database backup using Database Configuration Assistant (DBCA) while creating the database 

答案:E

解析:在创建数据库的时候有个选项是来创建数据库备份的 

27. Which two statements about Flashback Query are true? (Choose two.) 

A) It is generated by using the redo log files. 

B) It helps in row-level recovery from user errors. 

C) It can be performed to recover ALTER TABLE statements 

D) It fails when undo data pertaining to the transaction is overwritten. 

E) The database has to be opened with the resetlogs option after performing Flashback Query. 

答案:B D

解析:Flashback Query可以帮助用户解决行级别的错误。是根据undo data来闪回的,undo retention=900s,这要看有没有retention guarantee,如果有,15分钟内不会被覆盖。如果没有打开,那得看UNTO有没有可用空间,如果没有就会被覆盖 

Flashback database相当一次不完全恢复, 此时必需alter database open resetlogs; 即截断多余的scn,本质还是select file#,checkpoint_change# from v$datafile; 

select file#,checkpoint_change# from v$datafile_header,两个结果不一致造成的. 

10g支持穿越resetlogs了,即用当前数据库的控制文件(resetlog后的控制文件)加上resetlog之前数据文件的备份,其实只要scn连续就行 

但一旦resetlogs后,无法再flashback到之前的时间点了

28. As a result of performance analysis, you created an index on the prod_name column of the prod_det table, 

which contains about ten thousand rows. Later, you updated a product name in the table. How does this 

change affect the index? 

A) A leaf will be marked as invalid. 

B) An update in a leaf row takes place. 

C) The index will be updated automatically at commit. 

D) A leaf row in the index will be deleted and inserted. 

E) The index becomes invalid when you make any updates. 

答案:D

解析:索引分三层,最下面一层是 leaf ,每个leaf block 包含很多 leaf row, 每个leaf row 是由键值和rowid组成, 查找索引时先找到键值,再根据对应的rowid找到数据块中的数据。更新索引要先删除后插入,因为这种方式最简洁和规范。不然的话,如果你采用移动的方式会变得非常麻烦和不可控制。 


29. View the Exhibit. 

Your Oracle 10g database has 6 tablespaces in which) 

-TEMP is the default temporary tablespace 

-UNDOTBS1 is the default undo tablespace 

-USERS is the default permanent tablespace 

In this database, which two tablespaces can be made read only? (Choose two.) 

A) TEMP 

B) PROD 

C) USERS 

D) SYSAUX 

E) SYSTEM 

F) UNDOTBS1 

答案:B  C

解析:系统的表空间是不能改为read only的


30. You suspect unauthorized data manipulation language (DML) operations on a particular table. You want to 

track users who are performing the transactions and the values used in the transactions. Also, you plan to 

transfer these values to another table for analysis. 

How would you achieve this? 

A) by using triggers 

B) by using external tables 

C) by using anonymous PL/SQL blocks 

D) by auditing all DML operations on the table 

答案:A

解析:因为要在另一张表中追踪,所以D选项审计DML错误



31. You are using the backup scheduler in Enterprise Manager (EM) to schedule a backup of your database. 

Which type of script does the backup scheduler generate? 

A) SQL script 

B) PL/SQL script 

C) Operating System (OS) script 

D) Enterprise Manager (EM) script 

E) Recovery Manager (RMAN) script 

答案:E

解析:没有为什么。EM里去操作下就知道了



32. View the Exhibit to observe the message received while trying to drop the SL_REP user in Oracle 

Enterprise Manager. The SL_REP user owns objects and is currently connected to the database instance. 

What would happen if you click YES in the Exhibit? 

A) An error is returned, and the user is not dropped. 

B) The drop operation waits until the session started by the user ends. 

C) The user is dropped successfully, and the session started by the user is killed. 

D) The user is dropped, and the objects owned by the user are transferred to the recycle bin. 

答案:A

解析:数据库用户正连接数据时,这时是不能删除该用户的 



33. User SCOTT executes the following command on the EMP table but has not issued COMMIT, ROLLBACK, 

or any data definition language (DDL) command: 

SQL> SELECT job FROM emp 

2 WHERE job='CLERK' FOR UPDATE OF empno; 

SCOTT has opened another session to work with the database. Which three operations would wait when 

issued in SCOTT's second session? (Choose three.) 

A) LOCK TABLE emp IN SHARE MODE; 

B) LOCK TABLE emp IN EXCLUSIVE MODE; 

C) DELETE FROM emp WHERE job='MANAGER'; 

D) INSERT INTO emp(empno,ename) VALUES (1289,'Dick') ; 

E) SELECT job FROM emp WHERE job='CLERK' FOR UPDATE OF empno; 

答案:ABE

解析:

SELECT …… FROM …… FOR UPDATE 语句申请的是相应行的排他锁以及行所在表的共享锁。 

SHARE:允许并发查询,但禁止更新锁定的表。需要有(并且会自动请求)SHARE锁定才能创建表的索引。 

EXCLUSIVE:允许查询锁定表,但禁止对锁定表执行任何其它活动。需要有EXCLUSIVE 锁定才能删除表。 

update, insert ,delete, select ... for update会LOCK相应的ROW. 只有一个TRANSACTION可以LOCK相应的行,也就是说如果一个ROW已经LOCKED了,那就不能被其他TRANSACTION所LOCK了。LOCK由statement产生,由TRANSACTION结尾(commit,rollback),也就是说一个SQL完成后LOCK还会存在,只有在COMMIT/ROLLBACK后才会RELEASE。 



34. You have a text file that maintains information on thousands of items. The end-user application requires 

the transfer of that information into a table in the database. What would you use to achieve this task? (Choose 

two.) 

A) Oracle Text 

B) Data Pump 

C) SQL*Loader 

D) Oracle Import 

E) External table 

答案:C E



35. The SAVE_AMT column in the ACCOUNTS table contains the balance details of customers in a bank. As part of the year-end tax and interest calculation process, all the rows in the table need to be accessed. The bank authorities want to track access to the rows containing balance amounts exceeding $200,000, and then send an alert message to the administrator. Which method would you suggest to the bank for achieving this task? 

A) implementing value-based auditing by using triggers 

B) implementing fine-grained auditing with audit condition and event handler 

C) performing standard database auditing to audit object privileges by setting the AUDIT_TRAIL parameter to 

EXTENDED 

D) performing standard database auditing to audit SQL statements with granularity level set to ACCESS 

答案:B

解析:

(warehouse)值的审计是通过数据库trigger 

dbma_fga(fine-grained auditing) 精细粒度审计 能控制到列和行 

trigger不能track select,但FGA可以, fga可以將使用者的操作具體操作記錄下來. 

FGA精细审计,精确到行列的审计就要使用精细审计。FGA的审计信息,存放在$FGA_LOG中 

show parameter audit 

AUDIT_FILE_DEST =指示出审计的文件存放的路径信息 

audit_sys_operations 默认值是FALSE,如果开启审计功能,这个参数需要修改为TRUE。 

audit_syslog_level 语句:指定审计语句或特定类型的语句组 

权限:使用审计语句指定系统权限,象AUDIT CREATE ANY TRIGGER 对象:在指定对象上指定审计语句,象ALTER TABLE on the emp table AUDIT_TRAIL = NONE|DB|OS DB--审计信息记录到数据库中 OS--审计信息记录到操作系统文件中 NONE--关闭审计(默认值) 

alter system set audit_sys_operations=TRUE scope=spfile; 

alter system set audit_trail=db scope=spfile; 

一个有趣的效果,就是所有sysdba权限下的操作都会被记录到这个/oracle/app/oracle/admin/ora10g/adump审计目录下。这也是为什么开启了审计功能后会存在一些开销和风险。 

查看审计设置可以通过查询dba_obj_audit_opts视图来完成 select OWNER,OBJECT_NAME,OBJECT_TYPE,DEL,INS,SEL,UPD from dba_obj_audit_opts; 

通过查询dba_audit_trail视图或者sys.aud$视图得到详细的审计信息,这种审计方法可以得到操作的时间,操作用户等较粗的信息 

FGA:可以通过FGA得到操作的SQL语句级别的信息 

exec dbms_fga.add_policy(object_schema=>'SEC', object_name=> 't_audit', policy_name=> 'check_t_audit',statement_types => 'INSERT, UPDATE, DELETE, SELECT'); 

对t_audit表增删改查操作一番,查看审计结果 

select db_user,sql_text from dba_fga_audit_trail; 

对象的审计object(object privilege) 

select * from dba_obj_audit_opts (注意这个地方是obj) 

audit select on tt by session;(sys用户除外,by session是缺省的) 

同一个session执行相同语句只审计一次 

audit select on tt by access whenever successfull; (whenever successfull好像不起作用) 

sql的审计statement(sql) 

audit table by test; 

truncate table aud$ (aud$唯一一个sys用户下的表可以修改) 

audit select on tt by session whenever not successfull; 

select * from dba_stmt_audit_opts (权限的审计都在里面,但表不在权限里) 

dbma_fga(fine-grained auditing) 精细粒度审计 能控制到列和行 

select * from dba_common_audti_trail 包含标准和精细审计(标准审计,不会捕获真实的值) 



36. You are creating a locally managed tablespace to meet the following requirements: 

All the extents should be of the same size. 

The data should be spread across two data files. 

A bitmap should be used to record the free space within the allocated extents. 

Which three options would you choose? (Choose three.) 

A) set PCTFREE and PCTUSED to 50 

B) specify extent allocation as Uniform 

C) specify extent allocation as Automatic 

D) create the tablespace as bigfile tablespace 

E) create the tablespace as smallfile tablespace 

F) set segment space management to Automatic 

G) use the RESIZE clause while creating the tablespace 

答案:BEF

解析:要求是创建统一区的管理表空间,所以是uniform,表空间有2个文件,不可能是bigfile(如果是bigfile只能是一个文件) 自动区段空间管理(ASSM)——ASSM的tablespace是通过将SEGMENT SPACE MANAGEMENT AUTO子句添加到tablespace的定义句法里而实现的。 通过使用位图bitmap取代传统单向的链接列表freelist,ASSM的tablespace会将freelist的管理自动化,并取消为独立的表格和索引指定PCTUSED、FREELISTS和FREELIST GROUPS存储参数的能力。 



37. Your test database is running in NOARCHIVELOG mode. What are the implications of this? 

A) You can perform open database backups. 

B) You can perform closed database backups. 

C) You cannot perform schema-level logical backups. 

D) You can perform the backup of only the SYSTEM tablespace when the database is open. 

答案:B

解析:非归档模式下,只能在关闭数据库后备份 


38. You are in the middle of a transaction and very crucial data has been modified. Because of a hardware 

failure, the instance has shut down before synchronizing all the database files. Which two statements are true? 

(Choose two.) 

A) On startup, SMON coordinates instance recovery. 

B) On startup, CKPT coordinates instance recovery. 

C) On startup, use RMAN to perform instance recovery. 

D) Uncommitted changes will be rolled back after the database is opened. 

E) On startup, perform media recovery and then instance recovery. 

F) On startup, all the files will be synchronized and you get both committed and uncommitted data. 

答案:AD

解析:由于硬件损坏,类似意外掉电,这就意味着shutdown abort,当重新启动后SMON进程会自动恢复实例,uncommited的数据会自动rollback,同时,commited的数据而又未写到datafile中的会被写进datafile中。并没有数据文件丢失,不需要介质恢复,E错,容易迷惑 

System Monitor Process (SMON) 

The system monitor process (SMON) performs recovery, if necessary, at instance startup. SMON is also responsible for cleaning up temporary segments that are no longer in use and for coalescing contiguous free extents within dictionary managed tablespaces. If any terminated transactions were skipped during instance recovery because of file-read or offline errors, SMON recovers them when the tablespace or file is brought back online. SMON checks regularly to see whether it is needed. Other processes can call SMON if they detect a need for it. With Real Application Clusters, the SMON process of one instance can perform instance recovery for a failed CPU or instance. 


39. After being hired as a database administrator, you find that there is only one database that is functional and that is being accessed by the applications. You want to create a replica of the database, to be used for testing purposes. What is the best method to create the replica? 

A) create a database by using CREATE DATABASE .. command and manually copy the data 

B) use Database Configuration Assistant (DBCA) to create a template from the existing database to contain the database structure 

C) use DBCA to create a template from the existing database to contain the database structure and then manually copy the data using Oracle Data Pump 

D) use DBCA to create a template from the existing database to contain the database structure with data files and then use the same template to create the database in the new location 

答案:D

解析:因为该数据库正在被使用,无法关闭。所以使用DBCA创建一个模板,并使用该模板创建数据库


40. You are working on an online transaction processing (OLTP) system. You notice that a PL/SQL procedure got executed twice at 2 00 p.m. This has incorrectly updated the EMP_SAL table. How would you revert the table to its state at 2 :00 p.m.? 

A) Perform point-in-time recovery to 2: 00 p.m. 

B) Use Flashback Table feature to revert the changes. 

C) Restore the entire database from the recent backup and open it. 

D) Issue the rollback statement with system change number (SCN). 

答案:B

解析:Flashback Table单独恢复某个表,不影响别个表数据,即别的业务可以正常进行 


41. View the Exhibit. 

What would happen if you change the value of Desired Mean Time To Recover to 30? 

A) The MTTR Advisor would be enabled. 

B) The Redo Log Advisor would be disabled. 

C) Automatic checkpoint tuning would be disabled. 

D) The redo log from log buffers would be written to redo log files at a slower rate. 

答案:A

解析:MTTRMean Time To Recover :就是checkpoint发生的频率的一个参数,越小这个CKPT进程发生越频繁,实例恢复时间则越短,反之实例恢复时间则越长.0的时候  不起作用。反之 就是enable 



42. Due to media failure you lost one of the data files belonging to the USERS tablespace, and the tablespace is not available to use. Which statement regarding the status of the database is true? 

A) The database remains open. 

B) The database gets dismounted. 

C) The database becomes read only. 

D) The database instance gets aborted. 

E) The database gets shut down automatically. 

F) The status of the database depends on the status of the USERS tablespace. 

答案:A

解析:The database remains open. and the datafile belong to user became offline 



43. Which two statements are true about the roles in the Oracle database? (Choose two.) 

A) A role can be granted to itself. 

B) Roles are owned by the SYS user. 

C) Roles can be granted to other roles. 

D) A role cannot be assigned external authentication. 

E) A role can contain both system and object privileges. 

答案: C,E 

解析:external authentication 外部认证 

create role role1 identified externally; 

角色在定义是可以加口令验证,但是使用identified externally时用户属于外部认正,书上说是系统认证,而且定义是不用设置口令,这时我要激活角色该怎么提供口令呢? 

role可以赋予给其它的role,同时role的权限可以包括系统权限和对象权限 

查看角色具有的系统权限 

select * from dba_sys_privs where grantee='DBA'; 

查看角色具有的对象权限 

select * from dba_tab_privs where grantee='role_test'; 

查看用户具有的角色 

select * from dba_role_privs where grantee='ROLE_TEST' 



44. View the Exhibit to observe the privileges granted to the MGR_ROLE role. 

The SCOTT user has been granted the CONNECT and RESOURCE roles only. 

The database administrator (DBA) grants MGR_ROLE to the SCOTT user by using this command: 

SQL> GRANT MGR_ROLE TO SCOTT WITH ADMIN OPTION; 

Which statement is true about the SCOTT user after he is granted this role? 

A) The SCOTT user can grant the MGR_ROLE role and the privileges in it to other users. 

B) The SCOTT user can grant the privileges in the MGR_ROLE role to other users but not with ADMIN_OPTION. 

C) The SCOTT user can grant only the MGR_ROLE role to other users but not the privileges in it. 

D) The SCOTT user can grant the privileges in the MGR_ROLE role to other users but cannot revoke privileges from them. 

答案:C

解析:ADMIN OPTION当有这个字段时,表明可以把该权限赋予另外一个人 

获得该角色的用户只对该角色有管理的权限,不能对该角色所拥有的对象权限或系统权限进行操作.(需实验) 

另:授予他人的对象权限在被授予者向第三人授予该权限时,最初授权者无法取消第三人的对象权限。但是如果最初授予的是系统权限,则最初授权人可以取消第三人的系统权限。 



45. You want the user APP_DBA to administer the Oracle database from a remote machine. APP_DBA is granted the SYSDBA privilege to perform administrative tasks on the database. 

Which file is used by the Oracle database server to authenticate APP_DBA? 

A) control file 

B) password file 

C) listener controller file 

D) control file and password file 

答案:B

解析:Oracle数据库中SYSDBA用户的账户情报存放在密码文件中,目的是为了在无法打开数据的情况下,仍然能够使用SYSDBA用户登录数据库。



46. Which two statements are true about simple views? (Choose two.) 

A) Views can be created as read only. 

B) Views are data segments like tables. 

C) Views can be created on the basis of more than one table. 

D) Data manipulation language (DML) operations cannot be performed on views. 

答案:AC

解析:视图可以被创建为只读,视图本身是没有数据的,视图可以基于多表建立,在视图上可以执行DML语句 

A只是说视图可以被创建为只读,而不是只能创建为只读,小心迷惑 


47. While planning to manage more than one database in your system, you perform the following activities: 

1. Organize different categories of files into independent subdirectories. 

2. Use consistent naming convention for database files. 

3. Separate administrative information pertaining to each database. 

Which option corresponds to the type of activities performed by you? 

A) Oracle Managed Files 

B) Oracle Grid Architecture 

C) Optimal Flexible Architecture 

D) Oracle database architecture 

答案:C

解析:Flexible 灵活的 architecture 体系结构 

Oracle Grid Architecture is used for rac

Oracle的最佳灵活体系结构(Optimal Flexible Architecture,简称OFA),是指Oracle软件数据库文件及文件夹的命名约和存储位置规则。 

使用最佳灵活体系结构,能够简化数据库系统的管理工作,使数据库管理员更加容易地定位文件或添加文件;还可以将Oracle系统的执行文件、管理文件、数据文件分别存储到不同的硬盘上,从而有效地使用用户系统中的所有存储空间、克服某个(些)硬盘存储空间的限制,合理分配存储负担,降低单个硬盘存储速度方面的瓶颈,提高整个系统的存储效率。 

OFA的核心是一个命名机制 

1、linux/unix下面对于mount点的命名采用/pm的方式 

p:字符常量,通常是u m:固定长度,通常是2 

例如/u01、/u02 

2、BASE目录通常是/pm/h/u 

h:常量,通常是app u:目录所有者,通常是oracle 

例如/u01/app/oracle 

3、ORACLE_HOME目录通常是/pm/h/u/product/V 

V:版本号,例如9.2.0、10.2.0 

新增的一些组件,例如asm、db_1都在这个目录下面 

例如/u01/app/oracle/product/10.2.0 

4、数据库特定的管理文件,例如启动参数文件、转储文件 

/pm/h/u/admin/d/a 

d表示数据库的名字 a表示子目录的名称,例如参数文件是pfile,用户目录是udump 

例如/u01/app/oracle/admin/ora10g/pfile 

5、关键文件通常是/pm/q/d 

q通常是oradata 例如/u02/oradata/ora10g 

控制文件通常是controln.ctl,n表示数据位数,通常是2 

例如control01.ctl、control02.ctl 

redon.log,n通常是2,例如redo01.log、redo02.log 

数据文件tn.dbf,t表示表空间的名字,n通常是2 

例如users01.dbf、users02.dbf等 



48. Which naming method uses the tnsnames.ora file to store the connect descriptor used by the client while connecting to the database instance from a remote machine? 

A) host naming method 

B) local naming method 

C) external naming method 

D) directory naming method 

答案:B

解析:tnsnames.ora在Oracle中,Oracle\Network\ADMIN\tnsnames.ora 文件很重要,它作用是: 本地命名的配置。本地名用简单的名称就可以访问到所需的数据库或服务器所需的信息。 

local naming method言外之意就是需要把连接db的信息配置到本地(client端)的tnsnames.ora文件里 



49. Your database is running in the ARCHIVELOG mode. You placed a tablespace, tbs_1, offline with the immediate option. Which statement is correct in this scenario? 

A) The operation would fail if tbs_1 were a read-only tablespace. 

B) The operation would fail if tbs_1 were a read/write tablespace. 

C) The operation would fail if tbs_1 were the default tablespace for the database. 

D) If the above operation were successful, media recovery would be required to bring the tablespace online. 

E) If the above operation were successful, instance recovery would be required to bring the tablespace online. 

答案:D

解析:OFFLINE {NORMAL | TEMPORARY | IMMEDIATE} 其中,normal是默认的。 

----offline normal: 

idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; 

offline normal,tablespace内所有的数据文件上触发checkpoint。 checkpoint_change#增加。 

online时,不需要media recovery,同时tablespace内所有的数据文件上再次触发checkpoint。 checkpoint_change#增加。 

----offline temporary:证明了文档中的如下说法: If no files are offline, but you use the temporary option, media recovery is not required to bring the tablespace back online. 

对照之前的checkpoint,可以发现:offline temporary只对那些online的数据文件进行checkpoint,而且在将tablespace online 的时候,那些进行过checkpoint的数据文件将不需要media recovery 

----offline immediate 

tablespace内所有的数据文件上不触发checkpoint。 checkpoint_change#不变。 

将tablespace online 时需要media recovery。online时,tablespace内所有的数据文件上再次触发checkpoint。 checkpoint_change#增加。 



50. You work in a data warehouse environment that involves the execution of complex queries. The current content of the SQL cache holds the ideal workload for analysis. 

You want to analyze only few most resource-intensive statements. What would be your suggestion to receive recommendations on the efficient use of indexes and materialized views to improve query performance? 

A) Run the SQL Access Advisor. 

B) Run the SQL Tuning Advisor (STA). 

C) Run the Automatic Workload Repository (AWR) report. 

D) Run the Automatic Database Diagnostic Monitor (ADDM). 

答案:A

解析:

sql tuing advisor将一条或多条SQL语句作为输入,并且研究这些语句的结构与执行方式.这些SQL语句称为SQL TUNING SET,标识负载较高的SQL语句与建议改进措施.

SQL ACCESS ADVISOR 也将SQL TUNING SET 作为其输入.这个顾问程序通过学习添加索引或物化视图来改进SQL执行性能.


原创粉丝点击