配置实验环境: 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
标签:info,实用,--,filetype,dmp,SQL,table,解析
From: https://blog.51cto.com/prudentwoo/6545695