[Oracle]脚本创建DB

C:\Users\Admin>set ORACLE_HOME=E:\oracle11g\product\11.2.0\dbhome_1
C:\Users\Admin>set ORACLE_SID=bruce

C:\Users\Admin>oradim -new -sid bruce
Instance created.


初始化参数文件内容(11g):
db_name=bruce
audit_file_dest=E:\oracle11g
audit_trail =db
db_block_size=8192
control_files = ('E:\oracle11g\oradata\control01.ctl','E:\oracle11g\oradata\control02.ctl','E:\oracle11g\oradata\control03.ctl')
compatible =11.2.0

初始化参数文件内容(10g):
db_name=bruce10g
audit_trail =db
db_block_size=8192
control_files = ('E:\oracle\product\oradata\control01.ctl','E:\oracle\product\oradata\control02.ctl','E:\oracle\product\oradata\control03.ctl')
compatible =10.2.0
undo_management=auto
undo_tablespace=undotbs1
background_dump_dest='E:\oracle\product\10.2.0\admin\bruce10g\bdump'
sga_target=419430400                          #如果没有加这个参数会报

C:\Users\Admin>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue May 23 13:47:12 2017

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area  150667264 bytes
Fixed Size                  1373152 bytes
Variable Size              92277792 bytes
Database Buffers           50331648 bytes
Redo Buffers                6684672 bytes

之后执行如下脚本:
create database bruce
maxlogfiles 5
maxlogmembers 5
maxdatafiles 100
maxinstances 1
logfile
group 1 ('E:\oracle11g\oradata\redo1.log') size 10m,
group 2 ('E:\oracle11g\oradata\redo2.log') size 10m,
group 3 ('E:\oracle11g\oradata\redo3.log') size 10m
datafile 'E:\oracle11g\oradata\system.dbf' size 200m reuse
sysaux datafile 'E:\oracle11g\oradata\sysaux.dbf' size 100m
default tablespace users
datafile 'E:\oracle11g\oradata\userdata.dbf' size 100m
undo tablespace undotbs1 datafile 'E:\oracle11g\oradata\undotbs1.dbf' size 100m
default temporary tablespace temp
tempfile 'E:\oracle11g\oradata\temp01.dbf' size 100m reuse
character set al32utf8
;

完成后
SQL> select status from v$instance;

STATUS
------------
OPEN

完成后执行如下三个脚本:
@$ORACLE_HOME/rdbms/admin/catalog.sql
@$ORACLE_HOME/rdbms/admin/catproc.sql
conn system/manager
@$ORACLE_HOME/sqlplus/admin/pupbld.sql 

新闻名称:[Oracle]脚本创建DB
文章出自:http://myzitong.com/article/pcoipc.html