首页 » Linux » Oracle 11g 静默安装及图形安装错误及竖条

Oracle 11g 静默安装及图形安装错误及竖条

 
文章目录

Oracle 11g 静默安装

说明:

系统:centos 6.x
安装目录: /data/oracle是$ORACLE_BASE目录
主机名: oracle
oracle版本: 11.2.0.1.0 EE

第一步:一键准备环境脚本

脚本可以多次运行,有设置aliyun的epel源和yum源,内容如下:

#!/bin/bash
# create a auto-install oracle_11g-db
# Author: clc
# create data: 2017-04-28
# OS: CENTOS 6
# set hostname is oracle

function env_prepare(){
# stop iptables and selinux
/etc/init.d/iptables stop && chkconfig --level 35 iptables off
setenforce 0 && sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config 

#change hostname
hostname oracle
a=`grep -c  "HOSTNAME=oracle" /etc/sysconfig/network`
if [ $a -lt 1 ]
    then
		echo "HOSTNAME=oracle">>/etc/sysconfig/network
fi

#add hostname to hosts
a_ip=`ifconfig |awk -F "[: ]+" '{if(NR==2)print $4}'`
bb=`grep -c "oracle" /etc/hosts`
if [ $bb -lt 1 ]
	then
	echo "${a_ip}  oracle" >>/etc/hosts
fi


#change repo and epel yum
ee=`ls /etc/yum.repos.d/|grep epel.repo|wc -l`
if [ $ee -lt 1 ]
	then
	mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup\
	&& wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo\
	&& wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
fi

#software install

yum install gcc make binutils gcc-c++ compat-libstdc++-33 \
elfutils-libelf-devel elfutils-libelf  libaio libaio-devel \
numactl-devel sysstat unixODBC unixODBC-devel  glibc  \
glibc-common  glibc-devel glibc-headers   libgcc libgomp\
libstdc++ libstdc++-devel pdksh unzip -y

cc=`rpm -aq|grep pdksh|wc -l`
dd=`ls |grep "pdksh"|wc -l`
if [ $cc -lt 1 -a $dd -lt 1 ]
	then
	wget ftp://ftp.linux.ro/centos/5.11/os/i386/CentOS/pdksh-5.2.14-37.el5_8.1.i386.rpm \
	&& rpm -ivh pdksh-5.2.14-37.el5_8.1.i386.rpm
fi

#create user
b=`grep -c "oinstall" /etc/group`
c=`grep -c "dba" /etc/group`
d=`grep -c "oracle" /etc/passwd`
if [ $b -lt 1 ]
	then
	groupadd oinstall 
fi

if [ $c -lt 1 ]
	then
	groupadd dba
fi

if [ $d -lt 1 ]
	then
	useradd -G dba,oinstall -g dba oracle
fi


#mkdir directory
mkdir /data/oracle/product/11.2.0/db_1/ -p
mkdir /data/oraInventory -p

#change directory privileges 
chown -R oracle:oinstall /data

#enviroment prepare
e=`egrep -c  "2047|16384|1024|65536" /etc/security/limits.conf `
if [ $e -lt 4 ]
	then
	echo "oracle soft nproc 2047" >>/etc/security/limits.conf
	echo "oracle hard nproc 16384" >>/etc/security/limits.conf
	echo "oracle soft nofile 1024" >>/etc/security/limits.conf
	echo "oracle hard nofile  65536" >>/etc/security/limits.conf
fi

#kernel set
f=`egrep -c  "1048576|6815744|2097152|4096|9000|32000|262144|\
4194304|262144|1048576" /etc/sysctl.conf`
if [ $f -lt 10 ]
	then
	echo -e  "fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1073741824 
#!!!this is half of physical memory 
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" >>/etc/sysctl.conf && \
sysctl -p
fi


#oracle env 
g=`egrep -c "ORACLE_HOME|ORACLE_BASE"  /home/oracle/.bash_profile` 
if [ $g -lt 2 ]
	then
	echo 'export ORACLE_BASE=/data/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LANG=C' >/tmp/oracle_env && \
	su - oracle -c -l "cat /tmp/oracle_env >>/home/oracle/.bash_profile"
fi


#add swap space
ff=`ls /home|grep "swapfile"|wc -l `
if [ $ff -lt 1 ]
	then
	dd if=/dev/zero of=/home/swapfile bs=1M count=2048 && \
	mkswap /home/swapfile && \
	swapon /home/swapfile 
fi

}


function main(){
env_prepare
}
main



第二步:上传oracle软件

上传软件之后,解压:unzip 1.zip && unzip 2.zip
可以把解压后的安装软件放在/tmp目录或在/data/目录下,要更改一下属主,chown -R oracle ./database

第三步:安装

进入到软件database目录,安装的命令如下:

./runInstaller -silent -responseFile /home/oracle/db_install.rsp  -ignorePrereq

rsp文件在软件下的./database/response/目录下有,我们可以根据那个更改,而且也有参数的说明。
db_install.rsp文件如下:

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracle
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=/data/oracle/product/11.2.0/db_1
ORACLE_BASE=/data/oracle
oracle.install.db.InstallEdition=EE
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracle
UNIX_GROUP_NAME=oinstall
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=/data/oracle/product/11.2.0/db_1
ORACLE_BASE=/data/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=dba
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=
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=

安装是在后台完成的,最后安装成功之后会叫你用root执行两个脚本,你可以查看安装目录的大小,应该是不断增加的,如下:

#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.

第三步:配置监听程序

netca.rsp可以直接使用./database/response目录下的netca.rsp文件,配置命令如下:

netca /silent /responsefile /data/database/response/netca.rsp

有没有成功可以查看输出,安装之后会有1521端口,而且是已经启动的。

第四步:静默安装数据库

命令如下:

dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname orcl -sid orcl -responseFile NO_VALUE -characterSet ZHS16GBK -memoryPercentage 30 -syspassword 123456 -systempassword 123456 -dbsnmppassword 123456 -emConfiguration LOCAL

第五步:增加一个表空间和用户,用PL/SQL developer测试连接

增加一个clctest1的临时表空间和表空间,用户是clc1,增加的命令如下:

create temporary tablespace clctest1_temp tempfile '/data/oracle/oradata/orcl/clctest1_temp.dbf'  size 32m  autoextend on next 32m maxsize unlimited;

create tablespace clctest1 logging datafile '/data/oracle/oradata/orcl/clctest1.dbf' size 32m autoextend on next 32m maxsize unlimited extent management local;

create user clc1 identified by 123456 account unlock default tablespace clctest1 temporary tablespace clctest1_temp;

grant connect,resource,dba to clc1;

然后在客户端的tnsname.ora设置如下:

# tnsnames.ora Network Configuration File: D:\app\Adnimitrator\product\11.2.0\client_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
CLC =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.180 )(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = clc)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.183 )(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

图形安装报错


安装到68%的时候会报错:error in invoking target install of makefile /u01/xxxxxx/ins_cts.mk see
处理方法:
修改/u01/app/oracle/product/11.2.0/dbhome_1/ctx/lib/ins_ctx.mk,将 ctxhx: $(CTXHXOBJ) $(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK) 修改为: ctxhx: $(CTXHXOBJ) -static $(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK) /usr/lib64/stdc.a 点击继续安装。接着又提示”Error in invoking target ‘agent nmhs’ of makefile ‘/u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk.’ ,解决方法:在makefile中添加链接libnnz11库的参数 修改/u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk,将 $(MK_EMAGENT_NMECTL)修改为:$(MK_EMAGENT_NMECTL) -lnnz11 点击继续安装。

弹框竖条

安装的时候弹出对话框看不到或者一个竖条,可以在安装的时候加上以下参数:
./runInstaller -jreLoc /etc/alternatives/jre_1.8.0 (这个jre你把基础环境弄好就会有的,不需要安装jdk环境)

原文链接:Oracle 11g 静默安装及图形安装错误及竖条,转载请注明来源!

0