Posts

Showing posts from March, 2022

Oracle: To generate DDL for schema

  set pagesize 0 set long 90000 set feedback off set echo off  spool scott_schema.sql  connect scott/tiger; SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name)      FROM USER_TABLES u; SELECT DBMS_METADATA.GET_DDL('INDEX',u.index_name)      FROM USER_INDEXES u; spool off;

DB2: To get create time and alter time for DB2 tables:

 to get create time and alter time for DB2 tables: db2 "select tabname, create_time from syscat.tables where tabschema = <schema> and tabname = <table> with ur" db2 "select tabname, alter_time from syscat.tables where tabschema = <schema> and tabname = <table> with ur" select * from syscat.tables where tabname = 'XTMW_CHANNELADVISOR' with ur; select tabname, create_time from syscat.tables where tabschema = 'WCS' and  tabname = 'APPEASEMENT' with ur

DB2: To get list of tables for a schema

SELECT TABNAME  FROM SYSCAT.TABLES  WHERE TABSCHEMA = 'WCS';    db2 list tables for schema wcs show detail; Column headings  Table/View    Type       Creation time           Schema  Table/View                                                                                                                       Schema                                                                                    ...