OCP-1Z0-新051-61题版本-1
2013-12-28 18:05
357 查看
QUESTION NO: 1
Evaluate the SQL statement:
TRUNCATE TABLE DEPT;
Which three are true about the SQL statement? (Choose three.)
A. It releases the storage space used by the table.
B. It does not release the storage space used by the table.
C. You can roll back the deletion of rows after the statement executes.
D. You can NOT roll back the deletion of rows after the statement executes.
E. An attempt to use DESCRIBE on the DEPT table after the TRUNCATE statement executes will display an error.
F. You must be the owner of the table or have DELETE ANY TABLE system privileges to truncate the DEPT table
Answer: A,D,F
答案解析:
参考:http://docs.oracle.com/cd/E11882_01/server.112/e25494/general.htm#ADMIN11534
It is a DDL statement and cannot be rolled back D正确,C错误
A
for the table is returned to the containing tablespace after truncation. A正确。B错误
You can truncate any table or cluster in your own schema. Any user who has the
sys@TESTDB>conn scott/tiger
Connected.
scott@TESTDB>select * from dept_new
2 ;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
50 IT CHINA
60 CLERK BEIJING
6 rows selected.
scott@TESTDB>TRUNCATE TABLE dept_new;
Table truncated.
scott@TESTDB>select * from dept_new;
no rows selected
scott@TESTDB>desc dept_new; desc不会报错。E错误。
Name Null? Type
------------------------------------------------------------- - -------- ------------------------------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
scott@TESTDB>rollback; --不能rollback
Rollback complete.
scott@TESTDB>select * from dept_new; --没有返回
no rows selected
For example, the following statement truncates the
TRUNCATE TABLE emp;
Using the
is a DDL statement and cannot be rolled back. A
and triggers) or authorizations. A
You can truncate any table or cluster in your own schema. Any user who has the
truncate a table or cluster in any schema.
Before truncating a table or clustered table containing a parent key, all referencing foreign keys in different tables must be disabled. A self-referential constraint does not have to be disabled.
As a
if auditing is enabled. Instead, a single audit record is generated for the
A hash cluster cannot be truncated, nor can tables within a hash or index cluster be individually truncated. Truncation of an index cluster deletes all rows from all tables in the cluster. If all the rows must be deleted from
an individual clustered table, use the
The
that control whether space currently allocated for a table or cluster is returned to the containing tablespace after truncation.
These options also apply to any associated indexes. When a table or cluster is truncated, all associated indexes are also truncated. The storage parameters for a truncated table, cluster, or associated indexes are not changed
as a result of the truncation.
These
This option also drops any dependent object segments associated with the partition being truncated.
Note:
This functionality is available with Oracle Database 11g release 2 (11.2.0.2).
TRUNCATE TABLE emp DROP ALL STORAGE;
available for subsequent inserts and deletes:
TRUNCATE CLUSTER emp_dept REUSE STORAGE;
Evaluate the SQL statement:
TRUNCATE TABLE DEPT;
Which three are true about the SQL statement? (Choose three.)
A. It releases the storage space used by the table.
B. It does not release the storage space used by the table.
C. You can roll back the deletion of rows after the statement executes.
D. You can NOT roll back the deletion of rows after the statement executes.
E. An attempt to use DESCRIBE on the DEPT table after the TRUNCATE statement executes will display an error.
F. You must be the owner of the table or have DELETE ANY TABLE system privileges to truncate the DEPT table
Answer: A,D,F
答案解析:
参考:http://docs.oracle.com/cd/E11882_01/server.112/e25494/general.htm#ADMIN11534
It is a DDL statement and cannot be rolled back D正确,C错误
A
TRUNCATEstatement also specifies whether space currently allocated
for the table is returned to the containing tablespace after truncation. A正确。B错误
You can truncate any table or cluster in your own schema. Any user who has the
DROP ANY TABLEsystem privilege can truncate a table or cluster in any schema. F正确。
sys@TESTDB>conn scott/tiger
Connected.
scott@TESTDB>select * from dept_new
2 ;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
50 IT CHINA
60 CLERK BEIJING
6 rows selected.
scott@TESTDB>TRUNCATE TABLE dept_new;
Table truncated.
scott@TESTDB>select * from dept_new;
no rows selected
scott@TESTDB>desc dept_new; desc不会报错。E错误。
Name Null? Type
------------------------------------------------------------- - -------- ------------------------------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
scott@TESTDB>rollback; --不能rollback
Rollback complete.
scott@TESTDB>select * from dept_new; --没有返回
no rows selected
Using TRUNCATE
You can delete all rows of the table using theTRUNCATEstatement.
For example, the following statement truncates the
emptable:
TRUNCATE TABLE emp;
Using the
TRUNCATEstatement provides a fast, efficient method for deleting all rows from a table or cluster. A
TRUNCATEstatement does not generate any undo information and it commits immediately. It
is a DDL statement and cannot be rolled back. A
TRUNCATEstatement does not affect any structures associated with the table being truncated (constraints
and triggers) or authorizations. A
TRUNCATEstatement also specifies whether space currently allocated for the table is returned to the containing tablespace after truncation.
You can truncate any table or cluster in your own schema. Any user who has the
DROP ANY TABLEsystem privilege can
truncate a table or cluster in any schema.
Before truncating a table or clustered table containing a parent key, all referencing foreign keys in different tables must be disabled. A self-referential constraint does not have to be disabled.
As a
TRUNCATEstatement deletes rows from a table, triggers associated with the table are not fired. Also, a
TRUNCATEstatement does not generate any audit information corresponding to
DELETEstatements
if auditing is enabled. Instead, a single audit record is generated for the
TRUNCATEstatement being issued.
A hash cluster cannot be truncated, nor can tables within a hash or index cluster be individually truncated. Truncation of an index cluster deletes all rows from all tables in the cluster. If all the rows must be deleted from
an individual clustered table, use the
DELETEstatement or drop and re-create the table.
The
TRUNCATEstatement has several options
that control whether space currently allocated for a table or cluster is returned to the containing tablespace after truncation.
These options also apply to any associated indexes. When a table or cluster is truncated, all associated indexes are also truncated. The storage parameters for a truncated table, cluster, or associated indexes are not changed
as a result of the truncation.
These
TRUNCATEoptions are:
DROP STORAGE, the default option, reduces the number of extents allocated to the resulting table to the original setting for
MINEXTENTS. Freed extents are then returned to the system and can be used by other objects.
DROP
ALL
STORAGEdrops the segment. In addition to the
TRUNCATE
TABLEstatement,
DROP
ALL
STORAGEalso applies to the
ALTER
TABLE
TRUNCATE
(SUB)PARTITIONstatement.
This option also drops any dependent object segments associated with the partition being truncated.
DROP
ALL
STORAGEis not supported for clusters.
Note:
This functionality is available with Oracle Database 11g release 2 (11.2.0.2).
TRUNCATE TABLE emp DROP ALL STORAGE;
REUSE STORAGEspecifies that all space currently allocated for the table or cluster remains allocated to it. For example, the following statement truncates the
emp_deptcluster, leaving all extents previously allocated for the cluster
available for subsequent inserts and deletes:
TRUNCATE CLUSTER emp_dept REUSE STORAGE;
相关文章推荐
- OCP-1Z0-新051-61题版本-16
- OCP-1Z0-新051-61题版本-28
- OCP-1Z0-新051-61题版本-46
- OCP-1Z0-新051-61题版本-2
- OCP-1Z0-新051-61题版本-17
- OCP-1Z0-新051-61题版本-29
- OCP-1Z0-新051-61题版本-47
- OCP-1Z0-新051-61题版本-3
- OCP-1Z0-新051-61题版本-18
- OCP-1Z0-新051-61题版本-30
- OCP-1Z0-新051-61题版本-48
- OCP-1Z0-新051-61题版本-4
- OCP-1Z0-新051-61题版本-19
- OCP-1Z0-新051-61题版本-31
- OCP-1Z0-新051-61题版本-49
- OCP-1Z0-新051-61题版本-5
- OCP-1Z0-新051-61题版本-20
- OCP-1Z0-新051-61题版本-32
- OCP-1Z0-新051-61题版本-50
- OCP-1Z0-新051-61题版本-6