需要以下查询的一些建议
我需要针对以下查询的一些建议。
SQL> select value from v$dataguard_stats where name like 'apply lag';
VALUE
----------------------------------------------------------------
+00 00:21:38
其中+00 -->如果延迟超过 24 小时,则增加到 1。我的目标是编写一个脚本,每当延迟超过 5 小时(即值大于 +00 05:00:00)时,该脚本就会发送邮件。 Value 的数据类型是 varchar2(64)。我需要重写查询,使查询仅在值大于或等于 +00 05:00:00 时才显示输出。我不知道如何比较这个值。非常感谢任何帮助/建议。
请查找视图 v$dataguard_stats 的描述。
SQL> desc v$dataguard_stats;
Name Null? Type
----------------------------------------------------------------------------------------- -------- ------------------------------------------------------------
NAME VARCHAR2(32)
VALUE VARCHAR2(64)
UNIT VARCHAR2(30)
TIME_COMPUTED VARCHAR2(30)
感谢和问候
Karthik M
I need some suggestions with the following query.
SQL> select value from v$dataguard_stats where name like 'apply lag';
VALUE
----------------------------------------------------------------
+00 00:21:38
where +00 --> increases to 1 if the lag is for more than 24 hours. My objective is to write a script which sends a mail whenever the lag is for more than 5 hours i.e whenever the value is greater than +00 05:00:00. The datatype for Value is varchar2(64). I need to rewrite the query in such a way that the query displays output only when the value is greater than or equal to +00 05:00:00. I don't know how to compare this value. Any help/suggestions is highly appreciated.
Please find the description of the view v$dataguard_stats.
SQL> desc v$dataguard_stats;
Name Null? Type
----------------------------------------------------------------------------------------- -------- ------------------------------------------------------------
NAME VARCHAR2(32)
VALUE VARCHAR2(64)
UNIT VARCHAR2(30)
TIME_COMPUTED VARCHAR2(30)
Thanks and Regards
Karthik M
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该值存储为 INTERVAL 值的字符表示形式。您可以通过查看 v$dataguard_stats 视图中的 UNIT 列来看到这一点:
这应该会让您接近您想要的结果:
如果 apply_lag 大于 5 小时,则返回 1。
The value is stored as a character representation of an INTERVAL value. You can see this by looking at the UNIT column in the v$dataguard_stats view:
This should get you close to what you want:
This returns 1 if the apply_lag is greater than 5 hours.