db2 Backup
Up to DB2

environment aix5.3
Is there any chance to take a backup for database except two schemas
because i am having 10 schemas , two schemas are 45 gb
i need to take backup except for those two schemas and restore this backup in some other database
Hello Ramesh,
If these schemas are in one tablespace that don't have other schemas you can take a backup to this tablespace and so, you will have a backup to these schemas.
dbname=sample
tablespacename=IBMDB2SAMPLEREL
db2 backup db sample tablespace IBMDB2SAMPLEREL to .
But, if these schemas are in a tablespace with others schemas, you will have to follow the steps below:
db2look -d <dbname> -e -z <schema_name1> -o ddl_schema1.sql
db2look -d <dbname> -e -z <schema_name2> -o ddl_schema2.sql
Execute the script below to get all tables from your schemas:
db2 -x "select 'export to ' || rtrim(tabname) || '.ixf of ixf MODIFIED BY lobsinfile MESSAGES ' || rtrim(tabname) \
|| '.msg select * from ' || rtrim(tabschema)||'.'||rtrim(tabname) ||';'from syscat.tables where type = 'T' \
and tabschema in ('<schema_name>, ...)" > schema_tables.sql
Execute the output above:
db2 -tvf schema_tables.sql'
DONE!!! You have your backup with db2look and export