`

1z0-042题库笔记

阅读更多

说明:边看TK。 边随意记下的东西。 这都是一些我不太懂 然后通过搜索找的一些解题方法。太乱了 没有整理。

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

题目说的是决定UNDO表空间大小的三条: 这题定性分析就可以了,UNDO 表空间是用来记录事务数据的.
A.每个UNDO 块的大小
B.不对与redo log 无关
C.每秒生成的UNDO块的量 , 这个越大UNDO 表空间就要越大
D.与buffer cache无关
E.UNDO_retention : 在事务提交以后,UNDO 数据为一致性读还要保留多长时间.当然保留时间越长UNDO表空间就越大.

Answer: A, C, E

oracle启动分为三步:
nomount --根据参数文件启动实例(instance)
mount --加载控制文件,让实例和数据库相关联
open --根据控制文件找到并打开数据文件和日志文件,从而打开数据库

startup   nomount---数据库启动,但数据文件没有mount,没有打开  
startup   mount----数据库启动,但数据文件有mount,但没有打开  
startup   ----数据库启动,且打开

mount就是挂起控制文件

归档模式,数据库的日志可以长时间保存,有了归档日志,可以随时恢复归档日期内任何时间点的数据,便于数据库数据安全保护。
数据库归档模式,可以使用rman或手工在线备份数据

归档模式,可以在线或者离线备份数据库,可以是全备份或者是部分备份(单个表空间,数据文件)
非归档模式只能离线备份,而且必须备份所有的数据文件,控制文件,日志文件!

利用Oracle FGA实现审计

Oracle9i Database 推出了一种称为细粒度审计 (FGA) 的新特性。现在下面就利用FGA实现审计对表的审计。其中,EDMS是数据库的一个测试帐户。

1.   建立测试表(用户EDMS下)

Create Table T_AUDIT_DEMO
(
CID   INT   NOT NULL,
CNAME VARCHAR2(20) NULL,
ENAME VARCHAR2(20) NULL,
CONSTRAINT PK_T_AUDIT_DEMO PRIMARY KEY (CID)
);

2.   创建审计策略(用户SYS下)

begin
  dbms_fga.add_policy
  (
    object_schema=>'EDMS',
    object_name=>'T_AUDIT_DEMO',
    policy_name=>'T_AUDIT_DEMO_AUDIT'
  );
end;

3.   测试审计效果(用户EDMS下)

INSERT INTO T_AUDIT_DEMO VALUES(1,'曾勋','ZENG XUN');
INSERT INTO T_AUDIT_DEMO VALUES(2,'翁黎明','WENG LI MING');
INSERT INTO T_AUDIT_DEMO VALUES(3,'刘帝勇','LIU DI YONG');

4.   使用Select查询测试表(用户EDMS下)

SQL> SELECT * FROM T_AUDIT_DEMO; 
CID CNAME                ENAME
----- -------------------- -------
1 曾勋                 ZENG XUN
2 翁黎明               WENG LI MING
3 刘帝勇               LIU DI YONG
5.   再次查看审计效果(用户SYS下)

SQL> select statement_type,SQL_TEXT from dba_fga_audit_trail;
STATEMENT_TYPE SQL_TEXT
-------------- -----------
SELECT         SELECT * FROM T_AUDIT_DEMO
注意:之前的Insert语句并不在审计中。默认的只对Select进行审计。在Oracle 9i中它只捕获 SELECT 语句。而在Oracle 10i中进行了扩展,
支持对所有类型的DML进行审计。

6.   修改审计粒度(用户SYS下)

begin
  dbms_fga.add_policy
  (
    object_schema=>'EDMS',
    object_name=>'T_AUDIT_DEMO',
    policy_name=>'T_AUDIT_DEMO_AUDIT',
    statement_types=>'INSERT, UPDATE, DELETE, SELECT'
  );
end;

注意:不能实现对Truncat Table的审计。

7.   测试审计(用户EDMS、SYS下)

INSERT INTO T_AUDIT_DEMO VALUES(4,'黄智洪','HUANG ZHI HONG');
DELETE FROM T_AUDIT_DEMO WHERE CID < 4;
SQL> select statement_type,SQL_TEXT from dba_fga_audit_trail;
STATEMENT_TYPE SQL_TEXT
-------------- --------------------
SELECT       SELECT * FROM T_AUDIT_DEMO
INSERT       INSERT INTO T_AUDIT_DEMO VALUES(4,'黄智洪','HUANG ZHI HONG')
DELETE       DELETE FROM T_AUDIT_DEMO WHERE CID < 4
SELECT       SELECT * FROM T_AUDIT_DEMO

至此,我们已经实现了对表T_AUDIT_DEMO的审计。与FGA相关的表或者视图:

select  * from fga$
select  * from fga_log$
select  * from fgacol$
select * from dba_fga_audit_trail
select * from dba_common_audit_trail

select * from dba_audit_policies
select * from dba_fga_audit_trail

与FGA相关的包或者过程:

dbms_fga.add_policy
dbms_fga.drop_policy

至于这些表、视图、包的列或者参数的使用方法,可以Describe或者查看相关文档。

SYSAUX表空间在Oracle Database 10g中引入,作为SYSTEM表空间的辅助表空间. ... 如果SYSAUX表空间不可用,数据库核心功能将保持有效

把一个普通的文本格式的OS文件看作是Oracle数据库的外部表,Oracle可以象普通表一样进行select 操作,可以建视图,可以与其他进行连接等,
但不能对其进行DML操作,即该表是只读的!(10g里可借此导出数据至平面dmp文件)。
External table和正规的表很相似,以下的几点需要注意:

l 数据在数据库的外部组织,是操作系统文件。 
l 操作系统文件在数据库中的标志是通过一个逻辑目录来映射的。    
l 数据是只读的。(外部表相当于一个只读的虚表) 
l 不可以在上面运行任何DML操作,不可以创建索引。  
l 可以查询操作和连接,可以并行操作。

auditing  审计

audit condition and event handler
审计的条件和事件处理器

segment 段

exlent 数据扩展

data Blocks 数据块

. You want to create a tablespace with the following specifications:
1. The tablespace extends automatically.
2. Used and free extents should be managed by bitmaps.
3. Default PCTUSED attribute is set to 60.
4. All the extents would be of size 1 MB.
Which three options would you choose to create the tablespace? (Choose three.)
A. tablespace with AUTOEXTEND enabled
B. tablespace with dictionary-managed extents
C. tablespace with a uniform extent allocation of 1 MB
D. tablespace with segment space management as manual
E. tablespace with segment space management as automatic
Answer: ACD

这里的要求是创建个本地管理的表空间,而且表空间是自动扩展的,区的大小统一为1m,pctused为60,说明不能是assm的,

assm忽略pctused和freelist  有了ASSM,链接列表freelist被位图所取代

所以选ACD

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
)
answer: BEF
这里的要求是创建统一区的表地管理表空间,所以是uniform,表空间有2个文件,不可能是bigfile(如果是bigfile只能是一个文件)

A bitmap should be used to record the free space within the allocated extents.
这句话我觉得说的有问题,要改成块的管理方式才能选assm

自动区段空间管理(ASSM)——ASSM的tablespace是通过将SEGMENT SPACE MANAGEMENT AUTO子句添加到tablespace的定义句法里而实现的。
通过使用位图bitmap取代传统单向的链接列表freelist,ASSM的tablespace会将freelist的管理自动化,并取消为独立的表格
和索引指定PCTUSED、FREELISTS和FREELIST GROUPS存储参数的能力。

 create tablespace
  asm_lmt_ts
  datafile
  'c:\oracle\oradata\diogenes\asm_lmt.dbf'
  size
  5m
  EXTENT MANAGEMENT LOCAL    -- Turn on LMT (本地管理)
  SEGMENT SPACE MANAGEMENT AUTO -- Turn on ASSM
  ;

Which three statements correctly describe the functions and use of
constraints? (Choose three.)
A. Constraints provide data independence.
B. Constraints make complex queries easy.
C. Constraints enforce(强制) rules at the view level.
D. Constraints enforce rules at the table level.
E. Constraints prevent the deletion of a table if there are dependencies.(依赖性)
F. Constraints prevent the deletion of an index if there are dependencies.

C D E

从Oracle10gR2开始,数据库可以实现自动调整的检查点.
当FAST_START_MTTR_TARGET参数未设置时,自动检查点调整生效。
通常,如果我们必须严格控制实例或节点恢复时间,那么我们可以设置FAST_START_MTTR_TARGET为期望时间值;
如果恢复时间不需要严格控制,那么我们可以不设置FAST_START_MTTR_TARGET参数,从而启用Oracle10g的自动检查点调整特性。

Due to  因为

Optimal Flexible Architecture(OFA)
是什么?主要用途是什么?

最佳灵活体系结构(OFA)
oracle在所有支持平台上进行的安装和配置现在均符合最佳灵活体系结构(OFA)
OFA 按类型和使用情况组织数据库文件。包含Oracle 基代码的二进制文件安装在一个目录中,
控制文件日志文件和管理文件安装在另外一个目录中,数据库文件也另安装在一个目录中。

那能不能由机器自动在统计数据的基础上给出优化建议呢?Oracle10g中就推出了新的优化诊断工具:
数据库自动诊断监视工具(Automatic Database Diagnostic Monitor ADDM)
和SQL优化建议工具(SQL Tuning Advisor STA)。这两个工具的结合使用,能使DBA节省大量优化时间,

SQL Access Advisor 通过建议要创建、删除或保留的索引、物化视图、物化视图日志或分区来确定并帮助解决
与 SQL 语句执行相关的性能问题。它可以通过 Database Control 运行,也可以通过命令行使用 PL/SQL 过程
运行。

sql tuing advisor将一条或多条SQL语句作为输入,并且研究这些语句的结构与执行方式.
这些SQL语句称为SQL TUNING SET,标识负载较高的SQL语句与建议改进措施.
SQL ACCESS ADVISOR 也将SQL TUNING SET 作为其输入.这个顾问程序通过学习添加索引或物化视图来改进
SQL执行性能.

expdp是 oracle 10g提供的一个代替exp的工具,不论从速度还是功能上来讲,相对于exp来说都是一个飞跃。
1. 执行expdp之前要先创建directory对象,如:
CONNECT system/manager
CREATE OR REPLACE DIRECTORY expdir AS ‘d:\exp’;
GRANT read,write ON DIRECTORY expdir TO public;
2. 常见用法:
2.1 导出scott整个schema
expdp scott/tiger@bright parfile=c:\exp.par –默认导出登陆账号的schema
exp.par内容:
DIRECTORY=expdir
DUMPFILE=scott_full.dmp
LOGFILE=scott_full.log
或者:
expdp system/oracle@bright parfile=c:\exp.par  –其他账号登陆,在参数中指定schemas
exp.par内容:
DIRECTORY=expdir
DUMPFILE=scott_full.dmp
LOGFILE=scott_full.log
SCHEMAS=SCOTT

1·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 row是什么。】

2·You execute the following command to audit the database activities:
SQL> AUDIT DROP ANY TABLE BY scott BY SESSION WHENEVER SUCCESSFUL;
What is the effect of this command?
A) One audit record is created for the whole session if user SCOTT successfully drops one or more tables in his
session.
B) One audit record is created for every session when any user successfully drops a table owned by SCOTT.
C) One audit record is created for each successful DROP TABLE command executed by any user to drop tables
owned by SCOTT.
D) One audit record is generated for the session when SCOTT grants the DROP ANY TABLE privilege to other users in
his session.
E) One audit record is created for each successful DROP TABLE command executed in the session of SCOTT.

【答案是A。by access 和 by session有什么区别。这里的whole session是什么意思。】
索引分三层,最下面一层是 leaf ,每个leaf block 包含很多 leaf row, 每个leaf row 是由键值和rowid组成,
查找索引时先找到键值,再根据对应的rowid找到数据块中的数据。更新索引要先删除后插入,因为这种方式
最简洁和规范。不然的话,如果你采用移动的方式会变得非常麻烦和不可控制。
2)by session在每个session中发出command只记录一次,by access则每个command都记录,这是ORACLE语法规定的。

by using the Automatic Workload Repository Compare Period report

比如在每天的10点到11点,是业务处理的高峰期,平时性能一直表现可以接受。但是在某一天,
性能突然表现的很糟糕。那么可以使用这种report来查看一下,oracle究竟发生了哪些变化。
具体方面包括statistic(就是说在性能表现糟糕的阶段的统计值和性能表现在正常的阶段的统计值进行比较,
看究竟发现了哪些突出的变化)、workload profile(就是看性能表现糟糕的阶段的工作量统计和在醒那功能表
现正常的阶段的工作量统计,看是否发生了明显的变化)、configuration settings(看在性能表现糟糕阶
段的配置和在性能表现正常的阶段的配置是否发生了变化)

CREATE [OR REPLACE] TRIGGER trigger_name

    AFTER SUSPEND

    ON {DATABASE | SCHEMA}

    BEGIN

    ... code ...

    END;

    当程序遇到空间不足问题暂停运行时触发此触发器,可以在触发器中对增加空间

新介绍了一个功能,RESUMABLE
就是在当前系统资源不足的时候,不是报错中断当前的事务,
而是挂起当前session,然后可以后台处理,完成挂起事务

Your boss at Certkiller .com wants you to clarify Oracle 10g. Which two statements
regarding the LOGGING clause of the CREATE TABLESPACE... statement are
correcte? Choose two.
A.This clause is not valid for a temporary or undotablespace.
B.If thetablespaceis in the NOLOGGING mode, no operation on thetablespacewill
generate redo.
C.Thetablespacewill be IntheNOLOGGING mode by default, if not specified while
creating atablespace.
D.Thetablespace-level logging attribute can be overridden by logging specification at the
table, index, materialized view, materialized view log, and partition levels.

Answer: A, D

都是很基础的概念性问题,临时表空间都是nologging的

You work as a database administrator for Certkiller .com. You are using three
database, Certkiller DB01, Certkiller DB02, and Certkiller DB03, on different
host machines in your development environment. The database serverconfiguration,
such as IP address and listener port number, change frequently due to development
requirements, and you havethe task of notifying the developers of the changes.
Which connection method would you use to overcome this overhead?
A.Host naming
B.Local naming
C.Easy Connect
D.External naming
E.directory naming

Answer: E

这个也挺容易的,不过你先要理解每个命名的不同点和用途。目录命名把所有的连接标示符、
连接描述符都放在一个目录服务器里,这有利于管理员集中管理。题目好像说的是三个数据库服务器的
ip地址经常变化吧(我的英语不是很好),那采用目录命名的话就只需要配置一下目录服务器就可以了,
而其他的命名方式则需要逐一修改tnsname和listener.ora

You work as a database administrator for Certkiller .com. In your transaction
application, you have scheduled a job to update the optimizer statistics at05:00 pm
every Friday. The job has successfully completed. Which three pieces of information
would you check to confirm that the statistics have been collected? Choose three
A.Average row size
B.Last analyzed date
C.Size of table in bytes
D.Size of table in database blocks
E.Number of free blocks in the free list
F.Number of extents present in the table.

Answer: A, B, D

这个从最后分析时间肯定可以看出来的,其他两个选项不懂
这三个是dba_tables 里的三个关键字,如果从来没有收集过统计则这几个关键字应该空的

You work as a database administrator for Certkiller .com. While executing the
command line to create a table, the user gets the following error message and the
CREATE TABLE... command fails.
ERROR at line 1:
ORA-01950: no privileges ontablespace
What could be the possible reason for this error message?
A.Thetablespace Certkiller tbs7 is full.
B.The user is not the owner of the SYSTEMtablespace.
C.The user does have quota on the Certkiller 7tablespace.
D.The user does not have sufficient system privileges to create table in the Certkiller 7
tablespace.
E.The user does not have sufficient privileges to create table on the default permanent
tablespace

Answer: C
如果是配额不足,则应该报错应该是 配额不足而不是没有权限

You are connecting to an Oracle database server from a client by using the
following connect string:
SQL> CONNECT hr/hr@pdserver.us.oracle.com:1521/proddb
Which naming method is being used in this case?

A. Local Naming
B. Easy Connect
C. External Naming
D. Directory Naming

Answer: B
easy connect 记不太清了,应该是
在客户端不用做其他的配置只要在 hosts文件里解析了服务器主机名  对应的ip
在服务端 运行netca
-〉命名方法配置—〉选择 easy connect 到右侧—〉在右侧将easy connect 移道最上-〉完成
就可以使用了

You perform differential incremental level 1 backups of your database on each working day and level 0
backup on Sundays. Which two statements are true about the differential incremental backups? (Choose two.)  

A) The backup performed on Sundays contains all the blocks that have ever been use in the database.
B) The backup performed on Sundays contains all the blocks that have changed since the last level 1 backup.
C) The backup performed on each working day contains all the blocks that have changed since the last level 0 or level 1 backup.
D) The backup performed on each working day contains all the blocks that have changed since the last level 0 backup.

A 是全备份
B 是差异增量备份
C 是差异增量备份 differential incremental level 1
D 是累积增量备份
incremental备份,可以针对上一个0级,也可以针对上一个1级。所以答案AC正确
关于0级备份和1级备份。 1级备份应该是对上一个0级备份之后的更改的数据
答案是A C

In your database, the STATISTICS_LEVEL initialization parameter is set to BASIC. What is the impact of this setting?
A) The optimizer statistics are collected automatically.
B) Only the timed operating system (OS) statistics and plan execution statistics are collected.
C) The Oracle server dynamically generates the necessary statistics on tables as part of query optimization.
D) The snapshots for the Automatic Workload Repository (AWR) are not generated automatically.
E) Snapshots cannot be collected manually by using DBMS_WORKLOAD_REPOSITORY PACKAGE.

statistics_level参数是oracle9.2开始引入的一个控制系统统计参数收集的一个开关.一共有三个值:basic,typical,all.支持alter session,alter
system 动态修改.如果要用statspack或者AWR收集系统性能统计数据.那么这个参数的值必须为typical或all.通常all是一个全面收集,包括OS以及sql执
行路径方面的一些统计信息,除非遇见非常严重的性能问题或在一些特殊的性能挣断方面才会用到statistics_level=all,平常statistics_level=typeical
已经足够挣断99%的性能问题了.
statistics_level=basic的情况下,oracle关闭了所有性能数据的收集,也就是如果要关闭AWR或statspack收集,只要设置alter system set
statistics_level=basic;就行了;

Redo log files are not multiplexed in your database. Redo log blocks are corrupted
in group 2, and archiving has stopped. All the redo logs are filled and database
activity is halted. Database writer has written everything to disk. Which command
would you execute to proceed further?
A. RECOVER LOGFILE BLOCK GROUP 2;
B. ALTER DATABASE DROP LOGFILE GROUP 2;
C. ALTER DATABASE CLEAR LOGFILE GROUP 2;
D. ALTER DATABASE RECOVER LOGFILE GROUP 2;
E. ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 2;
Answer  E
没有归档的日志直接clear是不能清除掉的,须加上unarchived,而且该日志组应该也不能是current和active的

In the middle of a transaction, a user session was abnormally terminated but the instance is still up and the database is open.
Which two statements are true in this scenario? (Choose two.)
A) Event Viewer gives more details on the failure.
B) The alert log file gives detailed information about the failure.
C) PMON rolls back the transaction and releases the locks.
D) SMON rolls back the transaction and releases the locks.
E) The transaction is rolled back by the next session that refers to any of the blocks updated by the failed transaction.
F) Data modified by the transaction up to the last commit before the abnormal termination is retained in the database.
C F
F的意思如果一个SESSION,前面有COMMIT的部分是不回滚的。只有还未COMMIT部分被回滚了。

rarely ['rεəli] adv. 很少地;难得;罕有地
SQL Profile(计划调整分析):

Your database is running under automatic undo management and the UNDO_RETENTION parameter is set to 900 sec. You executed the following
command to enable retention guarantee:
SQL> ALTER TABLESPACE undotbs1 RETENTION GUARANTEE;
What effect would this statement have on the database?
A) The extents in undo tablespace retain data until the next full database backup.
B) The extents containing committed data in the undo tablespace are never overwritten.
C) The extents which no longer contain uncommitted data in the undo tablespace are not overwritten for at least15 minutes.
D) The extents containing committed data in the undo tablespace are not overwritten until the instance is shut down.
Answer c
据我所知,undo_tetention指定的是undo信息在重做日志表空间保留的时间。当时间上过期的时候,所占用的段才会被释放用于其它用途。
如果没有其它transaction,段没有被释放,自然可以回退到更早的时候

114. View this parameter setting in your database:
DB_CREATE_FILE_DEST='D: \oracle\product\10.2.0\oradata\oracle'
You created a tablespace by using this command:
CREATE TABLESPACE USERS;
Which two statements are true about the USERS tablespace? (Choose two.)
A) The tablespace has two data files.
B) An error is reported and tablespace creation fails.
C) Data files are created with names generated by the instance.
D) The tablespace can be extended without specifying the data file.
E) Data files belonging to the USERS tablespace cannot be renamed.
  C D
db_create_file_dest 参数的官方说法是启用基于Oracle-managed files(omf)管理。对redo、control、temp、undo、data文件的omf管理
我的理解就是,不让oracle傻傻的把所有的文件都放到默认的位置,既不安全,也不好看!于是乎,oracle就推出这一参数,
让用户指定各种文件的存放位置,但为了增加点神秘感,就把文件名改为一定规则的样子罢了!

You specified extent management as local for a tablespace. How will it affect space management in the tablespace?
A) All the extents will be of the same size.
B) Bitmap will be used to record free and allocated extents.
C) Free extents will be managed by the data dictionary tables.
D) The tablespace will be system managed and the users cannot specify the extent size.
   B
除非在创建数据库时选择定制把system tablespace的区管理类型改成在字典中管理,否则在system
tablespace类型是local的情况下是不支持创建dmt类型的表空间了。
另外值得一提的是从9.2开始,即使在创建db时指定temp tbs为字典管理的,通过dbca创建时可以指定,
但是创建之后还是发现它是local管理的;使用命令创建时直接会报错:
extent management 有两种方式 extent management local (LMT); extent management dictionary (DMT)
默认的是local
Dmt,lmt就是针对表空间中extent是如何被管理而言的
每种也有两种大小增长方式:
uniform:默认为1M大小,在temp表空间里为默认的,但是不能被应用在undo表空间
autoallocate:

NLS_LANG   设置语言。

USER_A 赋权给USER_B  WITH GRANT OPTION;
B赋权C
A不能解除C的权限

SGA的各部分之和可以超过SGA_TARGET,但是不能超过SGA_MAX_SIZE
Oracle的SGA包括以下几个部分,可以通过show sga命令或者是通过查看v$sga视图来查看SGA的大概组成
在Oracle 10g中引入了一个非常重要的参数:SGA_TARGET,这也是Oracle 10g的一个新特性。
设置这个参数后,你就不需要为每个内存区来指定大小了。SGA_TARGET指定了SGA可以使用的最大内存大小,而SGA中各个内存的大小由Oracle自行控制,
不需要人为指定。Oracle可以随时调节各个区域的大小,使之达到系统性能最佳状态的个最合理大小,并且控制他们之和在SGA_TARGET指定的值之内

SGA_MAX_SIZE仍然表示SGA的大小的上限值,而SGA_TARGET是SGA的所有组件的大小的最大值之和,即当SGA_TARGET< SGA_MAX_SIZE的时候,oracle就会
忽略SGA_MAX_SIZE的值,SGA_TARGET也就成了SGA的在此实例中的上限制,它能动态改变大小,但是不能够大于SGA_MAX_SIZE的值。

in case of假设;万一;如果发生

select any dictionary 和select_catalog_role有什么...
select_catalog_role角色拥有访问包括sys模式中的表的数据库中的所有表
select any dictionary  这个是读取数据字典的权限

reexecute: 重新实施

闪回恢复区中添加或删除文件等变化都将记录在数据库的 alert 日志中,Oracle 10g 也针对该新特性提供了一个新的视图,
DBA_OUTSTANDING_ALERTS,通过该视图可以得到相关的信息

threshold ['θreʃhəuld] n. 极限,门槛,入口,开端

151. View the Exhibit to examine the output of the DBA_OUTSTANDING_ALERT view.
After 30 minutes, you executed the following command:
SQL> SELECT reason,metric_value FROM dba_outstanding_alerts;
REASON
METRIC_VALUE
-------------------------------------------------------
----------------------
Tablespace [TEST] is [28 percent] full
28.125
What could be the two reasons for the elimination of the other rows in the output? (Choose two.)
A) The threshold alert conditions are cleared.
B) The threshold alerts are transferred to DBA_ALERT_HISTORY.
C) The non-threshold-based alerts are transferred to DBA_ALERT_HISTORY.
D) The threshold alerts related to database metrics are permanently stored in
DBA_ALERT_HISTORY but not the threshold alerts related to instance metrics

答案:AB

先搞清 :
  DBA_OUTSTANDING_ALERTS :
 描述了oracle数据库认为是突出的警告。当向 Flash Recovery中添加或删除文件等变化都将记录在数据库的 alert 日志中,Oracle 10g 也针对该
新特性提供了一个新的视 图 ,通过该视图可以得到相关的信息。

 dba_alert_history:
 代表了不在突出的有时间限制的历史告警

 threshold_alert :
 是超过备份阈值时引发的警报

 ORACLE的一些内部组件可以周期性进行监控的动作,对发现的问题产生相应的alert信息。alert信息的产生是基于一些threshold值或者特定事件。
基于threshold的alert信息会自DBA_OUTSTANDING_ALERTS视图中找到,当被clear的时候,这些状态的警告会进入DBA_ALERT_HISTORY

152. Examine the following commands executed in your database:
SQL> ALTER SESSION RECYCLEBIN=ON;
Session altered
SQL > CREATE TABLE emp TABLESPACE tbsfd AS SELECT * FROM hr.employees;
Table created.
Further, you executed the following command to drop the table:
SQL> DROP TABLE emp;
Table dropped.
What happens in this scenario?
A) The table is moved to the SYSAUX tablespace.
B) The table is moved to the SYSTEM tablespace.
C) The table is removed from the database permanently.
D) The table is renamed and remains in the TBSFD tablespace.
答案:D

从Oracle10g开始,Oracle引入了flashback drop的新特性,这个新特性,允许你从当前数据库中恢复一个被drop了的对象。在执行drop操作时,
现在Oracle不是真正删除它,而是将该对象自动将放入回收站。对于一个对象的删除,其实仅仅就是简单的重令名操作。

所谓的回收站,是一个虚拟的容器,用于存放所有被删除的对象。在回收站中,被删除的对象将占用创建时的同样的空间,你甚至还可以对已经删除的
表查询,也可以利用flashback功能来恢复它, 这个就是flashback drop功能

SQL> alter session set recyclebin=off;
Session altered
在Oracle10gR2中,recyclebin变成了一个常规参数,可以在session/system级动态修改

oracle10启动EM
emctl start dbconsole

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
run orainstRoot.sh script 创建 Inventory pointer file(库存指针的文件。)

You want to move all the objects of the APPS user in the test database to the DB_USER schema of the production database. Which option
of IMPDP would you use to accomplish this task?
A) FULL
B) SCHEMAS
C) REMAP_SCHEMA
D) REMAP_DATAFILES
E) REMAP_TABLESPACE
   C

1、导出表
Expdp scott/tiger DIRECTORY=dump_dir DUMPFILE=tab.dmp TABLES=dept,emp
2、导出方案
Expdp scott/tiger DIRECTORY=dump_dir DUMPFILE=schema.dmp
SCHEMAS=system,scott
3、导出表空间
Expdp system/manager DIRECTORY=dump_dir DUMPFILE=tablespace.dmp
TABLESPACES=user01,user02

1、导入表
Impdp scott/tiger DIRECTORY=dump_dir DUMPFILE=tab.dmp TABLES=dept,emp
Impdp system/manage DIRECTORY=dump_dir DUMPFILE=tab.dmp TABLES=scott.dept,scott.emp
REMAP_SCHEMA=SCOTT:SYSTEM
第一种方法表示将DEPT和EMP表导入到SCOTT方案中,第二种方法表示将DEPT和EMP表导入的SYSTEM

1、REMAP_DATAFILE
该选项用于将源数据文件名转变为目标数据文件名,在不同平台之间搬移表空间时可能需要该选项.
REMAP_DATAFIEL=source_datafie:target_datafile
2、REMAP_SCHEMA
该选项用于将源方案的所有对象装载到目标方案中.

Connect-time failover如何解释?

Listener可以有两种方式配置:
1、静态服务注册
2、动态服务注册,再次方式下,若>1个Listener,则client请求时
一个Listener不通,会自动转到另外的Listener,;或一个Listener多个
instance时,一个instance down掉时,自动连到另一个instance;

在动态服务下,可以在tnsnames.ora文件中让Client对多个Listener发送请求,一个不通,可以转到另一个。
ora9i2a=
  (DESCRIPTION=
    (ADDRESS_LIST=
       (LOAD_BALANCE=off)
       (FAILOVER=on)
       (ADDRESS=(PRO..)(HOST=sales1-server)(PORT=1521))
       (ADDRESS=(PRO..)(HOST=sales2-server)(PORT=1521)))
     (CONNECT_DATA=(SERVICE_NAME=ora9i2a)))

A user complains about getting this error after issuing a certain SQL statement:
ORA-02393: exceeded call limit on CPU usage
Because of the error, the SQL statement gets aborted. What action would you take to increase the CPU usage limit in the subsequent
sessions of the user?
A) Modify the resource limit in the profile used by the user.
B) Set the RESOURCE_LIMIT initialization parameter to FALSE.
C) Increase the value of the SESSION_CACHED_CURSORS initialization parameter.
D) Increase the value of the SESSION_MAX_OPEN_FILES initialization parameter.
Answer:   A
你会采取什么行动来增加了限制在随后的CPU的使用
设置资源计划的初始化参数是resource_limit,这个参数设置为TRUE的时候起用资源限制。这个初始化参数是可以动态修改的。
这个参数书上说只有设为TRUE时,Profile才可以起作用的。
profile分两部分,resource_limit为true限定 资源参数(resource parameters) 设置有效,
密码参数(password parameters)设置始终有效,不管resouce_limit的值为true或false

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

You want to preserve the performance statistics collected during this period so that they can be used for comparison while analyzing
the performance of the database in the future
您想要将它保存下来的性能数据采集在这段时间里,这样他们可以用来对比分析数据库的性能
functional with peak load  功能负荷

167. Which two statements about Automatic Storage Management (ASM) are true? (Choose
A) ASM provides mirroring on file by file basis.
B) ASM provides automatic load balancing across all ASM disks.
C) ASM supports the Oracle database and operating system files.
D) ASM can be used to store trace files, alert log files, and the server parameter file (SPFILE).
Automatic Storage Management
Answer:  AB

  自动存储管理 (ASM)
  ASM 是 Oracle 数据库 10g 中一个非常出色的新特性,它以平台无关的方式提供了文件系统、逻辑卷管理器以及软件 RAID 等服务。
ASM 可以条带化和镜像磁盘,从而实现了在数据库被加载的情况下添加或移除磁盘以及自动平衡 I/O 以删除“热点”。它还支持直接和异步的
I/O 并使用 Oracle9i 中引入的 Oracle 数据管理器 API(简化的 I/O 系统调用接口)。
  ASM 不是一个通用的文件系统,并只能用于 Oracle 数据文件、重做日志以及控制文件。ASM 中的文件既可以由数据库自动创建和命名
(通过使用 Oracle 管理文件特性),也可以由 DBA 手动创建和命名。由于操作系统无法访问 ASM 中存储的文件,因此对使用 ASM 文件的
数据库执行备份和恢复操作的唯一途径就是通过恢复管理器 (RMAN)。
  ASM 作为单独的 Oracle 实例实施,只有它在运行时其他数据库才能访问它。在 Linux 上,只有运行 OCSSD 服务(由 Oracle 通用安装
程序默认安装)才能使用 ASM。ASM 需要的内存不多:对大多数系统,只需 64 MB。

enabling or disabling redo log archiving
启用或禁用日志文件归档
need to start the database in the MOUNT state

A maximum of 10 destinations can be specified.
最多10个目的地,可以指定。

多dbwr进程,如何让RMAN使用large pool进行on disk的备份/恢复?

Initially immediate vs initially deferred - -约束状态控制选项

Flashback Query - Fast Row-level Recovery

undo_retention
      这个参数设置回滚段中的被提交或回滚的数据强制保留时间,单位是秒。请注意,这个参数和1555错误有非常大的关系。
      但是,需要提醒的是,并不是回滚段中的数据超过这个时间以后就会被清除掉,而是等到后面事务产生的回滚数据覆盖掉“超期”数据。
      所以这就是为什么我们往往看到系统的回滚表空间占有率始终是100%的原因了。

请教checkpoint和redo log的数据库原理问题

例如现在有一个checkpoint C1,然后有个故障点E1

在C1到E1之间有个事务 T1,他已经commit,
按照书上的说法,这个T1事务是要redo的,但问题是这是建立T1操作的相应数据没有
从缓存中写入数据库的.如果数据已经写入数据库了,明显是不用redo的
但是书上好象从来没有提到这一点

只是说checkpoint前的已经提交的事务其操作的数据肯定也写入了数据库,所以不用redo

那么在checkpoint和故障点之间的事务是如何保证
那些已经commited的事务哪些要redo,哪些又不用redo的呢

Level 0 级是各增量备份的基础,那level 1 与level 2有什么不同呢?
分两种情况,incremental的和cumulitive的,前者备份跟自己同级或比自己级别低的,后者只备份比自己级别低的
前者:level1备份上一次level1或level0以来的变化,level2备份上一次level2或level1或level0以来的变化
后者:level1备份上一次level0以来的变化,level2备份上一次level1或level0以来的变化

oracle table-lock的5种模式
Oracle中的锁定可以分为几类:DML lock(data lock),DDL lock(dictionary lock)和internal lock/latch。
DML lock又可以分为row lock和table lock。

row lock在select.. for update/insert/update/delete时隐式自动产生,而table lock除了隐式产生,
也可以调用lock table <table_name> in </table_name> name来显示锁定。

如果不希望别的session lock/insert/update/delete表中任意一行,只允许查询,可以用
lock table table_name in exclusive mode (X)这个锁定模式级别最高,并发度最小。

如果允许别的session查询或用select for update锁定记录,不允许insert/update/delete,可以用lock table table_name in share row
exclusive mode。(SRX)

如 果允许别的session查询或select for update以及lock table table_name in share mode,只是不允许insert/update/delete,可以用lock
table table_name in share mode。(share mode和share row exclusive mode的区别在于一个是非抢占式的而另一个是抢占式的。进入
share row exclusive mode后其他session不能阻止你insert/update/delete,而进入share mode后其他session也同样可以进入share mode,
进而阻止你对表的修改。(S)

还有两种锁定模式,row share(RS)和row exclusive(RX)。他们允许的并发操作更多,一般直接用DML语句自动获得,而不用lock语句

Oracle主要提供了5种数据锁:共享锁(Share Table Lock,简称S锁)、排它锁(Exclusive Table Lock,简称X锁)、
行级锁(Row Share Table Lock,简称RS锁)、行级排它锁(Row Exclusive Table Lock,简称RX锁)
和共享行级排它锁(Share Row Exclusive Table Lock,简称SRX锁)。

用户创建的临时表是存放在TEMP表空间中的

创建Oracle临时表,可以有两种类型的临时表:

会话级的临时表

事务级的临时表。

尽管对临时表的DML操作速度比较快,但同样也是要产生 Redo Log 的,只是同样的DML语句,比对 PERMANENT 的DML 产生的Redo Log 少。

临时表不需要DML锁.当一个会话结束(用户正常退出 用户不正常退出 ORACLE实例崩溃)或者一个事务结束的时候,Oracle对这个会话的表执行 TRUNCATE 语句清空临时表数据.但不会清空其它会话临时表中的数据.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics