手动创建数据库及创建过程遇到的错误(踩到的坑)
TeacherWhat Oracle数据库技术
本文介绍手动创建数据库的方法及创建过程遇到的错误(踩到的坑).
动创建数据库的方法
1.定义相关环境变量
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE=/u01/app/oracle
$ echo $PATH
$ export PATH=$PATH:$ORACLE_HOME/OPatch/bin
2. 创建Password file,供远程Password认证连接
$ orapwd FILE=orapworcl ENTRIES=30
3.修改初期化参数
cd $ORACLE_HOME/dbs
cp init.ora initorcl.ora
vi initorcl.ora
initorcl.ora内容:
db_name=’ORCL’
memory_target=800M
processes = 150
db_block_size=8192
db_domain=”
db_recovery_file_dest=’/u01/app/oracle/fast_recovery_area’
db_recovery_file_dest_size=10G
diagnostic_dest=’/u01/app/oracle’
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)’
open_cursors=300
remote_login_passwordfile=’EXCLUSIVE’
undo_tablespace=’UNDOTBS1′
control_files = (‘/u01/app/oracle/oradata/orcl/ora_control01’, ‘/u01/app/oracle/oradata/orcl/ora_control02’)
compatible =’11.2.0′
4.修改CREATE DATABASE文
拷贝在线文档的CREATE DATABASE文模板
Home / Database / Oracle Database Online Documentation 11g Release 2 (11.2) / Database Administration
Database Administrator’s Guide
https://docs.oracle.com/cd/E11882_01/server.112/e25494/create.htm#ADMIN11085
>Specifying CREATE DATABASE Statement Clauses
修改成以下内容:
CREATE DATABASE orcl
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 (‘/u01/app/oracle/oradata/orcl/redo01a.log’) SIZE 100M ,
GROUP 2 (‘/u01/app/oracle/oradata/orcl/redo02a.log’) SIZE 100M ,
GROUP 3 (‘/u01/app/oracle/oradata/orcl/redo03a.log’) SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE ‘/u01/app/oracle/oradata/orcl/system01.dbf’ SIZE 3250M REUSE
SYSAUX DATAFILE ‘/u01/app/oracle/oradata/orcl/sysaux01.dbf’ SIZE 3250M REUSE
DEFAULT TABLESPACE users
DATAFILE ‘/u01/app/oracle/oradata/orcl/users01.dbf’
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE ‘/u01/app/oracle/oradata/orcl/temp01.dbf’
SIZE 20M REUSE
UNDO TABLESPACE UNDOTBS1
DATAFILE ‘/u01/app/oracle/oradata/orcl/undotbs01.dbf’
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
5.
通过initorcl.ora创建spfile,并启动数据库Nomount状态,创建数据库。
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 8 11:04:03 2018
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 836976640 bytes
Fixed Size 1348160 bytes
Variable Size 490737088 bytes
Database Buffers 339738624 bytes
Redo Buffers 5152768 bytes
SQL> CREATE DATABASE orcl
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 (‘/u01/app/oracle/oradata/orcl/redo01a.log’) SIZE 100M ,
GROUP 2 (‘/u01/app/oracle/oradata/orcl/redo02a.log’) SIZE 100M ,
GROUP 3 (‘/u01/app/oracle/oradata/orcl/redo03a.log’) SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE ‘/u01/app/oracle/oradata/orcl/system