The operator command -ACCESS DATABASE (abbreviation -ACC) does not “grant access” and it is not START DATABASE ACCESS(FORCE). In DB2 for z/OS it performs one of three jobs chosen by MODE: physically OPEN a page set on this member, remove group buffer pool dependency (NGBPDEP) before a heavy batch job, or flush in-memory real-time statistics (STATS) to the catalog. This page covers syntax, authorization, each MODE, and the mistakes that mix this command with START DATABASE.
Two different commands share the English word “access”:
You can issue -ACCESS DATABASE from a z/OS console, SDSF, DSN, DB2I COMMANDS, IMS/CICS, or IFI. Data sharing scope is group or member depending on MODE.
The privilege set needs one of:
If you list several databases and lack STARTDB on one of them, that database fails and the others that you are authorized for are still processed. When data definition control is active, installation SYSOPR or installation SYSADM is required for a database, table space, or index space that holds a registration table or index. Console commands use primary and secondary authorization IDs.
You name databases and spaces the same way as START/STOP/DISPLAY DATABASE: lists, ranges, and asterisk patterns.
12345-ACCESS DATABASE(dbname) SPACENAM(spacename) PART(n) MODE(OPEN|NGBPDEP|STATS) -ACCESS DATABASE(DSN9001) SPACENAM(DSN9002) PART(1,3) MODE(OPEN) -ACCESS DATABASE(DSN9001) SPACENAM(DSN9003) MODE(NGBPDEP) -ACCESS DB(*) SP(*) MODE(STATS)
When you access a logical partition of a nonpartitioning index, the index is not closed. To close a nonpartitioning index you access it without PART.
| MODE | Action | Typical scope |
|---|---|---|
| OPEN | Physically open the page set/partition on this member | Local member |
| NGBPDEP | Remove GBP-dependency; drain the object first | Member (drain that member’s use; data sharing) |
| STATS | Write RTS and optimizer recommendations to the catalog | Group (externalize all members’ in-memory stats) |
OPEN forces a physical open of the page set or partition on the local member only. The overhead moves from the first SQL thread onto the command thread, which can raise the first-transaction rate after IPL, after STOP DATABASE, or when objects were never opened on this member.
Db2 does not process objects whose data sets were never created (DEFINE NO without a later physical define). Opening on several members of a data sharing group at the same instant can return DSNI045I with reason 00C90090 (resource contention). Reissue the command; do not fire OPEN on every member in one automation blast.
In data sharing, an object that is of interest to more than one member is group buffer pool dependent. Coupling-facility page writes and cross-invalidation cost CPU. A large batch job that will be the only updater on one member benefits if you first drain the object and drop GBP dependency.
After the batch, normal SQL from other members makes the object GBP-dependent again. NGBPDEP is a window, not a permanent attribute of the table space.
STATS externalizes in-memory real-time statistics and optimizer statistics recommendations to the catalog tables that hold them. In data sharing, in-memory statistics from all members are written. The mode does not physically open page sets and does not change RW/RO/UT.
IBM recommends only certain database-name and space-name combinations with STATS. The documented catch-all for “everything currently in memory” is:
1-ACCESS DB(*) SP(*) MODE(STATS)
Use STATS before a report that reads RTS catalog tables, or before you want recommendations visible without waiting for the next automatic externalization. It is not a substitute for RUNSTATS after a bulk load.
MODE(OPEN) is unlocking the classroom and turning the lights on before the first student arrives, so the first student does not stand in the dark fumbling with the key. MODE(NGBPDEP) is telling the other classrooms to stop sharing the one chalkboard (the coupling facility) so your class can write on it alone for a long exam. MODE(STATS) is emptying the teacher’s pocket notebook into the official grade book so everyone can read the scores, without opening extra classrooms.
1. What does -ACCESS DATABASE MODE(OPEN) do?
2. When do you issue MODE(NGBPDEP)?
3. What does MODE(STATS) externalize?
4. Which privilege is required for ACCESS DATABASE?
5. Is -ACCESS DATABASE the same as START DATABASE ACCESS(FORCE)?