我们在工作中会有这样的情况,要将一个dmp文件导入到数据库中,可是我们却没有这个文件的元数据信息,比如数据库版本号、字符集,是Datapump文件还是传统的Export文件。Oracle10g以上的版本有一个DBMS_DATAPUMP工具包,里面有一个过程GET_DUMPFILE_INFO可以为我们取得dmp的文件信息。
我们先看看这个文件的过程的描述:
DBMS_DATAPUMP.GET_DUMPFILE_INFO(
filename IN
VARCHAR2,
directory
IN VARCHAR2,
info_table OUT
ku$_dumpfile_info,
filetype
OUT NUMBER);
下面是每个参数的描述:
filename
A simple filename with no directory path information
directory A directory object
that specifies where the file can be found
info_table
A PL/SQL table for storing information about the dump
file
filetype
The type of file (Data Pump dump file, original Export dump file,
or unknown)
下面开始测试,注意要在Oracle10g以上版本数据库中测试
1、导出一个文件,为方便起见,我们使用Oracle自带的目录对象DATA_PUMP