Oracle静默安装

最近需要远程安装一个数据库,由于没有桌面环境,xmanage由于各种原因不能使用,所以就研究了下静默安装,特做笔记以备后用。

一.安装前准备

    1.安装所需的依赖包

     yum  install gcc gcc-c++ make binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel unixODBC unixODBC-devel -y

2.增加oinstall和dba组把oracle加到这两个组中,设置Oracle密码

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

3.在root用户下创建u01目录及子目录,并改变其权限

mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1         
chown -R oracle:oinstall /u01                            
chmod -R 775 /u01 

4.修改oracle内核参数

vi /etc/sysctl.conf              编辑sysctl.conf文件,加入以下内容    

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152        
kernel.shmmax = 2147483648    
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

/sbin/sysctl -p                使配置生效 

5.设置Oracle用户Shell limit

vi /etc/security/limits.conf        编辑limits.conf文件,加入以下内容

# For Oracle

oracle  soft    nproc   2047

oracle  hard    nproc   16384

oracle  soft    nofile  1024

oracle  hard    nofile  65536

6.修改网络设置

chkconfig iptables off    --关闭防火墙的自动启动

service iptables stop   --关闭防火墙

sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config # setenforce 0 --关闭selinux

vi /etc/hosts

新加一条ip对应主机名的配置

7.配置Oracle用户环境变量

su – oracle
vi ~/.bash_profile                   编辑.bash_profile文件,加入以下内容

# For Oracle
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=headdb; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export CLASSPATH

source ~/.bash_profile                   使设置生效

8.拷贝Oracle安装吧到/tmp/ 并解压

unzip linux.x64_11gR2_database_1of2.zip

unzip linux.x64_11gR2_database_2of2.zip

9.修改/tmp/database/response/的db_install.rsp文件

 cat /tmp/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=zhjc
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.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=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=ZHS16GBK
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1500
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
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=

10.开始安装

cd /tmp/database/

./runInstaller -silent -ignorePrereq -force -responseFile /tmp/database/response/db_install.rsp

11.安装过程

[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
   CAUSE: The Central Inventory is located in the Oracle base.
   ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
 /u01/app/oracle/oraInventory/logs/installActions2019-05-13_11-31-34AM.log
The following configuration scripts need to be executed as the "root" user. 
 #!/bin/sh 
 #Root scripts to run

/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/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.

12.按提示用root执行脚本

/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh

13.配置监听程序

export DISPLAY=:0.0
$ORACLE_HOME/bin/netca -silent -responseFile /tmp/database/response/netca.rsp

14.创建库

修改配置文件  创建

vi /tmp/database/response/dbca.rsp

GDBNAME = " orcl.dg01"    //全局数据库的名字=SID+主机域名

SID="orcl" // SID

$ORACLE_HOME/bin/dbca -silent -responseFile /tmp/database/response/dbca.rsp 

至此数据库安装完成

你可能感兴趣的:(Oracle,静默安装,Oracle)