Skip to content

Creating an Altibase Database#

Overview#

This document describes how to create and drop an Altibase database.

This document is based on Altibase 7.1 or later.

Info

For errors and improvements related to this document, please contact the technical support portal or technical support center.

Info

This document is provided for informational purposes only and is subject to change without prior notice. It may contain errors, and Altibase makes no express or implied warranties of any kind, including but not limited to warranties of merchantability or fitness for a particular purpose.

The development, release, and timing of any features or functionality described for Altibase products in this document are at the sole discretion of Altibase.

Altibase may hold patents, trademarks, copyrights, or other intellectual property rights related to the contents of this document.

How to create a database#

Before starting Altibase for the first time, you must first create a database by following the steps below.

Check DB_NAME#

Check the DB_NAME value in altibase.properties.

$ cat $ALTIBASE_HOME/conf/altibase.properties | grep DB_NAME
DB_NAME       =  mydb

If DB_NAME is not the default value mydb, change mydb in the create database statement in $ALTIBASE_HOME/bin/server to the DB_NAME value.

$ vi $ALTIBASE_HOME/bin/server
...
startup process;
create database mydb INITSIZE=10M noarchivelog character set $2 national character set $3;
quit
EOF
...

Create the database#

Create the database by passing the database character set and the national character set to the server script, in that order.

$ server create <database character set> <national character set>

The following example uses UTF8 as the database character set and UTF16 as the national character set.

$ server create UTF8 UTF16
-----------------------------------------------------------------
     Altibase Client Query utility.
     Release Version 7.1.0.0.0
     Copyright 2000, ALTIBASE Corporation or its subsidiaries.
     All Rights Reserved.
-----------------------------------------------------------------
ISQL_CONNECTION = UNIX, SERVER = localhost, PORT_NO = 20300
[ERR-910FB : Connected to idle instance]
Connecting to the DB server.... Connected.

TRANSITION TO PHASE : PROCESS
Command executed successfully.
DB Info (Page Size     = 32768)
        (Page Count    = 257)
        (Total DB Size = 8421376)
        (DB File Size  = 1073741824)
...

Alternatively, you can create the database directly in iSQL instead of using the server script.

$ isql -u sys -p manager -sysdba
...
iSQL(sysdba)> STARTUP PROCESS;
...
iSQL(sysdba)> CREATE DATABASE mydb INITSIZE=10M NOARCHIVELOG CHARACTER SET UTF8 NATIONAL CHARACTER SET UTF16;
...
iSQL(sysdba)> exit

Each character set is described below.

Item Description
Database character set Character set of the data stored in the database
(US7ASCII, KO16KSC5601, MS949, BIG5, GB231280, MS936, UTF8, SHIFTJIS, MS932, EUCJP)
National character set Unicode-based character set of the data stored in NCHAR and NVARCHAR columns
(UTF8, UTF16)

Considerations when creating a database#

Keep the following in mind when creating a database.

Archive log mode#

Archive log mode can be set only in the control phase. To switch from noarchive log mode to archive log mode, shut down Altibase, start it up to the control phase, and then change the mode.

$ server stop

$ isql -u sys -p manager -sysdba
...
iSQL(sysdba)> STARTUP CONTROL;
...
iSQL(sysdba)> ALTER DATABASE ARCHIVELOG;
Alter success.
iSQL(sysdba)> STARTUP SERVICE;
...
Command executed successfully.
iSQL(sysdba)> exit

In archive log mode, Altibase only copies log files to the archive log directory and never deletes them. You must therefore manage the archive log files yourself, and reserve enough space in the archive log directory based on the backup cycle and the number of log files generated during that cycle.

DB_NAME#

DB_NAME is fixed when the database is created and cannot be changed afterward. Changing it requires re-creating the database and migrating the data, so choose it carefully when you first create the database.

How to drop a database#

Dropping a database deletes all of its data files, log files, and log anchor files.

Check the files to be deleted#

Before dropping the database, check the locations of the data files and log files so that you can verify they were deleted.

iSQL> SELECT A.NAME, B.CHECKPOINT_PATH FROM V$TABLESPACES A, V$MEM_TABLESPACE_CHECKPOINT_PATHS B WHERE A.ID = B.SPACE_ID;

iSQL> SELECT A.NAME, B.NAME FROM V$TABLESPACES A, V$DATAFILES B WHERE A.ID = B.SPACEID;

$ cat $ALTIBASE_HOME/conf/altibase.properties | grep ^LOG | grep DIR

Drop the database#

Shut down Altibase, start it up to the process phase, and then drop the database.

$ server stop

$ isql -u sys -p manager -sysdba
...
iSQL(sysdba)> STARTUP PROCESS;
Connecting to the DB server.... Connected.

TRANSITION TO PHASE : PROCESS
Command executed successfully.

iSQL(sysdba)> DROP DATABASE mydb;
Checking Log Anchor files
[Ok] /home/altibase/altibase_home/logs/loganchor0 Exist.
[Ok] /home/altibase/altibase_home/logs/loganchor1 Exist.
[Ok] /home/altibase/altibase_home/logs/loganchor2 Exist.
Removing DB files
Removing Log files
Removing Log Anchor files
Drop success.

iSQL(sysdba)> exit