2014/05/07

Published 5月 07, 2014 by

Oracle ASM To File File::DBMS_FILE_TRANSFER


Oracle ASM To File File:DBMS_FILE_TRANSFER
建立Directory
SQL> create directory souredir as '+DBDATA/c5tasm/datafile';
SQL> create directory destdir as '/orasys';
Directory created

確認directories:
SQL>select * from dba_directories;

確認FileStatus:
SQL>select file_name, file_id, online_status from dba_data_files order by File_id;

Tablespace C5OPI Offline:
SQL> alter tablespace C5OPI offline;
Tablespace altered.

做資料轉換:
SQL>begin
  dbms_file_transfer.copy_file(source_directory_object => 'destdir',
                               source_file_name => 'C5OPI_DATA_01.DBF',
                               destination_directory_object =>'souredir',
                               destination_file_name => 'C5OPI_DATA_01.DBF');
end;
/

把位置rename一下:
SQL> alter database rename file '/orasys/C5OPI_DATA_01.DBF' to  '+DBDATA/c5tasm/datafile/c5opi_data_01.dbf';
Database altered.

Recover datafile:
SQL> alter database recover datafile 6;

TablespaceOnline:
SQL> alter tablespace c5opi online;

確認最後狀況:
SQL>select file_name, file_id, online_status from dba_data_files;


Reference:
11gr2轉換:透過ASMCMD
DBMS_FILE_TRANSFER包方法
RMAN轉換
http://blog.itpub.net/17203031/viewspace-1065094/
================================================================
This e-mail and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the intended recipient.  If you are not the intended recipient or the named addressee, please notify the sender immediately and delete this e-mail and any files transmitted with it from your system; you should not disseminate, distribute, or copy this e-mail and any files transmitted with it, or take any action in reliance on the contents of the said e-mail and files.
================================================================