Skip to content

Instantly share code, notes, and snippets.

@coderkan
Last active April 3, 2018 08:43
Show Gist options
  • Save coderkan/b7019e7fa34f94af8423825b9cd1d35f to your computer and use it in GitHub Desktop.
Save coderkan/b7019e7fa34f94af8423825b9cd1d35f to your computer and use it in GitHub Desktop.
DB2 Common Commands
--Connect a database
db2 connect to SRCDB user username using password
--Copy a schema(_area_) from db1 to db2
db2move db1 COPY -sn _area_ -co TARGET_DB db2 USER username USING password
--Copy a schmea(SCHM1) to another db --> DSTDB and different name SCHM2
db2move SRCDB COPY -sn SCHM1 -co target_db DSTDB schema_map "((SCHM1,SCHM2))" -u userid -p password
db2move <dbname> COPY -co <COPY- options> -u <userid> -p <password>
--List all schemas in database
select schemaname from syscat.schemata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment