在测试库中做一个lob测试时,抛出如下这个错误:
scott@ORCL> select dbms_metadata.get_ddl('TABLE','T') from dual;
ERROR:
ORA-25153: Temporary Tablespace is Empty
ORA-06512: at "SYS.DBMS_LOB", line 424
ORA-06512: at "SYS.DBMS_METADATA", line 568
ORA-06512: at "SYS.DBMS_METADATA", line 1246
ORA-06512: at line 1
看了一下DBA_TABLESPACES,TEMP2的status还online....不过是假象。
scott@ORCL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
UNDOTBS1 ONLINE
USERS ONLINE
CTOC ONLINE
TEMP2 ONLINE
SDR ONLINE
PERFSTAT ONLINE
OA ONLINE
ORATEXT ONLINE
9 rows selected.
scott@ORCL> select * from v$tempfile;
no rows selected
scott@ORCL> select tablespace_name,file_name from dba_temp_files;
no rows selected
dba_temp_files里可是空空如也~~
再看看v$datafile里的情况
scott@ORCL> select name from v$datafile;
NAME
--------------------------------------------------
/oracle/oradata/orcl/system01.dbf
/oracle/oradata/orcl/undotbs01.dbf
/oracle/oradata/orcl/users01.dbf
/oracle/oradata/orcl/CTOC01.dbf
/oracle/product/9.2/dbs/SDR01.DBF
/oracle/oradata/orcl/perfstat.dbf
/oracle/oradata/orcl/oa01.dbf
/oracle/oradata/orcl/oratext01.dbf
8 rows selected.
个人觉得应该有两种情况可以引起类似错误:一种是OS level的physical datafile不见了,一种是logical tempfile不见了,我这种应该是第二种情况,验证一下。
[oracle@q1test01 orcl]$ ls -al
total 1427632
drwxr-xr-x 3 oracle oinstall 4096 Jul 30 12:35 .
drwxr-xr-x 3 oracle oinstall 4096 Aug 15 2007 ..
drwxr-xr-x 2 oracle oinstall 4096 Aug 12 13:42 archivelog
-rw-r----- 1 oracle oinstall 1056761 Nov 16 2007 block01.dbf
-rw-r----- 1 oracle oinstall 1875968 Sep 24 13:34 control01.ctl
-rw-r----- 1 oracle oinstall 1875968 Sep 24 13:34 control02.ctl
-rw-r----- 1 oracle oinstall 1875968 Sep 24 13:34 control03.ctl
-rw-r----- 1 oracle oinstall 524296192 Sep 21 21:53 CTOC01.dbf
-rw-r----- 1 oracle oinstall 20979712 Sep 21 21:53 oa01.dbf
-rw-r----- 1 oracle oinstall 20979712 Sep 21 21:53 oratext01.dbf
-rw-r----- 1 oracle oinstall 209723392 Sep 21 21:53 perfstat.dbf
-rw-r----- 1 oracle oinstall 10486272 Sep 11 11:07 redo01.log
-rw-r----- 1 oracle oinstall 10486272 Sep 21 21:43 redo02.log
-rw-r----- 1 oracle oinstall 10486272 Sep 24 13:30 redo03.log
-rw-r----- 1 oracle oinstall 262152192 Sep 24 13:15 system01.dbf
-rw-r----- 1 oracle oinstall 59777024 Jan 16 2008 temp01.dbf
-rw-r----- 1 oracle oinstall 5251072 Jan 17 2008 temp02.dbf
-rw-r----- 1 oracle oinstall 52436992 Jan 17 2008 temp1.dbf
-rw-r----- 1 oracle oinstall 5251072 Jan 17 2008 temp201.dbf
-rw-r----- 1 oracle oinstall 220209152 Sep 24 13:25 undotbs01.dbf
-rw-r----- 1 oracle oinstall 104865792 Sep 24 11:04 users01.dbf
说明一下:之前利用这个库做过一次temp表空间切换的测试,故现在可以看到有不同的temp的datafile.
注意一下时间,temp201.dbf datafile最后access时间怎么还停留在1月!难道是当时切换temp表空间的后遗症??
没有道理的,正式环境下的切换并没有出现此问题.
后来在网上的帖子得到启示,定位此问题应该是后来做重建控制文件的测试使得temp文件掉了.
重新加上这个temp文件应该问题可以得到解决:
scott@ORCL> alter tablespace temp2 add tempfile '/oracle/oradata/orcl/temp201.dbf';
Tablespace altered.
scott@ORCL> select FILE_NAME,TABLESPACE_NAME,STATUS from dba_temp_files;
FILE_NAME TABLESPACE_NAME STATUS
----------------------------------- ------------------------------ ---------
/oracle/oradata/orcl/temp201.dbf TEMP2 AVAILABLE
好了,再运行一下文章开头的那条语句.看一下还抛出那个错误不.
scott@ORCL> select dbms_metadata.get_ddl('TABLE','T') from dual;
DBMS_METADATA.GET_DDL('TABLE','T')
--------------------------------------------------------------------------------
CREATE TABLE "SYS"."T"
( "ID" NUMBER(*,0),
"TXT" CLOB,
PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SYSTEM" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SYSTEM"
LOB ("TXT") STORE AS (
TABLESPACE "SYSTEM" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
NOCACHE
STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
OK!正常了......
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12045182/viewspace-462878/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12045182/viewspace-462878/