暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

故障处理|Oracle如何解决 ORA-01542:表空间脱机,无法在其中分配空间

原创 小小亮 2022-11-04
1678

ORA-01542

试图将一个表移动到另一个表空间,但我们得到了 ORA-01542。

SQL> alter table employees move tablespace users online;
alter table employees move tablespace users online
            *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01542: tablespace 'EXAMPLE' is offline, cannot allocate space in it

ORA-01542 表示语句中涉及的表空间现在处于脱机状态,无法访问或重新分配段的空间。

让我们通过查询DBA_TABLESPACES查看表空间的状态。

SQL> select status from dba_tablespaces where tablespace_name = 'EXAMPLE';

STATUS
---------
OFFLINE

然后检查数据文件。

SQL> column name format a60;
SQL> select name, status from v$datafile order by file#;

NAME                                                         STATUS
------------------------------------------------------------ -------
/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/system01.dbf         SYSTEM
/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/sysaux01.dbf         ONLINE
/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/undotbs01.dbf        ONLINE
/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/users01.dbf          ONLINE
/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf        OFFLINE
/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example02.dbf        OFFLINE

6 rows selected.

如我们所见,属于表空间EXAMPLE的数据文件处于脱机状态。

解决方案

为了使用户能够访问表空间,我们应该将其联机。

SQL> alter tablespace example online;

Tablespace altered.

SQL> select status from dba_tablespaces where tablespace_name = 'EXAMPLE';

STATUS
---------
ONLINE

现在我们可以做我们的工作了。

SQL> alter table employees move tablespace users online;

Table altered.



原文标题:How to Resolve ORA-01542: tablespace is offline, cannot allocate space in it

原文作者:Ed Chen

原文链接:https://logic.edchen.org/how-to-resolve-ora-01542-tablespace-is-offline-cannot-allocate-space-in-it/

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论