db2sampl - Create sample database command
Creates a sample database named SAMPLE.
Note: On
Db2® Workgroup Server
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 is not automatically configured when it is first created. Users can issue the AUTOCONFIGURE command against the SAMPLE database later.
Authorization
One of the following authorizations is required:
- SYSADM
- SYSCTRL
Required Connection
None
Command syntax
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 that is 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.
- -encrypt
- Creates the sample database with default encryption options.
- -encroptsoptions
- Customizes the encryption options that are used to encrypt the sample database. The format of
the options string is Cipher=cipher-name:Mode=mode-name:Key
Length=key-length: Master Key Label=label-name, where:
- Cipher is optional. The valid value is AES.
- Mode is optional. The default is CBC.
- Key Length is optional. Valid values for AES are 128, 192, and 256 (the default is 256).
- Master Key Label uniquely identifies the master key within the keystore that is identified by the value of the keystore_location database manager configuration parameter. The maximum length of label-name is 255 bytes. If a master key label is not specified, the database manager automatically generates a master key label, and a master key is generated and inserted into the keystore.
- -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 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) code set 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.
In partitioned database environments:
- Creates a database named SAMPLE with a Unicode (UTF-8) code set 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.
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.
- Db2 native encryption must be configured prior to creating an encrypted sample database. For more information, see Db2 native encryption.
Examples
- To create a sample database with the default characteristics,
issue:
db2sampl
- On Windows operating
systems, to create a sample database named mysample on the E: drive
containing only SQL database objects in default schema and to view
status messages, issue:
db2sampl -dbpath E -name mysample -sql -force -verbose
- To create the Db2 Version 8
sample database, issue:
db2sampl -v8