Oracle在过去几天中查询归档日志的数量。
选择substr(to_char(first_time,'mm / / DD RR HH:MI:SS),1)天,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),'00,1,0))H00,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),01,1,0))H01,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),才会,1,0))H02,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),2003,1,0))股份,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),2004,1,0))层H04,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),2005,1,0))H05,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),2006,1,0))H06,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),2007,1,0))H07,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),2008,1,0))H08,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),2009年中期,1,0)),
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),2010,1,0))H10,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),就,1,0))H11,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),第二,1,0))H12,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),13,1,0))H13,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),14,H14 0)),
SUM (DECODE (SUBSTR (TO_CHAR (TO_CHAR (first_time,'MM/DD/RR HH24:MI:SS'), 10,2),'15', 1,0)) H15,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),16,1,0))H16,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),'17,1,0))H17,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),18个,1,0))H18,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),'19,1,0))H19,
SUM (DECODE (SUBSTR (TO_CHAR (TO_CHAR (first_time,'MM/DD/RR HH24:MI:SS'), 10,2),'20', 1,0)) H20,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),21,1,0))H21,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),'22,1,0))H22,
和(解码(substr(to_char(to_char(first_time,'mm / / RR DD hh24:MI:SS),2),'23,1,0))H23,
总数(*)
从V log_history一美元
在first_time > = to_char(sysdate-10)
组用substr(to_char(first_time,'mm / / DD RR HH:MI:SS),1,5)
为了通过substr(to_char(first_time,'mm / / DD RR HH:MI:SS),1)描述;
修改的天数,你可以修改first_time > = to_char(sysdate-11)
结果执行
总结
以上是Oracle查询,萧边介绍给你。我们在过去几天中查询了脚本的数量,希望能对您有所帮助。如果你有任何问题,请给我留言,萧边会及时给您回复。谢谢您支持网站。