CREATE DATABASE

Create a database.

Syntax:

   CREATE DATABASE database_name options

Options:

   DATAFILE filespec AUTOEXTEND OFF
   DATAFILE filespec AUTOEXTEND ON [NEXT int K | M] [MAXSIZE int K | M]
   MAXDATAFILES int
   EXTENT MANAGEMENT LOCAL
   DEFAULT TEMPORARY TABLESPACE tablespace [TEMPFILE filespec] [EXTENT MANAGEMENT LOCAL] [UNIFORM [SIZE int K | M]]
   UNDO TABLESPACE tablespace [DATAFILE filespec]
   LOGFILE [GROUP int] filespec
   MAXLOGFILES int
   MAXLOGMEMBERS int
   MAXLOGHISTORY int
   MAXINSTANCES int
   ARCHIVELOG | NOARCHIVELOG
   CONTROLFILE REUSE
   CHARACTER SET charset
   NATIONAL CHARACTER SET charset
   SET TIMEZONE = 'time_zone_region'
   SET TIMEZONE = '{+|-} hh:mm'
   FORCE LOGGING
   USER SYS IDENTIFIED BY password
   USER SYSTEM IDENTIFIED BY password

If more than one DATAFILE or LOGFILE is to be specified - several 'filespecs' can be included in one clause separated with commas e.g. DATAFILE filespec1, filespec2, filespec3

If you do not specify both system passwords, Oracle will create the default passwords "change_on_install" for SYS and "manager" for SYSTEM.

After creating the database, you can change between ARCHIVELOG mode and NOARCHIVELOG mode with the ALTER DATABASE statement.

Example
-- Create a database with the SID of MyDemo and char set WE8ISO8859P1
connect SYS/change_on_install as SYSDBA
set echo on
spool CreateDB.log
startup nomount pfile="E:\oradata\MyDemo\scripts\init.ora";

CREATE DATABASE MyDemo
MAXDATAFILES 100
DATAFILE 'E:\OraData\MyDemo\SYS1.dbf' SIZE 250 M
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE temp TEMPFILE 'E:\OraData\MyDemo\TEMP.dbf' SIZE 50 M
UNDO TABLESPACE "UndoTbs1" DATAFILE 'E:\OraData\MyDemo\UNDO.dbf' SIZE 200 M CHARACTER SET WE8ISO8859P1 LOGFILE 'E:\OraData\MyDemo\rbs01.dbf' SIZE 2M, 'E:\OraData\MyDemo\rbs02.dbf' SIZE 2M, 'E:\OraData\MyDemo\rbs03.dbf' SIZE 2M, 'E:\OraData\MyDemo\rbs04.dbf' SIZE 2M, 'E:\OraData\MyDemo\rbs05.dbf' SIZE 2M; == LOGFILE GROUP 1 ('E:\oradata\MyDemo\redo01.log') SIZE 102400K, GROUP 2 ('E:\oradata\MyDemo\redo02.log') SIZE 102400K, GROUP 3 ('E:\oradata\MyDemo\redo03.log') SIZE 102400K;

Related Commands:

DATABASE - ALTER DATABASE

Related Views:

 GLOBAL_NAME
 DBA_DATA_FILES
 V$CONTROLFILE
 V$DATABASE
 V$DATAFILE
 V$LOG
 V$LOGFILE


© Copyright SS64.com 1999-2013
Some rights reserved