1.先删除原有的数据库
shutdown immediate;
startup mount;
alter system enable restricted session;(切换到模式)
drop database;(删除数据库)
2.开始手工创建库
到bash_profile配置文件更改配置文件,oracle_sid改为pengchen
ORACLE_SID=penchen
然后退出oracle用户 重新登录
3.创建初始化文件
去cd /oracle/app/admin/TEST/bdump/alert_TEST.log里面把
processes = 150
__shared_pool_size = 83886080
__large_pool_size = 4194304
__java_pool_size = 4194304
__streams_pool_size = 0
sga_target = 285212672
control_files = /oracle/app/oradata/TEST/control01.ctl, /oracle/app/oradata/TEST/control02.ctl, /oracle/app/oradata/TEST/control03.ctl
db_block_size = 8192
__db_cache_size = 188743680
compatible = 10.2.0.1.0
db_file_multiblock_read_count= 16
db_recovery_file_dest = /oracle/app/flash_recovery_area
db_recovery_file_dest_size= 2147483648
undo_management = AUTO
undo_tablespace = UNDOTBS1
remote_login_passwordfile= EXCLUSIVE
db_domain =
dispatchers = (PROTOCOL=TCP) (SERVICE=TESTXDB)
job_queue_processes = 10
background_dump_dest = /oracle/app/admin/TEST/bdump
user_dump_dest = /oracle/app/admin/TEST/udump
core_dump_dest = /oracle/app/admin/TEST/cdump
audit_file_dest = /oracle/app/admin/TEST/adump
db_name = TEST
open_cursors = 300
pga_aggregate_target = 94371840
复制到$ORACLE_HOME/dbs/init$ORACLE_SID.ora配置文件中把里面的TEST替换成pengchen
processes = 150
__shared_pool_size = 83886080
__large_pool_size = 4194304
__java_pool_size = 4194304
__streams_pool_size = 0
sga_target = 285212672
control_files = /oracle/app/oradata/pengchen/control01.ctl, /oracle/app/oradata/pengchen/control02.ctl, /oracle/app/oradata/pengchen/control03.ctl
db_block_size = 8192
__db_cache_size = 188743680
compatible = 10.2.0.1.0
db_file_multiblock_read_count= 16
db_recovery_file_dest = /oracle/app/flash_recovery_area
db_recovery_file_dest_size= 2147483648
undo_management = AUTO
undo_tablespace = UNDOTBS1
remote_login_passwordfile= EXCLUSIVE
db_name = pengchen
pga_aggregate_target = 94371840
4.建立密码文件
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=123456 force=y
5.建立需要的的目录
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/pfile
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/dpdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump
6.创建spfile
startup nomount
ORACLE instance started.
create spfile from pfile;
File created.
7.建立数据库
vim /home/oracle/createDB.sql
把create database vfast
logfile group 1 ('$ORACLE_BASE/oradata/vfast/redo01.log') size 100m,
group 2 ('$ORACLE_BASE/oradata/vfast/redo02.log') size 100m,
group 3 ('$ORACLE_BASE/oradata/vfast/redo03.log') size 100m
maxlogfiles 10
maxlogmembers 5
maxloghistory 5
maxdatafiles 100
maxinstances 1
character set zhs16gbk
national character set al16utf16
datafile '$ORACLE_BASE/oradata/vfast/system01.dbf' size 350m reuse autoextend on next 1m maxsize unlimited extent management local
sysaux datafile '$ORACLE_BASE/oradata/sysaux01.dbf' size 350m reuse autoextend on next 1m maxsize unlimited
default temporary tablespace temp01 tempfile '$ORACLE_BASE/oradata/vfast/temp01.dbf' size 50m reuse autoextend on next 1m maxsize 500m
undo tablespace undotbs1 datafile '$ORACLE_BASE/oradata/vfast/undotbs01.dbf' size 500m reuse autoextend on next 1m maxsize unlimited;
写到以上配置文件里
执行以上脚本
@/home/oracle/createDB.sql 执行后会报错
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-00200: control file could not be created
ORA-00202: control file: '/oracle/app/oradata/pengchen/control01.ctl'
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory
意思是找不到 pengchen 这个目录
去/oracle/app/oradata下创建一个名字 pengchen目录然后在从新执行
@/home/oracle/createDB.sql
提示Database created.
查询一下select name from v$database
NAME
---------
PENGCHEN
8.创建数据字典视图
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catalog.sql 各种等
9.创建存储过程包
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catproc.sql各种等
18_彭臣