配置实验环境:

1.1 生产三个文件

exp woo/oracle table=dump_table file=1.dmp;

expdp woo/oracle tables=dump_table directory=dhome dumpfile=2.dmp;

touch 3.dmp

2.创建随机数据

SQL> create table dump_table as

2  select rownum as id,

3                  to_char(sysdate + rownum / 24 / 3600, 'yyyy-mm-dd hh24:mi:ss') as inc_datetime,

4                  trunc(dbms_random.value(0, 100)) as random_id,

5                  dbms_random.string('x', 20) random_string

6             from dual

7           connect by level <= 10;

Table created.

SQL> desc dump_table;

Name                                      Null?    Type

----------------------------------------- -------- ----------------------------

ID                                                 NUMBER

INC_DATETIME                                       VARCHAR2(19)

RANDOM_ID                                          NUMBER

RANDOM_STRING                                      VARCHAR2(4000)

SQL> select count(*) from dump_table;

COUNT(*)

----------

10

3.生成如下文件

[oracle@ora11grac1 ~]$ ls -rtl

total 212

-rw-r--r-- 1 oracle oinstall 16384 Mar 18 15:06 1.dmp

-rw-r----- 1 oracle asmadmin 98304 Mar 18 15:13 2.dmp

-rw-r--r-- 1 oracle asmadmin  1071 Mar 18 15:14 export.log

-rw-r----- 1 oracle asmadmin 98304 Mar 18 15:14 3.dmp

4.判断文件室友哪个版本生成的

[oracle@ora11grac1 ~]$ sed -n 1p 1.dmp

EXPORT:V11.02.00

5.判断文件类型

SQL> set serveroutput on

SQL> declare

2   v_filetype    NUMBER;                 -- 0=unknown 1=expdp 2=exp 3=ext

3   v_info_table  sys.ku$_dumpfile_info;  -- PL/SQL table with file info

4  begin

5   dbms_datapump.get_dumpfile_info(

6    filename => '1.dmp',

7    directory => upper('dhome'),

8    info_table => v_info_table, filetype => v_filetype);

9    dbms_output.put_line('Filetype : ' || v_filetype);

10  end;

11  /

Filetype : 2

SQL> set serveroutput on

SQL> declare

2   v_filetype    NUMBER;                 -- 0=unknown 1=expdp 2=exp 3=ext

3   v_info_table  sys.ku$_dumpfile_info;  -- PL/SQL table with file info

4  begin

5   dbms_datapump.get_dumpfile_info(

6    filename => '2.dmp',

7    directory => upper('dhome'),

8    info_table => v_info_table, filetype => v_filetype);

9    dbms_output.put_line('Filetype : ' || v_filetype);

10  end;

11  /

Filetype : 1

PL/SQL procedure successfully completed.

SQL> set serveroutput on

SQL> declare

2   v_filetype    NUMBER;                 -- 0=unknown 1=expdp 2=exp 3=ext

3   v_info_table  sys.ku$_dumpfile_info;  -- PL/SQL table with file info

4  begin

5   dbms_datapump.get_dumpfile_info(

6    filename => '3.dmp',

7    directory => upper('dhome'),

8    info_table => v_info_table, filetype => v_filetype);

9    dbms_output.put_line('Filetype : ' || v_filetype);

10  end;

11  /

Filetype : 1

PL/SQL procedure successfully completed.

SQL> set serveroutput on

SQL> declare

2   v_filetype    NUMBER;                 -- 0=unknown 1=expdp 2=exp 3=ext

3   v_info_table  sys.ku$_dumpfile_info;  -- PL/SQL table with file info

4  begin

5   dbms_datapump.get_dumpfile_info(

6    filename => 'export.log',

7    directory => upper('dhome'),

8    info_table => v_info_table, filetype => v_filetype);

9    dbms_output.put_line('Filetype : ' || v_filetype);

10  end;

11  /

Filetype : 0

PL/SQL procedure successfully completed.

6.数据库字符集,数据库名称,操作系统类型,操作系统名称

[oracle@ora11grac1 ~]$ sed -n 1p 2.dmp

\ÒÂÇg€¼uC¡ÈÃë KàS

H€"WOO"."SYS_EXPORT_TABLE_01"x86_64/Linux 2.4.xxora11grac1:woo1AL32UTF8 11.02.00.04.00001:001:000001:000001ÿÿ$$

7.判断文件所属表空间或用户

[oracle@ora11grac1 ~]$ sed -n 2p 1.dmp

DWOO

8.导出方式,USER,TABLE,

[oracle@ora11grac1 ~]$ sed -n 3p 1.dmp

RTABLES

9.判断文件数据块大小

[oracle@ora11grac1 ~]$ sed -n 4p 1.dmp

8192

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐