如何移動asm磁碟組內的資料檔案到另外一個磁碟組
1) Identify the data file to be moved.
2) Identify the diskgroup on to which the file has to be moved.
3) Take the file offline.
4) Copy the file to new diskgroup using Either RMAN or DBMS_FILE_TRANSFER.
5) Rename the file to point to new location.
6) Recover the file.
7) Bring the file online.
8) Verify the new file locations.
9) Delete the file from its original location.
1) Identify the data file to be moved.
----------------------------------------
In database instance
SQL:ORCL> SELECT FILE_NAME FROM DBA_DATA_FILES:
+ASMDSK2/orcl/datafile/users.256.565313879 <======= Move this to ASDSK1.
+ASMDSK1/orcl/sysaux01.dbf
+ASMDSK1/orcl/undotbs01.dbf
+ASMDSK1/orcl/system01.dbf
2) Identify the diskgroup on to which the file has to be moved.
--------------------------------------------------------------
In ASM instance
SQL:ASM> SELECT GROUP_NUMBER, NAME FROM V$ASM_DISKGROUP;
GROUP_NUMBER NAME
------------ ---------
1 ASMDSK1
2 ASMDSK2
3) Take the file offline.
--------------------------
SQL:ORCL> ALTER DATABASE DATAFILE '+ASMDSK2/orcl/datafile/users.256.565313879' OFFLINE;
4)Now Copy the file from Source diskgroup ASMDSK1 to target Diskgroup ASMDSK2.
--------------------------------------------------------------------------------------------
Either
4. a) DBMS_FILE_TRANSFER package or
4. b) RMAN
can be used for this step.
( The step 5 to step 8 is based on the filenames from method b).
4.a).Using DBMS_FILE_TRANSFER package
SQL:ORCL>create or replace directory orcl1 as '+asmdsk1/orcl/datafile';
SQL:ASM> Alter disgroup asmdsk2 add directory '+asmdsk2/test';
SQL:ORCL> create or replace directory orcl2 as '+asmdsk2/test';
SQL:ORCL>
BEGIN
DBMS_FILE_TRANSFER.COPY_FILE(
source_directory_object => 'ORCL1',
source_file_name => 'users.259.565359071',
destination_directory_object => 'ORCL2',
destination_file_name => 'USERS01.DBF');
END; Database altered.
4 b).Using RMAN copy the file to new diskgroup.
$ rman target system@orcl10
target database Password:
connected to target database: ORCL (DBID=1089529226)
RMAN>
RMAN> COPY DATAFILE '+ASMDSK2/orcl/datafile/users.256.565313879' TO '+ASMDSK1';
Starting backup at 03-AUG-05
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=146 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=+ASMDSK2/orcl/datafile/users.256.565313879
output filename=+ASMDSK1/orcl/datafile/users.259.565359071 tag=TAG20050803T12110
9 recid=2 stamp=565359071
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 03-AUG-05
5) Rename the file to point to new location.
-------------------------------------------
If you have used DBMS_FILE_TRANSFER (method 4 a)) use the following command to rename:
SQL:ORCL> ALTER DATABASE RENAME FILE '+ASMDSK2/orcl/datafile/users.256.565313879' TO
'+ASMDSK1/orcl/datafile/users.259.565359071'
Database altered.
If you have used RMAN (method 4 b) use the following option of RMAN
RMAN run {
set newname for datafile '+ASMDSK2/orcl/datafile/users.256.565313879'
to '+ASMDSK1/orcl/datafile/users.259.565359071' ;
switch datafile all;
}
6) Recover the file.
-------------------
SQL:ORCL> RECOVER DATAFILE '+ASMDSK1/orcl/datafile/users.259.565359071'
Media recovery complete.
7) Bring the file online.
-----------------------
SQL:ORCL>ALTER DATABASE DATAFILE '+ASMDSK1/orcl/datafile/users.259.565359071' ONLINE
Database altered.
8) Verify the new file location.
---------------------------------
SQL:ORCL> SELECT FILE_NAME FROM DBA_DATA_FILES;
FILE_NAME
-------------------------------------------------------------------------------
+ASMDSK1/orcl/datafile/users.259.565359071
+ASMDSK1/orcl/sysaux01.dbf
+ASMDSK1/orcl/undotbs01.dbf
+ASMDSK1/orcl/system01.dbf
9) Delete the file from its original location either per SQLPLUS or per ASMCMD:
e.g.: SQL:ASM> ALTER DISKGROUP ASMDSK2 DROP FILE users.256.565313879;
or: ASMCMD> rm -rf <filename>
Note:
Most Automatic Storage Management files do not need to be manually
deleted because, as Oracle managed files, they are removed
automatically when they are no longer needed.
However, if
you need to drop an Oracle Managed File (OMF) manually you should use
the fully qualified filename if you reference the file. Otherwise you
will get an error (e.g. ORA-15177).
e.g.: SQL:ASM> ALTER DISKGROUP ASMDSK2 DROP FILE '+ASMDSK2/orcl/datafile/users.256.565313879';
Note: The steps provided above assume that the database is open and in Archivelog mode.
--以上步驟是在資料庫開啟狀態並且是歸檔模式
如果要遷移system和sysaux表空間下的資料檔案到另外一個磁碟組,則需要啟動資料庫到mount狀態
以下是相關步驟:
1. Create a Copy of datafile in target Diskgroup:
RMAN> backup as copy tablespace system format '<New DG>';
RMAN> backup as copy tablespace sysaux format '<New DG>';
2. Then shutdown the database and restart to a mounted state
RMAN> shutdown immediate;
RMAN> startup mount;
3. switch the datafiles to the copy
RMAN> switch tablespace system to copy;
RMAN> switch tablespace sysaux to copy;
4. Recover the changes made to these tablespaces;
RMAN> recover database;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-2123720/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 遷移ASM磁碟組ASM
- ASM磁碟組限制ASM
- 【ASM】Oracle asm磁碟被格式化,如何掛載該磁碟組ASMOracle
- 資料檔案遷移至其他磁碟組
- ASM磁碟組更換磁碟的操作方法ASM
- 一次ASM新增新的磁碟組ASM
- ASM 磁碟組的建立及擴容ASM
- asm磁碟組依賴導致資料庫自啟動報錯ASM資料庫
- 遷移OCR和VotingDisk並刪除原ASM磁碟組ASM
- 【ASM】Oracle asm刪除磁碟組注意事項ASMOracle
- 從定位資料塊所在ASM磁碟到ASM strippingASM
- ASM磁碟組擴容操作文件ASM
- ORACLE ASM磁碟組空間溢位OracleASM
- 使用udev擴充套件ASM磁碟組dev套件ASM
- 【資料庫資料恢復】Oracle資料庫ASM磁碟組掉線如何恢復資料?資料庫資料恢復OracleASM
- Oracle ASM磁碟組擴容(AIX7.1)OracleASMAI
- ASM磁碟組ORA-15042 ORA-15096ASM
- ASM重新命名包含OCR/vote file的磁碟組ASM
- Oracle RAC環境下ASM磁碟組擴容OracleASM
- 【資料庫資料恢復】ASM磁碟組掉線的Oracle資料庫資料恢復案例資料庫資料恢復ASMOracle
- Oracle RAC ASM磁碟組擴容時遇到的VIP漂移OracleASM
- 基於裸裝置的ASM磁碟組擴容方案ASM
- 在ASM磁碟組中刪除歸檔日誌報ORA-15028ASM
- 安卓shell 移動某個時間之後的檔案到另外一個資料夾 命令記錄安卓
- RAC之grid叢集安裝及ASM磁碟組配置ASM
- 【ASM】ASM磁碟頭被重寫,如何修復ASM
- 【ASM】ASM資料檔案和OS檔案(FILESYSTEM)轉移方法總結ASM
- (grid重灌後圖形介面報錯)ASM磁碟組字元介面配置ASM字元
- Oracle資料庫 ASM磁碟線上擴容Oracle資料庫ASM
- 組磁碟陣列的主要作用陣列
- 【ARCH】Oracle 判斷asm磁碟組大小,超過閾值清理指令碼OracleASM指令碼
- Windows 複製 xcopy 檔案到另外一個 目錄Windows
- 踩坑PHP複製檔案到另外資料夾PHP
- 更換ocr和votingdisk磁碟組
- 記 QEMU 虛擬磁碟裝置移動檔案拋異常但實際移動成功
- 問題:未清空磁碟被新增到磁碟組觸發壞塊
- Linux磁碟管理與檔案系統(關於磁碟方面)Linux
- Oracle 11.2.0.4 rac for aix acfs異常環境的克隆環境ASM磁碟組掛載緩慢OracleAIASM
- ORACLE ASM的SSD磁碟空間回收分析OracleASM