Creating a Database Manually
MAXLOGFILES 5 MAXLOGMEMBERS
MAXDATAFILES 100 MAXLOGHISTORY 100 LOGFILE
GROUP 1 ('/DISK3/log1a.rdo',/DISK4/log1b.rdo’) SIZE 1 M, GROUP 2 ('/DISK3/log2a.rdo',/DISK4/log2b.rdo’) SIZE 1 M DATAFILE
'/DISK1/system01.dbf' size 50M autoextend on CHARACTER SET WE8ISO8859P1;
...Creating a Database Manually The CREATE DATABASE Command (continued)
[DATAFILE filespec [autoextend_clause] [, filespec [autoextend_clause]...]]
filespec :== ’filename’ [SIZE integer][K|M] [REUSE]
autoextend_clause :== [AUTOEXTEND {OFF
|ON [NEXT integer[K|M]]
[MAXSIZE {UNLIMITED|integer[K|M]}] }
]
where:
database is the name of the database to be created (If the name of the database is omitted, the
initialization parameter DB_NAME is used.)
CONTROLFILE REUSE specifies that an existing control file identified in the parameter file should be reused
LOGFILE GROUP specifies the names of the log files to be used and the group to which they belong
MAXLOGFILES specifies the maximum number of redo log file groups that can ever be created for the database
MAXLOGMEMBERS specifies the maximum number of log file members for a log file group MAXLOGHISTORY specifies the maximum number of
archived redo logs for automatic media recovery of the Oracle Parallel Server
DATAFILE filespec specifies the data files to be used AUTOEXTEND enables or disables the automatic
extension of a data file (see
“Maintaining Tablespaces and Data Files”)
The CREATE DATABASE Command (continued)
MAXDATAFILES specifies the initial sizing of the data file section of the control file at CREATE DATABASE or CREATE
CONTROLFILE time. An attempt to add a new file whose number is greater than MAXDATAFILES, but less than or equal to DB_FILES, causes the control file to expand automatically so that the data files section can accommodate more files
MAXINSTANCES is the maximum number of instances that can simultaneously mount and open the database
ARCHIVELOG establishes that redo logs must be archived before they can be reused NOARCHIVELOG establishes that redo logs can be reused
without archiving their contents
CHARACTER SET is the character set the database uses to store data
NATIONAL CHARACTER SET
specifies the national character set used to store data in columns defined as NCHAR, NCLOB, or NVARCHAR2
If not specified, the national character set is the same as the database character set (see the lesson “Using National Language Support”).
If REUSE is specified in a file specification, then the file must exist; otherwise the SIZE option must be specified and the file must not exist.
Example
...Creating a Database Manually The CREATE DATABASE Command (continued)
Note:
• The Oracle server allocates as much space in the control files as the values of MAXLOGMEMBERS, MAXLOGFILES, MAXDATAFILES,
MAXLOGHISTORY, and MAXINSTANCES require.
To change the value of these parameters, use the CREATE CONTROLFILE command to re-create the control file. (See the course Enterprise DBA Part 1B:
Backup and Recovery.)
• There is no DROP DATABASE command. To delete a database, you must delete the data files from the operating system. Use the following query to list the physical data files you will have to remove manually from the operating system:
SQL> SELECT name FROM v$datafile 2 UNION
3 SELECT name FROM v$controlfile 4 UNION
5 SELECT member FROM v$logfile; NAME --- C:\ORA815\ORADATA\V815\CONTROL01.CTL C:\ORA815\ORADATA\V815\CONTROL02.CTL C:\ORA815\ORADATA\V815\INDX01.DBF C:\ORA815\ORADATA\V815\OEMREP01.DBF C:\ORA815\ORADATA\V815\RBS01.DBF C:\ORA815\ORADATA\V815\REDO01.LOG C:\ORA815\ORADATA\V815\REDO01A.LOG C:\ORA815\ORADATA\V815\REDO01B.LOG C:\ORA815\ORADATA\V815\REDO02.LOG C:\ORA815\ORADATA\V815\REDO03.LOG C:\ORA815\ORADATA\V815\SYSTEM01.DBF C:\ORA815\ORADATA\V815\TEMP01.DBF C:\ORA815\ORADATA\V815\USERS01.DBF 13 rows selected.
With the Database Configuration Assistant, it is possible to remove the services as well as the data files.
The CREATE DATABASE Command (continued)
• To make the new database the default database on Windows NT, change the ORACLE_SID in the registry.
• It is not possible to change the character set or the national character set after creating the database.
• On Windows NT you can use the build_db.sql script located in the %ORACLE_HOME%\RDBMS\ADMIN directory to create a database.
...Creating a Database Manually
Troubleshooting
If one of the three problems shown on the slide occurs, the CREATE DATABASE statement fails.
In every case, you should shut down the database, delete any files created by the CREATE DATABASE statement, correct the errors, and attempt to create again.
Copyright Oracle Corporation, 1999. All rights reserved.
®
Troubleshooting
Creation of the database fails if:
• There are syntax errors in the SQL script • Files that should be created already exist
• Operating system errors such as file or directory permission or insufficient space errors occur
After Creating the Database
After the database is created, the database is opened, the SQL script sql.bsq is
successfully executed, and the database objects named in this slide are created. You can view the dynamic performance views such as V$LOGFILE,
V$CONTROLFILE, and V$DATAFILE, but no data dictionary views are created. The following lessons explain how to create the data dictionary views to create additional tablespaces, alter and add redo log files, add control files, and so on.
Copyright Oracle Corporation, 1999. All rights reserved.
®
After the Database Is Created
The database contains:
• Data files that make up the SYSTEM tablespace • Control files and redo log files
• The user SYS with the password