日期:2010-10-24  浏览次数:21101 次

手工创建数据库的全部脚本及其说明

手工创建数据库的全部脚本及说明


系统环境:
1、操作系统:Windows 2000 Server,机器内存128M
2、数据库: Oracle 8i R2 (8.1.6) for NT 企业版
3、安装路径:D:\ORACLE

建库步骤:
1、手工创建相关目录
D:\Oracle\admin\test
D:\Oracle\admin\test\adhoc
D:\Oracle\admin\test\bdump
D:\Oracle\admin\test\cdump
D:\Oracle\admin\test\create
D:\Oracle\admin\test\exp
D:\Oracle\admin\test\pfile
D:\Oracle\admin\test\udump

D:\Oracle\oradata\test
D:\Oracle\oradata\test\archive

2、手工创建初始化启动参数文件:D:\Oracle\admin\test\pfile\inittest.ora,内容:

db_name = "test"
instance_name = test
service_names = test
db_files = 1024
control_files = ("D:\Oracle\oradata\test\control01.ctl", "D:\Oracle\oradata\test\control02.ctl", "D:\Oracle\oradata\test\control03.ctl")
open_cursors = 200
max_enabled_roles = 30
db_file_multiblock_read_count = 8
db_block_buffers = 4096
shared_pool_size = 52428800
large_pool_size = 78643200
java_pool_size = 20971520
log_checkpoint_interval = 10000
log_checkpoint_timeout = 1800
processes = 115
parallel_max_servers = 5
log_buffer = 32768
max_dump_file_size = 10240
global_names = true
oracle_trace_collection_name = ""
background_dump_dest = D:\Oracle\admin\test\bdump
user_dump_dest = D:\Oracle\admin\test\udump
db_block_size = 16384
remote_login_passwordfile = exclusive
os_authent_prefix = ""
job_queue_processes = 4
job_queue_interval = 60
open_links = 4
distributed_transactions = 10
mts_dispatchers = "(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)"
mts_dispatchers = "(protocol=TCP)"
compatible = 8.1.0
sort_area_size = 65536
sort_area_retained_size = 65536

# log_archive_start = true
# log_archive_dest_1 = "location=D:\Oracle\oradata\oradb\archive"
# log_archive_format = %%ORACLE_SID%%T%TS%S.ARC


3、手工创建D:\Oracle\Ora81\DATABASE\inittest.ora文件,

内容:IFILE=’D:\Oracle\admin\test\pfile\inittest.ora’

4、使用orapwd.exe命令,创建D:\Oracle\Ora81\DATABASE\PWDtest.ora

命令:D:\Oracle\Ora81\bin\orapwd file=D:\Oracle\Ora81\DATABASE\PWDtest.ora password=ORACLE entries=5


5、通过oradim.exe命令,在服务里生成一个新的实例管理服务,启动方式为手工
set ORACLE_SID=test
D:\Oracle\Ora81\bin\oradim -new -sid test -startmode manual -pfile "D:\Oracle\admin\test\pfile\inittest.ora"

6、生成各种数据库对象
D:\ >svrmgrl

--创建数据库
connect INTERNAL/oracle
startup nomount pfile="D:\Oracle\admin\test\pfile\inittest.ora"
CREATE DATABASE test
LOGFILE ’D:\Oracle\oradata\test\redo01.log’ SIZE 2048K,
’D:\Oracle\oradata\test\redo02.log’ SIZE 2048K,
’D:\Oracle\oradata\test\redo03.log’ SIZE 2048K
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXLOGHISTORY 1
DATAFILE ’D:\Oracle\oradata\test\system01.dbf’ SIZE 58M REUSE AUTOEXTEND ON NEXT 640K
MAXDATAFILES 254
MAXINSTANCES 1
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET ZHS16GBK;

控制文件、日志文件在上面语句执行时生成


connect INTERNAL/oracle
--修改系统表空间
ALTER TABLESPACE SYSTEM DEFAULT STORAGE ( INITIAL 64K NEXT 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 50);
ALTER TABLESPACE SYSTEM MINIMUM EXTENT 64K;

--创建回滚表空间
CREATE TABLESPACE RBS DATAFILE ’D:\Oracle\oradata\test\rbs01.dbf’ SIZE 256M REUSE
AUTOEXTEND ON NEXT 5120K
MINIMUM EXTENT 512K
DEFAULT STORAGE ( INITIAL 512K NEXT 512K MINEXTENTS 8 MAXEXTENTS 4096);

--创建用户表空间
CREATE TABLESPACE USERS DATAFILE ’D:\Oracle\oradata\test\users01.dbf’ SIZE 128M REUSE
AUTOEXTEND ON NEXT 1280K
MINIMUM EXTENT 128K
DEFAULT STORAGE ( INITIAL 128K NEXT 128K MINEXTENTS 1 MAXEXTENTS 4096 PCTINCREASE 0);

--创建临时表空间
CREATE TABLESPACE TEMP DATAFILE ’D:\Or