Specify a name for the dbspace. This is not the actual database file name, which you specify using filename. dbspace-name is an internal name you can refer to, for example in statements and procedures. You cannot use the following names for a
dbspace because they are reserved for predefined dbspaces: system, temporary, temp, translog, and translogmirror.
An error is returned if you specify a value that contains a period (.).
Specify a name for the database file, including, optionally, the path to the file. If no path is specified, the database
file is created in the same location (directory) as the main database file. If you specify a different location, the path
is relative to the database server. The backslash ( \ ) is an escape character in SQL strings, so each backslash must be doubled.
The filename parameter must be either a string literal or a variable.
Cloud note: For tenant databases in a cloud, when you specify the location of a dbspace, you can specify only a file name. You cannot
specify a directory path.
The CREATE DBSPACE statement creates a new database file. When a database is created, it is composed of one file. All tables
and indexes created are placed in that file. CREATE DBSPACE adds a new file to the database. This file can be on a different
disk drive than the main file, which means that the database can be larger than one physical device.
For each database, there is a limit of twelve dbspaces in addition to the main file.
Each object, such as a table or index, is contained entirely within one dbspace. The IN clause of the CREATE statement specifies
the dbspace into which an object is placed. Objects are put into the system database file by default. You can also specify
which dbspace tables are created in by setting the default_dbspace option before you create the tables.
The following CREATE DBSPACE statement creates a dbspace called libbooks. The database file name for the dbspace is library.db, located in the c:\ directory. A subsequent CREATE TABLE statement creates a table called LibraryBooks in the libbooks dbspace.
CREATE DBSPACE libbooks
CREATE TABLE LibraryBooks (
) IN libbooks;