I'm trying to dump the contents of a particular schema in one IBM DB2 UDB server into an sql text file (much like the mysqldump functionality of mysql).
I came across db2look, but it only dumps the structure of the schema (only ddl, no dml).
So how can I get my thing done?
jrh.
A Mysql dump is called a backup in DB2. It creates a binary file that you can restore in the same kind of platform (Window, Linux). It contains the tables definition (DDL), the data and the security. and 3. There is another command that just extract the DDL of the defined objects.
To generate a dump select the database or table in the Object Browser and select Database -> Backup/Export -> Backup Database As SQL Dump… This option is also available in Table -> Backup/Export -> Backup Database As SQL Dump... or just press Ctrl+Alt+E.
A database dump contains a record of the table structure and/or the data from a database and is usually in the form of a list of SQL statements ("SQL dump"). A database dump is most often used for backing up a database so that its contents can be restored in the event of data loss.
Db2 Schema with all DDL Backup :
I have use below command it worked for me to export all DDL.
db2look -d CusDb -x -e -z CusSchema -o OutputFile
Syntax : db2look -d DbName -x -e -z SchemaName -o OutputFile_name
What you're looking for is the db2move command. For a particular schema you should use the "sn" switch.
So for example to export the data:
db2move [your_db_name] EXPORT -sn [your_schema_name]
There are many options and switches available for db2move depending on exactly what you want to do.
If db2move is not exactly what you need, you can review the table of Data Movement Options available in DB2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With