[每日一题] 11gOCP 1z0-052 :2013-09-24 temporary tables(二)

2014-11-24 14:40:35 · 作者: · 浏览: 1
st-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
如果不信你可以把gyj.dmp数据用工具imp导入另一个用户,然后查一下temp_t1,temp_t2临时表中有没有数据,这个我就不做了,留给大家思考、实践。临时表是私有的数据只是临时存放,提交或着退出会话都会释放临时表中的数据。
答案C,正确。临时表并非存放在用户的表空间中,而是存放在 Schema 所指定的临时表空间中。
[html]
gyj@OCM> Select Table_Name, Tablespace_Name From User_Tables Where Table_Name Like 'TEMP%';
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
TEMP_T1
TEMP_T2
可见这两张临时表并未存放在用户的表空间中。
用户 GYJ的临时表空间是 TEMP , 用户创建的临时表是存放在TEMP表空间中的。下面来证明
[html]
gyj@OCM> SELECT UserName, Default_Tablespace def_ts, Temporary_Tablespace temp_ts FROM User_Users;
USERNAME DEF_TS TEMP_TS
------------------------------ ------------------------------ ------------------------------
GYJ GYJ TEMP
gyj@OCM> alter tablespace temp tempfile offline;
alter tablespace temp tempfile offline
*
ERROR at line 1:
ORA-12905: default temporary tablespace cannot be brought OFFLINE
gyj@OCM> create temporary tablespace temp1 tempfile '/u01/app/oracle/oradata/ocm/temp02.dbf' size 10M;
Tablespace created.
gyj@OCM> alter database default temporary tablespace temp1;
Database altered.
gyj@OCM> alter tablespace temp tempfile offline;
Tablespace altered.
gyj@OCM> INSERT INTO TEMP_T2 VALUES(1,'AAAAA');
INSERT INTO TEMP_T2 VALUES(1,'AAAAA')
*
ERROR at line 1:
ORA-00376: file 201 cannot be read at this time
ORA-01110: data file 201: '/u01/app/oracle/oradata/ocm/temp01.dbf'
答案:D不正确。临时表是私有,不同的会话相互之间是不能看到对方操作的数据。以上有证明我就不再举例了。
答案:E正确。临时表是私有的,每个会话只能查到当前会话下自己DML的数据,每个会话互不干涉,因此临时表不需要锁。这个大家可以去实验验证。