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

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



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24486203/viewspace-2157173/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/24486203/viewspace-2157173/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值