db2_export.sh script
Use the db2_export.sh
script, which can
be found in the $TOP/src/db/scripts/backup directory,
to export the IBM® Product Master schema.
Running this script generates the SQL scripts required to create tables,
indexes and sequences with their current values, and stores them in
a tar file in the back up directory.
Prerequisites
Before you run thedb2_export.sh
script,
you must:- Shut down the Product Master application connected to the database schema.
- Make sure that the back up directory exists on local disks on the database server and does not contain DB2 data files.
- Make sure that the owner of the back up directory is the DB2 instance owner on the database server.
- Make sure that you log in to the database server as the DB2 instance
owner to copy and run the
db2_export.sh
script. You must not run the script from the application server. - Make sure that the
db2_export.sh
script is saved in the UNIX format if you copy it from a Windows-based computer to the database server. If the file is not in the UNIX format, the system might introduce end-of-line characters that will cause the script to fail.
Syntax
db2_export.sh ----db=databasename --dbuser=exportuser --dbpassword=exportuserpassword --backupdir=bkpdirectory --bkpfile=bkpfilename
Parameters
- db
- Specify the name of the database from where you want to export the schema.
- dbuser
- Specify the name of the Product Master database
schema user to export. It is db_userName in the
common.properties
file. - dbpassword
- Specify the password of the Product Master database
schema user to export. It is db_password in the
common.properties
file. - backupdir
- Specify the name of the directory with the full path where you want to export the database schema. The tar file is created in this directory.
- bkpfile
- Specify the name of the back up tar file.
Example
In this example, the db2_export.sh
script
is run to export the wpcdb database schema to the july10bkp
file
in the /u01/backup directory for the user wpc1.
db2_export.sh --db=wpcdb --dbuser=wpc1 --dbpassword=passwd --backupdir=/u01/backup --bkpfile=july10bkp