手工创建Oracle数据库(一)

2014-11-24 17:57:38 · 作者: · 浏览: 2

create database prod
user sys identified by prod
user system identified by prod
datafile '$ORACLE_BASE/oradata/prod/system01.dbf' size 400m
sysaux datafile '$ORACLE_BASE/oradata/prod/sysaux01.dbf' size 100m
default temporary tablespace temp tempfile '$ORACLE_BASE/oradata/prod/temp01.dbf' size 100m
undo tablespace rtbs datafile '$ORACLE_BASE/oradata/prod/undo01.dbf' size 100m
logfile
group 1 '$ORACLE_BASE/oradata/prod/redo01.log' size 50m,
group 2 '$ORACLE_BASE/oradata/prod/redo02.log' size 50m
character set zhs16gbk;


注意建库语句创建system和sysaux表空间特殊语法,不要带tablespace关键字,否则会创建失败
undo tablespace表空间的名字必须与undo_tablesapce参数设置保持一致,否则在告警日志中会报类似下面的错误
ORA-30012 signalled during: CREATE UNDO TABLESPACE UNDO01 DATAFILE '$ORACLE_BASE/oradata/prod/undo01.dbf' size 100m
...
Sun Feb 15 00:27:01 2015
Errors in file /u01/app/oracle/admin/prod/udump/prod_ora_18355.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-30012: undo tablespace 'rtbs' does not exist or of wrong type
Sun Feb 15 00:27:01 2015
Errors in file /u01/app/oracle/admin/prod/udump/prod_ora_18355.trc:
ORA-01501: CREATE DATABASE failed
ORA-01519: error while processing file ' /rdbms/admin/sql.bsq' near line 5792
ORA-00604: error occurred at recursive SQL level 1
ORA-30012: undo tablespace 'rtbs' does not exist or of wrong type
Error 1519 happened during db open, shutting down database
找不到rtbs这个undo表空间导致创建失败
2、创建数据库
首先启动实例到nomount状态
[oracle@sigleNode dbs]$ export ORACLE_SID=prod
[oracle@sigleNode dbs]$ sqlplus / as sysdba
SQL> startup nomount;
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.


Total System Global Area 205520896 bytes
Fixed Size 1218508 bytes
Variable Size 92276788 bytes
Database Buffers 104857600 bytes
Redo Buffers 7168000 bytes
实例成功启动到nomount状态,但是报了废弃参数问题
通过告警日志发现具体如下
Deprecated system parameters with specified values:
parallel_automatic_tuning
End of deprecated system parameter listing
指明参数parallel_automatic_tuning已经废弃,编辑初始化文件
[oracle@sigleNode dbs]$ vi initprod.ora
注释掉下面一行
#parallel_automatic_tuning = true
重启启动实例到nomount状态
SQL> startup nomount;
ORACLE instance started.


Total System Global Area 201326592 bytes
Fixed Size 1218484 bytes
Variable Size 88082508 bytes
Database Buffers 104857600 bytes
Redo Buffers 7168000 bytes
执行建库脚本cr_db.sql
SQL> @$ORACLE_HOME/dbs/cr_db.sql;


Database created.
通过告警日志看到建库的详细过程如下:
create database prod
user sys identified by ****user system identified by *datafile '$ORACLE_BASE/oradata/prod/system01.dbf' size 400m
sysaux datafile '$ORACLE_BASE/oradata/prod/sysaux01.dbf' size 100m
default temporary tablespace temp tempfile '$ORACLE_BASE/oradata/prod/temp01.dbf' size 100m
undo tablespace rtbs datafile '$ORACLE_BASE/oradata/prod/undo01.dbf' size 100m
logfile
group 1 '$ORACLE_BASE/oradata/prod/redo01.log' size 50m,
group 2 '$ORACLE_BASE/oradata/prod/redo02.log' size 50m
character set zhs16gbk
Sun Feb 15 00:28:30 2015
Database mounted in Exclusive Mode
Sun Feb 15 00:28:33 2015
Successful mount of redo thread 1, with mount id 283499181
Assigning activation ID 283499181 (0x10e5daad)
Thread 1 opened at log sequence 1
Current log# 1 seq# 1 mem# 0: /u01/app/oracle/oradata/prod/redo01.log
Successful open of redo thread 1
Sun Feb 15 00:28:33 2015
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Sun