oracle创建数据库

时间:2022-05-09 21:16:36

手工创建数据库(myorcl)

export ORACLE_SID=myorcl

 

1.创建口令文件

orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=oracle

 

2.创建参数文件

vi $ORACLE_HOME/dbs/initmyorcl.ora

参数:

db_name='myorcl'

compatible=11.2.0.4.0

age_target=1g

control_file='/u01/app/oracle/oradata/myorcl/control01.ctl'

audit_file_dest='/u01/app/oracle/admin/myorcl/adump'

diagnostic_dest='/u01/app/oracle'

db_recovery_file_dest_size=4g

db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'

undo_tablespace=undo01

 

3.创建相关目录

mkdir -p /u01/app/oracle/oradata/myorcl

mkdir -p /u01/app/oracle/admin/myorcl/adump

mkdir -p /u01/app/oracle/fast_recovery_area

 

4.启动实例到nomount

sqlplus / as sysdba

把pfile转成spfile

create spfile from pfile;

startup nomount

 

5.创建数据库

create database myorcl

datafile '/u01/app/oracle/oradata/myorcl/system01.dbf' size 400m autoextend on next 64m extend management local

sysaux datafile '/u01/app/oracle/oradata/myorcl/sysaux01.dbf' size 100m autoextend on next 64m

umdo tablespace undo01 datafile '/app/oracle/oradata/myorcl/undo01.dbf' size 100m autoextend on next 64m

default tempoary tablespace temp tempfile '/app/oracle/oradata/myorcl/temp01.dbf' size 50m autoextend on

character set zhs16gbk

national character set al16utf16

logfile

group 1 '/u01/app/oracle/oradata/myorcl/redo01.log' size 50m,

group 2 '/u01/app/oracle/oradata/myorcl/redo02.log' size 50m,

group 3 '/u01/app/oracle/oradata/myorcl/redo03.log' size 50m;

 

6.创建数据字典,构造pl/sql运行环境

@?/rdbms/admin/catalog.sql

@?/rdbms/admin/catproc.sql

 

7.建立测试用户scott

@?/rdbms/admin/utlsampl.sql

 

conn system/manager

@?/sqlplus/admin/pupbld.sql

 

 

 

根据模板静默安装:

dbca -silent -createDatabase -templateName /u01/app/oracle/product/11.2.0/db_1/assistants/dbca/templates/General_Purpose.dbc -gdbName db01 -sid db01 -sysPassword oracle -systemPassword oracle -characterSet zhs16gbk -nationalCharacterSet al16utf16 -response NO_VALUE -datafileDestination /u01/app/oracle/oradata