现在的位置: 首页 > 数据库 > 正文

redhat6.4中手动创建oracle11g数据库

2014年12月28日 数据库 ⁄ 共 2161字 ⁄ 字号 暂无评论

确定好数据库名和实例名

1.设置环境变量

2.创建需要的目录

  mkdir -p $ORACLE_BASE/oradata/DB_NAME

  mkdir -p $ORACLE_BASE/admin/<sid>/adump

  mkdir -p $ORACLE_BASE/flash_recovery_area

3.创建参数文件pfile

cp $ORACLE_HOME/dbs/init.ora $ORACLE_HOME/dbs/initorcl.ora

内容如下

db_name='ORCL'

memory_target=1G

processes = 300

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

audit_trail ='db'

db_block_size=8192

db_domain=''

db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

db_recovery_file_dest_size=2G

diagnostic_dest='/u01/app/oracle'

dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'

open_cursors=300 

remote_login_passwordfile='EXCLUSIVE'

undo_tablespace='UNDOTBS1'

# You may want to ensure that control files are created on separate physical

# devices

control_files = ('/u01/app/oracle/oradata/orcl/control01.ctl', '/u01/app/oracle/oradata/orcl/control02.ctl')

compatible ='11.2.0'

4.创建密码文件

[oracle@localhost dbs]$ orapwd file=orapworcl entries=5

Enter password for SYS: orcl

[oracle@localhost dbs]$ ls -l

total 8

-rw-r--r--. 1 oracle oinstall 2851 May 15  2009 init.ora

-rw-r-----. 1 oracle oinstall 2048 Dec 27 14:05 orapworcl

5.创建Oracle的建库脚本crtdb.sql,内容如下

create database orcl

user sys identified by orcl

user system identified by orcl

maxlogfiles 5

maxlogmembers 5

maxloghistory 1

maxdatafiles 1024

character set zhs16gbk

national character set al16utf16

extent management local

logfile

group 1('/u01/app/oracle/oradata/orcl/redo01.log') size 50m,

group 2('/u01/app/oracle/oradata/orcl/redo02.log') size 50m,

group 3('/u01/app/oracle/oradata/orcl/redo03.log') size 50m

datafile '/u01/app/oracle/oradata/orcl/system.dbf' size 300M reuse autoextend on maxsize unlimited

sysaux datafile '/u01/app/oracle/oradata/orcl/sysaux.dbf' size 200M reuse autoextend on maxsize unlimited

default tablespace users datafile '/u01/app/oracle/oradata/orcl/user01.dbf' size 100M reuse autoextend on next 5M maxsize unlimited

default temporary tablespace temp tempfile '/u01/app/oracle/oradata/orcl/temp01.dbf' size 100M reuse autoextend on next 5M maxsize unlimited

undo tablespace undotbs datafile '/u01/app/oracle/oradata/orcl/undo01.dbf' size 200M reuse autoextend on next 50M maxsize unlimited;

6.启动数据库到nomount状态

sqlplus / as sysdba

startup nomount

@crtdb.sql;

7.创建Oracle的数据字典

@$ORACLE_HOME/rdbms/admin/catalog.sql;

@$ORACLE_HOME/rdbms/admin/catproc.sql;

8.创建监听netca

原文:http://718693.blog.51cto.com/708693/1596675