Ever had a need to export only certain procedures from one user to be recreated in a different database or user? Unlike the traditional export utility,Data Pump allows you to export only a particular type of object. For instance, the following command lets you export only procedures, and nothing else--no tables, views, or even functions:
expdp ananda/iclaim directory=DPDATA1 dumpfile=expprocs.dmp include=PROCEDURE
To export only a few specific objects--say, function FUNC1 and procedure PROC1--you could use
expdp ananda/iclaim directory=DPDATA1 dumpfile=expprocs.dmp include=PROCEDURE:"='PROC1'",FUNCTION:"='FUNC1'"
This dumpfile serves as a backup of the sources. You can even use it to create DDL scripts to be used later. A special parameter called SQLFILE allows the creation of the DDL script file.
impdp ananda/iclaim directory=DPDATA1 dumpfile=expprocs.dmp sqlfile=procs.sql
This instruction creates a file named procs.sql in the directory specified by DPDATA1, containing the scripts of the objects inside the export
dumpfile. This approach helps you create the sources quickly in another schema.
Using the parameter INCLUDE allows you to define objects to be included or excluded from the dumpfile. You can use the clause
INCLUDE=TABLE:"LIKE 'TAB%'" to export only those tables whose name start with TAB. Similarly, you could use the construct
INCLUDE=TABLE:"NOT LIKE 'TAB%'" to exclude all tables starting with TAB. Alternatively you can use the EXCLUDE parameter to exclude
specific objects.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/38542/viewspace-1002066/ ,如需转载,请注明出处,否则将追究法律责任。