这是最好的时代,这是最坏的时代,这是智慧的时代,这是愚蠢的时代;这是信仰的时期,这是怀疑的时期;这是光明的季节,这是黑暗的季节;这是希望之春,这是失望之冬;人们面前有着各样事物,人们面前一无所有;人们正在直登天堂;人们正在直下地狱。
我也要与时俱进了,被itpub2.0牵着尾巴,拼命的奔跑,不停的灌水...
关于主外键表数据提交过程中的一点疑惑
上一篇 / 下一篇 2008-01-11 00:18:35 / 个人分类:数 据 库
查看( 37 ) /
评论( 26 )
TAG:
-
tolywang
发布于2008-01-10 08:18:25
-
TX锁
在 parent key 所在的table中插入数据,不提交,使用sys用户看不到数据插入,不过使用这个表所在的用户登入似乎可以看到数据 。
-
bq_wang
发布于2008-01-10 08:23:46
-
同一个表的东西是不是也是这样
Insert into temptable select 1 from onetable;
Insert into temptable select count(*) from temptable;
-
wangfans
发布于2008-01-10 09:44:33
-
我的理解是,
主表lookup子表查找refrence key的时候,肯定是lookup了包括还在缓冲区里面的脏数据。
证明:
SQL> INSERT INTO ChildTable VALUES(3,'ChildA');
1 row created.
这个时候还没有写入数据文件,只是在缓冲区里面。
SQL> INSERT INTO MainTable VALUES(3,3,'MainA');
1 row created.
为什么能找到关系键,应该扫面了缓冲区。
-
棉花糖ONE发布于2008-01-10 09:59:35
-
你的这东西和一种情况类似
insert into table values(1);
假设session 1执行了这个语句,那么对于session 1这个会话来说,1是可见的
但是对于别的session来说1是不可见
-
bq_wang
发布于2008-01-10 20:23:22
-
有没有什么具体的机制和理论介绍啊

-
bq_wang
发布于2008-01-10 20:30:47
-
我的问题在于这两个表有主外键约束,为什么没写入基础表之前引用表就能写入了

-
yanggq
发布于2008-01-10 20:43:20
-
1.一致读,
2.子表(引用的表)的引用字段可以为空
-
yanggq
发布于2008-01-10 20:43:48
-
3.还有deffer constraint.
-
bq_wang
发布于2008-01-10 20:48:51
-
好像你说的也不成立啊,你可以试试看直接插入那张引用表,肯定是通不过的

-
yanggq
发布于2008-01-10 20:51:04
-
你的表怎么定义的?还有constraint如何定义的?还有session的设置?
-
bq_wang
发布于2008-01-10 20:55:51
-
就是个主表和外键表啊,没什么特别的吧,session是默认的
好像很久之前就有些疑惑,一直不敢确认是否保险
-
yanggq
发布于2008-01-10 21:01:24
-
数据在一个transcation中是可以看的到的,你可以看看oracle concept中关于事务和read consistent的那一章,我找找
-
bq_wang
发布于2008-01-10 21:04:16
-
OK,我也找找看,难道我对事务的理解有问题

-
yanggq
发布于2008-01-10 21:07:27
-
multi-version
-
yanggq
发布于2008-01-10 21:14:39
-
http://download.oracle.com/docs/ ... 0/consist.htm#i5338
-
admincy
发布于2008-01-10 21:21:49
-
QUOTE:
原帖由 tolywang 于 2008-1-10 08:18 发表

TX锁
在 parent key 所在的table中插入数据,不提交,使用sys用户看不到数据插入,不过使用这个表所在的用户登入似乎可以看到数据 。
不提交的话需在同一个session中才能看得到
-
admincy
发布于2008-01-10 21:26:41
-
读的一致性,在同一事务中所读的是同一个版本的表数据
-
bq_wang
发布于2008-01-10 22:48:07
-
看完了,不过好像糊里糊涂的
Multiversion Concurrency ControlOracle automatically provides read consistency to a query so that all the data that the query sees comes from a single point in time (statement-level read consistency). Oracle can also provide read consistency to all of the queries in a transaction (transaction-level read consistency).
Oracle uses the information maintained in its rollback segments to provide these consistent views. The rollback segments contain the old values of data that have been changed by uncommitted or recently committed transactions. Figure 13-1 shows how Oracle provides statement-level read consistency using data in rollback segments.
Figure 13-1 Transactions and Read Consistency

Description of "Figure 13-1 Transactions and Read Consistency"
As a query enters the execution stage, the current system change number (SCN) is determined. In Figure 13-1, this system change number is 10023. As data blocks are read on behalf of the query, only blocks written with the observed SCN are used. Blocks with changed data (more recent SCNs) are reconstructed from data in the rollback segments, and the reconstructed data is returned for the query. Therefore, each query returns all committed data with respect to the SCN recorded at the time that query execution began. Changes of other transactions that occur during a query's execution are not observed, guaranteeing that consistent data is returned for each query.
-
cc59
发布于2008-01-10 23:55:56
-
QUOTE:
原帖由 tolywang 于 2008-1-10 08:18 发表

TX锁
在 parent key 所在的table中插入数据,不提交,使用sys用户看不到数据插入,不过使用这个表所在的用户登入似乎可以看到数据 。
不会的,除非你在sqlplus中设置自动提交了.
否则在不同的会话不可能能够看到不提交的数据
-
yangtingkun
发布于2008-01-11 00:10:46
-
QUOTE:
原帖由 cc59 于 2008-1-10 23:55 发表

9i