2017-08-03 115 views
0

我正在嘗試學習如何使用命令行將數據導入/導出到Oracle。從我發現的情況來看,它看起來像我應該使用sqlldr.exe文件來導入和導出,但我不確定除userid之外還需要什麼參數。有人可以向我解釋什麼參數是必要的,什麼是可選的?Oracle使用命令行導入/導出

回答

2

按照以下步驟操作:

EXPORT:

1-創建源服務器上導出目錄。 mkdir /path/path

2-授予oracle用戶。 chown oracle /path/path

3-在數據庫中創建一個direcktory。 CREATE DIRECTORY Your_Dir_Name as '/path/path';

4-將您的Oracle用戶添加到EXP_FULL_DATABASE角色。 Grant EXP_FULL_DATABASE to your_user;

5-將您創建的數據庫目錄授予角色。 GRANT READ, WRITE ON DIRECTORY Your_Dir_Name TO EXP_FULL_DATABASE ;

6-使用oracle用戶執行expdp命令。 expdp your_db_user/password schemas=Your_Schema_Name tables=table_name directory=Your_Dir_Name version=your_version_for_target_db dumpfile=data.dmp logfile=data.logEXPDP命令需要很多參數的,我寫的例子檢查所有參數https://oracle-base.com/articles/10g/oracle-data-pump-10g。)

IMPORT:

1-創建目標服務器上的導入目錄。 mkdir /path/path

2-授予oracle用戶。 chown oracle /path/path

3-在目標數據庫中創建direcktory。 CREATE DIRECTORY Your_Dir_Name as '/path/path';

4-將您的Oracle用戶添加到IMP_FULL_DATABASE角色。 Grant IMP_FULL_DATABASE to your_user;

5-將您在數據庫中創建的目錄授予角色。 GRANT READ, WRITE ON DIRECTORY Your_Dir_Name TO IMP_FULL_DATABASE ;

6-使用oracle用戶執行impdp命令。 impdp your_db_user/password directory=Your_Dir_Name dumpfile=data.dmp logfile=data.logIMPDP命令需要我寫很多參數的例子。查詢所有參數https://oracle-base.com/articles/10g/oracle-data-pump-10g)(If你要重命名模式,表空間,表使用remap參數)。

0

在和mehmet sahin談過後,我們發現以下命令將導入到Oracle中。

imp user/pwd file=[Path to dmp file]\import.dmp full=y 

您可以使用以下命令導出。

exp user/pwd file=[Path to dmp file]\export.dmp 

這兩個命令也會帶入.exp文件。