Adsense

Saturday, June 28, 2014

How to copy table in db2 | db2look command with example

In DB2, you can create a duplicate table or copy an existing table to a new table  with data or without data in many ways. One way is to use db2look command. Using db2look command, you can create a table structure from an existing table with check constraints,  default values and foreign keys, etc.. Let us start with the below example. db2look -d sales -t ITEMMASTER -e > item.ddl  The above statement  generates   DDL Statements for the table ITEMMASTER in the file item.ddl DDL statments includes create...

Saturday, June 14, 2014

How to get database size in db2

Many ways are there to find db size in db2. The easiest way to find the data base size is to run the following commands I) db2 connect to dbname    db2 call get_dbsize_info(?,?,?,-1),  where get_dbsize_info is the built-in stored procedure.  In the above procedure, first 3 parameters are output parameters and the 4th parameter is the only input parameter.The value of output parameters of my data base (SAMPLE)  are returned as given below. Parameter Name : SNAPSHOTTIMESTAMP Parameter Value : 2014-06-15-00.32.43.272000 Parameter...