您的当前位置:我要购书网>在线阅读>数据库

导出oracle数据库对象---同义词,系列,视图

来源:互联网  作者:  发布:我要购物网收集整理  发布时间:2006-8-31 人气:151

脚本可分两部分:
同义词
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;
相关文章
· 导出sqlserver数据到excel中
· 导出lotus用户的方法(用asp技术)
· 导出数据到excel概述
· 导出oracle数据库对象---同义词,系列,视图
热点文章
%>
· creating user controls
· 提高fastreplace速度 (fstrrep.pas)
· asc ii 完整码表及简介
· 自动生成拼音(汉字反查到拼音)
· sql2000无法安装的解决办法
· 浏览器集成教学 自定义浏览器
· vc++技术内幕(第四版)笔记(第7章)
· mysql5.0中文乱码解决方案
· sql server日期计算
· vc下利用ado连接access数据库
 淘宝旺旺:我要购书网上书店『图书目录
本购书中心地址: 杭州市延安路111号清波商厦南楼D座(总部) 上海市闸北区老沪太路网上购书中心(沪部),  邮编:310002
电子邮件:books@51goushu.com  经营许可证编号:沪ICP备06038574号
版权所有 2003-2008 © All Rights Reserved .购书网