oracle oracle物化视图刷新时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/380694/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
oracle materialized view refresh time
提问by shaunf
anyone able to tell me how often a materialized view is set to refresh with the following setting plz?
谁能告诉我使用以下设置刷新物化视图的频率?
REFRESH FORCE ON DEMAND START WITH sysdate+0 NEXT (round(sysdate) + 1/24) + 1
REFRESH FORCE ON DEMAND START WITH sysdate+0 NEXT (round(sysdate) + 1/24) + 1
i think i read it as every hour but i'm not sure
我想我每小时都读一遍,但我不确定
回答by tuinstoel
SQL> alter session set nls_date_format = 'yyyy-mm-dd :hh24:mi:ss';
Session changed.
SQL> select sysdate from dual;
SYSDATE
--------------------
2008-12-19 :12:18:28
SQL> select (round(sysdate) + 1/24) + 1 from dual;
(ROUND(SYSDATE)+1/24
--------------------
2008-12-21 :01:00:00
回答by Stew S
To answer your first question (will this run once an hour?):
回答你的第一个问题(这会每小时运行一次吗?):
Nope, this will run once when you create it because of this clause:
不,由于此子句,这将在您创建它时运行一次:
START WITH sysdate+0
Personally, I think the "+0" is extraneous, as now is now.
就个人而言,我认为“+0”是无关紧要的,就像现在一样。
Then it will run tomorrow at 1 a.m., because of the following clause:
然后它将在明天凌晨 1 点运行,因为以下子句:
NEXT (round(sysdate) + 1/24) + 1
The "1/24" part calculates when 1 a.m. is, since Oracle dates are actually stored as numbers, with the decimal part indicating hours, minutes, etc. The syntax is just fine.
“1/24”部分计算凌晨 1 点,因为 Oracle 日期实际上存储为数字,小数部分表示小时、分钟等。语法很好。
回答by David Aldridge
I'm not 100% sure that it's legal in a materialized view scheduling statement, but you might like to try the (arguably) more intuitive INTERVAL specification:
我不是 100% 确定它在物化视图调度语句中是合法的,但您可能想尝试(可以说)更直观的 INTERVAL 规范:
round(sysdate) + interval '1 1' day to hour
Other examples here: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements003.htm#SQLRF00221
此处的其他示例:http: //download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements003.htm#SQLRF00221
回答by Nadi E Musleh
i think using
我认为使用
NEXT (trunc(sysdate) + 1/24) + 1
is more accurate
更准确