$ pwd
/home/oracle

导出存储过程

$ vi test.par
INCLUDE=PROCEDURE:"IN ('P_TEST_LAST_DDL')"
SCHEMAS=scott

  

$ sqlplus / as sysdba

SQL> create directory backup as '/home/oracle';

Directory created.

SQL> grant write,read on directory backup to scott;

Grant succeeded.

$ sqlplus scott/tiger
SQL> create or replace procedure P_TEST_LAST_DDL
2 as
3 begin
4 null;
5 end;
6 /

Procedure created.

SQL> select status from user_objects a where a.object_name = 'P_TEST_LAST_DDL';

STATUS
--------------
VALID

$ expdp scott/tiger directory=backup parfile=test.par file=proceduretest.dmp

  

Export: Release 11.2.0.4.0 - Production on Mon Jun 17 17:53:10 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "file=proceduretest.dmp" Location: Command Line, Replaced with: "dumpfile=proceduretest.dmp"
Legacy Mode has set reuse_dumpfiles=true parameter.
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01": scott/******** directory=backup parfile=test.par dumpfile=proceduretest.dmp reuse_dumpfiles=true
Estimate in progress using BLOCKS method...
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/proceduretest.dmp
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at Mon Jun 17 17:53:12 2019 elapsed 0 00:00:02

$ sqlplus scott/tiger

SQL> create or replace function f_get_date
2 return varchar2
3 as
4 v_sysdate varchar2(30);
5 begin
6 select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') into v_sysdate from dual;
7 return v_sysdate;
8 end;
9 /

Function created.

SQL> select f_get_date from dual;

F_GET_DATE
--------------------------------------------------------------------------------
2019-06-17 17:58:09

导出函数

$ vi test.par
INCLUDE=PROCEDURE:"IN ('P_TEST_LAST_DDL')"
INCLUDE=FUNCTION:"IN ('F_GET_DATE')"
SCHEMAS=scott $ expdp scott/tiger directory=backup parfile=test.par file=proceduretest2.dmp

  

Export: Release 11.2.0.4.0 - Production on Mon Jun 17 18:00:31 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "file=proceduretest2.dmp" Location: Command Line, Replaced with: "dumpfile=proceduretest2.dmp"
Legacy Mode has set reuse_dumpfiles=true parameter.
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01": scott/******** directory=backup parfile=test.par dumpfile=proceduretest2.dmp reuse_dumpfiles=true
Estimate in progress using BLOCKS method...
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/proceduretest2.dmp
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at Mon Jun 17 18:00:33 2019 elapsed 0 00:00:02

$ sqlplus scott/tiger

Create Or Replace Package Pkg_TEST_Demo Is

Type Gemp_Rec Is Record(
r_Empno Scott.Emp.Empno%Type,
r_Sal Scott.Emp.Sal%Type);

Procedure Show_Emp_Info;

Function Get_Sal(Emp_Id Number) Return Number;

End Pkg_TEST_Demo;
/

Create Or Replace Package Body PKG_TEST_DEMO Is

Procedure Show_Emp_Info Is
Cursor c_Emp Is
Select * From Scott.Emp;
Begin
For Emp_i In c_Emp Loop
Dbms_Output.Put_Line('员工姓名:' || Emp_i.Ename || ' 部门:' ||
Emp_i.Deptno);
End Loop;
Exception
When No_Data_Found Then
Dbms_Output.Put_Line('没有员工信息');
When Others Then
Dbms_Output.Put_Line('发生异常');
End Show_Emp_Info;

Function Get_Sal(Emp_Id Number) Return Number Is
l_Sal Scott.Emp.Sal%Type;
Begin
Select Sal Into l_Sal From Scott.Emp Where Empno = Emp_Id;
Dbms_Output.Put_Line(Emp_Id || '的工资是:' || l_Sal);
Return l_Sal;
Exception
When No_Data_Found Then
Dbms_Output.Put_Line('查无此人');
When Others Then
Dbms_Output.Put_Line('发生异常');
End Get_Sal;

End Pkg_TEST_Demo;
/

导出包(包头包体)

$ vi test.par
INCLUDE=PROCEDURE:"IN ('P_TEST_LAST_DDL')"
INCLUDE=FUNCTION:"IN ('F_GET_DATE')"
INCLUDE=PACKAGE:"IN ('PKG_TEST_DEMO')"
SCHEMAS=scott $ expdp scott/tiger directory=backup parfile=test.par file=proceduretest3.dmp

  

Export: Release 11.2.0.4.0 - Production on Mon Jun 17 18:04:52 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "file=proceduretest3.dmp" Location: Command Line, Replaced with: "dumpfile=proceduretest3.dmp"
Legacy Mode has set reuse_dumpfiles=true parameter.
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01": scott/******** directory=backup parfile=test.par dumpfile=proceduretest3.dmp reuse_dumpfiles=true
Estimate in progress using BLOCKS method...
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/proceduretest3.dmp
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at Mon Jun 17 18:04:54 2019 elapsed 0 00:00:02

Oracle导出存储过程对象的更多相关文章

  1. Oracle导出存储过程

    SQL> SELECT * FROM dba_directories ; OWN DIRECTORY_NAME DIRECTORY_PATH ------- ------------------ ...

  2. Oracle中如何导出存储过程、函数、包和触发器的定义语句?如何导出表的结构?如何导出索引的创建语句?

    Oracle中如何导出存储过程.函数.包和触发器的定义语句?如何导出表的结构?如何导出索引的创建语句? QQ群里有人问:如何导出一个用户下的存储过程?   麦苗答:方法有多种,可以使用DBMS_MET ...

  3. Oracle怎么导出存储过程

    Oracle怎么导出存储过程 http://www.myexception.cn/database/1564245.html 导出: 1, 2,点击输出文件,选择要导出文件,选择要导出的目录以及设置导 ...

  4. Oracle 导出、导入某用户所有数据(包括表、视图、存储过程...)

    Oracle 导出.导入某用户所有数据(包括表.视图.存储过程...)前提:在CMD 命令下 导出命令:exp 用户名/密码@数据库 owner=用户名 file=文件存储路径(如:F:\abcd.d ...

  5. oracle导出序列的几种办法

    oracle导出序列的几种办法 注:本文来源于<oracle导出序列的几种办法> 方法一: select 'create sequence ' ||sequence_name|| ' mi ...

  6. Oracle导出/导入数据库的三种模式

    导出 模式一:全量导出(慎用) exp 用户名/密码@数据库实例 owner=用户名 file=文件存储路径 log=日志存储路径 full=y 栗子:exp Mark/123456@151.2.*. ...

  7. PB中用oracle的存储过程返回记录集做数据源来生成数据窗口,PB会找不到此存储过程及不能正常识别存储过程的参数问题(转)

    (转)在PB中用oracle的存储过程返回记录集做数据源来生成数据窗口 首先oracle的存储过程写法与MSSQL不一样,差别比较大. 如果是返回数据集的存储过程则需要利用oracle的包来定义游标. ...

  8. oracle中存储过程详解

    oracle中存储过程的使用 过程是指用于执行特定操作的PL/SQL块.如果客户应用经常需要执行特定操作,那么可以考虑基于这些操作建立过程.通过使用过程,不仅可以简化客户应用的开发和维护,而且可以提高 ...

  9. Oracle 用户、对象权限、系统权限

    --================================ --Oracle 用户.对象权限.系统权限 --================================  一.用户与模式 ...

随机推荐

  1. MYSQL索引的深入学习

    通常大型网站单日就可能会产生几十万甚至几百万的数据,对于没有索引的表,单表查询可能几十万数据就是瓶颈. 一个简单的对比测试 以我去年测试的数据作为一个简单示例,20多条数据源随机生成200万条数据,平 ...

  2. ArcGis 创建含孔洞面要素AO C#

    IGeometryCollection geometryCollection = new PolygonClass(); IPointCollection pointCollection_Exteri ...

  3. 算法竞赛模板 KMP

    KMP算法图解: ① 首先,字符串“BBC ABCDAB ABCDABCDABDE”的第一个字符与搜索词“ABCDABD”的第一个字符,进行比较.因为B与A不匹配,所以搜索词后移一位. ② 因为B与A ...

  4. Vue.js文档学习

    Vue细碎小点 生命周期钩子:created().mounted().updated().destroyed() 不要在选项属性或回调上使用箭头函数,比如 created: () => cons ...

  5. java 中String类的常用方法总结,玩转String类

    String类: String类在java.lang包中,java使用String类创建一个字符串变量,字符串变量属于对象.String类对象创建后不能修改,StringBuffer & St ...

  6. shell变量的间接引用

  7. windows 之间远程大文件传输问题解决

    今天我在远程登录另一台windows的时候,需要传输一个大约3GB的文件,但是每每经过了一会儿,就会提示我未知错误问题. 我在网上找了一下,本问题的解决方法如下. 1.打开远程登录的对话窗口 2.选择 ...

  8. 视频专家之路【四】:ffmpeg简单实战之获取属性

    本文是听了雷宵骅大神的课之后的总结,部分内容借用了其PPT的内容,如有侵权请告知删除. 雷宵骅大神的博客为:https://blog.csdn.net/leixiaohua1020 本节的目的正式开始 ...

  9. Django过滤器之safe

    safe除了将html生成安全的文本外,还有将整型转为字符串: {% for user in user_list %} {% if user.id|safe == uid %} <li clas ...

  10. 如何设置和使用MacOS上的Microsoft Office套件

    自30年前首次发布以来,Microsoft Office已成为全球最受欢迎的生产力套件之一.借助Word和Excel for Mac之类的程序,毫无疑问,MS Office套件在任何计算机上都是必须下 ...