Oracle使用命令行导入/导出

时间:2017-08-03 15:57:25

标签: oracle import export

我正在尝试学习如何使用命令行将数据导入/导出到Oracle。从我发现的,看起来我应该使用sqlldr.exe文件来导入和导出,但我不确定除了userid之外还需要什么参数。有人可以向我解释一下哪些参数是必要的,哪些是可选的?

3 个答案:

答案 0 :(得分:3)

请按照以下步骤操作:

导出:

1-在源服务器上创建导出目录。 mkdir /path/path

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

3-在数据库中创建目录。 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-在目标数据库中创建目录。 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命令需要很多参数我写的例子。检查你想要重命名模式,表空间,表使用remap参数的所有参数https://oracle-base.com/articles/10g/oracle-data-pump-10g)(If

答案 1 :(得分:1)

有几种方法可以在Oracle中导出/导入数据。您提到的工具sqlldr称为SQL*Loader。您还可以实际使用Oracle Data Pump,导出/导入实用程序取代旧的导出/导入工具。所有这些工具都在Database UtilitiesOracle Database Documentation一书中完整记录。

答案 2 :(得分: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文件。