首页 > 代码库 > CentOS 7 静默安装oracle 11R2 ,并手动创建数据库 createdatabase

CentOS 7 静默安装oracle 11R2 ,并手动创建数据库 createdatabase

官方文档:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCCADGD


需要的安装包:

binutils-2.23.52.0.1-12.el7.x86_64 

compat-libcap1-1.10-3.el7.x86_64 

compat-libstdc++-33-3.2.3-71.el7.i686

compat-libstdc++-33-3.2.3-71.el7.x86_64

gcc-4.8.2-3.el7.x86_64 

gcc-c++-4.8.2-3.el7.x86_64 

glibc-2.17-36.el7.i686 

glibc-2.17-36.el7.x86_64 

glibc-devel-2.17-36.el7.i686 

glibc-devel-2.17-36.el7.x86_64 

ksh

libaio-0.3.109-9.el7.i686 

libaio-0.3.109-9.el7.x86_64 

libaio-devel-0.3.109-9.el7.i686 

libaio-devel-0.3.109-9.el7.x86_64 

libgcc-4.8.2-3.el7.i686 

libgcc-4.8.2-3.el7.x86_64 

libstdc++-4.8.2-3.el7.i686 

libstdc++-4.8.2-3.el7.x86_64 

libstdc++-devel-4.8.2-3.el7.i686 

libstdc++-devel-4.8.2-3.el7.x86_64 

libXi-1.7.2-1.el7.i686 

libXi-1.7.2-1.el7.x86_64 

libXtst-1.2.2-1.el7.i686 

libXtst-1.2.2-1.el7.x86_64 

make-3.82-19.el7.x86_64 

sysstat-10.1.5-1.el7.x86_64

unixODBC-2.3.1-6.el7.x86_64 or later

unixODBC-2.3.1-6.el7.i686 or later

unixODBC-devel-2.3.1-6.el7.x86_64 or later

unixODBC-devel-2.3.1-6.el7.i686 or later


yum 进行安装

yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686



创建oinstall和dba组

/usr/sbin/groupadd oinstall

/usr/sbin/groupadd dba


创建oracle用户

/usr/sbin/useradd -g oinstall -G dba oracle


设置oracle用户密码

passwd oracle


验证创建是否正确

[root@node1001 ~]# id oracle

uid=1000(oracle) gid=1000(oinstall) 组=1000(oinstall),1001(dba)


配置内核参数

[root@docker ~]# vim /etc/sysctl.conf


# System default settings live in /usr/lib/sysctl.d/00-system.conf.

# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file

#

# For more information, see sysctl.conf(5) and sysctl.d(5).

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 536870912

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576


参数的值不能小于上面的配置,这是oracle官方建议的最小值,生产环境建议调整这些参数,以优化系统性能。


修改后使之生效

/sbin/sysctl -p


修改用户限制

vim  /etc/security/limits.conf


#在末尾添加

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240


创建安装目录

mkdir -p /u01/app/

chown -R oracle:oinstall /u01/app/

chmod -R 775 /u01/app/


配置环境变量

su - oracle

vim .bash_profile


#在文件尾追加:

#oracle数据库安装目录

export ORACLE_BASE=/u01/app

#oracle数据库路径    

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1

#oracle启动数据库实例名

export ORACLE_SID=orcl 


#添加系统环境变量

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

#添加系统环境变量

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib


使bash_profile生效:

source .bash_profile


解压oracle 数据库安装包

unzip p13390677_112040_Linux-x86-64_1of7.zip

unzip p13390677_112040_Linux-x86-64_2of7.zip


修改静默安装配置文件 /home/oracle 为oracle安装文件目录

vim /home/oracle/database/response/db_install.rsp


配置内容为:

oracle.install.option=INSTALL_DB_SWONLY     // 安装类型

ORACLE_HOSTNAME=node1001// 主机名称(hostname查询)

UNIX_GROUP_NAME=oinstall     // 安装组

INVENTORY_LOCATION=/u01/app/oraInventory   //INVENTORY目录(不填就是默认值)

SELECTED_LANGUAGES=en,zh_CN,zh_TW // 选择语言

ORACLE_HOME=/u01/app/product/11.2.0.4/dbhome_1    //oracle_home

ORACLE_BASE=/u01/app                      //oracle_base

oracle.install.db.InstallEdition=EE     // oracle版本

oracle.install.db.isCustomInstall=false   //自定义安装,否,使用默认组件

oracle.install.db.DBA_GROUP=dba /  / dba用户组

oracle.install.db.OPER_GROUP=oinstall // oper用户组

oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //数据库类型

oracle.install.db.config.starterdb.globalDBName=orcl //globalDBName

oracle.install.db.config.starterdb.SID=orcl      //SID

oracle.install.db.config.starterdb.memoryLimit=81920 //自动管理内存的内存(M)

oracle.install.db.config.starterdb.password.ALL=oracle //设定所有数据库用户使用同一个密码

SECURITY_UPDATES_VIA_MYORACLESUPPORT=false         //(手动写了false)

DECLINE_SECURITY_UPDATES=true   //设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)


开始静默安装

[oracle@node1001 database]$ ./runInstaller -silent -responseFile /home/oracle/database/response/db_install.rsp


查看安装目录

tail -f /u01/app/oraInventory/logs/installActions2016-08-31_06-56-29PM.log


出现类似如下提示表示安装完成:


------------------------------------------------------------------------

The following configuration scripts need to be executed as the "root" user. 

#!/bin/sh 

#Root scripts to run

 

/u01/app/oraInventory/orainstRoot.sh

/u01/app/product/11.2.0/db_1/root.sh

To execute the configuration scripts:

 1. Open a terminal window 

2. Log in as "root" 

3. Run the scripts 

4. Return to this window and hit "Enter" key to continue 


Successfully Setup Software.


切换到root用户执行sh脚本

su - root
/u01/app/oraInventory/orainstRoot.sh
/u01/app/product/11.2.0.4/dbhome_1/root.sh


切换到oracle用户,配置监听程序

su - oracle

netca /silent /responsefile /home/oracle/database/response/netca.rsp


手动编辑监听文件

vim $ORACLE_HOME/network/admin/listener.ora


监听文件内容

# listener.ora Network Configuration File: 

/u01/app/product/11.2.0.4/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.


#LISTENER =

#  (DESCRIPTION_LIST =

#    (DESCRIPTION =

#      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

#      (ADDRESS = (PROTOCOL = TCP)(HOST = node1003)(PORT = 1521))

#    )

#  )


#ADR_BASE_LISTENER = /u01/app

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = orcl)

      (ORACLE_HOME = /u01/app/product/11.2.0.4/dbhome_1)

      (SID_NAME = orcl)

    )

  )

LISTENER =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.64.4)(PORT = 1521))

  )


启动监听程序

lsnrctl start


编辑数据库控制文件,根据实际情况编辑

vim $ORACLE_HOME/dbs/initorcl.ora


*.audit_file_dest=‘/u01/app/admin/orcl/adump‘

*.audit_trail=‘db‘

*.compatible=‘11.2.0.4‘

*.control_files=‘/u01/app/oradata/orcl/ora_control1‘

*.db_block_size=8192

*.db_domain=‘‘

*.db_name=‘orcl‘

*.db_recovery_file_dest_size=2G

*.db_recovery_file_dest=‘/u01/app/fast_recovery_area‘

*.diagnostic_dest=‘/u01/app‘

*.memory_target=8G

*.open_cursors=150

*.processes=300

*.remote_login_passwordfile=‘EXCLUSIVE‘

*.undo_tablespace=‘UNDOTBS1‘


启动数据库,准备创建数据库

sqlplus / as sysdba

startup mount;


=======手动创建数据库语句如下:=============================================

根据实际情况执行调整

create database orcl

 maxlogfiles 5

 maxlogmembers 5

 maxdatafiles 100

 maxinstances 1

 logfile

 group 1 (‘/u01/app/oradata/orcl/redo1.log‘) size 200m,

 group 2 (‘/u01/app/oradata/orcl/redo2.log‘) size 200m,

 group 3 (‘/u01/app/oradata/orcl/redo3.log‘) size 200m

 datafile

 ‘/u01/app/oradata/orcl/system.dbf‘ size 200m reuse

 sysaux datafile ‘/u01/app/oradata/orcl/sysaux.dbf‘ size 300m

 default tablespace users

 datafile ‘/u01/app/oradata/orcl/userdata.dbf‘ size 300m

 undo tablespace undotbs1

 datafile ‘/u01/app/oradata/orcl/undo1.dbf‘ size 300m

 default temporary tablespace temp1

 tempfile ‘/u01/app/oradata/orcl/temp01.dbf‘

 size 100m reuse

 character set al32utf8


手动创建完数据库后,sqlplus 下先后执行相关脚本文件

@$ORACLE_HOME/rdbms/admin/catalog.sql


@$ORACLE_HOME/rdbms/admin/catproc.sql


执行完成之后,数据库创建完成,查看数据库状态

select status from v$instance;


本文出自 “奇杰的技术博客” 博客,转载请与作者联系!

CentOS 7 静默安装oracle 11R2 ,并手动创建数据库 createdatabase