How to check the last modification time of a table in db2?
You can use the following command to view the last modification time of tables in a DB2 database:
- First, log in to the DB2 database with an administrator user account.
- Execute the following command to connect to the corresponding database:
db2 connect to your_database_name
- Use the following command to view the last modification time of the table:
db2 "SELECT TABNAME, LASTUSED FROM SYSCAT.TABLES WHERE TABSCHEMA = 'your_schema_name' AND TABNAME = 'your_table_name'"
Replace “your_database_name” with the name of the database you want to connect to, “your_schema_name” with your schema name, and “your_table_name” with the name of the table you want to check.
After executing the above command, the table name and last modified time will be displayed.
Note: SYSCAT.TABLES is a DB2 system catalog table that contains information about all tables in the database.