English 中文(简体)
奇怪的神谕问题
原标题:
  • 时间:2009-04-04 14:11:03
  •  标签:

我试着把它放在句子里,但给一个例子会更好:

SELECT * FROM someTable WHERE id = someID;

returns no rows
...
some time passes (no inserts are done to the table and no ID updates)
...

SELECT * FROM someTable WHERE id = someID;
returns one row!

有可能某些DB机制阻止第一个SELECT返回行吗?

Oracle log has no errors.

No transactions are rolled back when two selects are executed.

最佳回答

You can t see uncommitted data in another session. When did the commit happen?

EDIT1: Are you the only one using this database? Or did/do you have multiple sessions?

I think in another session you or someone else has inserted this row, you do your select and you don t see this row. After that a commit happens in the other session (maybe implicit because a session is closed) and then you see this row when you select again.

I can think of other explanations, but I first want to know are you only one using this database.

问题回答

使用Oracle提供的读一致性,您不应该看到出现这样的行。如果您在某种自动提交的模式下运行,使得每个语句都是一个独立的事务,则不违反读一致性。您使用哪个程序访问数据库?我同意其他人的观察;如果您的会话没有插入它,同时没有其他会话处于活动状态,则该行不应出现。我不知道有哪个DBMS会通过自发数据生成来满足自己。

Don t you have scheduled jobs in that Oracle?





相关问题
热门标签