配置环境:
已经安装好redhat4版本软件、安装好oracle 10g数据库软件、足够的磁盘空间
1、创建数据库所需相关目录
[oracle@shiyueasm ~]$ mkdir -p/u01/admin/orcl/bdump
[oracle@shiyueasm ~]$ mkdir -p/u01/admin/orcl/cdump
[oracle@shiyueasm ~]$ mkdir -p /u01/admin/orcl/udump
[oracle@shiyueasm ~]$ mkdir -p /u01/admin/orcl/disk1
[oracle@shiyueasm ~]$ mkdir -p /u01/admin/orcl/disk2
2、创建参数文件
[root@shiyueasm ~]# su �C oracle
[oracle@shiyueasm ~]$ cd $ORACLE_HOME/dbs
[oracle@shiyueasm dbs]$ ll
-rw-r―�C 1 oracle oinstall 8385 Sep11 1998 init.ora
[oracle@shiyueasm dbs]$ cat init.ora |grep-v ^# > initorcl.ora
[oracle@shiyueasm dbs]$ vi initorcl.ora
编辑initorcl.ora文件并根据下面示例进行更改
――――――――――――――――――――――――――――――――
db_name=orcl
db_files = 80
db_file_multiblock_read_count = 8
#db_block_buffers = 100
#shared_pool_size = 3500000
log_checkpoint_interval = 10000
processes = 50
parallel_max_servers = 5
#log_buffer = 32768
max_dump_file_size = 10240
global_names = TRUE
control_files=(‘/u01/oradata/orcl/disk1/control01.ctl’,'/u01/oradata/orcl/disk2/control02.ctl’)
sga_target=300m
background_dump_dest=/u01/admin/orcl/bdump
core_dump_dest=/u01/admin/orcl/cdump
user_dump_dest=/u01/admin/orcl/udump
undo_tablespace=shiyuetbs
undo_management=auto
――――――――――――――――――――――――――――――――
更改完成后输入:wq进行保存退出
3、测试参数文件是否正确
[oracle@shiyueasm ~]$ exportORACLE_SID=orcl
[oracle@shiyueasm ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 �C Productionon Mon Aug 8 14:26:07 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1219136 bytes
Variable Size 96470464 bytes
Database Buffers 209715200 bytes
RedoBuffers 7168000 bytes
4、编写建库脚本文件
[oracle@shiyueasm ~]$ cd $ORACLE_HOME/dbs
[oracle@shiyueasm dbs]$ ll
total 80
-rw-rw―- 1 oracle oinstall 1544 Aug 8 14:26 hc_orcl.dat
-rw-r―�C 1 oracle oinstall 8385 Sep11 1998 init.ora
-rw-r�Cr�C 1 oracle oinstall 975 Aug 8 14:25 initorcl.ora
[oracle@shiyueasm dbs]$ vi orcl.sql
把如下脚本文件写进orcl.sql文件
――――――――――――――――――――――――――――――――――
create databaseorcl
user sysidentified by oracle
user systemidentified by oracle
maxloghistory 1024
maxinstances 2
maxlogfiles 20
maxdatafiles 2048
datafile’/u01/oradata/orcl/system01.dbf’ size 300m autoextend on next 30m maxsizeunlimited extent management local
sysaux datafile’/u01/oradata/orcl/sysaux01.dbf’ size 300m autoextend on next 30m maxsizeunlimited
default temporarytablespace temp01 tempfile ‘/u01/oradata/orcl/temp01.dbf’ size 100m
undo tablespaceshiyuetbs datafile ‘/u01/oradata/orcl/shiyuetbs.dbf’ size 300m autoextend onnext 30m maxsize unlimited
default tablespaceshiyue datafile ‘/u01/oradata/orcl/shiyue01.dbf’ size 200m
logfile
group 1(‘/u01/oradata/orcl/disk1/redo1_1.dbf’,'/u01/oradata/orcl/disk2/
redo1_2.dbf’) size50m,
group 2 (‘/u01/oradata/orcl/disk1/redo2_1.dbf’,'/u01/oradata/orcl/disk2/
redo2_2.dbf’) size50m,
group 3(‘/u01/oradata/orcl/disk1/redo3_1.dbf’,'/u01/oradata/orcl/disk2/
redo3_2.dbf’) size50m;
――――――――――――――――――――――――――――――――――
写入完成后输入:wq进行保存退出
5、创建数据库
[oracle@shiyueasm dbs]$ export ORACLE_SID=orcl
[oracle@shiyueasm dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 �C Production on Mon Aug 814:41:28 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release10.2.0.1.0 �C Production
With the Partitioning, OLAP and Data Mining options
SQL>@orcl.sql
Database created
SQL>@?/rdbms/admin/catalog
【注】跑完改脚本后接着跑下面的脚本,请耐心等待!
SQL>@?/rdbms/admin/catproc
SQL>conn system/oracle
SQL>@?/sqlplus/admin/pupbld
SQL>select name from v$datafile;
NAME
――――――――――――――――――――――――――�C
/u01/oradata/orcl/system01.dbf
/u01/oradata/orcl/shiyuetbs.dbf
/u01/oradata/orcl/sysaux01.dbf
/u01/oradata/orcl/shiyue01.dbf
4 rows selected.
SQL>select name from v$controlfile;
NAME
――――――――――――――――――――――――――�C
/u01/oradata/orcl/disk1/control01.ctl
/u01/oradata/orcl/disk2/control02.ctl
2 rows selected.
SQL>select name from v$tempfile;
NAME
――――――――――――――――――――――――――�C
/u01/oradata/orcl/temp01.dbf
1 row selected.
SQL>select member from v$logfile;
MEMBER
――――――――――――――――――――――――――�C
/u01/oradata/orcl/disk1/redo1_1.dbf
/u01/oradata/orcl/disk2/redo1_2.dbf
/u01/oradata/orcl/disk1/redo2_1.dbf
/u01/oradata/orcl/disk2/redo2_2.dbf
/u01/oradata/orcl/disk1/redo3_1.dbf
/u01/oradata/orcl/disk2/redo3_2.dbf
6 rows selected.
好了,脚本跑完,手动建库完成!