Oracle手工建库的时候遇到一个小问题,顺便记录了一下。
SQL> @/home/oracle/createDB.sql
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-01501: CREATE DATABASE failed
ORA-01519: error while processing file '?/rdbms/admin/dtxnspc.bsq' near line 5
ORA-00604: error occurred at recursive SQL level 1
ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type
Process ID: 2013
Session ID: 1 Serial number: 3
原因:创建的undo表空间与参数文件写的不一致。
创建的时侯,undo表空间写的是undotbs
UNDO TABLESPACE undotbs
DATAFILE '/u01/app/oracle/oradata/tomato/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
参数文件中写但是UNDOTBS1
undo_tablespace='UNDOTBS1'
把创建的语句中的undotbs改为undotbs1
删除掉已经创建出来的控制文件,日志文件和数据文件
[oracle@potato ~]$ rm -rf /u01/app/oracle/oradata/tomato/control1.ctl
[oracle@potato ~]$ rm -rf /u01/app/oracle/fast_recovery_area/tomato/control02.ctl
[oracle@potato tomato]$ ls
redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf undotbs01.dbf
[oracle@potato tomato]$ rm -rf *
重新创建一遍即可
SQL> @/home/oracle/createDB.sql
Database created.
因为数据自带的参数文件init.ora里面的参数undo_tablespace='UNDOTBS1',而官方文档的建库语句中UNDO TABLESPACE undotbs
两者不一致,所以一不小心,很容易引起错误。