[Oracle] 指令碼建立DB

tolilong發表於2017-11-11
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 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2147133/,如需轉載,請註明出處,否則將追究法律責任。

相關文章