数据库

本类阅读TOP10

·SQL语句导入导出大全
·Power Designer杂记
·SQL Server日期计算
·常用的oracle函数使用说明(一)
·sqlserver2000数据库置疑的解决方法
·MS SQLServer OLEDB分布式事务无法启动的一般解决方案
·SQL to Excel 的应用
·SQL语句导入导出大全
·Error:ORA-01033:ORACLE initialization or shutdown in progress错误解决
·Oracle中password file的作用及说明

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
导出oracle数据库对象---同义词,系列,视图

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

脚本可分两部分:
同义词
1:synonym.cmd:
sqlplus dxsq/teledoone@jnnew @synonym.sql
2.synonym.sql:
create table tmp_user_synonym as select 'create synonym '||synonym_name||chr(13)||'for'||chr(13)||TABLE_OWNER||'.'||TABLE_NAME||chr(13)||'/' text from user_synonyms;
set heading off feedback off termout off
set pagesize 0
set linesize 100
set long 100000
col tt format a
spool d:\bat\synonym.log;
select text tt from tmp_user_synonym;
spool off;
drop table tmp_user_synonym;
exit;
大家可以以一反三,系列的写法可以参考下面:

drop table tmp_user_sequence;
create table tmp_user_sequence (text varchar2(4000));
declare
begin
  for tt in (select * from user_sequences) loop
     insert into tmp_user_sequence values('prompt');
     insert into tmp_user_sequence values('prompt create sequence '||tt.SEQUENCE_NAME);
     insert into tmp_user_sequence values('prompt');
     insert into tmp_user_sequence values('create sequence' || ' '|| tt.SEQUENCE_NAME);
     insert into tmp_user_sequence values('minvalue' ||' '|| tt.MIN_VALUE );
     insert into tmp_user_sequence values('MAXVALUE' ||' '|| tt.MAX_VALUE);
     insert into tmp_user_sequence values('start with ' || ' '||tt.LAST_NUMBER);
     insert into tmp_user_sequence values('increment by' ||' '|| tt.INCREMENT_BY);
     insert into tmp_user_sequence values('cache' ||' '|| to_char(tt.CACHE_SIZE));
     if tt.CYCLE_FLAG='Y' then
       insert into tmp_user_sequence values('cycle');
     end if;
     if tt.ORDER_FLAG='Y' then
       insert into tmp_user_sequence values('order');
     end if;
     insert into tmp_user_sequence values('/');
     insert into tmp_user_sequence values('');
  end loop;
  commit;
end;
/
set heading off feedback off termout off;
column text format A100;
spool d:\bat\user_sequences.log
select text from tmp_user_sequence;
spool off;
exit;




相关文章

相关软件




月光软件程序下载编程文档电脑教程网站设计网址导航网络文学游戏天地幽默笑话生活休闲写作范文安妮宝贝
电脑技术编程开发网络专区谈天说地情感世界游戏元素分类游戏热门游戏体育运动手机专区业余爱好影视沙龙
音乐天地数码广场教育园地科学大观古今纵横谈股论金人文艺术医学保健动漫图酷二手专区地方风情各行各业

月光软件站·版权所有