Wednesday, 30 October 2024

How to know when your DB2 instance was started for the last time

How to know when your DB2 instance was started for the last time

Discovering when was the last time your DB2 instance was started
If you need information about the last time your DB2 instance was started, you can perform the following command:
db2 get snapshot for dbm | grep -i manager

The output result you'll get should be something like this:
Start Database Manager timestamp               = 03/17/2008 07:00:41.018041


In addiction, if you also want to know when was the last time your server was rebooted, you can perform on AIX command prompt:
$ who -b

The output for this command should be something like:
   .        system boot Jan 27 04:19

Tuesday, 29 October 2024

Dropping all tables from a specific schema

Dropping all tables from a specific schema

Use this query to select and drop all tables of a schema

SCHEMA NAME = TEST
db2 -x "select 'drop table '||rtrim(tabschema)||'.'||rtrim(tabname) from syscat.tables where tabschema = 'TEST'"