Oracle静默安装

前端之家收集整理的这篇文章主要介绍了Oracle静默安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

测试CentOS 6.5_x64下静默安装Oracle 11g R2数据库


【一、下载地址】

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

Oracle 11g 联机文档:

http://www.oracle.com/pls/db112/homepage


【二、系统要求】

内存:1G(官方最低要求1G)

硬盘:40G(企业版安装所需4.29G和1.7G数据文件


检查的命令

内存

# grep MemTotal /proc/meminfo

MemTotal: 1906488 kB


交换空间

# grep SwapTotal /proc/meminfo

SwapTotal: 8388604 kB


磁盘空间

# df -ah

Filesystem Size Used Avail Use% Mounted on

/dev/sda2 42G 6.0G 34G 16% /

proc 0 0 0 - /proc

sysfs 0 0 0 - /sys

devpts 0 0 0 - /dev/pts

tmpfs 931M 0 931M 0% /dev/shm

none 0 0 0 - /proc/sys/fs/binfmt_misc


【三、安装前系统准备】

1、修改主机名

# sed -i "s/HOSTNAME=localhost.localdomain/HOSTNAME=oracledb/" /etc/sysconfig/network

# hostname dbserver


2、添加主机名与IP对应记录

#vi /etc/hosts

10.10.10.111 dbserver


3、关闭Selinux

# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config

# setenforce 0


# rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

binutils-2.20.51.0.2-5.42.el6.x86_64

compat-libstdc++-33-3.2.3-69.el6.x86_64

elfutils-libelf-0.158-3.2.el6.x86_64

elfutils-libelf-devel-0.158-3.2.el6.x86_64

gcc-4.4.7-11.el6.x86_64

gcc-c++-4.4.7-11.el6.x86_64

package glibc-2.5 is not installed

glibc-common-2.12-1.149.el6.x86_64

glibc-devel-2.12-1.149.el6.x86_64

glibc-devel-2.12-1.149.el6.i686

glibc-headers-2.12-1.149.el6.x86_64

ksh-20120801-21.el6.x86_64

libaio-0.3.107-10.el6.x86_64

libaio-devel-0.3.107-10.el6.i686

libaio-devel-0.3.107-10.el6.x86_64

libgcc-4.4.7-11.el6.x86_64

libgcc-4.4.7-11.el6.i686

libstdc++-4.4.7-11.el6.x86_64

libstdc++-4.4.7-11.el6.i686

libstdc++-devel-4.4.7-11.el6.x86_64

libstdc++-devel-4.4.7-11.el6.i686

make-3.81-20.el6.x86_64

sysstat-9.0.4-27.el6.x86_64

unixODBC-2.2.14-14.el6.i686

unixODBC-2.2.14-14.el6.x86_64

unixODBC-devel-2.2.14-14.el6.x86_64

unixODBC-devel-2.2.14-14.el6.i686

#


4、创建用户和组(root用户:创建Oracle安装组oinstall,数据库管理员组dba,及oracle用户)

#

# groupadd -g 500 oinstall

# groupadd -g 501 dba

# useradd -u 500 -g oinstall -G dba oracle (主组oinstall,其它组:dba)

# passwd oracle


5、修改内核参数

# vi /etc/sysctl.conf #末尾添加如下

net.ipv4.ip_local_port_range = 9000 65500

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 10523004

kernel.shmmax = 6465333657

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

# sysctl -p #使配置生效


6、修改系统资源限制

# vi /etc/security/limits.conf #末尾添加如下

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536


7、修改用户验证选项,增加如下内容

# vi /etc/pam.d/login

session required /lib/security/pam_limits.so

session required pam_limits.so



8、修改用户配置文件

# vi/ etc/profile

if [ $USER = "oracle" ]; then

if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi


9、创建安装目录及设置权限

# mkdir -p /u01/app/oracle/product/11.2.0/db_1

# mkdir -p /u01/app/oraInventory

# chown -R oracle:oinstall /u01/app/oracle

# chown -R oracle:oinstall /u01/app/oraInventory

# chmod -R 775 /u01/app/oracle/product/11.2.0/db_1

# chmod -R 775 /u01/app/oraInventory



# vim /etc/oraInst.loc

inventory_loc=/u01/app/oraInventory

inst_group=oinstall

# chown oracle:oinstall /etc/oraInst.loc

# chmod 644 /etc/oraInst.loc



[root@dbserver soft]# mkdir -p /u01/app/oracle/product/11.2.0/db_1

[root@dbserver soft]# mkdir -p /u01/app/oraInventory

[root@dbserver soft]# chown -R oracle:oinstall /u01/app/oracle

[root@dbserver soft]# chown -R oracle:oinstall /u01/app/oraInventory

[root@dbserver soft]# chmod -R 775 /u01/app/oracle/product/11.2.0/db_1

[root@dbserver soft]# chmod -R 775 /u01/app/oraInventory



10、设置oracle环境变量

#su - oracle

$ vim ~/.bash_profile

export ORACLE_BASE=/u01/app/oracle

export ORACLE_SID=ORADB

注意,除了ORACLE_BASE和ORACLE_SID,(/etc/profile和.bash_profile中)不设置任何oracle相关环境变量(ORACLE_HOME,PATH,LD_LIBRARY_PATH等)。


完成后查看环境变量是否完成:

$ env |grep ORA

ORACLE_SID=ORADB

ORACLE_BASE=/u01/app/oracle


【四、安装Oracle】

1. 解压Oracle软件

# unzip linux.x64_11gR2_database_1of2.zip

# unzip linux.x64_11gR2_database_1of2.zip


2.图形界面安装略。(通常的生产环境是不安装图形界面的)

# xhost + #使所有用户都能访问图形桌面

# su - oracle

#.~/database/runInstaller

输入接受一些安全问题的邮件地址


3.字符界面下安装oracle

解压后得到database目录,其中包含response目录,该目录中有三个rsp文件,用来作为静默安装时的应答文件的模板。


三个文件作用分别是:

db_install.rsp:安装应答

dbca.rsp: 创建数据库应答

netca.rsp: 建立监听、本地服务名等网络设置的应答

将db_install.rsp备份一份,在其基础上修改内容,将create database段中内容设置好即可。


4.修改静默安装的配置文件

$ less /soft/database/response/db_install.rsp |grep -v "#"|grep -v "^$"

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

oracle.install.option=INSTALL_DB_SWONLY

ORACLE_HOSTNAME=oracledb

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/u01/app/oraInventory

SELECTED_LANGUAGES=en,zh_CN

ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1

ORACLE_BASE=/opt/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.isCustomInstall=false

oracle.install.db.customComponents=oracle.server:11.2.0.4.0,oracle.sysman.ccr:10.2.4.0.0,oracle.xdk:11.2.0.4.0,oracle.rdbms.oci:11.2.0.4.0,oracle.network:11.2.0.4.0,oracle.network.listener:11.2.0.4.0,oracle.rdbms:11.2.0.4.0,oracle.options:11.2.0.4.0,oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,orcle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0

oracle.install.db.DBA_GROUP=dba

oracle.install.db.OPER_GROUP=oinstall

oracle.install.db.CLUSTER_NODES=

oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

oracle.install.db.config.starterdb.globalDBName=ORADB

oracle.install.db.config.starterdb.SID=ORADB

oracle.install.db.config.starterdb.characterSet=AL32UTF8

oracle.install.db.config.starterdb.memoryOption=true

oracle.install.db.config.starterdb.memoryLimit=81920

oracle.install.db.config.starterdb.installExampleSchemas=false

oracle.install.db.config.starterdb.enableSecuritySettings=true

oracle.install.db.config.starterdb.password.ALL=oracle

oracle.install.db.config.starterdb.password.SYS=

oracle.install.db.config.starterdb.password.SYSTEM=

oracle.install.db.config.starterdb.password.SYSMAN=

oracle.install.db.config.starterdb.password.DBSNMP=

oracle.install.db.config.starterdb.control=DB_CONTROL

oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false

oracle.install.db.config.starterdb.dbcontrol.emailAddress=

oracle.install.db.config.starterdb.dbcontrol.SMTPServer=

oracle.install.db.config.starterdb.automatedBackup.enable=false

oracle.install.db.config.starterdb.automatedBackup.osuid=

oracle.install.db.config.starterdb.automatedBackup.ospwd=

oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE

oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

oracle.install.db.config.asm.diskGroup=

oracle.install.db.config.asm.ASMSNMPPassword=

MYORACLESUPPORT_USERNAME=

MYORACLESUPPORT_PASSWORD=

SECURITY_UPDATES_VIA_MYORACLESUPPORT=

DECLINE_SECURITY_UPDATES=true //一定要设为 true

PROXY_HOST=

PROXY_PORT=

PROXY_USER=

PROXY_PWD=


5.开始静默安装

$ /opt/database/runInstaller -silent -force -responseFile /soft/database/response/db_install.rsp

[oracle@oracledb database]$ ./runInstaller -silent -force -responseFile /soft/database/response/db_install.rsp

正在启动 Oracle Universal Installer...


检查临时空间: 必须大于 120 MB。 实际为 33830 MB 通过

检查交换空间: 必须大于 150 MB。 实际为 8191 MB 通过

准备从以下地址启动 Oracle Universal Installer /tmp/OraInstall2017-09-20_10-00-29AM. 请稍候...[oracle@dbserver database]$ 可以在志:

/u01/app/oraInventory/logs/installActions2017-09-20_10-00-29AM.log

Oracle Database 11g 的 安装 已成功。

请查看 '/u01/app/oraInventory/logs/silentInstall2017-09-20_10-00-29AM.log' 以获取详细资料。


/opt/app/oracle/oraInventory/orainstRoot.sh

/opt/app/oracle/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.

安装完毕后会提示上述的信息,按照要求执行上述脚本即可。


6.设置oracle用户.bahs_profile文件

su - oralce

修改.bash_profile如下:

export PATH

export ORACLE_BASE=/u01/app/oracle

export ORACLE_SID=ORADB

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export TNS_ADMIN=$ORACLE_HOME/network/admin

export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin

export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib

export ORACLE_OWNER=oracle

export SPFILE_PATH=$ORACLE_HOME/dbs

export ORA_NLS10=$ORACLE_HOME/nls/data



【五、配置监听程序】

[oracle@oracledb bin]$ $ORACLE_HOME/bin/netca /silent /responseFile /soft/database/response/netca.rsp

Parsing command line arguments:

Parameter "silent" = true

Parameter "responsefile" = /soft/database/response/netca.rsp

Done parsing command line arguments.

Oracle Net Services Configuration:

Profile configuration complete.

Listener "LISTENER" already exists.

Oracle Net Services configuration successful. The exit code is 0


启动监控程序

$lsnrctl start或/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER

[oracle@dbserver database]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-SEP-2017 10:26:36

Copyright (c) 1991,2013,Oracle. All rights reserved.

Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production

System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

STATUS of the LISTENER

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

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date 20-SEP-2017 10:26:38

Uptime 0 days 0 hr. 0 min. 20 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))

The listener supports no services

The command completed successfully

$



静默dbca建库

oracle@oracledb]$ vim /soft/database/response/dbca.rsp

GDBNAME = "ORADB" //78行 全局数据库的名字=SID+主机域名

SID="ORADB" //149行 SID

CHARACTERSET="AL32UTF8" //415行 编码

NATIONALCHARACTERSET="UTF8" //425行 编码


[oracle@oracledb response]$ $ORACLE_HOME/bin/dbca -silent -responseFile /soft/database/response/dbca.rsp

Enter SYS user password:

Enter SYSTEM user password:

复制数据库文件

1% 已完成

3% 已完成

37% 已完成

正在创建并启动 Oracle 实例

40% 已完成

45% 已完成

50% 已完成

55% 已完成

56% 已完成

60% 已完成

62% 已完成

正在进行数据库创建

66% 已完成

70% 已完成

73% 已完成

85% 已完成

96% 已完成

100% 已完成

有关详细信息,请参阅日志文件 "/u01/app/oracle/cfgtoollogs/dbca/ORADB/ORADB.log"。

[oracle@dbserver db_1]$


启动数据库

[oracle@oracledb ~]$ sqlplus / as sysdba

sql*Plus: Release 11.2.0.1.0 Production on Mon Feb 16 14:26:57 2015

Copyright (c) 1982,2009,Oracle. All rights reserved.

Connected to an idle instance.

sql> startup

ORACLE instance started.


Total System Global Area 3290345472 bytes

Fixed Size 2217832 bytes

Variable Size 1795164312 bytes

Database Buffers 1476395008 bytes

Redo Buffers 16568320 bytes

Database mounted.

Database opened.

sql>

猜你在找的Oracle相关文章