ORACLE:当对象被删除时,授权是否会被删除?

发布于 2024-08-22 02:14:51 字数 573 浏览 10 评论 0原文

我目前有 2 个模式,A 和 B。B

有一个表,A 在其上执行选择插入和更新。

在我们的 sql 脚本中,我们已向 A 授予权限,以便它可以完成其任务。

grant select on B.thetable to A
etc,etc

现在,每天至少一次删除表“thetable”并将另一个表重命名为 B。

rename someothertable to thetable

执行此操作后,当 A 对 B.thetable 执行选择时,我们会收到错误。

ORA-00942: table or view does not exist

执行删除+重命名操作后,授权是否也可能丢失?

我们是否必须再次分配权限?

update

someothertable 没有任何授权。

update2

将数据插入“thetable”的日常进程每 N 次插入执行一次提交,因此无法执行任何回滚。这就是我们使用 2 个表的原因。

提前致谢

I currently have 2 schemas, A and B.

B has a table, and A executes selects inserts and updates on it.

In our sql scripts, we have granted permissions to A so it can complete its tasks.

grant select on B.thetable to A
etc,etc

Now, table 'thetable' is dropped and another table is renamed to B at least once a day.

rename someothertable to thetable

After doing this, we get an error when A executes a select on B.thetable.

ORA-00942: table or view does not exist

Is it possible that after executing the drop + rename operations, grants are lost as well?

Do we have to assign permissions once again ?

update

someothertable has no grants.

update2

The daily process that inserts data into 'thetable' executes a commit every N insertions, so were not able to execute any rollback. That's why we use 2 tables.

Thanks in advance

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

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

发布评论

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

评论(4

星軌x 2024-08-29 02:14:51

是的,一旦您删除该表,补助金也会被删除。

您可以尝试创建一个从 thetable 中选择的 VIEW 并对其授予 SELECT 权限。

不过,你定期丢桌子的策略对我来说听起来不太正确。为什么你必须这样做?

编辑

有比每天删除桌子更好的方法。

  1. thetable 添加另一列,说明该行是否有效。

  2. 在该列上放置索引(或扩展用于从该表中选择的现有索引)。

  3. 向您的查询添加另一个条件以仅考虑“有效”行或创建一个视图来处理该情况。

    向您的查询添加

  4. 导入数据时,将新行设置为“new”。导入完成后,您可以在单个事务中删除所有“有效”行并将“新”行设置为“有效”。

如果导入失败,您可以回滚您的事务。

Yes, once you drop the table, the grant is also dropped.

You could try to create a VIEW selecting from thetable and granting SELECT on that.

Your strategy of dropping a table regularly does not sound quite right to me though. Why do you have to do this?

EDIT

There are better ways than dropping the table every day.

  1. Add another column to thetable that states if the row is valid.

  2. Put an index on that column (or extend your existing index that you use to select from that table).

  3. Add another condition to your queries to only consider "valid" rows or create a view to handle that.

  4. When importing data, set the new rows to "new". Once the import is done, you can delete all "valid" rows and set the "new" rows to "valid" in a single transaction.

If the import fails, you can just rollback your transaction.

假面具 2024-08-29 02:14:51

也许重命名表的过程还应该执行一个为您授予权限的过程?您甚至可以在字典中查询现有的补助金并将其应用到重命名的表中。

Perhaps the process that renames the table should also execute a procedure that does your grants for you? You could even get fancy and query the dictionary for existing grants and apply those to the renamed table.

紫﹏色ふ单纯 2024-08-29 02:14:51

不 :
“Oracle 数据库自动将旧对象上的完整性约束、索引和授权转移到新对象。”
http://download.oracle.com/ docs/cd/B19306_01/server.102/b14200/statements_9019.htm#SQLRF01608

您一定还有其他问题

No :
"Oracle Database automatically transfers integrity constraints, indexes, and grants on the old object to the new object."
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9019.htm#SQLRF01608

You must have another problem

对你再特殊 2024-08-29 02:14:51

另一种方法是使用临时表来完成您正在做的工作。毕竟,听起来这只是数据是暂时的,至少在该表中是这样,并且您不必每次拥有一组新数据/创建新表时都必须重新申请拨款

Another approach would be to use a temporary table for the work you're doing. After all, it sounds like it is just the data is transitory, at least in that table, and you wouldn't keep having to reapply the grants each time you had a new set of data/create the new table

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