创建数据库的名字为:DBSHOP
一:创建必要的目录
export ORACLE_SID=DBSHOP
mkdir -p $ORACLE_BASE/oradata/$ORACLE_SID
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/pfile
在$ORACLE_HOME/dbs目录下创建ORACLE的参数文件initSID.ora,
可先拷贝数据库自带的init.ora文件,在修改
cp init.ora init$ORACLE_SID.ora
用vi命令编辑init$ORACLE_SID.ora文件,修改如下:
db_name='DBSHOP'
memory_target=700M
processes = 150
audit_file_dest='/u01/oracle/admin/DBSHOP/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/oracle/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=DBSHOP)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = ('/u01/oracle/oradata/DBSHOP/control01.ctl','/u01/oracle/oradata/DBSHOP/control02.ctl','/u01/oracle/oradata/DBSHOP/control03.ctl')
compatible ='11.2.0'
创建密码文件:
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=sys entries=5 force=y
建立创建数据库脚本: /u01/createdb.sql 内容如下
create database DBSHOP
MAXINSTANCES 1
MAXLOGHISTORY 1
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
DATAFILE '/u01/oracle/oradata/DBSHOP/system01.dbf' size 100m reuse autoextend on next 1m maxsize
unlimited
sysaux datafile '/u01/oracle/oradata/DBSHOP/syaux01.dbf' size 100m reuse autoextend on next 1m maxsize unlimited
default temporary tablespace TEMP tempfile '/u01/oracle/oradata/DBSHOP/temp01.dbf' size 20m reuse autoextend on next 64k maxsize unlimited
undo tablespace UNDOTBS1 datafile '/u01/oracle/oradata/DBSHOP/undo01.dbf' size 20m reuse autoextend on next 5m maxsize unlimited
logfile
GROUP 1 ('/u01/oracle/oradata/DBSHOP/redo01.dbf') size 10m,
GROUP 2 ('/u01/oracle/oradata/DBSHOP/redo02.dbf') size 10m,
GROUP 3 ('/u01/oracle/oradata/DBSHOP/redo03.dbf') size 10m
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
登陆数据库
su - oracle
sqlplus / as sysdba
依次执行
SQL>startup nomount
SQL>@/u01/createdb.sql
SQL>@?/rdbms/admin/catalog.sql
SQL>@?/rdbms/admin/catproc.sql
SQL>@?/rdbms/admin/catexp.sql
--注意:@?在这里代表的是 $ORACLE_HOME