$ db2look -d wcstg1 -e -a -t wcs.staglog -o staglog.ddl -- Generate statistics for all creators -- The db2look utility will consider only the specified tables -- Creating DDL for table(s) -- Output is sent to file: staglog.ddl -- Binding package automatically ... -- Bind is successful [stg1ins1@db2stg601 stg1ins1 C0000001] $ view staglog.ddl [stg1ins1@db2stg601 stg1ins1 C0000001]
$ db2 "reorg table wcs.staglog inplace allow write access" DB20000I The REORG command completed successfully. DB21024I This command is asynchronous and may not be effective immediately. [stg1ins1@db2stg601 stg1ins1 C0000001] The command comes back immediately but check on the status by doing this: $ db2pd -d wcstg1 -reorg | grep STAGLOG 0x00007FD78572C608 3 42 n/a n/a n/a STAGLOG Online 0 3 0x00007FD78572C608 STAGLOG 05/22/2022 08:13:46 n/a n/a n/a n/a 723060 9689919 Started 0 [stg1ins1@db2stg601 stg1ins1 LOGSTREAM0000] OR ...
(1) get the last active log >db2 get db config | grep -i log [...] First active log file = S0003690.LOG [...] $ db2 prune logfile prior to S0003690.LOG the above will be decom and use instead $ db2 prune history 20220521000000 (YYYYMMDDHHMMSS) Note that 202205 <-- implies from the first of May
SELECT TABSCHEMA, TABNAME, SUM(DATA_OBJECT_P_SIZE)+ SUM(INDEX_OBJECT_P_SIZE)+ SUM(LONG_OBJECT_P_SIZE)+ SUM(LOB_OBJECT_P_SIZE)+ SUM(XML_OBJECT_P_SIZE) FROM SYSIBMADM.ADMINTABINFO where tabschema='WCS' and tabname='STAGLOG' group by tabschema,tabname;
To drop multiple columns: alter table wcs.XGCPMSPUNIVERSEPRODUCT drop column retailprice drop column saleprice; Table WCS.XGCPMSPUNIVERSEPRODUCT altered. The above can be done in SQL Developer. But in putty do the following: $ db2 reorg table wcs.XGCPMSPUNIVERSEPRODUCT; DB20000I The REORG command completed successfully.
In SQL Developer or set term off set feed off set sqlformat csv spool out.csv select /*+ parallel */* from table_name; spool off In the output , right-click and export to txt file