Skip to main content

Posts

Showing posts with the label db2 export

db2 one liners

Some very helpful one liners for db2. If you are a fan like me to execute db2 commands within the Unix/AIX prompt, rather than going into DB2 inbuilt prompt then all commands run on the fly. Much powerful is Unix prompt as you can modify data in whichever way you want. db2 list database directory;    #Lists all databases within the installation db2 list node directory; db2 "SELECT SCHEMANAME FROM SYSCAT.SCHEMATA";  #Shows all schema within the Database Instance db2 set schema myschema01   # Setting schema before execution db2 "LIST TABLES FOR SCHEMA myschema01" | more db2 describe indexes for table <table_name> show detail | tr -s " "   # shows details about the table including primary key and indexes db2 get snapshot for application agentid 228 | more # db2 "force applicatioin (228) "   #Careful as it forces the session 228 out of DB2 db2pd -d myDB01 -wlocks db2 export to C:\CSVFiles\OutputmyTable.csv of del select * fr