RAC环境下创建本地数据文件的解决方法

同事不小心,在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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/501889/viewspace-1083311/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值