oracle导入一个未知的dump文件

本文详细介绍了 Oracle 数据库中使用数据泵导出 (Data Pump Export) 和普通导出 (Normal Export) 方法的区别,并提供了如何查看导出类型及在不知道源模式的情况下将转储文件导入到新数据库的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

稍后翻译,来自 https://community.oracle.com/thread/1101968


*1) i got a .dmp file obtained by an export. (not sure whether its exp or expdb)*

If in windows environments we can find the export type by using the following:
type dumpfile.dmp | more
for eg: Normal export method:
D:\050710>type fullbkp.dmp | more

▓EXPORT:V09.02.00
DHELPDBA
RENTIRE
2048
0
20

0


Now from the above you can identify it has normal export method.

For Datapump export Method:
F:\Oracle_Backup>type DBBKPFULL.DMP | more
☺☺~N⌠╩
gÇ╝
☺;Ö☺§(±l#ºN»ê&
íHYóo


▓┌☺ ♦♦
☻☻
☺▼*
╖Äx
"HOVDBA"."SYS_EXPORT_FULL_01"

Now from the above you can identify it has datapump export method.

*2) is there a way to me to import this dumpfile to a fresh database without knowing the source schemas ??*

In normal export method you can use show=y

imp system/password file=dumpfile.dmp log=logfile.log full=y show=y

In datapump export method you use sqlfile option:

impdp system/password directory=direct_name dumpfile=dumpfile.dmp logfile=logfile.log sqlfile=toknowschema.log full=y exclude=table_statistics,index_statistics


If you use full=y alone it wil import the entire database objects from the dumpfile.

If you use full=y & show=y options together, it means entire database objects scripts will be spooled into log file mentioned.

In your case check the logfile used by you ie : exp-full-20100715.log 

You can find the exported schema details in that

### 如何测试导入 dmp 文件或解决相关问题 在 Oracle 数据库中,导入 `.dmp` 文件是一项常见的任务,但可能会遇到各种错误。以下是一些方法来测试导入 `.dmp` 文件以及解决可能遇到的问题。 #### 1. 使用 `impdp` 测试导入 `impdp` 是 Oracle 提供的 Data Pump 工具,用于高效地导入 `.dmp` 文件。可以通过以下命令进行测试: ```bash impdp username/password@database directory=directory_object dumpfile=dump_file_name.dmp logfile=import.log ``` 其中: - `username/password@database` 是连接到目标数据库的凭据。 - `directory=directory_object` 是一个预定义的目录对象,指向包含 `.dmp` 文件文件系统路径[^1]。 - `dumpfile=dump_file_name.dmp` 是要导入的 `.dmp` 文件。 - `logfile=import.log` 是生成的日志文件,记录导入过程中的所有操作和错误。 #### 2. 解决常见错误 在导入过程中,可能会遇到一些常见错误。以下是几个典型问题及其解决方案: - **错误 SP2-0734: 未知的命令开头** 这个错误通常是因为在 SQL*Plus 环境下直接运行了 `imp` 或 `impdp` 命令。需要退出 SQL*Plus 并在操作系统命令行中执行这些命令[^1]。 - **表空间不存在** 如果 `.dmp` 文件中的数据属于某个特定表空间(如 TEST),而该表空间尚未创建,则需要先创建表空间。例如: ```sql create tablespace TEST logging datafile 'D:\app\用户\oradata\test.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local; ``` 创建表空间后,重新尝试导入操作[^2]。 - **忽略已存在的对象** 如果目标数据库中已经存在 `.dmp` 文件中的某些对象,并且希望保留现有数据并添加新数据,可以使用 `ignore=y` 参数: ```bash imp scott/tiger@orcl file="d:\test.dmp" full=y ignore=y ``` 此参数会忽略导入过程中出现的重复对象错误[^2]。 #### 3. 验证导入结果 完成导入后,可以通过以下步骤验证导入是否成功: - **检查日志文件** 查看 `logfile=import.log` 中的内容,确保没有关键错误或警告。 - **查询数据字典** 使用以下查询验证目标数据库中是否存在预期的表、索引等对象: ```sql SELECT owner, table_name FROM all_tables WHERE table_name LIKE '%TEST%'; ``` - **检查数据完整性** 对于关键表,可以运行简单的统计查询以确认数据是否正确导入: ```sql SELECT COUNT(*) FROM schema_name.table_name; ``` #### 4. 调试与排查 如果导入仍然失败,可以启用调试模式以获取更多详细信息: ```bash impdp username/password@database directory=directory_object dumpfile=dump_file_name.dmp logfile=import.log stats=ALL ``` 参数 `stats=ALL` 会提供更详细的性能统计信息,帮助分析潜在问题。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值