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

  • 相关阅读:
    win7用VMware安装CentOs7搭建Linux环境
    安装Vmware并破解
    Webpack打包
    jquery获取动态table列表的值并组装成数组返回
    微信、钉钉、浏览器上H5页面头部标题(title)的修改,不刷新问题
    帮你彻底搞懂JS中的prototype、__proto__与constructor(图解)
    mysql常用语句
    JQuery日期插件
    系统激活教程及文件
    git教程
  • 原文地址:https://www.cnblogs.com/cegh/p/4147951.html
Copyright © 2011-2022 走看看