首页  电脑故障排除  病毒安全 电脑基础知识  硬件知识  软件应用知识  操作系统知识  编程程序

美国编程网址 日本编程网址 法国编程网址 德国编程网址 韩国编程网址 香港编程网址 台湾编程网址

您的位置:首页>>编程程序>>Oracle

快速编译sql过程和视图的脚本

 
快速编译sql过程和视图的脚本
常常遇到因为过程或者视图没有被编译,,而无法正常运行基于存储过程的数据库程序。用以下几句sql语句,用于在程序执行之前,自动编译。省去了我们的麻烦
/***************************************pro.sql****************************************/#用于快速编辑过程set feedback offset heading offspool c:\pro.sql;#编译过程select 'alter procedure '||OBJECT_NAME||' compile;' from sys.all_probe_objects where OWNER='UserName' and OBJECT_TYPE='PROCEDURE' and STATUS='INVALID';spool off;@c:\pro.sql;#编译视图spool c:\pro.sql;select 'alter view '||OBJECT_NAME||' compile;' from sys.all_probe_objects where OWNER='UserName' and OBJECT_TYPE='view' and STATUS='INVALID';spool off;@c:\pro.sql;exit;#select * from sys.all_objects where object_type in ('TABLE', 'VIEW' ) and STATUS!='VALID';/**************************************************pro.bat ******************************************************/set ORACLE_SID=DB_NAME;sqlplus username/password @F:\shell\pro.sql用于执行,这个sql语句/*/**************************************************exec.bat*****************************************************/加入at 计划任务net stop schedulenet start scheduleat 23:00 /every:M,T,W,Th,F,S,SU F:\shell\pro.bat////////////////////////////////////////////////////////////////////The End ///////////////////////////////////////////////////////////////////////////////////

查看上一页  返回分类首页 返回96PC首页  查看下一页

  版权所有:电脑知识大全 网站备案:粤ICP备07031496号  联系我们

友情链接:母婴知识  外贸商务网  娱乐频道  汽车维修知识  股票入门知识  游戏攻略秘籍  本站空间由安信网络提供