使用来自另一个模式的模式获取 oracle scn

get oracle scn with a schema from another schema

我的数据库中有 2 个模式,一个管理模式(包含所有表)和第二个模式,它已授予 select、更新、从管理的同义词表中删除。 (我用的是11G)

我只使用管理架构。 我想做的是,在操作完成之前获取 scn:

SELECT current_scn FROM V$DATABASE;

然后完成了一些操作,之后我试图用我在操作前存储的 scn 制作一个 select:

SELECT * FROM myTable AS OF SCN 2312312; 

然后是

ORA-01031: insufficient privileges
01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to perform a database operation without
           the necessary privileges.
*Action:   Ask your database administrator or designated security
           administrator to grant you the necessary privileges

这个错误来了。

您需要授予用户权限 运行 针对 table 的闪回查询。

grant flashback 
   on myTable
   to someUser;

或者您可以授予用户权限以针对任何 table

进行 运行 闪回查询
grant flashback any table
   to someUser

通常,审核员在看到各种 "any" 特权时会感到相当紧张,但这一项相当安全。您可能还想授予对 dbms_flashback 包的权限。

文档很好地概述了 administrative tasks to enable flashback features