列出Oracle导出转储文件的内容

发布于 2024-12-16 20:48:19 字数 142 浏览 1 评论 0原文

我有一个 oracle 完整转储。我知道我必须使用 fromuser touser 子句来导入转储。但是我不知道转储中包含的模式的名称。

如何打开使用 Oracle 10g 创建的转储来检查和分析内容?

I have an oracle full dump. I know I have to imp the dump with the fromuser touser clause. However I don't know the names of the schemas included in the dump.

how can I open the dump created with Oracle 10g just to check and analyze the content?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

紧拥背影 2024-12-23 20:48:19

只需使用 SHOW=Y 参数

IMP SCOTT/TIGER SHOW=Y FILE=import_file.dmp

Just use the SHOW=Y parameter

IMP SCOTT/TIGER SHOW=Y FILE=import_file.dmp
孤云独去闲 2024-12-23 20:48:19
imp SCOTT/tiger show=Y fiLE=IMPORT_FILE.DMP log=**logfile.log** fromuser=scott touser=scott 

如果您只对对象名称和架构的名称感兴趣,那么这对于对象列表而不是表内的内容很有用。

命令成功完成后,使用您最喜欢的文本编辑器(如记事本/vim)通过添加参数 LOG=logfile.log 打开 imp 命令生成的日志文件。
在此文件中,imp 命令将输出它将按照实际情况执行的所有操作。
现在在每个位置搜索文本“导入”,您将获得架构名称,后跟该架构中包含的 object_names。

接下来是创建/更改对象的命令,就像它们在原始数据库中一样。
之后将模拟数据插入,您可以了解每个模式中有多少记录。

但它不会列出它们。

用于仅导入一个表 EMP 的示例导入文件

---------imp 命令的开始输出 --------

Export file created by EXPORT:V10.02.01 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set

**. importing SCOTT's objects into SCOTT**  
 "ALTER SESSION SET CURRENT_SCHEMA= "SCOTT""  
 "CREATE TABLE "EMP" ("EMPNO" NUMBER(4, 0), "ENAME" VARCHAR2(10), "JOB" VARCH"  
 "AR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE, "SAL" NUMBER(7, 2), "COMM" NUM"  
 "BER(7, 2), "DEPTNO" NUMBER(2, 0))  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRAN"  
 "S 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAU"  
 "LT) TABLESPACE "USERS" LOGGING NOCOMPRESS"  
. . skipping table "EMP"                                

 "CREATE UNIQUE INDEX "PK_EMP" ON "EMP" ("EMPNO" )  PCTFREE 10 INITRANS 2 MAX"  
 "TRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL D"  
 "EFAULT) TABLESPACE "USERS" LOGGING"  
 "ALTER SESSION SET CURRENT_SCHEMA= "SCOTT""  
 "ALTER TABLE "EMP" ADD  CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO") USING INDE"  
 "X PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREE"  
 "LIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ENABLE "  

 "ALTER TABLE "EMP" ADD CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO") REFEREN"  
 "CES "DEPT" ("DEPTNO") ENABLE NOVALIDATE"  
 "ALTER TABLE "EMP" ENABLE CONSTRAINT "FK_DEPTNO""  

Import terminated successfully without warnings.  

---------imp 命令的结束 ---- -----

看这里

该工具声称并为您提供转储文件和将数据放入 Excel/Access/CSV 格式的文件中。这也许就是您正在寻找的。

它显示表中的内容,而无需导入真实数据库,

以防万一有人想要查找哪个转储文件包含所需的数据。

您应该保留一个日志文件,该日志文件的名称与每个 DUMPFILE 后缀相同,并附加其日期和时间,而不是遍历所有旧转储。
例如 FULL_DB_DUMP_15012014_1240pm.DMP

这样您只需打开相关日志文件即可了解哪些文件包含您需要或感兴趣的架构。

[2]:再考虑一下:如果您的转储文件达到 2GB 并且您可以识别 ORACLE SQL。
使用十六进制编辑器(如 HxD、Hexor、HexEdit)以只读模式打开转储文件。打开后,您可以以二进制/ascii 形式浏览转储文件的内容。这可能是一个粗略的方法,但它会给你一个模式和对象名称 DDL 的部分视图,以及视图/触发器/函数/过程等的一些内容。了解全部内容。但它达到了目的。也许相对较快。

imp SCOTT/tiger show=Y fiLE=IMPORT_FILE.DMP log=**logfile.log** fromuser=scott touser=scott 

if you are only interested in the name of object names and schema this is good for list of objects not the contents inside table.

once your command is successfully finished, use your favorite text editor like notepad /vim to open the log file generated by imp command by adding parameter LOG=logfile.log.
in this file imp command will output all the actions it will perform as real case scenario.
now search for the text "importing " on each location you will get SCHEMA NAMES followed by the object_names contained in that schema.

followed by commands to create/alter the objects as they were in original database.
after that the data insertions will be simulated you may get idea how many records in each schema.

but it won't list them.

SAMPLE import file for importing just one table EMP

---------start output of imp command --------

Export file created by EXPORT:V10.02.01 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set

**. importing SCOTT's objects into SCOTT**  
 "ALTER SESSION SET CURRENT_SCHEMA= "SCOTT""  
 "CREATE TABLE "EMP" ("EMPNO" NUMBER(4, 0), "ENAME" VARCHAR2(10), "JOB" VARCH"  
 "AR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE, "SAL" NUMBER(7, 2), "COMM" NUM"  
 "BER(7, 2), "DEPTNO" NUMBER(2, 0))  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRAN"  
 "S 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAU"  
 "LT) TABLESPACE "USERS" LOGGING NOCOMPRESS"  
. . skipping table "EMP"                                

 "CREATE UNIQUE INDEX "PK_EMP" ON "EMP" ("EMPNO" )  PCTFREE 10 INITRANS 2 MAX"  
 "TRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL D"  
 "EFAULT) TABLESPACE "USERS" LOGGING"  
 "ALTER SESSION SET CURRENT_SCHEMA= "SCOTT""  
 "ALTER TABLE "EMP" ADD  CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO") USING INDE"  
 "X PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREE"  
 "LIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ENABLE "  

 "ALTER TABLE "EMP" ADD CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO") REFEREN"  
 "CES "DEPT" ("DEPTNO") ENABLE NOVALIDATE"  
 "ALTER TABLE "EMP" ENABLE CONSTRAINT "FK_DEPTNO""  

Import terminated successfully without warnings.  

---------end of out of imp command ---------

Look here

This tool claims and offers you to take a dump file and put the data into Excel/Access/CSV formated file. which maybe what you are looking for.

it show whats inside the tables with out import to real database

just in case someone is looking to find which dump file contains the data needed.

instead of going through all the old dumps you should keep a logfile with same name of each DUMPFILE suffix appended with its date and time.
like FULL_DB_DUMP_15012014_1240pm.DMP

so that you just open the relevant log file to get the idea which files contain what schema of your need or interest.

[2]: ON a second thought: if your dump file is upto 2GB and you can identify ORACLE SQL.
Use a hex editor like HxD, Hexor, HexEdit in readonly mode to open the dump file. Once opened you can browse the contents of dump file in binary/ascii form. this may be a crude method but it will give you a partial view of schema and objects names DDL with some contents of views/triggers/Functions/Procedures etc. Although, you will not be able to read & understand the whole contents. but it servers the purpose. maybe relatively fast.

与君绝 2024-12-23 20:48:19

如果您在 UNIX 环境中工作,则可以使用命令字符串来显示转储文件中的可读信息。

strings test.dmp|grep CREATE.*TABLE

if you are working in a UNIX environment, you may use command strings to show readable information from the dump files.

strings test.dmp|grep CREATE.*TABLE
北笙凉宸 2024-12-23 20:48:19

如果您正在寻找表格列表,我发现了这个糟糕的解决方案,我不知道它是否有帮助:

IMP  user/pass@db SHOW=Y FILE='C:\2022\markit.dmp' FULL=y INDEXFILE='C:\2022\markit.dmp.idx.log'

the我得到的输出

If you looking for a list of tables I found this poor solution, I don't know if it helps :

IMP  user/pass@db SHOW=Y FILE='C:\2022\markit.dmp' FULL=y INDEXFILE='C:\2022\markit.dmp.idx.log'

the output I got

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文