ORA-25153: Temporary Tablespace is Empty解决方法

时间:2023-03-08 22:01:16

SQL> @/tmp/4.txt

create table huang_1 (deptno number,dname varchar2(19),loc varchar2(20))

*

ERROR at line 1:

ORA-25153: Temporary Tablespace is Empty

提示temporary表空间为空。

下面我们查看当前是那个用户

SQL> show user

USER is "SYS"

下面我们查看这个用户的默认的temporary表空间是那个。

SQL> select username,temporary_tablespace from dba_users where username='SYS';

USERNAME                       TEMPORARY_TABLESPACE

------------------------------ ------------------------------

SYS                            TEMP

下面我们查看这个表空间在状态。

SQL> select tablespace_name,status from dba_tablespaces where tablespace_name='TEMP';

TABLESPACE STATUS

---------- ---------

TEMP       ONLINE

这里是online,如果是offline,我们就要alter tablespace temp online,online我们就不管它。

下面我们查看表空间和数据文件的对应关系。

SQL> select file_name,tablespace_name from dba_temp_files;

FILE_NAME                                          TABLESPACE

-------------------------------------------------- ----------

/opt/oracle/oradata/orcl/temphuang.dbf             TEMPHUANG

在这里我们没有看到temp这个表空间,说明temp这个表空间的数据文件在逻辑上面是不存在的,下面我们查看物理上面是否存在,

SQL> !ls /opt/oracle/oradata/orcl/temp01.dbf

/opt/oracle/oradata/orcl/temp01.dbf

上面说明物理上面是存在的,只是逻辑上面不存在,下面我们填加就可以了。

SQL> alter tablespace temp add tempfile '/opt/oracle/oradata/orcl/temp01.dbf';

Tablespace altered.

下面再次查看是否存在

SQL> select tablespace_name,file_name from dba_temp_files;

TABLESPACE FILE_NAME

---------- --------------------------------------------------

TEMPHUANG  /opt/oracle/oradata/orcl/temphuang.dbf

TEMP       /opt/oracle/oradata/orcl/temp01.dbf

已经存在了,下面是执行我们原来执行的命令。

SQL> @/tmp/4.txt

Table created.

已经成功了。

--本篇文章转自:ORA-25153: Temporary Tablespace is Empty 解决方法