创建数据库 - with CREATE DATABASE STATEMENT
1. Set SID
in bash
ORACLE_SID=ocm
export ORACLE_SID
2. 
Set Env Vars
ORACLE_SID and ORACLE_HOME
3. Choose a Database 
Administrator Authentication Method
password file
OS auth
4. Create 
Init Parameter File
$ORACLE_HOME/dbs/initocm.ora
6. Connect to the 
Instance
Passowrd file auth
$ sqlplus /nolog
SQL> CONNECT SYS AS 
SYSDBA
OS auth
$ sqlplus /nolog
SQL> CONNECT / AS 
SYSDBA
7. Create SPFile
CREATE SPFILE FROM PFILE;
8. start 
instance in nomount
SQL>START NOMOUNT
9. Issue CREATE DATABASE 
STATEMENT
(1)Please create the ocm directory in $ORACLE_BASE/oradata/ 
folder before run below commands
(2)make sure the db_name and undo_tablespace 
value in the pfile match what in the create database statement 
CREATE 
DATABASE ocm
USER SYS IDENTIFIED BY pehz123Q
USER SYSTEM IDENTIFIED BY 
pehz123Q
LOGFILE GROUP 1 
(‘/opt/oracle/oradata/ocm/redo01a.log‘,‘/opt/oracle/oradata/ocm/redo01b.log‘) 
SIZE 100M BLOCKSIZE 512,
GROUP 2 
(‘/opt/oracle/oradata/ocm/redo02a.log‘,‘/opt/oracle/oradata/ocm/redo02b.log‘) 
SIZE 100M BLOCKSIZE 512,
GROUP 3 
(‘/opt/oracle/oradata/ocm/redo03a.log‘,‘/opt/oracle/oradata/ocm/redo03b.log‘) 
SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 
1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET 
AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE 
‘/opt/oracle/oradata/ocm/system01.dbf‘ SIZE 325M REUSE
SYSAUX DATAFILE 
‘/opt/oracle/oradata/ocm/sysaux01.dbf‘ SIZE 325M REUSE
DEFAULT TABLESPACE 
users
DATAFILE ‘/opt/oracle/oradata/ocm/users01.dbf‘
SIZE 500M REUSE 
AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE 
tempts1
TEMPFILE ‘/opt/oracle/oradata/ocm/temp01.dbf‘
SIZE 20M 
REUSE
UNDO TABLESPACE ocm_UNDOTBS1
DATAFILE 
‘/opt/oracle/oradata/ocm/undotbs01.dbf‘
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE 
UNLIMITED;
(2) SAMPLE 2, Use OMF
SET 
DB_CREATE_FILE_DEST=‘/u01/app/oracle/oradata‘ in 
SPFILE
DB_CREATE_FILE_DEST
DB_CREATE_ONLINE_LOG_DEST_n
DB_RECOVERY_FILE_DEST
CREATE 
DATABASE mynewdb
USER SYS IDENTIFIED BY sys_password
USER SYSTEM 
IDENTIFIED BY system_password
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY 
TABLESPACE temp
UNDO TABLESPACE undotbs1
DEFAULT TABLESPACE 
users;
10. Create additional TABLESPACEs
CREATE TABLESPACE 
apps_tbs LOGGING
DATAFILE ‘/opt/oracle/oradata/ocm/apps01.dbf‘
SIZE 500M 
REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT 
LOCAL;
-- create a tablespace for indexes, separate from user tablespace 
(optional)
CREATE TABLESPACE indx_tbs LOGGING
DATAFILE 
‘/opt/oracle/oradata/ocm/indx01.dbf‘
SIZE 100M REUSE AUTOEXTEND ON NEXT 1280K 
MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
11.Run Scripts to Build 
Data Dictionary Views
Login as 
SYSDBA
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
Login 
as SYSTEM
@?/sqlplus/admin/pupbld.sql
12. Install other options in 
Oracle Database Reference online book
13. Back Up the Database.
14. Enable 
Automatic Instance 
Startup
#################################################
What 
CREATE DATABASE DO? 
The actual operations performed depend on the clauses 
that you specify in the CREATE DATABASE statement and the initialization 
parameters that you have set.
Basicly it do the following things
Creates 
the data files for the database
Creates the control files for the 
database
Creates the redo log files for the database and establishes the 
ARCHIVELOG mode
Creates the SYSTEM tablespace
Creates the SYSAUX 
tablespace
Creates the data dictionary
Sets the character set that stores 
data in the database
Sets the database time zone
Mounts and opens the 
database for use
