ORA-01641
尝试将数据文件添加到表空间,但失败并出现 ORA-01641。
SQL> alter tablespace example add datafile '/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf' size 10m autoextend on next 10m maxsize unlimited;
alter tablespace example add datafile '/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf' size 10m autoextend on next 10m maxsize unlimited
*
ERROR at line 1:
ORA-01641: tablespace 'EXAMPLE' is not online - cannot add data file
ORA-01641 表示您要添加数据文件的表空间不在线(即可写),当表空间为OFFLINE或READ ONLY时,您无法添加文件。
解决方案
1.对于离线表空间
首先,我们检查了表空间的状态。
SQL> select status from dba_tablespaces where tablespace_name = 'EXAMPLE';
STATUS
---------
OFFLINE
在进行任何操作之前,请确保对该表空间的所有操作都已完成。否则,您在尝试联机时可能会看到错误。
为了使表空间联机,我们像这样更改表空间。
SQL> alter tablespace example online;
Tablespace altered.
SQL> select status from dba_tablespaces where tablespace_name = 'EXAMPLE';
STATUS
---------
ONLINE
2.对于只读表空间
我们通常将表空间设置为只读以保护它不被更改。
SQL> select status from dba_tablespaces where tablespace_name = 'EXAMPLE';
STATUS
---------
READ ONLY
为了使READ ONLY表空间可写,我们通过更改它来将其恢复为READ WRITE 。
SQL> alter tablespace example read write;
Tablespace altered.
SQL> select status from dba_tablespaces where tablespace_name = 'EXAMPLE';
STATUS
---------
ONLINE
现在,您可以将数据文件添加到表空间。
原文标题:How to Resolve ORA-01641: tablespace is not online - cannot add data file
原文作者:Ed Chen
原文链接:https://logic.edchen.org/how-to-resolve-ora-01641-tablespace-is-not-online-cannot-add-data-file/
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。