oracle constraints(3)
oracle constraints 应用
oracle constraints可以设置为立即检查或者当时事务提交时检查。
可以在创建约束的时候指定是deferrable。然后通过set constraints xxx set deferred或者immediate,也可以在seesion级别设定所有约束为deferred或者immediate(alter seesion set constraints deferred/immediate)。
SQL> select t.constraint_name, t.status, t.validated, t.deferrable from user_constraints t;
CONSTRAINT_NAME STATUS VALIDATED DEFERRABLE
------------------------------ -------- ------------- --------------
SYS_C003765 ENABLED VALIDATED NOT DEFERRABLE
SYS_C003768 ENABLED NOT VALIDATED NOT DEFERRABLE
UK_T ENABLED NOT VALIDATED NOT DEFERRABLE
SQL> alter table t2 add primary key(vid) deferrable;
Table altered
SQL>
SQL> select t.constraint_name, t.status, t.validated, t.deferrable from user_constraints t;
CONSTRAINT_NAME STATUS VALIDATED DEFERRABLE
------------------------------ -------- ------------- --------------
SYS_C003765 ENABLED VALIDATED NOT DEFERRABLE
SYS_C003772 ENABLED VALIDATED DEFERRABLE
SYS_C003768 ENABLED NOT VALIDATED NOT DEFERRABLE
UK_T ENABLED NOT VALIDATED NOT DEFERRABLE
SQL> select * from t2;
VID VNAME VSEX
---------- ---------- ----------
1 a y
2 b
3 c x
SQL> insert into t2 values (1,'d','y');
insert into t2 values (1,'d','y')
ORA-00001: 违反唯一约束条件 (PORTALDB.SYS_C003772)
SQL> set constraints SYS_C003772 deferred;
Constraints set
SQL> insert into t2 values (1,'d','y');
1 row inserted
SQL> set constraints SYS_C003772 deferred;
Constraints set
SQL> commit;
commit
ORA-02091: 事务处理已重算
ORA-00001: 违反唯一约束条件 (PORTALDB
相关文档:
使用CodeSmith生成oracle数据库表的实体层(Model)
http://blog.csdn.net/dacong/archive/2009/01/27/3853663.aspx
自己写的,CodeSimth中的例子都是msSQL server的,所以自己写了个支持Oracle数据库表的,不一定很完善,适用就好,数据类型没有周全考虑,只考虑了常用的一些类型,增加了个表名字属性,采用的.net2.0我结 ......
2009-12-01 00:41:35
之前安装了oracle 10g,后来为了在C#里面连接oracle,安装了ODAC,之后连接数据库时,填写数据库服务名,总是会出错,连接测试无法通过,不填数据库服务名,倒还可以通过连接测试
今晚终于查到原因了。。。
系统属性那里的环境变量,path这里,oracle的两个默认路径:
d:\oracle\product\10. ......
查询用户信息
SELECT USERNAME,DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, PROFILE, ACCOUNT_STATUS, CREATED from dba_users; 查询用户空间使用和上限情况
SELECT username, tablespace_name, bytes/1024/1024 space_used_in_mb, max_bytes/1024/1024 max_space_in_mb from dba_ts_quotas; 创建 ......
按资料说V$BH查看表来显示数据库里每个对象类型的数据缓冲区里数据块的数量.
然后查询V$bh
select
owner, object_name
from
dba_objects o,
v$bh &nbs ......