带有命令行的 Oracle Importing/Exporting

Oracle Importing/Exporting with Command Line

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

按照以下步骤操作:

出口:

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

导入:

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.log (IMPDP 命令需要很多参数我写了例子。检查所有参数 https://oracle-base.com/articles/10g/oracle-data-pump-10g)(If 你想重命名模式,table 空间,table 使用 remap 参数).

在 Oracle 中 export/import 数据有几种方法。您提到的工具 sqlldr 称为 SQL*Loader. You can also and actually should use Oracle Data Pump, the Export/Import utility which superseded the old Export/Import tool. All of those tools are documented in full in the Database Utilities book of the Oracle Database Documentation

和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 文件。