zjycy / FreeBsd/linux / cent os 6.6 x64 自动静默安装oracle 11gr...

0 0

   

cent os 6.6 x64 自动静默安装oracle 11gr2脚本

2017-02-22  zjycy

前提:centos 6.6已经做了basic安装,ip和主机名已设置.oracle安装文件p13390677_112040_Linux-x86-64_1of7.zip,p13390677_112040_Linux-x86-64_2of7.zip
放在/root下,pdksh-5.2.14-30.x86_64.rpm包放在/root下.
os:centos 6.6
oracle:11.2.0.4
IP:192.108.56.119
hostname:ct6602

---以下内容放在一个文本下,sh执行即可:
#!/bin/bash

##此处用于加载光驱安装缺少的包,也可改为网络方式.
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
mv /etc/yum.repos.d/*.repo /root/

cat > /etc/yum.repos.d/CentOS-Media.repo << EOF
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/cdrom/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
EOF

yum clean all
yum makecache

##配置操作系统
chkconfig iptables off
service iptables stop
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

cat >> /etc/hosts << EOF
192.108.56.119    ct6602
EOF

cat >> /etc/sysctl.conf << EOF
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF

sysctl -p

cat >> /etc/security/limits.conf  << EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF

##配置oracle用户
groupadd oinstall
groupadd dba
useradd -d /home/oracle -g oinstall -G dba oracle
echo 'system'|passwd --stdin oracle

cat >> /home/oracle/.bash_profile << EOF
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=ct6602
export ORACLE_TERM=xterm
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
ulimit -u 16384 -n 65536
umask 022
EOF
 .  /home/oracle/.bash_profile
 
mkdir -p /u01/app/oracle /u02/oradata /u03/archivelog /u09/orabackup
chown -R oracle.oinstall  /u01/app /u02/oradata /u03/archivelog /u09/orabackup
chmod -R 775 /u01/app

yum -y 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

rpm -ivh /root/pdksh-5.2.14-30.x86_64.rpm

yum -y install expect

mv /root/p13390677_112040_Linux-x86-64_* /home/oracle/

chown -R oracle.oinstall /home/oracle/p13390677_112040_Linux-x86-64_*

su - oracle -c 'unzip /home/oracle/p13390677_112040_Linux-x86-64_1of7.zip'
su - oracle -c 'unzip /home/oracle/p13390677_112040_Linux-x86-64_2of7.zip'

##配置安装响应文件
##db_install.rsp
su - oracle -c cat >> /home/oracle/db_install.rsp <
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_AND_CONFIG
ORACLE_HOSTNAME=ct6602
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/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.EEOptionsSelection=false
oracle.install.db.optionalComponents=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,oracle.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=dba
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=ct6602
oracle.install.db.config.starterdb.SID=ct6602
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=700
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=false
oracle.install.db.config.starterdb.password.ALL=system
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.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=/u02/oradata/
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=false
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
EOF

##netca.rsp
su - oracle -c cat > /home/oracle/netca.rsp << EOF
[GENERAL]
RESPONSEFILE_VERSION='11.2'
CREATE_TYPE='CUSTOM'
[oracle.net.ca]
INSTALLED_COMPONENTS={'server','net8','javavm'}
INSTALL_TYPE=''typical''
LISTENER_NUMBER=1
LISTENER_NAMES={'LISTENER'}
LISTENER_PROTOCOLS={'TCP;1521'}
LISTENER_START=''LISTENER''
NAMING_METHODS={'TNSNAMES','ONAMES','HOSTNAME'}
NSN_NUMBER=1
NSN_NAMES={'EXTPROC_CONNECTION_DATA'}
NSN_SERVICE={'PLSExtProc'}
NSN_PROTOCOLS={'TCP;HOSTNAME;1521'}
EOF

##dbca.rsp
su - oracle -c cat > /home/oracle/dbca.rsp << EOF
[GENERAL]
RESPONSEFILE_VERSION = '11.2.0'
OPERATION_TYPE = 'createDatabase'
[CREATEDATABASE]
GDBNAME = 'ct6602'
SID = 'ct6602'
TEMPLATENAME = 'General_Purpose.dbc'
CHARACTERSET = 'AL32UTF8'
NATIONALCHARACTERSET= 'AL16UTF16'

SYSPASSWORD = 'system'
SYSTEMPASSWORD = 'system'
DATAFILEDESTINATION =/u02/oradata
RECOVERYAREADESTINATION=/u09/orabackup
TOTALMEMORY = '700'
[createTemplateFromDB]
SOURCEDB = 'myhost:1521:orcl'
SYSDBAUSERNAME = 'system'
TEMPLATENAME = 'My Copy TEMPLATE'
[createCloneTemplate]
SOURCEDB = 'orcl'
TEMPLATENAME = 'My Clone TEMPLATE'
[DELETEDATABASE]
SOURCEDB = 'orcl'
[generateScripts]
TEMPLATENAME = 'New Database'
GDBNAME = 'orcl11.us.oracle.com'
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = 'orcl11g.us.oracle.com'
NODELIST=
SYSDBAUSERNAME = 'sys'
[DELETEINSTANCE]
DB_UNIQUE_NAME = 'orcl11g.us.oracle.com'
INSTANCENAME = 'orcl11g'
SYSDBAUSERNAME = 'sys'
EOF

##安装oracle
su - oracle -c '/home/oracle/database/runInstaller -silent -noconfig -ignorePrereq -responseFile /home/oracle/db_install.rsp'

cat << EOF
###########################################################################
安装完oracle,在root用户执行下面4条命令.

sh /u01/app/oraInventory/orainstRoot.sh
sh /u01/app/oracle/product/11.2.0/db_1/root.sh
su - oracle -c 'netca /silent /responsefile /home/oracle/netca.rsp'
su - oracle -c 'dbca -silent -responseFile /home/oracle/dbca.rsp'
############################################################################
EOF

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。如发现有害或侵权内容,请点击这里 或 拨打24小时举报电话:4000070609 与我们联系。

    猜你喜欢

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多
    喜欢该文的人也喜欢 更多