刚刚见好库,参考了好多文章,都是比较凌乱的,版本各异,自己总结如下。
RedHat WS3+Oracle10g Release 2
Oracle10gR2下手动创建数据库
$su - oracle
1.设置系统环境变量:
ORACLE_HOME=/home/oracle/prodUCt/10.2.0 ORACLE_BASE=/home/oracle
2.系统规划:
实例名称ORACLE_SID=test
数据库名称:test
3.手工创建如下目录:
/home/oracle/admin/test/cdump
/home/oracle/admin/test/bdump
/home/oracle/admin/test/udump
/home/oracle/admin/test/pfile
/home/oracle/oradata/test
4.建立密码文件:
/home/oracle/product/10.2.0/bin/orapwd file=/home/oracle/product/10.2.0/dbs/orapwtest passWord=test
5.修改参数文件:
格式:/home/oracle/product/10.2.0/dbs/init.ora
实例:/ home/oracle/product/10.2.0/dbs/inittest.ora
内容如下:
large_pool_size=4194304
shared_pool_size=48265318
core_dump_dest='/home/oracle/admin/test/cdump'
db_block_size=8192
db_domain='com'
db_file_multiblock_read_count=16
db_name='test'
db_recovery_file_dest='/home/oracle/flash_recovery_area'
db_recovery_file_dest_size=2147483648
dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
job_queue_processes=10
open_cursors=300
pga_aggregate_target=12777216
processes=150
undo_management='auto'
undo_tablespace='undotbs1'
user_dump_dest='/home/oracle/admin/test/udump'
NLS_DATE_FORMAT="Mon DD YYYY HH24:MI:SS"
NLS_DATE_LANGUAGE=AMERICAN
6.设置当前工作实例:
eXPort ORACLE_SID=test
7.登陆oracle:
>sqlplus “/ as sysdba”
8.启动实例:
SQL>startup nomount
9.创建数据库的脚本:
create database test
logfile group 1 '/home/oracle/oradata/test/redo01.log' size 10m reuse,
group 2 '/home/oracle/oradata/test/redo02.log' size 10m reuse,
group 3 '/home/oracle/oradata/test/redo03.log' size 10m reuse
datafile '/home/oracle/oradata/test/test01.dbf' size 500m reuse
maxdatafiles 100
archivelog
character set UTF8
national character set UTF8
sysaux datafile '/home/oracle/oradata/test/sys01.dbf' size 230m autoextend on next 10m maxsize unlimited
undo tablespace undotbs1 datafile '/home/oracle/oradata/test/undo.dbf' size 100m
create temporary tablespace temp tempfile '/home/oracle/oradata/test/temp01.dbf' size 100m autoextend on next 10m maxsize unlimited
create tablespace users datafile '/home/oracle/oradata/test/users01.dbf' size 500m autoextend on next 10m maxsize unlimited;
create user test identified by test default tablespace users;
grant connect,resource to test;
create tablespace rbs datafile '/home/oracle/oradata/test/rbs01.dbf' size 200m
reuse autoextend on next 5m
create tablespace tools datafile '/home/oracle/oradata/test/tools01.dbf' size
64m reuse autoextend on next 320k
create tablespace indx datafile '/home/oracle/oradata/test/indx01.dbf' size
32m reuse autoextend on next 1280k
create public rollback segment rbs0 tablespace rbs storage (optimal 4096k)
create public rollback segment rbs1 tablespace rbs storage (optimal 4096k)
create public rollback segment rbs2 tablespace rbs storage (optimal 4096k)
create public rollback segment rbs3 tablespace rbs storage (optimal 4096k)
alter rollback segment "rbs0" online
alter rollback segment "rbs1" online
alter rollback segment "rbs2" online
alter rollback segment "rbs3" online
10.运行如下文件:
/home/oracle/product/10.2.0/rdbms/admin/catalog.sql
/home/oracle/product/10.2.0/rdbms/admin/catproc.sql
11.经验总结:
①inittest.ora中的control_files要害字所指示的目录必需存在。
②inittest.ora中undo_tablespace中的名字必需与Create Database中的相同。我可是在这点上走了不少弯路啊。以前的建库过程总是出现ORA-01092:ORACLE instance terminated.Disconnection forced.郁闷至极不知如何解决。重装几次还是这样,最后仔细检查inittest.ora文件,发现undo_tablespace=’UNDOTBS1’,而Create Database中undo_tablespace=’undotbs1’,大小写的差别浪费了我几天的时间。
③分析数据库出错可以到/home/oracle/admin/test/bdump目录下的alert_test.log中查找。