什么会导致 Oracle ROWID 更改?

发布于 2024-07-10 20:21:47 字数 156 浏览 6 评论 0原文

AFAIK Oracle 中的 ROWID 表示相应数据文件中记录的物理位置。 在什么情况下记录的ROWID可能会改变?

我所知道的一个是分区表上的更新,它将记录“移动”到另一个分区。

还有其他情况吗? 我们的大多数数据库都是 Oracle 10。

AFAIK ROWID in Oracle represents physical location of a record in appropriate datafile.
In which cases ROWID of a record may change ?

The one known to me is UPDATE on partitioned table that "moves" the record to another partition.

Are there another cases ? Most of our DBs are Oracle 10.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

稀香 2024-07-17 20:21:47

正如您所说,只要在磁盘上物理移动行,就会发生这种情况,例如:

  • 导出/导入表
  • ALTER TABLE XXXX MOVE
  • ALTER TABLE XXXX SHRINK SPACE
  • FASHBACK TABLE XXXX
  • 拆分分区
  • 更新值以使其移动到新的值分区
  • 组合两个分区

如果位于索引组织表中,则对主键的更新也会为您提供不同的 ROWID。

As you have said, it occurs anytime the row is physically moved on disk, such as:

  • Export/import of the table
  • ALTER TABLE XXXX MOVE
  • ALTER TABLE XXXX SHRINK SPACE
  • FLASHBACK TABLE XXXX
  • Splitting a partition
  • Updating a value so that it moves to a new partition
  • Combining two partitions

If is in an index organized table, then an update to the primary key would give you a different ROWID as well.

岁月静好 2024-07-17 20:21:47

WW 的另一个+1,但只是添加一点额外的...

如果主要问题是您是否可以存储 ROWID 供以后使用,我会说“不要这样做”。

您可以在事务中使用 ROWID - 例如收集一组 ROWID 来执行后续操作 - 但您不应该将 ROWID 存储在表中并假设它们将以后使用就可以了。

Another +1 to WW, but just to add a little extra...

If the driving question is whether you can store ROWIDs for later use, I would say "don't do it".

You are fine to use ROWIDs within a transaction - for example collecting a set of ROWIDs on which to carry out a subsequent operations - but you should never store the ROWIDs in a table and assume they're going to be ok to use at a later date.

一身仙ぐ女味 2024-07-17 20:21:47

+1 @WW

顺便说一句:

索引组织表的 ROWID 是不同的(我相信它们被称为 UROWID),因为行的物理位置可以在表更新期间发生变化(当树节点拆分或连接时)。

为了使索引仍然可行,UROWID 包括“逻辑 id”(主键)和“可能的物理 id”(常规 ROWID),后者可能已过期。

+1 @WW

As an aside:

ROWID for index organized tables are different (they are called UROWID, I believe), because the physical location of the row can change during updates to the table (when tree nodes split or are joined).

In order to make indexing still possible, the UROWID includes the "logical id" (the primary key), and the "likely physical id" (a regular ROWID), the latter of which may be expired.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文