Technote (FAQ)
Question
When restoring a database from one system to another the restore may fail with an SQL0298N "Bad container path" error. This document describes one cause of this problem and how to resolve it.
Cause
This error can occur when a table space is defined with a fully-qualified container path pointing into the database directory. For example:
CREATE TABLESPACE tbsp MANAGED BY SYSTEM USING ('/home/db2inst1/db2inst1/NODE0000/SQL00003/tbsp');
While this may be a valid container path for this database, the presence of the "SQL00003/..." folder in the path will cause problems if the database is restored onto another system with a different set of defined databases.
When the database is restored on another system it will be given the next database number for that system, which may not be the same as on the original system. The restore operation tries to recreate this table space using the fully-qualified container path that was given when the table space was created. But since the path belongs to a different database number the path cannot by used by this database, so the restore operation fails with SQL0298N.
Diagnosis details
The db2diag.log reports the following entries:
2005-12-29-10.42.12.195000-300 I16206637H356 LEVEL: Error
PID : 1688 TID : 3044 PROC : db2agent (SAMPLE)
INSTANCE: db2inst1 NODE : 000
FUNCTION: DB2 UDB, buffer pool services, sqlbCheckContPathsForOtherDbDir, probe:10
RETCODE : ZRC=0x8002003C=-2147352516=SQLB_BAD_CONTAINER_PATH
"Bad container path"
2005-12-29-10.42.12.289000-300 I16206995H502 LEVEL: Error
PID : 1688 TID : 3044 PROC : db2agent (SAMPLE)
INSTANCE: db2inst1 NODE : 000
FUNCTION: DB2 UDB, buffer pool services, sqlbCheckContPathsForOtherDbDir, probe:10
DATA #1 : String, 209 bytes
Container path appears to be under another database's directory.
Container Path = /home/db2inst1/db2inst1/NODE0000/SQL00003/tbsp
Current Database Directory = SQL00002
Other Database Directory = SQL00003
"Current Database Directory" tells you the database number that has been assigned to the database being restored on this system.
"Other Database Directory" tells you the database number that the container path is associated with.
Answer
The SQL0298N error can be resolved by performing a redirected restore. When using the SET TABLESPACE CONTAINERS command to define storage for the problem table spaces, do not fully-qualify a path into the database directory. If you wish the table space to be stored in the database directory and it is an SMS table space, specify only a relative pathname. The table space will then be created under the appropriate database directory.
For example, instead of specifying the path as:
/home/db2inst1/db2inst1/NODE0000/SQL00002/tbsp
specify only:
tbsp
If you do fully-qualify the path, specify a path that is outside of the database directory.
Related information
Database directories and files
Redirected restore
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.