| Oracle8i SQL Reference Release 3 (8.1.7) Part Number A85397-01 |
|
SQL Statements:
CREATE CLUSTER to CREATE SEQUENCE, 5 of 25
Use the CREATE DATABASE statement to create a database, making it available for general use.
This statement erases all data in any specified datafiles that already exist in order to prepare them for initial database use. If you use the statement on an existing database, all data in the datafiles is lost.
After creating the database, this statement mounts it in either exclusive or parallel mode (depending on the value of the PARALLEL_SERVER initialization parameter) and opens it, making it available for normal use. You can then create tablespaces and rollback segments for the database.
|
See Also:
|
You must have the OSDBA role enabled.
If the REMOTE_LOGIN_PASSWORDFILE initialization parameter is set to exclusive, Oracle returns an error when you attempt to re-create the database. To avoid this message, either set the parameter to shared, or re-create your password file before re-creating the database.
maxsize_clause::=
database
Specify the name of the database to be created and can be up to 8 bytes long. The database name can contain only ASCII characters. Oracle writes this name into the control file. If you subsequently issue an ALTER DATABASE statement that explicitly specifies a database name, Oracle verifies that name with the name in the control file.
If you omit the database name from a CREATE DATABASE statement, Oracle uses the name specified by the initialization parameter DB_NAME. If the DB_NAME initialization parameter has been set, and you specify a different name from the value of that parameter, Oracle returns an error.
|
See Also: "Schema Object Naming Guidelines" for additional rules to which database names should adhere |
CONTROLFILE REUSE
Specify CONTROLFILE REUSE to reuse existing control files identified by the initialization parameter CONTROL_FILES, thus ignoring and overwriting any information they currently contain. Normally you use this clause only when you are re-creating a database, rather than creating one for the first time. You cannot use this clause if you also specify a parameter value that requires that the control file be larger than the existing files. These parameters are MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES, and MAXINSTANCES.
If you omit this clause and any of the files specified by CONTROL_FILES already exist, Oracle returns an error.
LOGFILE filespec
Specify one or more files to be used as redo log files. Each filespec specifies a redo log file group containing one or more redo log file members (copies). All redo log files specified in a CREATE DATABASE statement are added to redo log thread number 1.
If you omit the LOGFILE clause, Oracle creates two redo log file groups by default. The names and sizes of the default files depend on your operating system.
MAXLOGFILES integer
Specify the maximum number of redo log file groups that can ever be created for the database. Oracle uses this value to determine how much space in the control file to allocate for the names of redo log files. The default, minimum, and maximum values depend on your operating system.
MAXLOGMEMBERS integer
Specify the maximum number of members, or copies, for a redo log file group. Oracle uses this value to determine how much space in the control file to allocate for the names of redo log files. The minimum value is 1. The maximum and default values depend on your operating system.
MAXLOGHISTORY integer
Specify the maximum number of archived redo log files for automatic media recovery with Oracle Parallel Server. Oracle uses this value to determine how much space in the control file to allocate for the names of archived redo log files. The minimum value is 0. The default value is a multiple of the MAXINSTANCES value and depends on your operating system. The maximum value is limited only by the maximum size of the control file.
MAXDATAFILES integer
Specify the initial sizing of the datafiles section of the control file at CREATE DATABASE or CREATE CONTROLFILE time. An attempt to add a file whose number is greater than MAXDATAFILES, but less than or equal to DB_FILES, causes the Oracle control file to expand automatically so that the datafiles section can accommodate more files.
The number of datafiles accessible to your instance is also limited by the initialization parameter DB_FILES.
MAXINSTANCES integer
Specify the maximum number of instances that can simultaneously have this database mounted and open. This value takes precedence over the value of initialization parameter INSTANCES. The minimum value is 1. The maximum and default values depend on your operating system.
ARCHIVELOG | NOARCHIVELOG
CHARACTER SET character_set
Specify the character set the database uses to store data. The supported character sets and default value of this parameter depend on your operating system.
Restriction: You cannot specify any fixed-width multibyte character sets as the database character set.
NATIONAL CHARACTER SET character_set
Specify the national character set used to store data in columns specifically defined as NCHAR, NCLOB, or NVARCHAR2. If not specified, the national character set defaults to the database character set.
DATAFILE filespec
Specify one or more files to be used as datafiles. All these files become part of the SYSTEM tablespace. If you omit this clause, Oracle creates one datafile by default. The name and size of this default file depend on your operating system.
autoextend_clause
The autoextend_clause lets you enable or disable the automatic extension of a datafile. If you do not specify this clause, datafiles are not automatically extended.
CREATE DATABASE Example
The following statement creates a small database using defaults for all arguments:
CREATE DATABASE;
The following statement creates a database and fully specifies each argument:
CREATE DATABASE newtestCONTROLFILE REUSE LOGFILE GROUP 1 ('diskb:log1.log', 'diskc:log1.log') SIZE 50K, GROUP 2 ('diskb:log2.log', 'diskc:log2.log') SIZE 50K MAXLOGFILES 5 MAXLOGHISTORY 100 DATAFILE 'diska:dbone.dat' SIZE 2M MAXDATAFILES 10 MAXINSTANCES 2 ARCHIVELOG CHARACTER SET US7ASCII NATIONAL CHARACTER SET JA16SJISFIXED DATAFILE 'disk1:df1.dbf' AUTOEXTEND ON 'disk2:df2.dbf' AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED;
|
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|