top of page

How to check and set DB2 Database read-only or read-write mode.

In this blog post we will see and learn how to check your database is in read-only mode or read-write mode. DB2 LUW write suspend (read-only or Suspend I/O) state is commonly checked during a splitting of mirrored database.


Splitting a mirror database means creating a snapshot or an instantaneous copy of the source database by writing the data to the hard disk. If necessary, you can use this disk copy to clone a new but identical database, or use it as a backup copy to restore the original database. When splitting a mirror, make sure that there is no page write operation on the database and ensure consistent copy in DB2. DB2 suspended I/O or write suspend support allows you to perform split mirror operations without shutting down the database. The idea is to put the database in write suspend mode before splitting the mirror, and then resume normal I/O activities after the split is completed.

Well we have two methonds here like db2pd and db2 get db cfg to check the db2 database I/O State. These tools will allow you to check and report on the database configuration and to identify if the database is in write suspend state or not.


1) To check db2 database read-only or read-write mode

db2 connect to <db_name>
db2pd -db <db_name> -dbcfg |grep -i write
db2 get db cfg for <db_name> |grep -i "write suspend"


2) To set db2 database to read-only mode

db2 connect to <db_name>
db2 set write suspend for database
db2 get db cfg for <db_name> |grep -i "write suspend"

3) To set db2 database back to read and write mode.

db2 connect to <db_name>
db2 set write resume for database
db2 get db cfg for <db_name> |grep -i "write suspend"

That's all in this post. If you liked this blog and interested in knowing more about IBM Db2. Please Like, Follow, Share & Subscribe to www.ImJhaChandan.com.

Comments


jc_logo.png

Hi, thanks for stopping by!

Welcome! to my “Muse & Learn” blog.

This website will help you to learn useful queries/SQL, Tips to troubleshoot problem and their remediation, perform DB related activities etc... and don't forget to muse with us :)....

It cover few useful information on below topics :

 

MySQL, SQL Server, DB2, Linux/UNIX/AIX, HTML ....

Let the posts
come to you.

Thanks for submitting!

  • Instagram
  • Facebook
  • Twitter
© 2023 By ImJhaChandan
bottom of page