Creates a sample database named SAMPLE.
Note: On DB2® Workgroup Server Edition and DB2 Express® Edition,
the SAMPLE database includes materialized query tables (MQT), and
multidimensional cluster tables (MDC) that causes a license violation.
This violation can only be removed by upgrading to DB2 Enterprise Server Edition.
This
database will not be automatically configured when it is first created.
Users can issue the AUTOCONFIGURE command against
the SAMPLE database at a later time.
Command syntax

>>-db2sampl--+-------------------+--+---------------------+----->
'-dbpath--path-name-' '-name--database-name-'
.-verbose-. .-sql-. .-xml-.
>--+-------+--+---------+--+-----+--+-----+--+----+--+------+--><
'-force-' '-quiet---' '-v8-' +-?----+
+-?----+
'-help-'
Command parameters
- -dbpath path-name
- Specifies the path on which to create the database. On Windows operating systems, specifies the
letter of the drive on which to create the database. The maximum length
for path-name is 175 characters. By default, path-name is
the default path specified in the database manager configuration file
(dftdbpath parameter).
- -name database-name
- Specifies a name for the sample database. The database name must
adhere to the naming conventions for databases. By default, database-name is SAMPLE.
- -force
- Forces the drop and recreation of any existing database in the
instance with the same name as specified for the sample database.
- -verbose
- Prints status messages to standard output.
- -quiet
- Suppresses the printing of status messages to standard output.
- -sql
- Creates tables, triggers, functions, procedures, and populates
the tables with data.
- -xml
- Creates tables with columns of data type XML, creates indexes
on the XML columns, registers XML schemas, and populates these tables
with data including XML document values.
This option is only supported where XML is supported. If XML
is not supported, this option is ignored.
- -v8
- Creates the DB2 Universal Database™ Version 8 sample database, database objects
and data. The Version 8 sample database is a non-unicode database
named SAMPLE that is created in the default path
specified in the database manager configuration file (dftdbpath parameter).
- -? | ? | help
- Returns the db2sampl command syntax help.
Default behavior of db2sampl
When
the db2sampl command is issued without any optional
arguments, depending on whether the environment is partitioned or
not, it behaves differently:
In non-partitioned database environments:
- Creates a database named SAMPLE with
a Unicode (UTF-8) codeset in the default database path.
- Creates relational database objects including tables, indexes,
constraints, triggers, functions, procedures, multi-dimensional clustered
tables and materialized query tables.
- Populates relational tables with data.
- Creates tables with XML data type columns.
- Creates indexes over XML data.
- Creates an XML schema repository that contains XML schema documents.
- All database object names are qualified with the value of the CURRENT_SCHEMA special
register.
In partitioned database environments:
- Creates a database named SAMPLE with
a Unicode (UTF-8) codeset in the default database path.
- Creates relational database objects including tables, indexes,
constraints, triggers, functions, procedures, multi-dimensional clustered
tables and materialized query tables.
- Populates tables with data.
- All database object names are qualified with the value of the CURRENT_SCHEMA special
register.
Usage notes
- The db2sampl command can only be issued on
a computer where a DB2 database
server is installed. It cannot be issued from a remote IBM® Data Server Client.
- The sample database is created with the instance authentication
type that is specified by the database manager configuration parameter, authentication.