RAC環境下建立本地資料檔案的解決方法

charmesp發表於2014-02-18
同事不小心,在RAC環境下建立了本地資料檔案,這個肯定會出問題的,節點2不能訪問此資料檔案。其實發現做錯了,立馬刪掉應該沒有問題。資料檔案還沒有資料。
下面演示一下錯誤的解決方法,思路就是,把本地檔案COPY到共享磁碟中(ASM),在rename即可。

點選(此處)摺疊或開啟

  1. SQL> alter tablespace USERS add datafile '/home/oracle/user01.dbf' size 10m;//建立錯誤過程

  2. Tablespace altered.

  3. SQL> alter database datafile 8 offline;

  4. Database altered.

  5. SQL>
  6. SQL>
  7. SQL>
  8. SQL> exit
  9. Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
  10. With the Partitioning, Real Application Clusters, OLAP, Data Mining
  11. and Real Application Testing options
  12. oracle@zbdb1:~/product/10.2.0/db_1/bin> rman target /

  13. Recovery Manager: Release 10.2.0.4.0 - Production on Tue Feb 18 16:17:54 2014

  14. Copyright (c) 1982, 2007, Oracle. All rights reserved.


  15. connected to target database: QT0000J2 (DBID=3109660417)

  16. RMAN>
  17. RMAN>

  18. RMAN>

  19. RMAN>

  20. RMAN> copy datafile '/home/oracle/user01.dbf' to '+RACDG';

  21. Starting backup at 18-FEB-14
  22. using target database control file instead of recovery catalog
  23. allocated channel: ORA_DISK_1
  24. channel ORA_DISK_1: sid=1060 instance=qt0000j21 devtype=DISK
  25. channel ORA_DISK_1: starting datafile copy
  26. input datafile fno=00008 name=/home/oracle/user01.dbf
  27. output filename=+RACDG/qt0000j2/datafile/users.270.839866683 tag=TAG20140218T161802 recid=1 stamp=839866682
  28. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
  29. Finished backup at 18-FEB-14

  30. RMAN> exit


  31. Recovery Manager complete.
  32. oracle@zbdb1:~/product/10.2.0/db_1/bin> sqlplus / as sysdba;

  33. SQL*Plus: Release 10.2.0.4.0 - Production on Tue Feb 18 16:19:02 2014

  34. Copyright (c) 1982, 2007, Oracle. All Rights Reserved.


  35. Connected to:
  36. Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
  37. With the Partitioning, Real Application Clusters, OLAP, Data Mining
  38. and Real Application Testing options

  39. SQL>
  40. SQL>
  41. SQL> alter database rename file '/home/oracle/user01.dbf' to '+RACDG/qt0000j2/datafile/users.270.839866683';

  42. Database altered.

  43. SQL>
  44. SQL>
  45. SQL>
  46. SQL> select name from v$datafiles;
  47. select name from v$datafiles
  48.                  *
  49. ERROR at line 1:
  50. ORA-00942: table or view does not exist


  51. SQL> select name from v$datafile;

  52. NAME
  53. --------------------------------------------------------------------------------
  54. +RACDG/qt0000j2/datafile/system.259.730655367
  55. +RACDG/qt0000j2/datafile/undotbs1.260.730655371
  56. +RACDG/qt0000j2/datafile/sysaux.261.730655371
  57. +RACDG/qt0000j2/datafile/undotbs2.263.730655377
  58. +RACDG/qt0000j2/datafile/users.264.730655377
  59. +RACDG/qt0000j2/datafile/ciimss_ts.268.733087301
  60. +RACDG/qt0000j2/datafile/ciimss_idx_ts.269.733087365
  61. +RACDG/qt0000j2/datafile/users.270.839866683

  62. 8 rows selected.

  63. SQL> select file_name,file_id,ONLINE_STATUS from dba_data_files;

  64. +RACDG/qt0000j2/datafile/users.270.839866683     8 RECOVER

  65. SQL> recover datafile 8;
  66. ORA-00279: change 225618407 generated at 02/18/2014 16:17:27 needed for thread
  67. 1
  68. ORA-00289: suggestion :
  69. /home/oracle/product/10.2.0/db_1/dbs/arch1_2667_730655361.dbf
  70. ORA-00280: change 225618407 for thread 1 is in sequence #2667


  71. Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
  72. auto
  73. Log applied.
  74. Media recovery complete.
  75. SQL> select file_name,file_id,ONLINE_STATUS from dba_data_files;
  76. +RACDG/qt0000j2/datafile/users.270.839866683     8 OFFLINE

  77.  SQL> alter database datafile \'+RACDG/qt0000j2/datafile/users.270.839866683\' online;


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/501889/viewspace-1083311/,如需轉載,請註明出處,否則將追究法律責任。

相關文章