How to move ASM database files from one diskgroup to another
原來資料檔案:
ASMCMD> pwd
+sysdg/UIMDB/datafile
ASMCMD> ls
SYSAUX.257.840633371
SYSTEM.256.840633371
TEST.263.843647081
UIMDB_DATA.264.843647213
UIMDB_DATA.265.843647325
UIMDB_DATA.266.843664683
UIMDB_DATA.267.843665385
UIMDB_DATA01
UIMDB_DATA02
UIMDB_DATA03
UIMDB_DATA04
UNDOTBS1.258.840633371
UNDOTBS2.261.840633651
USER01
USERS.259.840633373
USERS.268.843733425
test
ASMCMD> pwd
+sysdg/UIMDB/datafile
SQL> SELECT FILE_NAME FROM DBA_DATA_FILES;
FILE_NAME
--------------------------------------------------------------------------------
+SYSDG/uimdb/datafile/users.259.840633373
+SYSDG/uimdb/datafile/undotbs1.258.840633371
+SYSDG/uimdb/datafile/sysaux.257.840633371
+SYSDG/uimdb/datafile/system.256.840633371
+SYSDG/uimdb/datafile/undotbs2.261.840633651
+UIMDATA1/uimdb/datafile/data01.dbf
+UIMDATA1/uimdb/datafile/uimdb_data.268.850040055
+SYSDG/uimdb/datafile/uimdb_data02
+UIMDATA1/uimdb/datafile/uimdb_index01
+SYSDG/uimdb/datafile/uimdb_data03
+UIMDATA1/uimdb/datafile/uimdb_index02
FILE_NAME
--------------------------------------------------------------------------------
+SYSDG/uimdb/datafile/uimdb_data04
+UIMDATA1/uimdb/datafile/uimdb_index03
+SYSDG/uimdb/datafile/user01
+UIMDATA1/uimdb/datafile/itsm_data01.dbf
15 rows selected.
修改後:
ASMCMD> pwd
+UIMDATA1/UIMDB/datafile
ASMCMD> ls
JTITSM.266.844964315
UIMDB_DATA.268.850040055
UIMDB_DATA.269.850040495
UIMDB_DATA.270.850040577
UIMDB_DATA.271.850041291
UIMDB_INDEX.263.843647479
UIMDB_INDEX.264.843664795
UIMDB_INDEX.265.843686027
UIMDB_INDEX01
UIMDB_INDEX02
UIMDB_INDEX03
USERS.272.850041359
data01.dbf
itsm_data01.dbf
ASMCMD>
FILE_NAME
--------------------------------------------------------------------------------
+SYSDG/uimdb/datafile/users.259.840633373
+SYSDG/uimdb/datafile/undotbs1.258.840633371
+SYSDG/uimdb/datafile/sysaux.257.840633371
+SYSDG/uimdb/datafile/system.256.840633371
+SYSDG/uimdb/datafile/undotbs2.261.840633651
+UIMDATA1/uimdb/datafile/data01.dbf
+UIMDATA1/uimdb/datafile/uimdb_data.268.850040055
+UIMDATA1/uimdb/datafile/uimdb_data.269.850040495
+UIMDATA1/uimdb/datafile/uimdb_index01
+UIMDATA1/uimdb/datafile/uimdb_data.270.850040577
+UIMDATA1/uimdb/datafile/uimdb_index02
FILE_NAME
--------------------------------------------------------------------------------
+UIMDATA1/uimdb/datafile/uimdb_data.271.850041291
+UIMDATA1/uimdb/datafile/uimdb_index03
+UIMDATA1/uimdb/datafile/users.272.850041359
+UIMDATA1/uimdb/datafile/itsm_data01.dbf
+UIMDATA1/uimdb/datafile/uimdb_index04
+UIMDATA1/uimdb/datafile/uimdb_index05
17 rows selected.
SQL>
處理步驟:
1 把原來的datafile進行offline:
SQL> ALTER DATABASE DATAFILE '+SYSDG/uimdb/datafile/uimdb_data02' offline;
Database altered.
SQL> ALTER DATABASE DATAFILE '+SYSDG/uimdb/datafile/uimdb_data03' offline;
2 用rman進行cp
rman:copy datafile '+SYSDG/uimdb/datafile/user01' to '+UIMDATA1';
RMAN> copy datafile '+SYSDG/uimdb/datafile/uimdb_data02' to '+UIMDATA1';
Starting backup at 12-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=5796 instance=uimdb1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00008 name=+SYSDG/uimdb/datafile/uimdb_data02
output file name=+UIMDATA1/uimdb/datafile/uimdb_data.269.850040495 tag=TAG20140612T102134 RECID=3 STAMP=850040564
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:15
Finished backup at 12-JUN-14
Starting Control File and SPFILE Autobackup at 12-JUN-14
piece handle=+FRADG/uimdb/autobackup/2014_06_12/s_850040570.411.850040571 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-14
3 用rman進行改路徑:
run {
set newname for datafile '+SYSDG/uimdb/datafile/user01' to '+UIMDATA1/uimdb/datafile/users.272.850041359';
switch datafile all;
}
RMAN> run {
2> set newname for datafile '+SYSDG/uimdb/datafile/uimdb_data03' to '+UIMDATA1/uimdb/datafile/uimdb_data.270.850040577';
3> switch datafile all;
4> }
executing command: SET NEWNAME
datafile 10 switched to datafile copy
input datafile copy RECID=4 STAMP=850040646 file name=+UIMDATA1/uimdb/datafile/uimdb_data.270.850040577
註釋:
新位置檔名稱從如下outputfile中新取得:
RMAN> copy datafile '+SYSDG/uimdb/datafile/uimdb_data03' to '+UIMDATA1';
Starting backup at 12-JUN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00010 name=+SYSDG/uimdb/datafile/uimdb_data03
output file name=+UIMDATA1/uimdb/datafile/uimdb_data.270.850040577 tag=TAG20140612T102256 RECID=4 STAMP=850040646
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:15
Finished backup at 12-JUN-14
Starting Control File and SPFILE Autobackup at 12-JUN-14
piece handle=+FRADG/uimdb/autobackup/2014_06_12/s_850040652.394.850040653 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-14
3 sqlplus進行恢復:
SQL> RECOVER DATAFILE '+UIMDATA1/uimdb/datafile/uimdb_data.268.850040055';
Media recovery complete.
SQL>
4 sqlplus進行online:
SQL> ALTER DATABASE DATAFILE '+UIMDATA1/uimdb/datafile/uimdb_data.268.850040055' online;
Database altered.
SQL> SELECT FILE_NAME FROM DBA_DATA_FILES;
5 最後到進入asm,刪除原來的datafile:
ASMCMD> rm UIMDB_DATA0*
You may delete multiple files and/or directories.
Are you sure? (y/n) y
ASMCMD> ls
SYSAUX.257.840633371
SYSTEM.256.840633371
TEST.263.843647081
UNDOTBS1.258.840633371
UNDOTBS2.261.840633651
USER01
USERS.259.840633373
USERS.268.843733425
reference:
How to move ASM database files from one diskgroup to another ? (文件 ID 330103.1)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/13750068/viewspace-1181137/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- how to move a MediaWiki wiki from one server to anotherServer
- How to Move or Copy a Tablespace to Another Database (61)Database
- How to free space from an ASM diskgroup? (Doc ID 1553744.1)ASM
- How to move progress database to different OSDatabase
- Move datafile:From File System to ASMASM
- Move datafile:From ASM to File SystemASM
- How does one rename a database?Database
- How to Restore the Database Using AMDU after Diskgroup CorruptionRESTDatabase
- [轉]How to release space from databaseDatabase
- How To Search and Restore files from Site Collection Recycle BinREST
- Duplicate Database from ASM to Non- ASM Database Using RMANDatabaseASM
- How to restore ASM based OCR after complete loss of the CRS diskgroupRESTASM
- ASM Diskgroup Can Not Be Shown When Creating Database With DBCAASMDatabase
- ORA-16649: possible failover to another database prevents this database from beiAIDatabase
- How to Copy ASM Files Across Nodes [ID 1147859.1]ASMROS
- How to move ASM spfile to a different disk group [ID 1082943.1]ASM
- How to restore and recover a database from an RMAN backup_881395.1RESTDatabase
- RMAN Duplicate Database From RAC ASM To RAC ASM [ID 461479.1]DatabaseASM
- Duplicate database from non ASM to ASM to a different host [ID 382669.1]DatabaseASM
- How to copy a datafile from ASM to a file system not using RMANASM
- How To Upgrade ASM from 10.2 to 11.1 (RAC)ASM
- How to release space from database( in other words: resize datafile ) (zt)Database
- How to release space from database( in other words: resize datafile ) 【zt】Database
- How to Move a Database Using Transportable Tablespaces (文件 ID 1493809.1)Database
- ORA-15055 ASM Diskgroup Status Showing Dismounted From RDBMS InstanceASM
- DUPLICATE (Backup based) DATABASE from non ASM to ASM to different host_382669.1DatabaseASM
- asm files,asm directories,asm templatesASM
- Oracle 12C Database File Mapping for Oracle ASM FilesOracleDatabaseAPPASM
- Duplicate database from non ASM to ASM (vise versa) to a different host-382669.1DatabaseASM
- How to move Oracle Spatial objects from SYSAUX tablespace to a user defined tablespace [ID 1119758.1OracleObjectUX
- Asm diskgroup 的修復ASM
- script of check repair ASM DISKGROUPAIASM
- How to CANCEL a query running in another session?Session
- 給ASM例項增加diskgroupASM
- How To Move The DB Audit Trails To A New TablespaceAI
- How to Quiesce a DatabaseUIDatabase
- ASM管理 - 如何重新命名diskgroupASM
- Reinstall ASM or DB HOME on One RAC Node From the Install Media_864614.1ASM