zoukankan      html  css  js  c++  java
  • oracle 自动生存清库脚本

    在项目上为了搭建测试库,常常会遇到要清除现在的库,很是折腾,闲暇之余,写了一个脚本留作备用。

    脚本如下:

    select '--清表' from dual union all select 'drop table ' ||a.TABLE_NAME ||''||';' from  user_tables a union  all select '--清序列' from dual --清序列 union all select 'drop sequence '|| a.sequence_name||''  ||';' from user_sequences  a --清存储过程 union all select '--清存储过程' from dual union all select  'drop procedure  '|| a.object_name||''  ||';'  from user_procedures  a where a.object_type='PROCEDURE' --清包 union all select '--清包' from dual union all select distinct  'drop PACKAGE  '|| a.object_name||''  ||';'  from user_procedures  a where a.object_type='PACKAGE' union all select '--清自定义函数' from dual union all select 'drop FUNCTION '|| a.object_name||''  ||';'   from user_procedures    a where a.object_type ='FUNCTION'

    在pl/sql里面运行之后自动生存执行的命令复制之后,

    新建一个 command window 窗口,把复制好的命令粘贴到窗口里面,直接运行就可以了。

    最后执行下面的语句生成导库语句

    --导入库

    select 'imp 用户名/密码@数据库 file='||'dmp文件'||' full=y' from dual

    打开cmd 窗口,标记一下上面复制的导库命令,修改一下,回车即可。

    --导出库

    select 'exp 用户名/密码@数据库 file='||'dmp文件'||' full=y' from dual

  • 相关阅读:
    [windows]清除访问共享的用户和密码信息
    Java架构搜集
    jsp、freemarker、velocity对比
    Spring MVC 了解WebApplicationContext中特殊的bean类型
    Web.xml配置详解之context-param
    <context:annotation-config/> 的理解
    使用@Controller注解为什么要配置<mvc:annotation-driven />
    web.xml配置之<context-param>详解
    @WebServlet
    正向代理与反向代理
  • 原文地址:https://www.cnblogs.com/cegh/p/4147951.html
Copyright © 2011-2022 走看看