DB2 – How to Duplicate SAMPLE Database

db2

Right now im accessing a SAMPLE db which is in remote server. I found that its default instance db2inst1 with database name "SAMPLE". Since everybody using the same database for all their purposes, i want to create a new DB for my application. i tried connecting to the server through telnet. Since there are lot of data in SAMPLE db, cloning or duplicating same would help me save time. Please can someone post some set of commands or steps to duplicate SAMPLE db through telnet and sqldeveloper. If not commands or steps for creating a new db also is fine.

FYI: DB2 version – v10.5.0.3

Best Answer

The SAMPLE database is usually created with the db2sampl command (documented here for DB2 LUW 10.5). You can tell db2sampl to create another SAMPLE database under a different name with the -name option (note: this command must typically be run by someone with SYSADM privilege in the instance, e.g. by the db2inst1 user). For example, on a Linux box:

someuser@myserver:~$ sudo su - db2inst1
[sudo] password for someuser:
db2inst1@myserver:~$ db2sampl -name SAMPLE2