阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 7.5下Oracle 11gR2手工建库过程

173次阅读
没有评论

共计 2760 个字符,预计需要花费 7 分钟才能阅读完成。

已提前最小化安装 CentOS 7.5 和 Oracle 11gR2 裸数据库软件,记录下手工建库过程,方便了解 dbca 建库原理。

1. 环境变量设置

# 设置环境变量

cat >> /home/oracle/.bash_profile <<EOF

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

export ORACLE_SID=std1

export PATH=$ORACLE_HOME/bin:/sbin:/usr/sbin:$PATH

EOF

source /home/oracle/.bash_profile

# 设置命令别名

cat >> /home/oracle/.bashrc <<EOF

alias dbn=’cd $ORACLE_HOME/network/admin’

alias dbs=’cd $ORACLE_HOME/dbs’

alias sql=’sqlplus / as sysdba’

EOF

source /home/oracle/.bashrc

# 设置 sqlplus 环境

cat >> $ORACLE_HOME/sqlplus/admin/glogin.sql <<EOF

Define _editor=’vi’

Set sqlprompt “_user’@’_connect_identifier> “

set time on

set timing on

set pagesize 40

set linesize 120

EOF

2. 创建所需目录

mkdir -p $ORACLE_BASE/admin/std1/adump && mkdir -p $ORACLE_BASE/oradata/std1 && mkdir -p $ORACLE_BASE/flash_recovery_area

3. 生成密码文件

dbn

orapwd file=orapwstd1 password=oracle entries=3

4. 创建 pfile 参数文件

cat init.ora | grep -v ^# | grep -v ^$ > initstd1.ora

%s/ORCL/std1/g

%s/orcl/std1/g

%s#<ORACLE_BASE>#$ORACLE_BASE/g

%s#ora_control1#/u01/app/oracle/oradata/std1/ora_control1.ctl#g

%s#ora_control2#/u01/app/oracle/oradata/std1/ora_control2.ctl#g

db_name=’std1′

memory_target=1G

processes = 150

audit_file_dest=’$ORACLE_BASE/admin/std1/adump’

audit_trail =’db’

db_block_size=8192

db_domain=”

db_recovery_file_dest=’$ORACLE_BASE/flash_recovery_area’

db_recovery_file_dest_size=2G

diagnostic_dest=’$ORACLE_BASE’

dispatchers='(PROTOCOL=TCP) (SERVICE=std1XDB)’

open_cursors=300

remote_login_passwordfile=’EXCLUSIVE’

undo_tablespace=’UNDOTBS1′

control_files = (/u01/app/oracle/oradata/std1/ora_control1.ctl,/u01/app/oracle/oradata/std1/ora_control2.ctl)

compatible =’11.2.0′

5. 生成 spfile 参数文件

mount -o remount,size=4g /dev/shm   

sqlplus / as sysdba

startup nomount

create spfile from pfile;

6. 执行创建数据库语句

vi crtdb.sql

CREATE DATABASE std1

  USER SYS IDENTIFIED BY oracle

  USER SYSTEM IDENTIFIED BY oracle

  LOGFILE GROUP 1 (‘/u01/app/oracle/oradata/std1/redo01a.log’,’/u01/app/oracle/oradata/std1/redo01b.log’) SIZE 100M BLOCKSIZE 512,

          GROUP 2 (‘/u01/app/oracle/oradata/std1/redo02a.log’,’/u01/app/oracle/oradata/std1/redo02b.log’) SIZE 100M BLOCKSIZE 512

  MAXLOGFILES 5

  MAXLOGMEMBERS 5

  MAXLOGHISTORY 1

  MAXDATAFILES 100

  CHARACTER SET US7ASCII

  NATIONAL CHARACTER SET AL16UTF16

  EXTENT MANAGEMENT LOCAL

  DATAFILE ‘/u01/app/oracle/oradata/std1/system01.dbf’ SIZE 325M REUSE

  SYSAUX DATAFILE ‘/u01/app/oracle/oradata/std1/sysaux01.dbf’ SIZE 325M REUSE

  DEFAULT TABLESPACE users

      DATAFILE ‘/u01/app/oracle/oradata/std1/users01.dbf’

      SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

  DEFAULT TEMPORARY TABLESPACE tempts1

      TEMPFILE ‘/u01/app/oracle/oradata/std1/temp01.dbf’

      SIZE 20M REUSE

  UNDO TABLESPACE undotbs1

      DATAFILE ‘/u01/app/oracle/oradata/std1/undotbs01.dbf’      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

@crtdb.sql

7. 生成数据字典

vi crtdic.sql

@?/rdbms/admin/catalog.sql

@?/rdbms/admin/catproc.sql

conn system/oracle

@?/sqlplus/admin/pupbld.sql

exit

@crtdic.sql

8. 检查一哈

select * from v$version;

CentOS 7.5 下 Oracle 11gR2 手工建库过程

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计2760字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中