您的位置:首页 > 其它

OCP 1Z0 052 170

2014-06-23 11:34 190 查看
170. 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.

Answer: AD

http://docs.oracle.com/cd/E11882_01/server.112/e41084/clauses002.htm#SQLRF52221

Restriction on [NOT] DEFERRABLE You cannot specify either of these parameters for a view constraint.

INITIALLY Clause The
INITIALLY
clause establishes the default checking behavior for constraints that are
DEFERRABLE
.
The
INITIALLY
setting can be overridden by a
SET
CONSTRAINT
(
S
) statement in a subsequent transaction.

Specify
INITIALLY
IMMEDIATE
to
indicate that Oracle should check this constraint at the end of each subsequent SQL statement. If you do not specify
INITIALLY
at all, then the default is
INITIALLY
IMMEDIATE
.
If you declare a new constraint
INITIALLY
IMMEDIATE
, then it must be valid at the time the
CREATE
TABLE
or
ALTER
TABLE
statement
is committed or the statement will fail.

Specify
INITIALLY
DEFERRED
to indicate that Oracle
should check this constraint at the end of subsequent transactions.

This clause is not valid if you have declared the constraint to be
NOT
DEFERRABLE
, because a
NOT
DEFERRABLE
constraint
is automatically
INITIALLY
IMMEDIATE
and cannot ever be
INITIALLY
DEFERRED
.

VALIDATE | NOVALIDATE The behavior of
VALIDATE
and
NOVALIDATE
always
depends on whether the constraint is enabled or disabled, either explicitly or by default. Therefore they are described in the context of "ENABLE
Clause" and "DISABLE Clause".

ENABLE Clause Specify
ENABLE
if you want the constraint
to be applied to the data in the table.

If you enable a unique or primary key constraint, and if no index exists on the key, then Oracle Database creates a unique index. Unless you specify
KEEP INDEX
when subsequently disabling the constraint, this index is dropped
and the database rebuilds the index every time the constraint is reenabled.

You can also avoid rebuilding the index and eliminate redundant indexes by creating new primary key and unique constraints initially disabled. Then create (or use existing) nonunique indexes to enforce the constraint. Oracle does not drop a nonunique index
when the constraint is disabled, so subsequent
ENABLE
operations are facilitated.

ENABLE
VALIDATE
specifies
that all old and new data also complies with the constraint. An enabled validated constraint guarantees that all data is and will continue to be valid.
If any row in the table violates the integrity constraint, then the constraint remains disabled and Oracle returns an error. If all rows comply with the constraint, then Oracle enables the constraint. Subsequently,
if new data violates the constraint, then Oracle does not execute the statement and returns an error indicating the integrity constraint violation.
If you place a primary key constraint in
ENABLE
VALIDATE
mode, then the validation process will verify that the primary key columns contain
no nulls. To avoid this overhead, mark each column in the primary key
NOT
NULL
before entering data into the column and before enabling the primary key constraint of the table.

ENABLE
NOVALIDATE
ensures that all new DML operations
on the constrained data comply with the constraint. This clause does not ensure that existing data in the table complies with the constraint.

If you specify neither
VALIDATE
nor
NOVALIDATE
, then the default is
VALIDATE
.

If you change the state of any single constraint from
ENABLE
NOVALIDATE
to
ENABLE
VALIDATE
, then the operation can
be performed in parallel, and does not block reads, writes, or other DDL operations.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: