In DB2, how to know date/time a particular Database was put to RO?

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
User avatar
saurabhgaur
New Member
Posts: 1
Joined: Tue Feb 27, 2024 11:59 am

In DB2, how to know date/time a particular Database was put to RO?

Post by saurabhgaur »

Is there any place where one can find at what date/time a particular Database was put to RO? Or got any change in status ? Is that available to see somewhere in the subsystem catalog or BSDS?
User avatar
Anuj Dhawan
Founder
Posts: 2805
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: In DB2, how to know date/time a particular Database was put to RO?

Post by Anuj Dhawan »

Hi SaurabhGaur,

Welcome to the forums!I've created a new post for your question to help you get the best possible attention. It's generally recommended to start new threads for new questions, and then link to any relevant previous discussions within your post, which you've looked at. This helps others searching for similar information find your question more easily.

If you had added your question to an older thread, it might have been harder for others to notice and respond.

Please feel free to ask your question here, and I'm sure the community will be happy to help!
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
DB2 Guy
Forum Moderator
Forum Moderator
Posts: 121
Joined: Sun Apr 21, 2013 8:25 pm
India

Re: In DB2, how to know date/time a particular Database was put to RO?

Post by DB2 Guy »

As far as I know, there isn't a single, definitive way to pinpoint the exact moment a DB2 database was switched to read-only (RO) status. However, there are several methods that can help you narrow down the timeframe:1. DB2 Logs:
  • Check the DB2 diagnostic log files (db2diag.log and others) for relevant entries. These logs may contain timestamps and messages indicating the database being placed in RO mode. Look for keywords like "READONLY" or "STOP DATABASE".
  • The timeframe covered by the logs will depend on your log rotation settings.
2. System Operations Staff:
  • If the RO switch was due to a planned maintenance activity, system administrators or operations staff likely have records of the specific time window.
3. Monitoring Tools:
  • If your organization uses database monitoring tools, they might have logged events related to the database status change. These tools can provide a more precise timestamp for the RO transition.
4. DB2 Commands: While not necessarily revealing the exact time, you can use the

Code: Select all

DISPLAY DATABASE
command to check the current status of the database, including whether it's read-only or read-write. This might help confirm if it's currently in RO mode. By combining information from these sources, you can get a clearer picture of when the database was switched to RO status.
User avatar
alexm3913
New Member
Posts: 1
Joined: Fri May 24, 2024 5:59 pm
United States of America

Re: In DB2, how to know date/time a particular Database was put to RO?

Post by alexm3913 »

Great question about tracking DB2 database status changes! While there's no single catalog table or BSDS record that directly logs read-only transitions, you have a few options to piece together the timeline.One approach is to query the SYSIBM.SYSLGRNX table which contains a history of logged events like -STO[P] DB commands that would put a database in RO mode. You can filter for rows with DBNAME and TYPE='P' (event marker) to narrow down the list of suspects.For example:SELECT TIMESTAMP, LRHTIME, AUTHID, PLANNAME FROM SYSIBM.SYSLGRNX WHERE DBNAME = 'MYDB' AND TYPE = 'P' ORDER BY LRHTIME DESC;This will show you recent commands run against the database along with the authorization ID and plan name. Look for -STO DB or similar that would have flipped the read-only switch.Another option is to enable audit tracing for the database with the ACCESS_CONTROL_LIST parameter. This will log changes to the database status in IFCID 0142 which you can then review in the audit log.As a last resort, you could also try searching through your SYSLOG or job output for the timeframe in question. Grep for things like "-STO DB" or "DSNT501I" messages indicating a read-only transition.It takes a bit of detective work, but with some SQL sleuthing and log diving you should be able to pinpoint when the database went read-only. Let me know if you have any other questions!
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”