Tuesday, July 10, 2012

Database frozen due to full archive log destination

Database froze, due to archive log destination being full and you can only connect as SYSDBA.
You can add one more archive log destination to a filesystem with enough free space:
SQL> alter system set log_archive_dest_1='LOCATION=/oratest/TESTDB/arch' scope=memory;
System altered.

SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     33
Next log sequence to archive   35
Current log sequence           35

Database will try to put logs on both destinations, but if one of them is full, it will fail and will put it only in the second destination. This is not a problem.
This depends on  LOG_ARCHIVE_MIN_SUCCEED_DEST parameter [default=1], which defines the minimum number of destinations that must succeed in order for the online logfile to be available for reuse.
Use RMAN to backup and delete your archive logs and when the incident is resolved, you may undo the change:
SQL> alter system set log_archive_dest_1='' scope=memory;
System altered.

SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     33
Next log sequence to archive   35
Current log sequence           35

Another way is to manually move some archive logs to a new destination.
Let's say our archive log destination is full.
Our current archive logs are:
./archivelog/2012_07_10:
total 20
-rw-r----- 1 oratest oinstall 1024 Jul 10 08:34 o1_mf_1_30_7zqhpr63_.arc
-rw-r----- 1 oratest oinstall 1024 Jul 10 08:34 o1_mf_1_31_7zqhps7b_.arc
-rw-r----- 1 oratest oinstall 1024 Jul 10 08:34 o1_mf_1_32_7zqhpt0t_.arc
-rw-r----- 1 oratest oinstall 1024 Jul 10 08:34 o1_mf_1_33_7zqhptqk_.arc
-rw-r----- 1 oratest oinstall 1536 Jul 10 08:34 o1_mf_1_34_7zqhpvkw_.arc

We may query V$ARCHIVED_LOG:
SELECT NAME, COMPLETION_TIME, DELETED, STATUS 
FROM V$ARCHIVED_LOG
ORDER BY COMPLETION_TIME;

NAMECOMPLETION_TIMEDELETEDSTATUS
............
10/7/2012 08:33:14YESD
/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_30_7zqhpr63_.arc10/7/2012 08:34:16NOA
/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_31_7zqhps7b_.arc10/7/2012 08:34:17NOA
/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_32_7zqhpt0t_.arc10/7/2012 08:34:18NOA
/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_33_7zqhptqk_.arc10/7/2012 08:34:18NOA
/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_34_7zqhpvkw_.arc10/7/2012 08:34:19NOA

Rows with NAME=NULL, DELETED=YES, STATUS=D [Deleted] are archive logs backed up and deleted by RMAN.
Those with a name, DELETED=NO, STATUS=A [Available] are still in your archive log destination.

We move one archive log to a new filesystem:
[oratest@testsrv 2012_07_10]$ mv o1_mf_1_30_7zqhpr63_.arc /oratest/TESTDB/arch/
[oratest@testsrv 2012_07_10]$ ll
total 16
-rw-r----- 1 oratest oinstall 1024 Jul 10 08:34 o1_mf_1_31_7zqhps7b_.arc
-rw-r----- 1 oratest oinstall 1024 Jul 10 08:34 o1_mf_1_32_7zqhpt0t_.arc
-rw-r----- 1 oratest oinstall 1024 Jul 10 08:34 o1_mf_1_33_7zqhptqk_.arc
-rw-r----- 1 oratest oinstall 1536 Jul 10 08:34 o1_mf_1_34_7zqhpvkw_.arc
[oratest@testsrv 2012_07_10]$ ll /oratest/TESTDB/arch/
total 4
-rw-r----- 1 oratest oinstall 1024 Jul 10 08:34 o1_mf_1_30_7zqhpr63_.arc

We try to backup  our archive logs using RMAN:
RMAN> RUN {
ALLOCATE CHANNEL ch01 TYPE DISK;
ALLOCATE CHANNEL ch02 TYPE DISK;
ALLOCATE CHANNEL ch03 TYPE DISK;
ALLOCATE CHANNEL ch04 TYPE DISK;
BACKUP INCREMENTAL LEVEL=0
    ARCHIVELOG ALL DELETE INPUT;
}

allocated channel: ch01
channel ch01: SID=50 device type=DISK

allocated channel: ch02
channel ch02: SID=69 device type=DISK

allocated channel: ch03
channel ch03: SID=83 device type=DISK

allocated channel: ch04
channel ch04: SID=100 device type=DISK

Starting backup at 10-JUL-12
current log archived
released channel: ch01
released channel: ch02
released channel: ch03
released channel: ch04
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 07/10/2012 09:42:30
RMAN-06059: expected archived log not found, loss of archived log compromises recoverability
ORA-19625: error identifying file /oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_30_7zqhpr63_.arc
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

We got an error and nothing was backed up and deleted. The moved file is missing.
We need to use RMAN CROSSCHECK command:
RMAN> CROSSCHECK ARCHIVELOG ALL;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=50 device type=DISK
validation failed for archived log
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_30_7zqhpr63_.arc RECID=15 STAMP=788258056
validation succeeded for archived log
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_31_7zqhps7b_.arc RECID=16 STAMP=788258057
validation succeeded for archived log
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_32_7zqhpt0t_.arc RECID=17 STAMP=788258058
validation succeeded for archived log
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_33_7zqhptqk_.arc RECID=18 STAMP=788258058
validation succeeded for archived log
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_34_7zqhpvkw_.arc RECID=19 STAMP=788258059
validation succeeded for archived log
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_35_7zqmppbw_.arc RECID=20 STAMP=788262150
Crosschecked 6 objects

Querying V$ARCHIVED_LOG we can see that moved log's STATUS changed to X [Expired]:
NAMECOMPLETION_TIMEDELETEDSTATUS
............
/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_30_7zqhpr63_.arc10/7/2012 08:34:16NOX
............

We retry to backup the archive logs:
RMAN> RUN {
ALLOCATE CHANNEL ch01 TYPE DISK;
ALLOCATE CHANNEL ch02 TYPE DISK;
ALLOCATE CHANNEL ch03 TYPE DISK;
ALLOCATE CHANNEL ch04 TYPE DISK;
BACKUP INCREMENTAL LEVEL=0
    ARCHIVELOG ALL DELETE INPUT;
}

released channel: ORA_DISK_1
allocated channel: ch01
channel ch01: SID=50 device type=DISK

allocated channel: ch02
channel ch02: SID=69 device type=DISK

allocated channel: ch03
channel ch03: SID=83 device type=DISK

allocated channel: ch04
channel ch04: SID=100 device type=DISK

Starting backup at 10-JUL-12
current log archived
channel ch01: starting compressed archived log backup set
channel ch01: specifying archived log(s) in backup set
input archived log thread=1 sequence=31 RECID=16 STAMP=788258057
input archived log thread=1 sequence=32 RECID=17 STAMP=788258058
channel ch01: starting piece 1 at 10-JUL-12
channel ch02: starting compressed archived log backup set
channel ch02: specifying archived log(s) in backup set
input archived log thread=1 sequence=33 RECID=18 STAMP=788258058
input archived log thread=1 sequence=34 RECID=19 STAMP=788258059
channel ch02: starting piece 1 at 10-JUL-12
channel ch03: starting compressed archived log backup set
channel ch03: specifying archived log(s) in backup set
input archived log thread=1 sequence=35 RECID=20 STAMP=788262150
channel ch03: starting piece 1 at 10-JUL-12
channel ch04: starting compressed archived log backup set
channel ch04: specifying archived log(s) in backup set
input archived log thread=1 sequence=36 RECID=21 STAMP=788262734
channel ch04: starting piece 1 at 10-JUL-12
channel ch01: finished piece 1 at 10-JUL-12
piece handle=/oratest/TESTDB/fast_recovery_area/TESTDB/backupset/2012_07_10/o1_mf_annnn_TAG20120710T095214_7zqn8ync_.bkp tag=TAG20120710T095214 comment=NONE
channel ch01: backup set complete, elapsed time: 00:00:00
channel ch01: deleting archived log(s)
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_31_7zqhps7b_.arc RECID=16 STAMP=788258057
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_32_7zqhpt0t_.arc RECID=17 STAMP=788258058
channel ch02: finished piece 1 at 10-JUL-12
piece handle=/oratest/TESTDB/fast_recovery_area/TESTDB/backupset/2012_07_10/o1_mf_annnn_TAG20120710T095214_7zqn8ynp_.bkp tag=TAG20120710T095214 comment=NONE
channel ch02: backup set complete, elapsed time: 00:00:00
channel ch02: deleting archived log(s)
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_33_7zqhptqk_.arc RECID=18 STAMP=788258058
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_34_7zqhpvkw_.arc RECID=19 STAMP=788258059
channel ch04: finished piece 1 at 10-JUL-12
piece handle=/oratest/TESTDB/fast_recovery_area/TESTDB/backupset/2012_07_10/o1_mf_annnn_TAG20120710T095214_7zqn8yor_.bkp tag=TAG20120710T095214 comment=NONE
channel ch04: backup set complete, elapsed time: 00:00:00
channel ch04: deleting archived log(s)
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_36_7zqn8yf3_.arc RECID=21 STAMP=788262734
channel ch03: finished piece 1 at 10-JUL-12
piece handle=/oratest/TESTDB/fast_recovery_area/TESTDB/backupset/2012_07_10/o1_mf_annnn_TAG20120710T095214_7zqn8yof_.bkp tag=TAG20120710T095214 comment=NONE
channel ch03: backup set complete, elapsed time: 00:00:00
channel ch03: deleting archived log(s)
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_35_7zqmppbw_.arc RECID=20 STAMP=788262150
Finished backup at 10-JUL-12
released channel: ch01
released channel: ch02
released channel: ch03
released channel: ch04

The archive log destination is now cleared:
/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10
[oratest@testsrv 2012_07_10]$ ll
total 0

All entries in V$ARCHIVED_LOG now have NAME=NULL, DELETED=YES, STATUS=D, except the log we moved.

Now we return that log in the archive log destination:
[oratest@testsrv 2012_07_10]$ mv /oratest/TESTDB/arch/o1_mf_1_30_7zqhpr63_.arc .
[oratest@testsrv 2012_07_10]$ ll
total 4
-rw-r----- 1 oratest oinstall 1024 Jul 10 08:34 o1_mf_1_30_7zqhpr63_.arc

We CROSSCHECK once more:
RMAN> CROSSCHECK ARCHIVELOG ALL;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=50 device type=DISK
validation succeeded for archived log
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_30_7zqhpr63_.arc RECID=15 STAMP=788258056
Crosschecked 1 objects

Querying V$ARCHIVED_LOG, we see that log is available again:
NAMECOMPLETION_TIMEDELETEDSTATUS
............
/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_30_7zqhpr63_.arc10/7/2012 08:34:16NOA
............

We take one more backup to delete it:
RMAN> RUN {
ALLOCATE CHANNEL ch01 TYPE DISK;
ALLOCATE CHANNEL ch02 TYPE DISK;
ALLOCATE CHANNEL ch03 TYPE DISK;
ALLOCATE CHANNEL ch04 TYPE DISK;
BACKUP INCREMENTAL LEVEL=0
    ARCHIVELOG ALL DELETE INPUT;
}

released channel: ORA_DISK_1
allocated channel: ch01
channel ch01: SID=50 device type=DISK

allocated channel: ch02
channel ch02: SID=69 device type=DISK

allocated channel: ch03
channel ch03: SID=83 device type=DISK

allocated channel: ch04
channel ch04: SID=100 device type=DISK

Starting backup at 10-JUL-12
current log archived
channel ch01: starting compressed archived log backup set
channel ch01: specifying archived log(s) in backup set
input archived log thread=1 sequence=30 RECID=15 STAMP=788258056
channel ch01: starting piece 1 at 10-JUL-12
channel ch02: starting compressed archived log backup set
channel ch02: specifying archived log(s) in backup set
input archived log thread=1 sequence=37 RECID=22 STAMP=788263417
channel ch02: starting piece 1 at 10-JUL-12
channel ch01: finished piece 1 at 10-JUL-12
piece handle=/oratest/TESTDB/fast_recovery_area/TESTDB/backupset/2012_07_10/o1_mf_annnn_TAG20120710T100337_7zqny9l8_.bkp tag=TAG20120710T100337 comment=NONE
channel ch01: backup set complete, elapsed time: 00:00:01
channel ch01: deleting archived log(s)
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_30_7zqhpr63_.arc RECID=15 STAMP=788258056
channel ch02: finished piece 1 at 10-JUL-12
piece handle=/optim2/oratest/TESTDB/fast_recovery_area/TESTDB/backupset/2012_07_10/o1_mf_annnn_TAG20120710T100337_7zqny9lj_.bkp tag=TAG20120710T100337 comment=NONE
channel ch02: backup set complete, elapsed time: 00:00:01
channel ch02: deleting archived log(s)
archived log file name=/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10/o1_mf_1_37_7zqny9fo_.arc RECID=22 STAMP=788263417
Finished backup at 10-JUL-12
released channel: ch01
released channel: ch02
released channel: ch03
released channel: ch04

[oratest@testsrv 2012_07_10]$ pwd
/oratest/TESTDB/fast_recovery_area/TESTDB/archivelog/2012_07_10
[oratest@testsrv 2012_07_10]$ ll
total 0

Monday, July 9, 2012

Concurrent requests information scripts

The first script will report information about your concurrent requests, such as if it's scheduled, running or completed, which users run them, request IDs, their arguments.
For example, to find all runs of Workflow Background Process program:
    SELECT F.REQUEST_ID,
         A.USER_NAME,
         DECODE (TO_CHAR (F.ACTUAL_START_DATE, 'DD/MM/YYYY HH24:MI:SS'),
                 NULL, 'PENDING',
                 TO_CHAR (F.ACTUAL_START_DATE, 'DD/MM/YYYY HH24:MI:SS'))
            DATE_STARTED,
         DECODE (
            DECODE (
               TRUNC (F.ACTUAL_COMPLETION_DATE - F.ACTUAL_START_DATE),
               0, NULL,
                  TRUNC (F.ACTUAL_COMPLETION_DATE - F.ACTUAL_START_DATE)
               || ' Days'
               || ' + ')
            || TO_CHAR (
                  TRUNC (SYSDATE)
                  + NUMTODSINTERVAL (
                       (F.ACTUAL_COMPLETION_DATE - F.ACTUAL_START_DATE) * 86400,
                       'second'),
                  'HH24:MI:SS'),
            ' Days + ', 'RUNNING',
            DECODE (
               TRUNC (F.ACTUAL_COMPLETION_DATE - F.ACTUAL_START_DATE),
               0, NULL,
                  TRUNC (F.ACTUAL_COMPLETION_DATE - F.ACTUAL_START_DATE)
               || ' Days'
               || ' + ')
            || TO_CHAR (
                  TRUNC (SYSDATE)
                  + NUMTODSINTERVAL (
                       (F.ACTUAL_COMPLETION_DATE - F.ACTUAL_START_DATE) * 86400,
                       'second'),
                  'HH24:MI:SS'))
            REQ_DURATION,
         F.COMPLETION_TEXT,
         P.CONCURRENT_PROGRAM_NAME CONC_PROGRAM,
         F.ARGUMENT_TEXT
    FROM APPLSYS.FND_CONCURRENT_REQUESTS F,
         APPLSYS.FND_USER A,
         APPLSYS.FND_CONCURRENT_PROGRAMS P,
         APPLSYS.FND_CONCURRENT_PROGRAMS_TL PT
   WHERE     A.USER_ID(+) = F.REQUESTED_BY
         AND F.CONCURRENT_PROGRAM_ID = P.CONCURRENT_PROGRAM_ID
         AND P.CONCURRENT_PROGRAM_ID = PT.CONCURRENT_PROGRAM_ID
         AND PT.USER_CONCURRENT_PROGRAM_NAME = 'Workflow Background Process'
         AND PT.LANGUAGE = 'US'
ORDER BY F.REQUESTED_START_DATE DESC;

REQUEST_IDUSER_NAMEDATE_STARTEDREQ_DURATIONCOMPLETION_TEXTCONC_PROGRAMARGUMENT_TEXT
39363160COLL_SETUPPENDINGRUNNINGFNDWFBGXXSTRYRE, , , N, Y, Y
39363194COLL_SETUP09/07/2012 12:00:0300:00:09Normal completionFNDWFBGXXSTRYRE, , , Y, N, N
39362136SYSADMIN09/07/2012 11:36:10RUNNINGFNDWFBGOEOL, , , Y, N, N
.....................
38021590SYSADMIN09/05/2012 10:25:034 Days + 23:06:07FNDWFBGOEOL, , , Y, N, N

If DATE_STARTED has a value of PENDING, then this concurrent request has not started yet. Ignore, in this case, the RUNNING value of REQ_DURATION.

You may filter the result by using specific columns in the WHERE clause.

PHASE_CODE and STATUS_CODE of APPLSYS.FND_CONCURRENT_REQUESTS table.
PHASE_CODE
VALUEMEANING
CCompleted
IInactive
PPending
RRunning

STATUS_CODE
VALUEMEANING
AWaiting
BResuming
CNormal
DCancelled
EError
FScheduled
GWarning
HOn hold
INormal
MNo manager
QStandby
RNormal
SSuspended
TTerminating
UDisabled
WPaused
XTerminated
ZWaiting

CONCURRENT_PROGRAM_NAME of APPLSYS.FND_CONCURRENT_PROGRAMS table, if you want to use its short name (FNDWFBG for our case).
ACTUAL_START_DATE of APPLSYS.FND_CONCURRENT_REQUESTS to limit the result by date.
USER_NAME of APPLSYS.FND_USER to check runs of specific users.

The second script will report the running/pending concurrent requests, to which concurrent manager are assigned, the node they are running their process IDs, log and output files, and database session information.
  SELECT
         REQ.REQUEST_ID "REQUEST ID",
         USR.USER_NAME "USER",
         QU.USER_CONCURRENT_QUEUE_NAME "CONC. MANAGER",
         REQ.REQUEST_DESCRIPTION "NAME",
         REQ.CONCURRENT_PROGRAM_NAME "SHORT NAME",
         REQ.ARGUMENT_TEXT "ARGUMENTS",
         DECODE (REQ.PHASE_CODE,
                 'R', 'RUNNING',
                 'P', 'PENDING',
                 'I', 'INCACTIVE')
            "PHASE",
         REQ.REQUEST_DATE "DATE SUBMITTED",
         REQ.REQUESTED_START_DATE "REQUESTED START DATE",
         REQ.ACTUAL_START_DATE "DATE STARTED",
         REQ.LOGFILE_NODE_NAME "NODE",
         REQ.LOGFILE_NAME "LOG",
         REQ.OUTFILE_NAME "OUTPUT",
         REQ.OS_PROCESS_ID "NODE PROCESS",
         REQ.ORACLE_PROCESS_ID "DB PROCESS",
         SS.INST_ID "DB INSTANCE",
         SS.SID "DB SID",
         SS.STATUS "DB SESSION STATUS"
    FROM APPS.FND_CONCURRENT_WORKER_REQUESTS REQ,
         APPLSYS.FND_USER USR,
         GV$SESSION SS,
         APPS.FND_CONCURRENT_QUEUES_VL QU
   WHERE     USR.USER_ID = REQ.REQUESTED_BY
         AND REQ.ORACLE_SESSION_ID = SS.AUDSID(+)
         AND REQ.CONCURRENT_QUEUE_ID = QU.CONCURRENT_QUEUE_ID
ORDER BY REQUEST_ID DESC;

Archived log generation volume and count report

V$ARCHIVED_LOG displays information about the archived logs generated by your database and haven't yet aged out from your control file.
We are going to use this view to generate a report, displaying some useful information about it.

BLOCKS column stores archived log's size in blocks, BLOCK_SIZE stores block size in bytes, so if we multiply them (BLOCKS*BLOCK_SIZE) we get its size in bytes.
ARCHIVED indicates whether the log is archived and DELETED whether RMAN has deleted it.

The following query displays per day the volume in MBytes of archived logs generated, deleted and of those that haven't yet been deleted by RMAN.
  SELECT SUM_ARCH.DAY,
         SUM_ARCH.GENERATED_MB,
         SUM_ARCH_DEL.DELETED_MB,
         SUM_ARCH.GENERATED_MB - SUM_ARCH_DEL.DELETED_MB "REMAINING_MB"
    FROM (  SELECT TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY') DAY,
                   SUM (ROUND ( (blocks * block_size) / (1024 * 1024), 2))
                      GENERATED_MB
              FROM V$ARCHIVED_LOG
             WHERE ARCHIVED = 'YES'
          GROUP BY TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY')) SUM_ARCH,
         (  SELECT TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY') DAY,
                   SUM (ROUND ( (blocks * block_size) / (1024 * 1024), 2))
                      DELETED_MB
              FROM V$ARCHIVED_LOG
             WHERE ARCHIVED = 'YES' AND DELETED = 'YES'
          GROUP BY TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY')) SUM_ARCH_DEL
   WHERE SUM_ARCH.DAY = SUM_ARCH_DEL.DAY(+)
ORDER BY TO_DATE (DAY, 'DD/MM/YYYY');

DAYGENERATED_MBDELETED_MBREMAINING_MB
29/06/2012315.77315.770
30/06/2012158.57158.570
01/07/2012153.09153.090
............
07/07/20121,040.221,040.220
08/07/2012637.59637.590
09/07/2012328.72174.28154.44

The following report will display the number of archived logs generated per hour per day:
  SELECT TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY') DAY,
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '00', 1, NULL))
            "00-01",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '01', 1, NULL))
            "01-02",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '02', 1, NULL))
            "02-03",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '03', 1, NULL))
            "03-04",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '04', 1, NULL))
            "04-05",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '05', 1, NULL))
            "05-06",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '06', 1, NULL))
            "06-07",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '07', 1, NULL))
            "07-08",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '08', 1, NULL))
            "08-09",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '09', 1, NULL))
            "09-10",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '10', 1, NULL))
            "10-11",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '11', 1, NULL))
            "11-12",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '12', 1, NULL))
            "12-13",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '13', 1, NULL))
            "13-14",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '14', 1, NULL))
            "14-15",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '15', 1, NULL))
            "15-16",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '16', 1, NULL))
            "16-17",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '17', 1, NULL))
            "17-18",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '18', 1, NULL))
            "18-19",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '19', 1, NULL))
            "19-20",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '20', 1, NULL))
            "20-21",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '21', 1, NULL))
            "21-22",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '22', 1, NULL))
            "22-23",
         SUM (DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '23', 1, NULL))
            "23-00",
         COUNT (*) TOTAL
    FROM V$ARCHIVED_LOG
WHERE ARCHIVED='YES'
GROUP BY TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY')
ORDER BY TO_DATE (DAY, 'DD/MM/YYYY');
   
DAY00-0101-0202-0303-04...20-2121-2222-2323-00TOTAL
29/06/2012...129
30/06/20121...16
01/07/20121...16
.................................
07/07/2012111...212229
08/07/2012111...11119
09/07/201221...9

So, for instance, at 30/06/12, between 03:00 and 04:00, no log was archived.
At 07/07/12, between 20:00 and 21:00, 2 logs were archived and, at that day, 29 logs were archived totally.

The combination of these scripts is:
  SELECT LOG_HISTORY.*,
         SUM_ARCH.GENERATED_MB,
         SUM_ARCH_DEL.DELETED_MB,
         SUM_ARCH.GENERATED_MB - SUM_ARCH_DEL.DELETED_MB "REMAINING_MB"
    FROM (  SELECT TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY') DAY,
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '00', 1, NULL))
                      "00-01",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '01', 1, NULL))
                      "01-02",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '02', 1, NULL))
                      "02-03",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '03', 1, NULL))
                      "03-04",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '04', 1, NULL))
                      "04-05",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '05', 1, NULL))
                      "05-06",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '06', 1, NULL))
                      "06-07",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '07', 1, NULL))
                      "07-08",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '08', 1, NULL))
                      "08-09",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '09', 1, NULL))
                      "09-10",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '10', 1, NULL))
                      "10-11",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '11', 1, NULL))
                      "11-12",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '12', 1, NULL))
                      "12-13",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '13', 1, NULL))
                      "13-14",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '14', 1, NULL))
                      "14-15",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '15', 1, NULL))
                      "15-16",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '16', 1, NULL))
                      "16-17",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '17', 1, NULL))
                      "17-18",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '18', 1, NULL))
                      "18-19",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '19', 1, NULL))
                      "19-20",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '20', 1, NULL))
                      "20-21",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '21', 1, NULL))
                      "21-22",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '22', 1, NULL))
                      "22-23",
                   SUM (
                      DECODE (TO_CHAR (COMPLETION_TIME, 'HH24'), '23', 1, NULL))
                      "23-00",
                   COUNT (*) TOTAL
              FROM V$ARCHIVED_LOG
             WHERE ARCHIVED = 'YES'
          GROUP BY TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY')) LOG_HISTORY,
         (  SELECT TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY') DAY,
                   SUM (ROUND ( (blocks * block_size) / (1024 * 1024), 2))
                      GENERATED_MB
              FROM V$ARCHIVED_LOG
             WHERE ARCHIVED = 'YES'
          GROUP BY TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY')) SUM_ARCH,
         (  SELECT TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY') DAY,
                   SUM (ROUND ( (blocks * block_size) / (1024 * 1024), 2))
                      DELETED_MB
              FROM V$ARCHIVED_LOG
             WHERE ARCHIVED = 'YES' AND DELETED = 'YES'
          GROUP BY TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY')) SUM_ARCH_DEL
   WHERE LOG_HISTORY.DAY = SUM_ARCH.DAY AND SUM_ARCH.DAY = SUM_ARCH_DEL.DAY(+)
ORDER BY TO_DATE (LOG_HISTORY.DAY, 'DD/MM/YYYY');