CREATE DATABASE
CREATE DATABASE#
Syntax#
create_database ::=#
Prerequisites#
Because this statement can only be executed during the PROCESS phase, the only user who can execute this SQL statement is the SYS user, and only when running in -sysdba mode.
Description#
This statement is used to create a database. When a database is created, various system tablespaces, including the dictionary tablespace, the undo tablespace, and temporary tablespaces are created. The names of these system tablespaces are defined by the system.
Please note that user-defined tablespaces cannot be created during database creation; rather, they are subsequently added by users.
The database character set and national character set must be specified when the database is created.
database_name#
This is used to specify the name of the database to be created. The database name specified here must be the same as that specified using the DB_NAME property in the properties file. If they are not the same, an error will be raised.
INITSIZE clause#
The initial size of a memory database is specified here, using an expression such as "128M" (i.e. 128 megabytes) or "4G" (i.e. 4 gigabytes). If only a number is specified here, the size unit is assumed to be megabytes by default.
The system tablespaces related to a disk database are automatically created when the CREATE DATABASE statement is executed.
The default values for system tablespaces are determined by reading the following properties from the altibase.properties file.
- SYS_DATA_TBS_EXTENT_SIZE, SYS_TEMP_TBS_EXTENT_SIZE, SYS_UNDO_TBS_EXTENT_SIZE
- SYS_DATA_FILE_INIT_SIZE, SYS_TEMP_FILE_INIT_SIZE, SYS_UNDO_FILE_INIT_SIZE
- SYS_DATA_FILE_MAX_SIZE, SYS_TEMP_FILE_MAX_SIZE, SYS_UNDO_FILE_MAX_SIZE
- SYS_DATA_FILE_NEXT_SIZE, SYS_TEMP_FILE_NEXT_SIZE, SYS_UNDO_FILE_NEXT_SIZE
ARCHIVELOG | NOARCHIVELOG#
This is used to specify whether the database will initially run in archivelog mode or noarchivelog mode. Archivelog mode is used to prepare for media recovery, whereas noarchivelog mode does not support media recovery.
For more information about Altibase backup and recovery, please refer to the Administrator's Manual.
charset#
This is used to specify the database character set and national character set.
- Available Database Character Sets
US7ASCII
KO16KSC5601
MS949
BIG5
GB231280
MS936
UTF8
SHIFTJIS
MS932
EUCJP - Available National Character Sets
UTF8
UTF16
Example#
<Query> Create a database named mydb that is initially 10 MB in size, and for which the database character set is KSC5601 and the national character set is UTF16.
$ isql -s localhost -u sys -p manager -sysdba
..
iSQL> STARTUP PROCESS;
Trying Connect to Altibase.. Connected with Altibase.
TRANSITION TO PHASE: PROCESS
Command execute success.
iSQL> CREATE DATABASE mydb INITSIZE=10M
NOARCHIVELOG
CHARACTER SET KSC5601
NATIONAL CHARACTER SET UTF16;
.
.
Create success.