手工建库oracle 11g for windows

一、创建必要的相关目录
D:\app\Administrator\admin\test
D:\app\Administrator\admin\test\adump
D:\app\Administrator\admin\test\dpdump
D:\app\Administrator\admin\test\pfile
D:\app\Administrator\admin\test\cdump
D:\app\Administrator\admin\test\create
D:\app\Administrator\oradata\test

二、创建初始化参数文件
1、把D:\app\Administrator\admin\orcl\pfile\init.ora.072015124214拷贝为
D:\app\Administrator\product\11.2.0\dbhome_1\database\inittest.ora
2、修改D:\app\Administrator\product\11.2.0\dbhome_1\database\inittest.ora参数如下:
db_name=test
control_files=("D:\app\Administrator\oradata\test\control01.ctl", "D:\app\Administrator\oradata\test\control02.ctl", "D:\app\Administrator\oradata\test\control03.ctl")

三、打开cmd,设置环境变量
set oracle_sid=test

四、创建服务,即创建实例
oradim -new -sid test

五、创建口令文件
orapwd file=D:\app\Administrator\product\11.2.0\dbhome_1\database\pwdtest.ora password=123;

六、启动服务器
SQL> connect / as sysdba
SQL> startup nomount

七、执行建库脚本
create database test
datafile 'D:\app\Administrator\oradata\test\system01.dbf' size 300m
autoextend on next 10m extent management local
sysaux datafile 'D:\app\Administrator\oradata\test\sysaux01.dbf' size 120m
undo tablespace undotbs1
datafile 'D:\app\Administrator\oradata\test\undotbs01.dbf' size 100m
default temporary tablespace temptbs1
tempfile 'D:\app\Administrator\oradata\test\temp01.dbf' size 50m
logfile group 1
('D:\app\Administrator\oradata\test\redo01.dbf') size 50m,
group 2
('D:\app\Administrator\oradata\test\redo02.dbf') size 50m,
group 3
('D:\app\Administrator\oradata\test\redo03.dbf') size 50m;
运行时可以使用以下语句
sql>start d:\test.sql

八、创建数据字典和包
sql>start D:\app\Administrator\product\11.2.0\dbhome_1\RDBMS\ADMIN\catalog
sql>start D:\app\Administrator\product\11.2.0\dbhome_1\RDBMS\ADMIN\catproc

九、执行pupbld.sql脚本
切换成system用户执行
conn system/manager
sql>start D:\app\Administrator\product\11.2.0\dbhome_1\sqlplus\admin\pupbld

十、执行scott脚本创建scott模式
sql>start D:\app\Administrator\product\11.2.0\dbhome_1\RDBMS\ADMIN\scott.sql
修改scott密码
SQL> conn / as sysdba
SQL> alter user scott identified by tiger;
SQL> connect scott/tiger
SQL> show user;
USER is "SCOTT"

十一、检查数据库是否OK
SQL> select * from emp;

你可能感兴趣的:(ORACLE实验)