CREATE DATABASE

Function

CREATE DATABASE creates a database. By default, the new database will be created by cloning the standard system database template1. A different template can be specified using TEMPLATE template name.

Precautions

Syntax

1
2
3
4
5
6
7
8
9
CREATE DATABASE database_name
    [ [ WITH ] { [ OWNER [=] user_name ] |
               [ TEMPLATE [=] template ] |
               [ ENCODING [=] encoding ] |
               [ LC_COLLATE [=] lc_collate ] |
               [ LC_CTYPE [=] lc_ctype ] |
               [ DBCOMPATIBILITY [=] compatibilty_type ] |
               
               [ CONNECTION LIMIT [=] connlimit ]}[...] ];

Parameter Description

The following are limitations on character encoding:

Examples

Create database music using GBK (the local encoding type is also GBK).

1
CREATE DATABASE music ENCODING 'GBK' template = template0;

Create database music2 and specify jim as its owner.

1
CREATE DATABASE music2 OWNER jim;

Create database music3 using template template0 and specify jim as its owner.

1
CREATE DATABASE music3 OWNER jim TEMPLATE template0;

Create a compatible Oracle database ora_compatible_db.

1
CREATE DATABASE ora_compatible_db DBCOMPATIBILITY 'ORA';

Helpful Links

ALTER DATABASE, DROP DATABASE