溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

rac歸檔模式/非歸檔模式下文件建至本地存儲修復方法-ORA-01157

發(fā)布時間:2020-08-07 20:44:03 來源:ITPUB博客 閱讀:203 作者:shawnloong 欄目:關系型數(shù)據(jù)庫
rac歸檔模式下文件建至本地存儲修復方法(以下為測試,生產環(huán)境慎重操作)
模擬誤操作
節(jié)點1添加數(shù)據(jù)文件

點擊(此處)折疊或打開

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

節(jié)點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.

節(jié)點2查詢已經(jīng)正常

點擊(此處)折疊或打開

  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
  2. 、


修改文件路徑

點擊(此處)折疊或打開

  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.
節(jié)點2查詢 正常

點擊(此處)折疊或打開

  1. SQL> select open_mode from v$database;

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



向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內容。

AI