移動資料檔案從檔案系統到ASM磁碟組中

liglewang發表於2011-09-16

測試環境:ORACLE 10.2.0.4 + ASM

把資料庫檔案從檔案系統移動到ASM,跟之前介紹的將ASM磁碟中的資料檔案移動到檔案其實差不多,也是有兩種方法可以實現,分別在資料庫關閉或者掛在狀態和在資料庫執行時把涉及到的表空間OFFLINE,下面我們透過實際操作來介紹下:

資料庫處於RUNNINGOPEN)狀態

1、  確認要移動的資料檔案

SQL> select file_id,file_name,tablespace_name from dba_data_files where file_id=4;
FILE_ID FILE_NAME                      TABLESPACE_NAME
---------- -------------------------------------------------- ------------------------------
4      /home/oracle/users.dbf            USERS

2、  OFFLINE表空間USERS

SQL> alter tablespace users offline;
Tablespace altered.

3、  透過RMAN進行COPY

RMAN> copy datafile 4 to '+XINER_DATA';
Starting backup at 07-APR-2011 12:35:51
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/home/oracle/users.dbf
output filename=+XINER_DATA/xiner/datafile/users.266.747837351
ag=TAG20110407T123551 recid=3 stamp=747837353
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 07-APR-2011 12:35:54
Starting Control File and SPFILE Autobackup at 07-APR-2011 12:35:54
piece handle=/u01/app/oracle/product/10.2.0/db_1/dbs/c-4034639180-20110407-07 comment=NONE
Finished Control File and SPFILE Autobackup at 07-APR-2011 12:35:57

4、  更新控制檔案以便其可以識別新路徑下的資料檔案

RMAN> switch datafile 4 to copy;
datafile 4 switched to datafile copy "+XINER_DATA/xiner/datafile/users.266.747837351"

5、  確認資料檔案已被遷至ASM磁碟組

SQL> select file_name,tablespace_name from dba_data_files where file_id=4;
FILE_NAME                      TABLESPACE_NAME
-------------------------------------------------- ------------------------------
+XINER_DATA/xiner/datafile/users.266.747837351     USERS

另外一種方式就是將資料庫關閉(shutdown)或者啟動到MOUNT狀態,然後透過RMAN進行copy,更以上面的步驟幾乎一樣,我就省略不寫了,有什麼問題,歡迎大家留言~

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

相關文章