由于当前环境已有一个数据库实例,但这并不影响我们创建一个新的实例sun
当前系统实例
[oracle@DBA2 dbs]$ env |grep ORACLE
ORACLE_SID=orcl1
ORACLE_BASE=/u/oracle
ORACLE_HOME=/u/oracle/product/11.2
[oracle@DBA2 dbs]$
export $ORACLE_SID=sun
orapwd file=$ORACLE_HOME/dbs/orapwsun password=oracle entries=10
[oracle@DBA2 dbs]$ vi initsun.ora
db_name=sun
control_files='/oradata/sun/control01.ctl'
sga_target=250M
undo_management=auto
undo_tablespace=undotbs
其中最主要的参数是db_name、control_files和sga_target
我将数据文件和日志文件和控制文件放在了一个目录下,我这里只用了一个控制文件。当然,最好使用两个或三个控制文件并存放在不同路径下,以保证数据文件的冗余。
[oracle@DBA2 ~]$ mkdir /oradata/sun
[oracle@DBA2 admin]$ mkdir /u/oracle/admin/adump
[oracle@DBA2 admin]$ mkdir /u/oracle/admin/bdump
[oracle@DBA2 admin]$ mkdir /u/oracle/admin/pfile
SQL> create spfile from pfile;
File created.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 418484224 bytes
Fixed Size 1336932 bytes
Variable Size 281020828 bytes
Database Buffers 130023424 bytes
Redo Buffers 6103040 bytes
SQL>
CREATE DATABASE sun
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/oradata/sun/redo01a.log') SIZE 20M,
GROUP 2 ('/oradata/sun/redo02a.log') SIZE 20M,
GROUP 3 ('/oradata/sun/redo03a.log') SIZE 20M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 2
CHARACTER SET AL32UTF8
DATAFILE '/oradata/sun/system01.dbf' SIZE 400M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/oradata/sun/sysaux01.dbf' SIZE 400M REUSE
DEFAULT TABLESPACE users
DATAFILE '/oradata/sun/users01.dbf' SIZE 20M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts01
TEMPFILE '/oradata/sun/tempts01.dbf' SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/oradata/sun/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
/
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql
OK,至此手动创建Oracle数据库完成,实验证明手动建库比DBCA建库要来的方便和快速,基本流程也就分以上几个步骤