大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
解决思路是:先备库增加standby redo删除老standby redo,然后主库增加standby redo删除老standby redo,主库增加新redo删除老redo,最后备库库增加 redo删除老redo。
专注于为中小企业提供成都做网站、网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业璧山免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了成百上千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
查看主库redo日志信息:
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.members, a.status, b.MEMBER FROM v$log a, v$logfile b where a.group#= b.group# and b.TYPE='ONLINE' ORDER BY a.GROUP#; GROUP# THREAD# size_mb MEMBERS STATUS MEMBER ---------- ---------- ---------- ---------- ---------------- ------------------------------------------------------------ 1 1 50 2 CURRENT +DATA/mecbs/onlinelog/group_1.261.862339607 1 1 50 2 CURRENT +RECO/mecbs/onlinelog/group_1.redo01.log 2 1 50 2 INACTIVE +DATA/mecbs/onlinelog/group_2.262.862339621 2 1 50 2 INACTIVE +RECO/mecbs/onlinelog/group_2.redo01.log 3 2 50 2 INACTIVE +RECO/mecbs/onlinelog/group_3.redo01.log 3 2 50 2 INACTIVE +DATA/mecbs/onlinelog/group_3.266.862341957 4 2 50 2 CURRENT +RECO/mecbs/onlinelog/group_4.redo01.log 4 2 50 2 CURRENT +DATA/mecbs/onlinelog/group_4.267.862341967
查看主库Standbylog 信息:
SQL> set pagesize 100 SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.status, b.member FROM v$standby_log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'STANDBY' ORDER BY a.group#; GROUP# THREAD# size_mb STATUS MEMBER ---------- ---------- ---------- ---------- ------------------------------------------------------------ 5 1 50 UNASSIGNED +DATA/mecbs/onlinelog/group_5.269.862401827 5 1 50 UNASSIGNED +RECO/mecbs/onlinelog/group_5.261.862401835 6 1 50 UNASSIGNED +DATA/mecbs/onlinelog/group_6.270.862401861 6 1 50 UNASSIGNED +RECO/mecbs/onlinelog/group_6.262.862401871 7 1 50 UNASSIGNED +DATA/mecbs/onlinelog/group_7.271.862401977 7 1 50 UNASSIGNED +RECO/mecbs/onlinelog/group_7.263.862401983 8 2 50 UNASSIGNED +DATA/mecbs/onlinelog/group_8.272.862402121 8 2 50 UNASSIGNED +RECO/mecbs/onlinelog/group_8.264.862402137 9 2 50 UNASSIGNED +DATA/mecbs/onlinelog/group_9.273.862402187 9 2 50 UNASSIGNED +RECO/mecbs/onlinelog/group_9.265.862402189 10 2 50 UNASSIGNED +DATA/mecbs/onlinelog/group_10.274.862402213 10 2 50 UNASSIGNED +RECO/mecbs/onlinelog/group_10.266.862402217
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.status, b.member FROM v$standby_log a, v$logfile b WHERE a.group# = b.group# 7 8 AND b.type = 'STANDBY' 9 ORDER BY a.group#; GROUP# THREAD# size_mb STATUS MEMBER ---------- ---------- ---------- ---------- ------------------------------------------------------------ 5 1 50 UNASSIGNED +DATA/phub/onlinelog/group_5.260.884293665 5 1 50 UNASSIGNED +RECO/phub/onlinelog/group_5.619.884293671 6 1 50 UNASSIGNED +DATA/phub/onlinelog/group_6.272.884293677 6 1 50 UNASSIGNED +RECO/phub/onlinelog/group_6.618.884293683 7 1 50 ACTIVE +DATA/phub/onlinelog/group_7.273.884293689 7 1 50 ACTIVE +RECO/phub/onlinelog/group_7.616.884293695 8 2 50 ACTIVE +DATA/phub/onlinelog/group_8.264.884293703 8 2 50 ACTIVE +RECO/phub/onlinelog/group_8.617.884293707 9 2 50 UNASSIGNED +DATA/phub/onlinelog/group_9.286.884293715 9 2 50 UNASSIGNED +RECO/phub/onlinelog/group_9.615.884293727 10 2 50 UNASSIGNED +DATA/phub/onlinelog/group_10.256.884293735 10 2 50 UNASSIGNED +RECO/phub/onlinelog/group_10.614.884293739
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.members, a.status, b.member FROM v$log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'ONLINE' 10 ORDER BY a.group#; GROUP# THREAD# size_mb MEMBERS STATUS MEMBER
---------- ---------- ---------- ---------- ---------------- ------------------------------------------------------------ 1 1 50 2 CURRENT +DATA/phub/onlinelog/group_1.282.884293611 1 1 50 2 CURRENT +RECO/phub/onlinelog/group_1.624.884293619 2 1 50 2 CLEARING +DATA/phub/onlinelog/group_2.281.884293627 2 1 50 2 CLEARING +RECO/phub/onlinelog/group_2.622.884293629 3 2 50 2 CLEARING +RECO/phub/onlinelog/group_3.620.884293641 3 2 50 2 CLEARING +DATA/phub/onlinelog/group_3.280.884293635 4 2 50 2 CURRENT +RECO/phub/onlinelog/group_4.621.884293661 4 2 50 2 CURRENT +DATA/phub/onlinelog/group_4.266.884293655
取消备库日志应用:
SQL> alter database recover managed standby database cancel; Database altered.
4.备库standby log 添加:
alter database add standby logfile thread 1('+BACK','+RECO') size 100M; alter database add standby logfile thread 1('+BACK','+RECO') size 100M; alter database add standby logfile thread 1('+BACK','+RECO') size 100M; alter database add standby logfile thread 2('+BACK','+RECO') size 100M; alter database add standby logfile thread 2('+BACK','+RECO') size 100M; alter database add standby logfile thread 2('+BACK','+RECO') size 100M;
(由于实验环境DATA磁盘组空间不够,所以添加到BACK磁盘组中)
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.status, b.member FROM v$standby_log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'STANDBY' 9 ORDER BY a.group#; GROUP# THREAD# size_mb STATUS MEMBER ---------- ---------- ---------- ---------- ------------------------------------------------------------ 5 1 50 UNASSIGNED +DATA/phub/onlinelog/group_5.260.884293665 5 1 50 UNASSIGNED +RECO/phub/onlinelog/group_5.619.884293671 6 1 50 UNASSIGNED +DATA/phub/onlinelog/group_6.272.884293677 6 1 50 UNASSIGNED +RECO/phub/onlinelog/group_6.618.884293683 7 1 50 ACTIVE +DATA/phub/onlinelog/group_7.273.884293689 7 1 50 ACTIVE +RECO/phub/onlinelog/group_7.616.884293695 8 2 50 ACTIVE +DATA/phub/onlinelog/group_8.264.884293703 8 2 50 ACTIVE +RECO/phub/onlinelog/group_8.617.884293707 9 2 50 UNASSIGNED +DATA/phub/onlinelog/group_9.286.884293715 9 2 50 UNASSIGNED +RECO/phub/onlinelog/group_9.615.884293727 10 2 50 UNASSIGNED +DATA/phub/onlinelog/group_10.256.884293735 10 2 50 UNASSIGNED +RECO/phub/onlinelog/group_10.614.884293739 11 1 100 UNASSIGNED +BACK/phub/onlinelog/group_11.306.886088609 11 1 100 UNASSIGNED +RECO/phub/onlinelog/group_11.548.886088623 12 1 100 UNASSIGNED +BACK/phub/onlinelog/group_12.307.886088647 12 1 100 UNASSIGNED +RECO/phub/onlinelog/group_12.550.886088653 13 1 100 UNASSIGNED +BACK/phub/onlinelog/group_13.289.886088921 13 1 100 UNASSIGNED +RECO/phub/onlinelog/group_13.551.886088931 14 2 100 UNASSIGNED +BACK/phub/onlinelog/group_14.288.886088951 14 2 100 UNASSIGNED +RECO/phub/onlinelog/group_14.553.886088963 15 2 100 UNASSIGNED +BACK/phub/onlinelog/group_15.305.886088979 15 2 100 UNASSIGNED +RECO/phub/onlinelog/group_15.552.886088993 16 2 100 UNASSIGNED +BACK/phub/onlinelog/group_16.304.886089015 16 2 100 UNASSIGNED +RECO/phub/onlinelog/group_16.638.886089027
5.删除备库standby log
SQL> alter database drop logfile group 5;
Database altered. SQL> alter database drop logfile group 6; Database altered. SQL> alter database drop logfile group 7; alter database drop logfile group 7 * ERROR at line 1: ORA-00261: log 7 of thread 1 is being archived or modified ORA-00312: online log 7 thread 1: '+DATA/phub/onlinelog/group_7.273.884293689' ORA-00312: online log 7 thread 1: '+RECO/phub/onlinelog/group_7.616.884293695' SQL> alter database drop logfile group 7; Database altered. SQL> alter database drop logfile group 8; Database altered. SQL> alter database drop logfile group 9; Database altered. SQL> alter database drop logfile group 10; Database altered.
一边在主库上切换日志,一边在备库上查询那些组UNASSIGNED,然后逐个drop掉:
完成后,再次查询备库standby_log:
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.status, b.member FROM v$standby_log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'STANDBY' ORDER BY a.group#; GROUP# THREAD# size_mb STATUS MEMBER ---------- ---------- ---------- ---------- ------------------------------------------------------------ 11 1 100 UNASSIGNED +BACK/phub/onlinelog/group_11.306.886088609 11 1 100 UNASSIGNED +RECO/phub/onlinelog/group_11.548.886088623 12 1 100 ACTIVE +BACK/phub/onlinelog/group_12.307.886088647 12 1 100 ACTIVE +RECO/phub/onlinelog/group_12.550.886088653 13 1 100 UNASSIGNED +BACK/phub/onlinelog/group_13.289.886088921 13 1 100 UNASSIGNED +RECO/phub/onlinelog/group_13.551.886088931 14 2 100 ACTIVE +BACK/phub/onlinelog/group_14.288.886088951 14 2 100 ACTIVE +RECO/phub/onlinelog/group_14.553.886088963 15 2 100 UNASSIGNED +BACK/phub/onlinelog/group_15.305.886088979 15 2 100 UNASSIGNED +RECO/phub/onlinelog/group_15.552.886088993 16 2 100 UNASSIGNED +BACK/phub/onlinelog/group_16.304.886089015 16 2 100 UNASSIGNED +RECO/phub/onlinelog/group_16.638.886089027
6.主库standbylog添加:
alter database add standby logfile thread 1('+DATA','+RECO') size 100M; alter database add standby logfile thread 1('+DATA','+RECO') size 100M; alter database add standby logfile thread 1('+DATA','+RECO') size 100M; alter database add standby logfile thread 2('+DATA','+RECO') size 100M; alter database add standby logfile thread 2('+DATA','+RECO') size 100M; alter database add standby logfile thread 2('+DATA','+RECO') size 100M;
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.status, b.member FROM v$standby_log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'STANDBY' 9 ORDER BY a.group#; GROUP# THREAD# size_mb STATUS MEMBER ---------- ---------- ---------- ---------- ------------------------------------------------------------ 5 1 50 UNASSIGNED +DATA/mecbs/onlinelog/group_5.269.862401827 5 1 50 UNASSIGNED +RECO/mecbs/onlinelog/group_5.261.862401835 6 1 50 UNASSIGNED +DATA/mecbs/onlinelog/group_6.270.862401861 6 1 50 UNASSIGNED +RECO/mecbs/onlinelog/group_6.262.862401871 7 1 50 UNASSIGNED +DATA/mecbs/onlinelog/group_7.271.862401977 7 1 50 UNASSIGNED +RECO/mecbs/onlinelog/group_7.263.862401983 8 2 50 UNASSIGNED +DATA/mecbs/onlinelog/group_8.272.862402121 8 2 50 UNASSIGNED +RECO/mecbs/onlinelog/group_8.264.862402137 9 2 50 UNASSIGNED +DATA/mecbs/onlinelog/group_9.273.862402187 9 2 50 UNASSIGNED +RECO/mecbs/onlinelog/group_9.265.862402189 10 2 50 UNASSIGNED +DATA/mecbs/onlinelog/group_10.274.862402213 10 2 50 UNASSIGNED +RECO/mecbs/onlinelog/group_10.266.862402217 11 1 100 UNASSIGNED +DATA/mecbs/onlinelog/group_11.277.886086953 11 1 100 UNASSIGNED +RECO/mecbs/onlinelog/group_11.927.886086965 12 1 100 UNASSIGNED +DATA/mecbs/onlinelog/group_12.282.886086997 12 1 100 UNASSIGNED +RECO/mecbs/onlinelog/group_12.928.886087017 13 1 100 UNASSIGNED +DATA/mecbs/onlinelog/group_13.283.886087033 13 1 100 UNASSIGNED +RECO/mecbs/onlinelog/group_13.929.886087047 14 2 100 UNASSIGNED +DATA/mecbs/onlinelog/group_14.284.886087059 14 2 100 UNASSIGNED +RECO/mecbs/onlinelog/group_14.930.886087067 15 2 100 UNASSIGNED +DATA/mecbs/onlinelog/group_15.285.886087089 15 2 100 UNASSIGNED +RECO/mecbs/onlinelog/group_15.931.886087099 16 2 100 UNASSIGNED +DATA/mecbs/onlinelog/group_16.286.886087115 16 2 100 UNASSIGNED +RECO/mecbs/onlinelog/group_16.932.886087125 alter database drop logfile group 5; alter database drop logfile group 6; alter database drop logfile group 7; alter database drop logfile group 8; alter database drop logfile group 9; alter database drop logfile group 10;
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.status, b.member FROM v$standby_log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'STANDBY' 9 ORDER BY a.group#; GROUP# THREAD# size_mb STATUS MEMBER ---------- ---------- ---------- ---------- ------------------------------------------------------------ 11 1 100 UNASSIGNED +DATA/mecbs/onlinelog/group_11.277.886086953 11 1 100 UNASSIGNED +RECO/mecbs/onlinelog/group_11.927.886086965 12 1 100 UNASSIGNED +DATA/mecbs/onlinelog/group_12.282.886086997 12 1 100 UNASSIGNED +RECO/mecbs/onlinelog/group_12.928.886087017 13 1 100 UNASSIGNED +DATA/mecbs/onlinelog/group_13.283.886087033 13 1 100 UNASSIGNED +RECO/mecbs/onlinelog/group_13.929.886087047 14 2 100 UNASSIGNED +DATA/mecbs/onlinelog/group_14.284.886087059 14 2 100 UNASSIGNED +RECO/mecbs/onlinelog/group_14.930.886087067 15 2 100 UNASSIGNED +DATA/mecbs/onlinelog/group_15.285.886087089 15 2 100 UNASSIGNED +RECO/mecbs/onlinelog/group_15.931.886087099 16 2 100 UNASSIGNED +DATA/mecbs/onlinelog/group_16.286.886087115 16 2 100 UNASSIGNED +RECO/mecbs/onlinelog/group_16.932.886087125
7.主库添加新的ONLINE REDO LOG:
SQL>alter database add logfile thread 1('+DATA','+RECO') size 100M; Database altered. SQL>alter database add logfile thread 1('+DATA','+RECO') size 100M; Database altered. SQL>alter database add logfile thread 1('+DATA','+RECO') size 100M; Database altered. SQL>alter database add logfile thread 2('+DATA','+RECO') size 100M; Database altered. SQL>alter database add logfile thread 2('+DATA','+RECO') size 100M; Database altered. SQL>alter database add logfile thread 2('+DATA','+RECO') size 100M; Database altered.
查询添加结果:
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.members, a.status, b.member FROM v$log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'ONLINE' 5 6 7 8 9 10 ORDER BY a.group#; GROUP# THREAD# size_mb MEMBERS STATUS MEMBER ---------- ---------- ---------- ---------- ---------------- ------------------------------------------------------------ 1 1 50 2 CURRENT +RECO/mecbs/onlinelog/group_1.redo01.log 1 1 50 2 CURRENT +DATA/mecbs/onlinelog/group_1.261.862339607 2 1 50 2 INACTIVE +DATA/mecbs/onlinelog/group_2.262.862339621 2 1 50 2 INACTIVE +RECO/mecbs/onlinelog/group_2.redo01.log 3 2 50 2 CURRENT +DATA/mecbs/onlinelog/group_3.266.862341957 3 2 50 2 CURRENT +RECO/mecbs/onlinelog/group_3.redo01.log 4 2 50 2 INACTIVE +RECO/mecbs/onlinelog/group_4.redo01.log 4 2 50 2 INACTIVE +DATA/mecbs/onlinelog/group_4.267.862341967 5 1 100 2 UNUSED +DATA/mecbs/onlinelog/group_5.274.886087389 5 1 100 2 UNUSED +RECO/mecbs/onlinelog/group_5.266.886087403 6 1 100 2 UNUSED +RECO/mecbs/onlinelog/group_6.265.886087423 6 1 100 2 UNUSED +DATA/mecbs/onlinelog/group_6.273.886087413 7 1 100 2 UNUSED +DATA/mecbs/onlinelog/group_7.272.886087433 7 1 100 2 UNUSED +RECO/mecbs/onlinelog/group_7.264.886087441 8 2 100 2 UNUSED +RECO/mecbs/onlinelog/group_8.263.886087483 8 2 100 2 UNUSED +DATA/mecbs/onlinelog/group_8.271.886087455 9 2 100 2 UNUSED +RECO/mecbs/onlinelog/group_9.262.886087513 9 2 100 2 UNUSED +DATA/mecbs/onlinelog/group_9.270.886087497 10 2 100 2 UNUSED +DATA/mecbs/onlinelog/group_10.269.886087541 10 2 100 2 UNUSED +RECO/mecbs/onlinelog/group_10.261.886087553
8.主库删除旧的ONLINE REDOLOG;(
alter database drop logfile group 1; alter database drop logfile group 2; alter database drop logfile group 3; alter database drop logfile group 4;) SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.members, a.status, b.member FROM v$log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'ONLINE' 10 ORDER BY a.group#; GROUP# THREAD# size_mb MEMBERS STATUS MEMBER ---------- ---------- ---------- ---------- ---------------- ------------------------------------------------------------ 5 1 100 2 CURRENT +DATA/mecbs/onlinelog/group_5.274.886087389 5 1 100 2 CURRENT +RECO/mecbs/onlinelog/group_5.266.886087403 6 1 100 2 INACTIVE +DATA/mecbs/onlinelog/group_6.273.886087413 6 1 100 2 INACTIVE +RECO/mecbs/onlinelog/group_6.265.886087423 7 1 100 2 INACTIVE +DATA/mecbs/onlinelog/group_7.272.886087433 7 1 100 2 INACTIVE +RECO/mecbs/onlinelog/group_7.264.886087441 8 2 100 2 INACTIVE +DATA/mecbs/onlinelog/group_8.271.886087455 8 2 100 2 INACTIVE +RECO/mecbs/onlinelog/group_8.263.886087483 9 2 100 2 CURRENT +DATA/mecbs/onlinelog/group_9.270.886087497 9 2 100 2 CURRENT +RECO/mecbs/onlinelog/group_9.262.886087513 10 2 100 2 INACTIVE +DATA/mecbs/onlinelog/group_10.269.886087541 10 2 100 2 INACTIVE +RECO/mecbs/onlinelog/group_10.261.886087553 12 rows selected.
9.备库添加新的ONLINE REDO LOG
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.members, a.status, b.member FROM v$log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'ONLINE' 10 ORDER BY a.group#; GROUP# THREAD# size_mb MEMBERS STATUS MEMBER ---------- ---------- ---------- ---------- ---------------- ------------------------------------------------------------ 1 1 50 2 CLEARING +DATA/phub/onlinelog/group_1.282.884293611 1 1 50 2 CLEARING +RECO/phub/onlinelog/group_1.624.884293619 2 1 50 2 CLEARING +DATA/phub/onlinelog/group_2.281.884293627 2 1 50 2 CLEARING +RECO/phub/onlinelog/group_2.622.884293629 3 2 50 2 CLEARING +RECO/phub/onlinelog/group_3.620.884293641 3 2 50 2 CLEARING +DATA/phub/onlinelog/group_3.280.884293635 4 2 50 2 CLEARING +RECO/phub/onlinelog/group_4.621.884293661 4 2 50 2 CLEARING +DATA/phub/onlinelog/group_4.266.884293655
8 rows selected. ORA-01275: Operation ADD LOGFILE is not allowed if standby file management is automatic. SQL> alter system set standby_file_management='MANUAL'; System altered. SQL>alter database add logfile thread 1('+BACK','+RECO') size 100M; Database altered SQL> .alter database add logfile thread 1('+BACK','+RECO') size 100M; Database altered. SQL>alter database add logfile thread 1('+BACK','+RECO') size 100M; Database altered. SQL>alter database add logfile thread 2('+BACK','+RECO') size 100M; Database altered. SQL>alter database add logfile thread 2('+BACK','+RECO') size 100M; Database altered. SQL>alter database add logfile thread 2('+BACK','+RECO') size 100M; Database altered.
10.删除备库旧的ONLINE REDO LOG:
如果日志状态一直是CLEARING,做以下操作:
SQL> alter database clear logfile group 1; Database altered. SQL> alter database clear logfile group 2; Database altered. SQL> alter database drop logfile group 1; Database altered. SQL> alter database drop logfile group 2; Database altered.
SELECT a.group#, a.thread#, a.bytes / 1024 / 1024 "size_mb", a.members, a.status, b.member FROM v$log a, v$logfile b WHERE a.group# = b.group# AND b.type = 'ONLINE' 10 ORDER BY a.group#; GROUP# THREAD# size_mb MEMBERS STATUS MEMBER ---------- ---------- ---------- ---------- ---------------- ------------------------------------------------------------ 5 1 100 2 CURRENT +BACK/phub/onlinelog/group_5.303.886091387 5 1 100 2 CURRENT +RECO/phub/onlinelog/group_5.599.886091395 6 1 100 2 CLEARING +BACK/phub/onlinelog/group_6.302.886091401 6 1 100 2 CLEARING +RECO/phub/onlinelog/group_6.604.886091411 7 1 100 2 CLEARING +BACK/phub/onlinelog/group_7.301.886091425 7 1 100 2 CLEARING +RECO/phub/onlinelog/group_7.603.886091435 8 2 100 2 CURRENT +BACK/phub/onlinelog/group_8.300.886091441 8 2 100 2 CURRENT +RECO/phub/onlinelog/group_8.609.886091449 9 2 100 2 CLEARING +BACK/phub/onlinelog/group_9.299.886091457 9 2 100 2 CLEARING +RECO/phub/onlinelog/group_9.611.886091467 10 2 100 2 CLEARING +BACK/phub/onlinelog/group_10.298.886091479 10 2 100 2 CLEARING +RECO/phub/onlinelog/group_10.612.886091501 12 rows selected. SQL> alter system set standby_file_management='AUTO' scope=both; System altered. SQL> alter database recover managed standby database using current logfile disconnect from session; Database altered.
---------------------------查看redo日志切换频率--------------------------------------------
Select round(FIRST_TIME, 'DD'), THREAD#, Count(SEQUENCE#) From v$log_history Group By round(FIRST_TIME, 'DD'), THREAD# Order By 1, 2 SELECT trunc(first_time) "Date", to_char(first_time, 'Dy') "Day", count(1) "Total", SUM(decode(to_char(first_time, 'hh34'),'00',1,0)) "h0", SUM(decode(to_char(first_time, 'hh34'),'01',1,0)) "h2", SUM(decode(to_char(first_time, 'hh34'),'02',1,0)) "h3", SUM(decode(to_char(first_time, 'hh34'),'03',1,0)) "h4", SUM(decode(to_char(first_time, 'hh34'),'04',1,0)) "h5", SUM(decode(to_char(first_time, 'hh34'),'05',1,0)) "h6", SUM(decode(to_char(first_time, 'hh34'),'06',1,0)) "h7", SUM(decode(to_char(first_time, 'hh34'),'07',1,0)) "h7", SUM(decode(to_char(first_time, 'hh34'),'08',1,0)) "h8", SUM(decode(to_char(first_time, 'hh34'),'09',1,0)) "h9", SUM(decode(to_char(first_time, 'hh34'),'10',1,0)) "h20", SUM(decode(to_char(first_time, 'hh34'),'11',1,0)) "h21", SUM(decode(to_char(first_time, 'hh34'),'12',1,0)) "h22", SUM(decode(to_char(first_time, 'hh34'),'13',1,0)) "h23", SUM(decode(to_char(first_time, 'hh34'),'14',1,0)) "h24", SUM(decode(to_char(first_time, 'hh34'),'15',1,0)) "h25", SUM(decode(to_char(first_time, 'hh34'),'16',1,0)) "h26", SUM(decode(to_char(first_time, 'hh34'),'17',1,0)) "h27", SUM(decode(to_char(first_time, 'hh34'),'18',1,0)) "h28", SUM(decode(to_char(first_time, 'hh34'),'19',1,0)) "h29", SUM(decode(to_char(first_time, 'hh34'),'20',1,0)) "h30", SUM(decode(to_char(first_time, 'hh34'),'21',1,0)) "h31", SUM(decode(to_char(first_time, 'hh34'),'22',1,0)) "h32", SUM(decode(to_char(first_time, 'hh34'),'23',1,0)) "h33"FROM V$log_historygroup by trunc(first_time), to_char(first_time, 'Dy')Order by 1
===========================THE END========================================