DBMS_FILE_TRANSFER Package in Oracle Database 10g
DBMS_FILE_TRANSFER Package in Oracle Database 10g
Oracle 10g has introduced the DBMS_FILE_TRANSFER package which provides an API for copying binary files between database servers.Common Usage Notes
All of the the currently supported procedures have some common usage notes listed below:- The user must have read privilege on the source directory object and write privilege on the destination directory object.
- The procedure converts directory object names to uppercase unless they are surrounded by double quotes.
- Files to be copied must be multiples of 512 bytes in size.
- Files to be copied must be equal to or less than 2 terabytes in size.
- File transfers are not transactional.
- Files are copied as binary, so no character conversions are performed.
- File copies can be monitored using the V$SESSION_LONGOPS view.
COPY_FILE
The COPY_FILE procedure allows you to copy binary files from one location to another on the same server.Checking the destination directory will reveal that the file has been copied successfully.-- Create the source and destination directory objects. CREATE OR REPLACE DIRECTORY db_files_dir1 AS '/u01/oradata/DB10G/'; CREATE OR REPLACE DIRECTORY db_files_dir2 AS '/u02/oradata/DB10G/'; -- Switch a tablespace into read only mode so we can -- use it for a test file transfer. ALTER TABLESPACE users READ ONLY; -- Copy the file. BEGIN DBMS_FILE_TRANSFER.COPY_FILE( source_directory_object => 'DB_FILES_DIR1', source_file_name => 'USERS01.DBF', destination_directory_object => 'DB_FILES_DIR2', destination_file_name => 'USERS01.DBF'); END; / -- Switch the tablespace back to read write mode. ALTER TABLESPACE users READ WRITE;
GET_FILE
The GET_FILE procedure allows you to copy binary files from a remote server to the local server.Checking the destination directory on the local server will reveal that the file has been copied successfully.-- Login to the remote server. CONN system/password@remote -- Create the source directory object and switch mode of a tablespace. CREATE OR REPLACE DIRECTORY db_files_dir1 AS '/u01/oradata/DB10G/'; ALTER TABLESPACE users READ ONLY; -- Login to the local server. CONN system/password@local -- Create the destination directory object and a database link. CREATE OR REPLACE DIRECTORY db_files_dir2 AS '/u02/oradata/DB10G/'; CREATE DATABASE LINK remote CONNECT TO system IDENTIFIED BY password USING 'REMOTE'; -- Get the file. BEGIN DBMS_FILE_TRANSFER.GET_FILE( source_directory_object => 'DB_FILES_DIR1', source_file_name => 'USERS01.DBF', source_database => 'REMOTE', destination_directory_object => 'DB_FILES_DIR2', destination_file_name => 'USERS01.DBF'); END; / -- Login to the remote server. CONN system/password@remote -- Switch the tablespace back to read write mode. ALTER TABLESPACE users READ WRITE;
PUT_FILE
The PUT_FILE procedure allows you to copy binary files from the local server to a remote server.-- Login to the remote server. CONN system/password@remote -- Create the destination directory object. CREATE OR REPLACE DIRECTORY db_files_dir2 AS '/u02/oradata/DB10G/'; -- Login to the local server. CONN system/password@local -- Create the source directory object, database link and switch mode of a tablespace. CREATE OR REPLACE DIRECTORY db_files_dir1 AS '/u01/oradata/DB10G/'; CREATE DATABASE LINK remote CONNECT TO system IDENTIFIED BY password USING 'REMOTE'; ALTER TABLESPACE users READ ONLY; -- Put the file. BEGIN DBMS_FILE_TRANSFER.PUT_FILE( source_directory_object => 'DB_FILES_DIR1', source_file_name => 'USERS01.DBF', destination_directory_object => 'DB_FILES_DIR2', destination_file_name => 'USERS01.DBF', destination_database => 'REMOTE'); END; / -- Switch the tablespace back to read write mode. ALTER TABLESPACE users READ WRITE;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-507977/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DBMS_FILE_TRANSFER package which provides an API for copying binary files between database serversPackageIDEAPIDatabaseServer
- 轉淘寶流雲dbms_file_transfer package usagePackage
- oracle 10g flashback databaseOracle 10gDatabase
- Scheduler in Oracle Database 10g(轉)OracleDatabase
- Rename Tablespace in Oracle database 10gOracleDatabase
- Migrate database to Exadata with DBMS_FILE_TRANSFERDatabase
- Tablespace Management Enhancements in Oracle Database 10gOracleDatabase
- Oracle 10g新增DROP DATABASE命令Oracle 10gDatabase
- SQL*Plus Enhancements in Oracle Database 10g(一)SQLOracleDatabase
- Oracle Database 10g Enhanced wait modelOracleDatabaseAI
- oracle 10g physical standby database creationOracle 10gDatabase
- Oracle 10g Limits - Logical Database LimitsOracle 10gMITDatabase
- oracle實驗記錄 (oracle 10G rman transport database)OracleDatabase
- Oracle Database 10g新特性-閃回表OracleDatabase
- Flashback New Features and Enhancements in Oracle Database 10gOracleDatabase
- 【OCM】Oracle Database 10g: Performance Tuning(一)OracleDatabaseORM
- 【OCM】Oracle Database 10g: Performance Tuning(二)OracleDatabaseORM
- 【OCM】Oracle Database 10g: Performance Tuning(三)OracleDatabaseORM
- 【OCM】Oracle Database 10g: Performance Tuning(四)OracleDatabaseORM
- Oracle 10g FLASHBACK DATABASE 實驗記錄Oracle 10gDatabase
- Oracle Database 10g新特性-回滾監視OracleDatabase
- 安裝oracle 10g EM database controlOracle 10gDatabase
- 《Oracle Database 10g安全性高效設計》OracleDatabase
- 【OCM】Oracle Database 10g: RAC for Administrators(一)OracleDatabase
- 【OCM】Oracle Database 10g: RAC for Administrators(二)OracleDatabase
- 【OCM】Oracle Database 10g: RAC for Administrators(三)OracleDatabase
- 【OCM】Oracle Database 10g: RAC for Administrators(四)OracleDatabase
- 【OCM】Oracle Database 10g: RAC for Administrators(五)OracleDatabase
- Transparent Data Encryption (TDE) in Oracle 10g Database Release 2Oracle 10gDatabase
- Oracle Database 10g新特性-閃回版本查詢OracleDatabase
- 使用 Oracle Database 10g中的閃回表特性OracleDatabase
- Upgrading from Oracle Database 10g to 11gOracleDatabase
- Oracle 12C xtts and dbms_file_transferOracleTTS
- Oracle 10g使用DBMS_FILE_TRANSFER包在ASM和作業系統之間拷貝檔案Oracle 10gASM作業系統
- Oracle Database 10g新特性-改善的表空間管理OracleDatabase
- workaround with install oracle database 10G on redhat ES5OracleDatabaseRedhat
- [書籍] Oracle Database 10g效能調整與優化OracleDatabase優化
- Oracle 基礎 ----packageOraclePackage