温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

rac归档模式/非归档模式下文件建至本地存储修复方法-ORA-01157

发布时间:2020-08-07 20:44:03 来源:ITPUB博客 阅读:204 作者:shawnloong 栏目:关系型数据库
rac归档模式下文件建至本地存储修复方法(以下为测试,生产环境慎重操作)
模拟误操作
节点1添加数据文件

点击(此处)折叠或打开

  1. SQL> alter tablespace netdata add datafile 'netdata03.dbf' size 20M;

节点2查询

点击(此处)折叠或打开

  1. SQL> select file_name from dba_data_files;
  2. ERROR:
  3. ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
  4. ORA-01110: data file 7: '/u01/app/oracle/product/11.2.0/db_1/dbs/netdata02.dbf'

将错误添加datafile offline

点击(此处)折叠或打开

  1. SQL> alter database datafile 7 offline;
  2. Database altered.
修改文件路径

点击(此处)折叠或打开

  1. SQL> alter database rename file '/u01/app/oracle/product/11.2.0/db_1/dbs/netdata02.dbf' to '+DATA1/DEVDB/DATAFILE/netdata02.dbf';


  2. Database altered.
recovery datafile

点击(此处)折叠或打开

  1. SQL> recover datafile 7;
  2. Media recovery complete.
datafile online

点击(此处)折叠或打开

  1. SQL> alter database datafile 7 online;


  2. Database altered.

节点2查询已经正常

点击(此处)折叠或打开

  1. SQL> select file_name from dba_data_files;


  2. FILE_NAME
  3. --------------------------------------------------------------------------------
  4. +DATA1/devdb/datafile/users.269.937046643
  5. +DATA1/devdb/datafile/undotbs1.276.937046643
  6. +DATA1/devdb/datafile/sysaux.277.937046643
  7. +DATA1/devdb/datafile/system.268.937046635
  8. +DATA1/devdb/datafile/undotbs2.267.937047083
  9. +DATA1/devdb/datafile/netdata.284.937049537
  10. +DATA1/devdb/datafile/netdata02.dbf


  11. 7 rows selected.
rac非归档模式下文件建至本地存储修复方法

点击(此处)折叠或打开

  1. SQL> archive log list;
  2. Database log mode No Archive Mode
  3. Automatic archival Disabled
  4. Archive destination USE_DB_RECOVERY_FILE_DEST
  5. Oldest online log sequence 175
  6. Current log sequence 177
  7. SQL>

  8. SQL> show parameters cluster;


  9. NAME TYPE VALUE
  10. ------------------------------------ ----------- ------------------------------
  11. cluster_database boolean TRUE
  12. cluster_database_instances integer 2
  13. cluster_interconnects string
误操作模拟

点击(此处)折叠或打开

  1. SQL> alter tablespace netdata add datafile 'netdata03.dbf' size 20M;

  2. Tablespace altered.

  3. SQL> select file_name from dba_data_files;
  4. ERROR:
  5. ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
  6. ORA-01110: data file 8: '/u01/app/oracle/product/11.2.0/db_1/dbs/netdata03.dbf'
尝试offline报错

点击(此处)折叠或打开

  1. SQL> alter database datafile 8 offline;
  2. alter database datafile 8 offline
  3. *
  4. ERROR at line 1:
  5. ORA-01145: offline immediate disallowed unless media recovery enabled



关库

点击(此处)折叠或打开

  1. [grid@rac1-213-11 ~]$ srvctl stop database -d devdb -o immediate
cp文件至asm

点击(此处)折叠或打开

  1. [grid@rac1-213-11 ~]$ asmcmd
  2. ASMCMD> pwd
  3. +DATA1/DEVDB/DATAFILE
  4. ASMCMD> cp /u01/app/oracle/product/11.2.0/db_1/dbs/netdata03.dbf .
  5. copying /u01/app/oracle/product/11.2.0/db_1/dbs/netdata03.dbf -> +DATA1/DEVDB/DATAFILE/netdata03.dbf
  6. ASMCMD> quit
启动到mount

点击(此处)折叠或打开

  1. [grid@rac1-213-11 ~]$ srvctl start database -d devdb -o mount


修改文件路径

点击(此处)折叠或打开

  1. [root@rac1-213-11 ~]# su - oracle
  2. [oracle@rac1-213-11 ~]$ sqlplus / as sysdba
  3. SQL*Plus: Release 11.2.0.4.0 Production on Sun Jul 1 22:02:50 2018
  4. Copyright (c) 1982, 2013, Oracle. All rights reserved.
  5. Connected to:
  6. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  7. With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
  8. Data Mining and Real Application Testing options
  9. SQL> alter database rename file '/u01/app/oracle/product/11.2.0/db_1/dbs/netdata03.dbf' to '+DATA1/DEVDB/DATAFILE/netdata03.dbf';
  10. Database altered.
节点2查询 正常

点击(此处)折叠或打开

  1. SQL> select open_mode from v$database;

  2. OPEN_MODE
  3. --------------------
  4. READ WRITE



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI