Reclaiming space from journal receivers

Reviewed on

Log in to save

First look at which ones are detached from the journal, largest first:

SELECT JOURNAL_LIBRARY, JOURNAL_NAME,
       JOURNAL_RECEIVER_LIBRARY, JOURNAL_RECEIVER_NAME,
       SIZE / 1024 AS MB, STATUS, DETACH_TIMESTAMP, SAVE_TIMESTAMP
  FROM QSYS2.JOURNAL_RECEIVER_INFO
 WHERE DETACH_TIMESTAMP IS NOT NULL
 ORDER BY SIZE DESC

SIZE is in kilobytes, so dividing by 1024 gives megabytes. DETACH_TIMESTAMP is null for the receiver still attached (as well as for empty or partial ones): filtering on not-null leaves the detached receivers, the only candidates for deletion.

STATUS says in one word whether they can be touched:

STATUS What it means
ATTACHED attached to the journal: in use, leave it
ONLINE detached and not saved: do not delete
SAVED saved after being detached; the space is still in use
FREED saved after being detached, with the space already freed at save time
PARTIAL restored from a save taken while attached, or tied to an incomplete remote journal

Example: saved and detached more than a year ago

SELECT JOURNAL_RECEIVER_LIBRARY, JOURNAL_RECEIVER_NAME,
       SIZE / 1024 AS MB, DETACH_TIMESTAMP, SAVE_TIMESTAMP
  FROM QSYS2.JOURNAL_RECEIVER_INFO
 WHERE STATUS = 'SAVED'
   AND DETACH_TIMESTAMP < CURRENT_TIMESTAMP - 1 YEAR
 ORDER BY SIZE DESC

A year is an example: the right limit depends on how far back you want to be able to recover with the oldest save you keep.

Delete them like this:

DLTJRNRCV JRNRCV(JRNLIB/RCV0000123)

Warning

without DLTOPT, if the receiver has not been saved the command sends inquiry CPA7025 (to the operator, if running in batch) and waits. With DLTOPT(*IGNINQMSG) that inquiry does not appear and the receiver is deleted even if unsaved: do not use it for clean-up. An unsaved receiver is what recovers the changes made after the last save; deleted, those changes are gone.

Warning

automatic management does not check the save either. CHGJRN ... MNGRCV(*SYSTEM) DLTRCV(*YES) has the system detach and delete receivers, and the deletion stops only for a lock, for a remote journal without a full copy yet, or for a program registered on exit point QIBM_QJO_DLT_JRNRCV. Using it without one of these means accepting the loss of unsaved receivers.


Releases. QSYS2.JOURNAL_RECEIVER_INFO is in IBM's 7.5 and 7.6 documentation; on an earlier release, if the query answers SQL0204, the view is not there and a receiver's status is read with DSPJRNRCVA, which also says whether it has been saved.

Sources

← Back to blog

Comments

No comments yet. Be the first to comment!

You need an account to comment. Log in · Sign up