1. Log onto the target database that is local to the ASM instance as the sys user.
2. create source directory within the target database.
SQL> create or replace directory SOURCE_DIR as '+DGROUP1/V10ASM/datafile/';
Directory created.
(In this example +DGROUP1/V10ASM/datafile/ is the source directory where the datafile is located and where you wish to copy the file from.)
3. create destination directory within database.
SQL> create or replace directory ORACLE_DEST as '/restore';
Directory created.
(In this example restore is the destination directory where the datafile is to be copied to.)
4. Execute the dbms_file_transfer package.
SQL>
BEGIN
dbms_file_transfer.copy_file(source_directory_object =>
'SOURCE_DIR', source_file_name => 'system.272.617284341',
destination_directory_object => 'ORACLE_DEST',
destination_file_name => 'system.dbf');
END;
output :
=======
create directory SOURCE_DIR as '+ORAFILES/hyttst9/datafile/';SQL>
Directory created.
SQL> create directory ORACLE_DEST as '/orabackup';
Directory created.
SQL> BEGIN
dbms_file_transfer.copy_file(source_directory_object =>
'SOURCE_DIR', source_file_name => 'tools.dbf',
destination_directory_object => 'ORACLE_DEST',
destination_file_name => 'tool_temp.dbf');
END; 2 3 4 5 6
7
8 /
PL/SQL procedure successfully completed.
-rw-r----- 1 oracle oinstall 100671488 Jul 25 05:18 tool_temp.dbf
2. create source directory within the target database.
SQL> create or replace directory SOURCE_DIR as '+DGROUP1/V10ASM/datafile/';
Directory created.
(In this example +DGROUP1/V10ASM/datafile/ is the source directory where the datafile is located and where you wish to copy the file from.)
3. create destination directory within database.
SQL> create or replace directory ORACLE_DEST as '/restore';
Directory created.
(In this example restore is the destination directory where the datafile is to be copied to.)
4. Execute the dbms_file_transfer package.
SQL>
BEGIN
dbms_file_transfer.copy_file(source_directory_object =>
'SOURCE_DIR', source_file_name => 'system.272.617284341',
destination_directory_object => 'ORACLE_DEST',
destination_file_name => 'system.dbf');
END;
output :
=======
create directory SOURCE_DIR as '+ORAFILES/hyttst9/datafile/';SQL>
Directory created.
SQL> create directory ORACLE_DEST as '/orabackup';
Directory created.
SQL> BEGIN
dbms_file_transfer.copy_file(source_directory_object =>
'SOURCE_DIR', source_file_name => 'tools.dbf',
destination_directory_object => 'ORACLE_DEST',
destination_file_name => 'tool_temp.dbf');
END; 2 3 4 5 6
7
8 /
PL/SQL procedure successfully completed.
-rw-r----- 1 oracle oinstall 100671488 Jul 25 05:18 tool_temp.dbf
No comments:
Post a Comment