Oracle 序列存储在什么表空间中?

发布于 2024-07-12 06:56:41 字数 521 浏览 4 评论 0原文

我和我的同事维护的应用程序在后端有一个 Oracle 数据库。 我们偶尔会考虑在“受限”模式下运行应用程序,并将其中一个数据库表空间设置为只读。 我们可以轻松地将必要的表和索引移动到单独的表空间,这些表空间将在“受限”模式下写入。 然而,尽管进行了多次 Google 搜索,我仍无法确定 Oracle 在哪个表空间中存储序列。

这个答案提到存储序列值在 SYSTEM.SEQ$ 表中。 我现在无法访问 Oracle DB,但我猜测该表位于系统表空间之一中。 我们设为只读的表空间不是系统表空间,而是我们自己的数据表空间之一。

在开发数据库上,我可以成功地从序列中进行选择,并将相关表空间设置为只读。

我怀疑让这个表空间只读不会有问题,但我宁愿我的怀疑不仅仅通过临时实验得到证实。 有人可以启发我吗?

The app my colleagues and I maintain has an Oracle database at the back-end. We're looking at occasionally running the app in a 'restricted' mode with one of the database tablespaces set to read-only. We can easily move the necessary tables and indexes over to separate tablespaces which will be writable in 'restricted' mode. However, despite several Google searches I can't determine in which tablespace Oracle stores sequences.

This answer mentions that sequence values are stored in the SYSTEM.SEQ$ table. I don't have access to an Oracle DB right now, but I would guess that this table lives in one of the system tablespaces. The tablespace we are making read-only isn't a system tablespace, it's one of our own data tablespaces.

On a dev database I can successfully SELECT from a sequence with the relevant tablespace made read-only.

I suspect it won't be a problem to have this tablespace read-only, but I'd rather my suspicions were confirmed by more than just ad-hoc experimentation. Could someone please enlighten me?

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

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

发布评论

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

评论(3

恋你朝朝暮暮 2024-07-19 06:56:41

序列(大部分)在 SEQ$ 中。 零件将以 OBJ$ 形式提供(以及其他地方的赠款)。
但所有这些表都在 SYSTEM 表空间中。 一些 SYSTEM 对象位于 SYSAUX 中。
DBA_SEGMENTS 是一个很好的视图,可以识别对象(例如 SEQ$)所在的表空间。

我怀疑 Oracle 不会让您将这些表空间置于只读模式,因为要做到这一点,需要将该表空间标记为只读,记录在该表空间的 SYSTEM 表中。 有点像将钥匙锁在它解锁的保险箱中。

Sequences are (mostly) in SEQ$. Parts will be in OBJ$ (and grants elsewhere).
But all these tables are in the SYSTEM tablespace. Some SYSTEM objects are in SYSAUX.
DBA_SEGMENTS is a good view to identify which tablespaces an object (such as SEQ$) resides in.

I suspect that Oracle wouldn't let you put these tablespaces into READ ONLY mode as, to do so, it would need to flag that tablespace as read only which is recorded in a SYSTEM table in that tablespace. Sort of like locking the key in the safe which it unlocks.

治碍 2024-07-19 06:56:41

我猜是系统,还有什么地方可以存储这些信息?

但你为什么想知道这个? 如果表空间是只读的,则无法插入或更新,因此根本不必使用序列。

I guess it is system, where else to store this information?

But why do you want to know this? If a tablespace is readonly you can't insert or update so you don't have to use the sequence(s) at all.

好久不见√ 2024-07-19 06:56:41

我现在面前没有 Oracle DB,如果我没记错的话,序列是数据字典的一部分,因此不能手动更新,甚至不能在没有特殊语法的情况下(简单地)查询(这这就是为什么你不能简单地获取序列的当前值 - 你必须递增它)。
显然,数据字典是 SYSTEM 表空间的一部分,应该以任何方式进行访问。

I don't have an Oracle DB in front of me right now, be if I recall correctly, sequences are part of the Data Dictionary, and thus cannot be updated manually, and even cannot be (simply) queried without the special syntax (this is why you cannot simply get the current value of a sequence - you must increment it).
Obviously, the Data Dictionary is part of the SYSTEM tablespace, and should be touched by any means.

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