ORA-01157
当我们尝试使表空间联机时看到错误 ORA-01157。
SQL> alter tablespace example online;
alter tablespace example online
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 13 - see DBWR trace file
ORA-01110: data file 13:
'/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf'ORA-01157 表示错误 ORA-01110 中指示的数据文件可能丢失或无法访问,因此数据库无法锁定它。
解决方案
我们根据他们的现象分别解决ORA-01157。
1. 缺少文件
有时,DBA 在移动物理数据文件后忘记重命名数据库中的数据文件。因此,数据库找不到文件。
[oracle@test ~]$ ls -l /u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf
ls: cannot access '/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf': No such file or directory为了解决这个问题,我们应该通过重命名来指向数据库中的当前文件。
SQL> alter database rename file '/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf' to '/u01/app/oracle/oradata/ORCLCDB/ORCLPDB/erp_tbs_01.dbf';
Database altered.然后使表空间联机。
2. 无法访问的文件
恢复数据文件后,权限集或所有权可能不正确。
[oracle@test ~]$ ls -l /u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf
-rw-r----- 1 root root 209723392 Jun 28 02:13 /u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf正如我们所看到的,所有权已经消失,我们应该纠正它。
[root@test ~]# chown oracle:oinstall /u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf
[root@test ~]# ls -l /u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf
-rw-r----- 1 oracle oinstall 209723392 Jun 28 02:13 /u01/app/oracle/oradata/ORCLCDB/ORCLPDB/example01.dbf然后我们将表空间联机。
SQL> alter tablespace example online;
Tablespace altered.我们解决了。
原文标题:How to Resolve ORA-01157: cannot identify/lock data file
原文作者:Ed Chen
原文链接:https://logic.edchen.org/how-to-resolve-ora-01157-cannot-identify-lock-data-file/
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




