1、建立目录
2、建立密码文件
3、创建参数文件pfile
4、创建spfile
5、启动数据库为nomount,并创建数据库
6、运行脚本
7、修改数据库状态
8、查看数据库
1)日志存放目录
[oracle@ocmserver]cd $ORACLE_BASE
[oracle@ocmserver]cd admin/
[oracle@ocmserver]ls
ibm
[oracle@ocmserver]mkdir hp
[oracle@ocmserver]cd hp
[oracle@ocmserver]mkdir {a,b,c,u}dump
[oracle@ocmserver]ls
adump bdump cdump udump
[oracle@ocmserver]pwd
/opt/oracle/admin/hp
[oracle@ocmserver]
2)创建数据文件存放目录
[oracle@ocmserver]cd $ORACLE_BASE/oradata
[oracle@ocmserver]mkdir hp
[oracle@ocmserver]ls
hp ibm
[oracle@ocmserver]
[oracle@ocmserver]cd $ORACLE_BASE
[oracle@ocmserver]cd admin/
[oracle@ocmserver]ls
ibm
[oracle@ocmserver]mkdir hp
[oracle@ocmserver]cd hp
[oracle@ocmserver]mkdir {a,b,c,u}dump
[oracle@ocmserver]ls
adump bdump cdump udump
[oracle@ocmserver]pwd
/opt/oracle/admin/hp
[oracle@ocmserver]
2)创建数据文件存放目录
[oracle@ocmserver]cd $ORACLE_BASE/oradata
[oracle@ocmserver]mkdir hp
[oracle@ocmserver]ls
hp ibm
[oracle@ocmserver]
[oracle@ocmserver]cd $ORACLE_HOME/dbs
[oracle@ocmserver]orapwd file=orapwhp password=oracle
[oracle@ocmserver]ls
hc_ibm.dat init.ora initaiobs.ora initdw.ora initibm.ora lkIBM orapwhp orapwibm spfileibm.ora
[oracle@ocmserver]
[oracle@ocmserver]orapwd file=orapwhp password=oracle
[oracle@ocmserver]ls
hc_ibm.dat init.ora initaiobs.ora initdw.ora initibm.ora lkIBM orapwhp orapwibm spfileibm.ora
[oracle@ocmserver]
vi inithp.ora
sqlplus / as sysdba
create spfile from pfile
create spfile from pfile
SQL>startup nomount
SQL>get $ORACLE_HOME/sql/crt_hp.sql
----<脚本如下>----
CREATE DATABASE hp
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/opt/oracle/oradata/hp/redo01.log') SIZE 100M,
GROUP 2 ('/opt/oracle/oradata/hp/redo02.log') SIZE 100M,
GROUP 3 ('/opt/oracle/oradata/hp/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET UTF8
DATAFILE '/opt/oracle/oradata/hp/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/opt/oracle/oradata/hp/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE tbs_1
datafile '/opt/oracle/oradata/hp/tbs_1.dbf' size 50m
DEFAULT TEMPORARY TABLESPACE tempts01
TEMPFILE '/opt/oracle/oradata/hp/temp01.dbf'SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/opt/oracle/oradata/hp/undotbs01.dbf'SIZE 200M REUSE
AUTOEXTEND ON MAXSIZE UNLIMITED;
SQL>get $ORACLE_HOME/sql/crt_hp.sql
----<脚本如下>----
CREATE DATABASE hp
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/opt/oracle/oradata/hp/redo01.log') SIZE 100M,
GROUP 2 ('/opt/oracle/oradata/hp/redo02.log') SIZE 100M,
GROUP 3 ('/opt/oracle/oradata/hp/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET UTF8
DATAFILE '/opt/oracle/oradata/hp/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/opt/oracle/oradata/hp/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE tbs_1
datafile '/opt/oracle/oradata/hp/tbs_1.dbf' size 50m
DEFAULT TEMPORARY TABLESPACE tempts01
TEMPFILE '/opt/oracle/oradata/hp/temp01.dbf'SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/opt/oracle/oradata/hp/undotbs01.dbf'SIZE 200M REUSE
AUTOEXTEND ON MAXSIZE UNLIMITED;
get $ORACLE_HOME/rdbms/admin/catalog.sql
get $ORACLE_HOME/rdbms/admin/catproc.sql
get $ORACLE_HOME/rdbms/admin/catproc.sql
alter database mount
alter database open
alter database open
select instance_name,status from v$instance
转载于:https://blog.51cto.com/alexy/1070209