参考文档:
https://docs.oracle.com/cd/E11882_01/server.112/e25494/create.htm#ADMIN11074
Step 1: Specify an Instance Identifier (SID)
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=
O
R
A
C
L
E
B
A
S
E
/
p
r
o
d
u
c
t
/
d
b
1
L
D
L
I
B
R
A
R
Y
P
A
T
H
=
ORACLE_BASE/product/db_1 LD_LIBRARY_PATH=
ORACLEBASE/product/db1LDLIBRARYPATH=ORACLE_HOME/lib:/usr/lib:/usr/lib
PATH=
O
R
A
C
L
E
H
O
M
E
/
b
i
n
:
ORACLE_HOME/bin:
ORACLEHOME/bin:PATH
export ORACLE_BASE ORACLE_HOME PATH LD_LIBRARY_PATH
export ORACLE_SID=study
export NLS_LANG=AMERICAN_AMERICA.UTF8
Step 2: Ensure That the Required Environment Variables Are Set
主要是确认一些环境变量:
For example, on most platforms, ORACLE_SID and ORACLE_HOME must be set. In addition, it is advisable to set the PATH variable to include the ORACLE_HOME/bin directory. On the UNIX and Linux platforms, you must set these environment variables manually. On the Windows platform, OUI automatically assigns values to ORACLE_HOME and ORACLE_SID in the Windows registry. If you did not create a database upon installation, OUI does not set ORACLE_SID in the registry, and you will have to set the ORACLE_SID environment variable when you create your database later.
Step 3: Choose a Database AdministratorAuthentication MethodStep
密码文件的路径:
[oracle@db-test1 dbs]$ pwd
/u01/app/oracle/product/db_1/dbs
ORAPWD FILE=filename [ENTRIES=numusers] [FORCE={Y|N}] [IGNORECASE={Y|N}]
orapwd FILE=orapwstudy password=oracle
4: Create the Initialization Parameter FileStep
文件里面有连接到例子:
[oracle@db-test1 dbs]$ vi initstudy.ora
db_name='study'
memory_target=4G
control_files = '/u01/app/oracle/oradata/study/control01.ctl', '/u01/app/oracle/oradata/study/control02.ctl'
undo_tablespace='UNDOTBS1'
启动到nomount:
[oracle@db-test1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 13 21:16:10 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 624952200 bytes
Database Buffers 436207616 bytes
Redo Buffers 5517312 bytes
5: (Windows Only) Create an InstanceStep
6: Connect to the InstanceStep
7: Create a Server Parameter FileStep
create spfile from pfile;
create pfile=’/tmp/pfile.ora’ from spfile;
8: Start the InstanceStep
9: Issue the CREATE DATABASE StatementStep
CREATE DATABASE study
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/study/redo01a.log') SIZE 50M,
GROUP 2 ('/u01/app/oracle/oradata/study/redo02a.log') SIZE 50M,
GROUP 3 ('/u01/app/oracle/oradata/study/redo03a.log') SIZE 50M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 200
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/study/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/study/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/study/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE UNDOTBS1
DATAFILE '/u01/app/oracle/oradata/study/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
SQL> select status from v$instance;
STATUS
OPEN
10: Create Additional TablespacesStep
SQL> select * from dba_data_files;
select * from dba_data_files
这时候还没有创建视图
CREATE TABLESPACE users LOGGING
DATAFILE '/u01/app/oracle/oradata/study/user01.dbf'
SIZE 500M ;
alter database default tablespace users;
11: Run Scripts to Build Data Dictionary ViewsStep
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql