如何在 PL-SQL 上更改之前获得 view/trigger?
How to get view/trigger before altered on PL-SQL?
我有一个看法:
昨天 |我的观点 | select * from mat where bereich='AAA'
|
今天 |我的观点 | select * from mat where bereich='BBB' AND typ='BR'
|
有人改变了我对 prod 的看法或者我忘记备份之前的查询并且它已经提交
如何找回我的 query/myview 昨天?
谢谢。
视图只是一个存储的查询,数据没有任何变化。只需使用旧查询重新创建视图:
create or replace myview as
select *
from mat
where bereich = 'AAA';
您可以使用 user_views
数据字典视图查看以前的 text
视图。为此,您需要一些特权,例如
SQL> sqlplus / as sysdba
SQL> grant flashback on user_views to myschema;
以及使用闪回技术的最低要求,例如
SQL> select p.value
from v$parameter p
where p.name = 'db_flashback_retention_target';
VALUE
-----
1440 -- should be set to 1440(minute) as minimum to get the value for the day before.
由您的 DBA 提供。
然后,连接到您的架构
SQL> conn myschema/mypwd
并使用以下查询
SQL> select t.text
from user_views
as of timestamp systimestamp - interval '1' day t
where t.view_name = 'MYVIEW';
重新创建您过去的 text
视图。
P.S. 关键字 day
可能会被替换为 hour
、minute
或 second
由于根据您的需要或愿望。
我有一个看法:
昨天 |我的观点 | select * from mat where bereich='AAA'
|
今天 |我的观点 | select * from mat where bereich='BBB' AND typ='BR'
|
有人改变了我对 prod 的看法或者我忘记备份之前的查询并且它已经提交
如何找回我的 query/myview 昨天?
谢谢。
视图只是一个存储的查询,数据没有任何变化。只需使用旧查询重新创建视图:
create or replace myview as
select *
from mat
where bereich = 'AAA';
您可以使用 user_views
数据字典视图查看以前的 text
视图。为此,您需要一些特权,例如
SQL> sqlplus / as sysdba
SQL> grant flashback on user_views to myschema;
以及使用闪回技术的最低要求,例如
SQL> select p.value
from v$parameter p
where p.name = 'db_flashback_retention_target';
VALUE
-----
1440 -- should be set to 1440(minute) as minimum to get the value for the day before.
由您的 DBA 提供。
然后,连接到您的架构
SQL> conn myschema/mypwd
并使用以下查询
SQL> select t.text
from user_views
as of timestamp systimestamp - interval '1' day t
where t.view_name = 'MYVIEW';
重新创建您过去的 text
视图。
P.S. 关键字 day
可能会被替换为 hour
、minute
或 second
由于根据您的需要或愿望。