Oracle中批量导出Sequence
使用exp工具,以tables的类型导出某个用户下所有的表和数据,发现其中sequence没有被导出。网上搜索之,发现toad貌似有此功能,于是安装了9.6.1.1版本,结果居然没发现此功能。(可能是我没找到,至少和那位老大的截图不同),最后找到如下脚本,可以将某个用户的全部sequence查询出来,并拼成创建语句。
代码如下:
Java代码
select
'create sequence '
||sequence_name||
' minvalue '
||min_value||
' maxvalue '
||max_value||
' start with '
||last_number||
' increment by '
||increment_by||
(
case
when cache_size=
0
then
' nocache'
else
' cache '
||cache_size end) ||
';'
from dba_sequences where sequence_owner=
'HR'
select 'create sequence '||sequence_name||
' minvalue '||min_value||
' maxvalue '||max_value||
' start with '||last_number||
' increment by '||increment_by||
(case when cache_size=0 then ' nocache' else ' cache '||cache_size end) ||';'
from dba_sequences where sequence_owner='HR'
注意:其中的HR,是需要导出sequence的用户,貌似必须大写的说!并且使用该脚本的用户需要有访问dba_sequences的权限。
导出结果如下:
Java代码
create sequence HIBERNATE_SEQUENCE minvalue
1
maxvalue
999999999999999999999999999
start with
1
increment by
1
cache
20
;
create sequence MIAGENTVERSION_VERSION_SEQ minvalue
1
maxvalue
999999999999999999999999
start with
121
increment by
1
cache
20
;&nbs
相关文档:
首先来复习一下行级锁的机制。当一个事务开始时必选先申请一个TX锁(保护回滚段、回滚数据块),只有先申请到回滚段资源后才能开始一个事务,才能进行DML操作。这个动作完成后,事务就可以开始修改数据了。当修改数据表的记录时,遵循以下的操作顺序。
1.获得表的TM锁(保护事务执行过程中其它用户不能修改表结构)
2.在 ......
Oracle 10G 数据库文件目录结构
在Oracle Database 10g中,Oracle的目录结构是由Oracle_Base及其子目录Oracle_Home、admin、flash_recovery_area和oradata目录构成的。为方便讨论,用Oracle_Base代表Oracle目录树的根,用Oracle_Home表示根目录下的主目录。
1.Oracle_Base目录
Oracle_Base代表Oracle目录树的根。 ......
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String URL=dbmes.url;
Connection con = DriverManager.getConnection(URL,dbmes.usrname,dbmes.pwd);
try{
// 准备语句执行对象
String bh=request.getParameter("dwmc");
Statement stmt = con.createStatement() ......
2009-04-22 22:00
来源:中国
IT
实验
室 作者:佚名
Oracle
客
户
端与服
务
器端的
连
接是通
过
客
户
端
发
出
连
接
请
求,由服
务
器端
监
听器
对
客
户
端
连
接
请
求
进
行合法
检查
,如果
连
接
请
求有效,
则进
行
连
接,否
则
拒
绝该连
接。 ......
1、查找表的所有索引(包括索引名,类型,构成列):
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = 要查询的表
2、查找表的主键(包括名称,构成列):
select cu.* from user_cons_columns cu, user_con ......