IBM DB2 Query Toolbox - Find the time when table was last accessed



Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

IBM Db2 Query Toolbox - Find the time when table was last accessed in Db2 database

A consulta abaixo retorna uma lista de tabelas e sua última data de uso.
Query below returns list of tables and their last using date.

Consulta - Query

SELECT TABSCHEMA || '.' || TABNAME AS TABLE
,      LASTUSED AS LAST_USED
,      CREATE_TIME
,      ALTER_TIME
  FROM SYSCAT.TABLES
 WHERE TABSCHEMA NOT LIKE 'SYS%'
   AND TYPE = 'T'
 ORDER BY LASTUSED DESC;

Colunas

  • tabela - nome do esquema da tabela
  • last_used - data do último uso da tabela na consulta DDL
  • create_time - hora em que a tabela foi criada.
  • alter_time - hora em que a tabela foi alterada pela última vez.

Linhas

  • Uma linha representa uma tabela no banco de dados
  • Escopo das linhas: todas as tabelas no banco de dados
  • Ordenado pela última data usada

Columns

  • table - name of the table schema
  • last_used - date of last table use in DDL query
  • create_time - time at which the table was created.
  • alter_time - time at which the table was last altered.

Rows

  • One row represents one table in database
  • Scope of rows: all tables in database
  • Ordered by last used date

Resultado - Sample results


Copyright © Dataedo.