Oracle 11g 静默安装脚本
####安装Oracle所需依赖包
function install_yum()
{
yum -y install $1
}
compat-libstdc++-* elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static
expat expat-devel gcc gcc-c++ glibc libaio libaio-devel libgcc libstdc++ libstdc++-devel
libXp libXp-devel make openmotif openmotif-devel ksh unixODBC unixODBC-devel mdadm readline*"
for j in $i
do
install_yum $j
done
m1=`ls /dev/* |grep md0`
then
ra=`ls /tmp/raiddir/*|awk -F'/' '{print $4}'|awk -F'.' 'BEGIN{ORS=" "}{print "/dev/"$1}'`
rb=`ls /tmp/raiddir/*|wc -l`
if [ $rb -eq 0 ]
then
echo "no init partition storage"
else
mdadm -C /dev/md0 -l raid0 -n $rb $ra
mkfs.ext4 /dev/md0
mdadm -E -s -v >> /etc/mdadm.conf
mkdir /u02
mount /dev/md0 /u02
echo '/dev/md0 /u02 ext4 defaults 0 0'>>/etc/fstab
fi
else
echo 'Md0 has been created'
fi
hname=`hostname`
red=`cat /etc/hosts|grep "$hname"|wc -l`
if [ $red -eq 1 ]
then
echo "/etc/hosts is OK Nothing to do"
else
echo "$ip_dir" "$hname" >>/etc/hosts
echo "/etc/hosts is OK"
fi
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
useradd -u 501 -g oinstall -G dba,oper oracle
echo oracle:oracle | chpasswd
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
echo '
PATH=$PATH:$HOME/bin
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=paydb
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$HOME/bin:$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch/
export TMP=/tmp
export TMPDIR=/tmp
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export LC_TYPE=en_US.UTF-8
export PATH
alias rman="rlwrap rman"
alias trace="cd /u01/app/oracle/diag/rdbms/paydb/paydb/trace"
alias dbs="cd /u01/app/oracle/product/11.2.0/db_1/dbs"
alias tns="cd /u01/app/oracle/product/11.2.0/db_1/network/admin"
alias arch="cd /u02/paydb/archivelog"
alias backup="cd /u02/paydb/backup"
alias redo="cd /u02/paydb/redo"
alias data="cd /u02/paydb/oradata"
alias awr="cd /u01/app/oracle/product/11.2.0/db_1/rdbms/admin"
alias listener="cd /u01/app/oracle/diag/tnslsnr/"$hostname"/listener/trace/"
'>>/home/oracle/.bash_profile
source .bash_profile
EOF
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app/oracle
#mkdir /u02
#mount /dev/md0 /u02
mkdir /u02/paydb/{oradata,archivelog,redo,standby,backup/{dump,rman}} -p
chown -R oracle:oinstall /u02/paydb/
chmod -R 775 /u02/paydb/
mkdir -p /u04/oracle
uid=`echo $?`
if [ $uid -eq 0 ]
then
echo "User: Oracle is Created"
else
echo "User: Oracle is Wrong"
echo "Pleas check!"
exit
fi
g=`free -b|grep Mem|awk '{print $2}'`
h=$(($g*4/5))
shmall=$(($h/4096))
echo "
#oracle
kernel.sysrq = 0
kernel.msgmnb = 65536
kernel.shmall = $shmall
fs.file-max = 6815744
kernel.msgmni = 2878
kernel.msgmax = 8192
kernel.msgmnb = 65536
kernel.sem = 250 32000 100 142
kernel.shmmni = 4096
kernel.shmmax = $h
kernel.sysrq = 0
net.core.wmem_default = 262144
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 3145728
net.ipv4.ip_local_port_range = 9000 65500
vm.min_free_kbytes = 51200" >> /etc/sysctl.conf
/sbin/sysctl -p
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536" >>/etc/security/limits.conf
if [ $USER = "oracle" ]||[ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi'>>/etc/profile
source /etc/profile
udir=/u04/oracle/database
if [ -e $udir ]
then
echo "Oracle soft has been created"
exit
else
unzip /tmp/p13390677_112040_Linux-x86-64_1of7.zip -d /u04/oracle
unzip /tmp/p13390677_112040_Linux-x86-64_2of7.zip -d /u04/oracle
ox=`echo $?`
if [ $ox -eq 0 ]
then
echo "Unzip oracle soft is right"
else
echo "Unzip oracle soft is wrong"
exit
fi
fi
m=`find /u04 -name db_install.rsp`
{
sed -i 's/'$1'/'$2'/g' $3
}
replace_install "oracle.install.option=" "oracle.install.option=INSTALL_DB_SWONLY" $m
replace_install "ORACLE_HOSTNAME=" "ORACLE_HOSTNAME=$hname" $m
replace_install "UNIX_GROUP_NAME=" "UNIX_GROUP_NAME=oinstall" $m
replace_install "INVENTORY_LOCATION=" "INVENTORY_LOCATION=\/u01\/app\/oraInventory" $m
replace_install "SELECTED_LANGUAGES=en" "SELECTED_LANGUAGES=en,zh_TW,zh_CN" $m
replace_install "ORACLE_HOME=" "ORACLE_HOME=\/u01\/app\/oracle\/product\/11.2.0\/db_1" $m
replace_install "ORACLE_BASE=" "ORACLE_BASE=\/u01\/app\/oracle" $m
replace_install "oracle.install.db.InstallEdition=" "oracle.install.db.InstallEdition=EE" $m
replace_install "oracle.install.db.DBA_GROUP=" "oracle.install.db.DBA_GROUP=dba" $m
replace_install "oracle.install.db.OPER_GROUP=" "oracle.install.db.OPER_GROUP=oper" $m
replace_install "oracle.install.db.CLUSTER_NODES=" "#oracle.install.db.CLUSTER_NODES=" $m
replace_install "SECURITY_UPDATES_VIA_MYORACLESUPPORT=" "SECURITY_UPDATES_VIA_MYORACLESUPPORT=false" $m
replace_install "DECLINE_SECURITY_UPDATES=" "DECLINE_SECURITY_UPDATES=true" $m
replace_install "oracle.installer.autoupdates.option=" "oracle.installer.autoupdates.option=SKIP_UPDATES" $m
su - oracle >>ora_install.log <<EOF
$n -silent -responseFile $m -ignoreSysPrereqs -ignorePrereq
EOF
sleep 300
sh /u01/app/oraInventory/orainstRoot.sh
sh /u01/app/oracle/product/11.2.0/db_1/root.sh
p=`cat ora_install.log |grep -w 'Successfully Setup Software.'`
r='Successfully Setup Software.'
then
echo "ora_soft_install is right"
else
echo "ora_soft_install is wrong"
exit
fi
s=`find /u04 -name netca.rsp`
su - oracle >> net.log <<EOF
netca -silent -responseFile $s
EOF
if [ $t -eq 0 ]
then
echo "netca is right"
echo "netca is wrong"
exit
fi
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = paydb)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = paydb)
)
)
'>> $ORACLE_HOME/network/admin/listener.ora
lsnrctl stop
lsnrctl start
EOF
v=`find /u04 -name dbca.rsp`
sed -i 's/GDBNAME = "orcl11g.us.oracle.com"/GDBNAME = "paydb"/g' $v
sed -i 's/SID = "orcl11g"/SID = "paydb"/g' $v
sed -i 's/#SYSPASSWORD = "password"/SYSPASSWORD = "oracle"/g' $v
sed -i 's/#SYSTEMPASSWORD = "password"/SYSTEMPASSWORD = "oracle"/g' $v
sed -i 's/#EMCONFIGURATION = "NONE"/EMCONFIGURATION = "NONE"/g' $v
sed -i 's/#SYSMANPASSWORD = "password"/SYSMANPASSWORD = "oracle"/g' $v
sed -i 's/#DBSNMPPASSWORD = "password"/DBSNMPPASSWORD = "oracle"/g' $v
sed -i 's/#CHARACTERSET = "US7ASCII"/CHARACTERSET = "ZHS16GBK"/g' $v
sed -i 's/#MEMORYPERCENTAGE = "40"/MEMORYPERCENTAGE = "70"/g' $v
sed -i 's#{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}#/u02/paydb/oradata#g' /u01/app/oracle/product/11.2.0/db_1/assistants/dbca/templates/General_Purpose.dbc
red=`cat /u01/app/oracle/product/11.2.0/db_1/assistants/dbca/templates/General_Purpose.dbc|grep -w "/u02/paydb/oradata"|wc -l`
if [ $red -eq 10 ]
then
echo "Sed dbca.rsp & General_Purpose.dbc is OK"
else
echo "Sed dbca.rsp & General_Purpose.dbc is Wrong"
exit
fi
dbca -silent -responseFile $v
EOF
if [ $x -eq 0 ]
then
echo "dbca is right!"
echo "dbca is wrong!"
exit
fi
su - oracle <<EOF
sqlplus / as sysdba << S
alter system set processes=5000 scope=spfile;
alter system set session_cached_cursors=1000 scope=spfile;
alter system set open_cursors=1000 scope=spfile;
alter system set log_archive_dest_1='location=/u02/paydb/archivelog';
create pfile from spfile;
shutdown immediate;
exit;
S
sqlplus / as sysdba << Z
startup mount;
alter database archivelog;
alter database open;
create pfile from spfile;
create directory dump as '/u02/paydb/backup/dump/';
alter tablespace users add datafile '/u02/paydb/oradata/users02.dbf' size 10G;
alter tablespace users add datafile '/u02/paydb/oradata/users03.dbf' size 10G;
alter tablespace users add datafile '/u02/paydb/oradata/users04.dbf' size 10G;
alter tablespace users add datafile '/u02/paydb/oradata/users05.dbf' size 10G;
alter tablespace users add datafile '/u02/paydb/oradata/users06.dbf' size 10G;
alter tablespace users add datafile '/u02/paydb/oradata/users07.dbf' size 10G;
alter tablespace users add datafile '/u02/paydb/oradata/users08.dbf' size 10G;
alter tablespace users add datafile '/u02/paydb/oradata/users09.dbf' size 10G;
alter tablespace users add datafile '/u02/paydb/oradata/users10.dbf' size 10G;
create tablespace DBADMIN datafile '/u02/paydb/oradata/dbadmin_data01' size 500M;
create user dbadmin identified by QazWsx12 default tablespace DBADMIN;
grant dba to dbadmin;
grant read,write on directory dump to dbadmin;
grant select on v_\$database to dbadmin;
grant select on v_\$instance to dbadmin;
grant select on dba_free_space to dbadmin;
grant select on DBA_HIST_SYSMETRIC_SUMMARY to dbadmin;
grant select on v_\$archived_log to dbadmin;
grant select on dba_data_files to dbadmin;
grant select on V_\$SGAINFO to dbadmin;
grant select on dba_temp_free_space to dbadmin;
grant select on dba_temp_files to dbadmin;
GRANT SELECT ON V_\$SQLAREA TO dbadmin;
grant select on v_\$sqlarea to dbadmin;
exit;
Z
EOF
yum -y install java
unzip /tmp/flyway-commandline-4.2.0-windows-x64.zip -d /u10/flyway
flyway_conf=/u10/flyway/flyway-4.2.0/conf/flyway.conf
flyway_sql=/u10/flyway/flyway-4.2.0/sql/db/migration
flyway_drivers=/u10/flyway/flyway-4.2.0/drivers
cp /tmp/ojdbc6.jar $flyway_drivers
ln -s /u10/flyway/flyway-4.2.0/flyway /usr/bin/flyway
cd /u10/flyway/flyway-4.2.0
chmod 777 sql
#a=`who|awk '{print $1}'`
#cd
echo "alias fly='cd /u10/flyway/flyway-4.2.0'" >>/etc/profile
source /etc/profile
flyway.url= jdbc:oracle:thin:@$ip_dir:1521:paydb
flyway.user=DBADMIN
flyway.password=QazWsx12
flyway.schemas=DBADMIN
flyway.table=SCHEMA_VERSION
flyway.baselineOnMigrate=true" >> $flyway_conf
##########################安装配置Oracle管理
mkdir /u01/dba_scripts -p
mkdir /u01/dba_scripts/db_performance -p
mkdir /u01/dba_scripts/delete_archlog/log -p
mkdir /u01/dba_scripts/tabsusage/log -p
mkdir /u01/dba_scripts/rman/log -p
mkdir /u01/dba_scripts/db_info -p
mkdir /u01/dba_scripts/dbms_stats/log -p
mkdir /u01/dba_scripts/other -p
mv /tmp/db_performance_metric.sh /u01/dba_scripts/db_performance
mv /tmp/delete_archivelog.sh /u01/dba_scripts/delete_archlog
mv /tmp/update_tbs_info.sh /u01/dba_scripts/tabsusage
mv /tmp/rman_full.sh /u01/dba_scripts/rman
mv /tmp/db_information_output.sh /u01/dba_scripts/db_info
mv /tmp/dbms_stats_tables.sh /u01/dba_scripts/dbms_stats
cat /tmp/crontab.txt >> /var/spool/cron/oracle
chown oracle. /u01/dba_scripts -R
chown oracle. /var/spool/cron/oracle
mv /tmp/{nmon_x86_64_rhel6,value_nmon.sh} /u01/dba_scripts/nmon_tool/
cat /tmp/crontab_root.txt >>/var/spool/cron/root
cp -a /tmp/dba_* /home/oracle/db_monitor/
chown oracle. /home/oracle/db_monitor/dba_*
Oracle 11g 静默安装脚本的更多相关文章
- Oracle 11g 静默安装过程(centos7)
开启机器,本次实例分配的ip是:192.168.3.197(Xshell ssh连接) 2 安装unzip 工具.vim编辑器(个人习惯,vi也可以) 3 在/etc/hosts文件中添加本机IP跟主 ...
- Oracle 11g静默安装简明版
环境:RHEL 6.5 + Oracle 11.2.0.4 1. 初步处理应答文件 2. 静默安装软件 3. 静默安装监听 4. 静默dbca建库 说明: 本文默认安装软件前的步骤已经设置完毕 如果没 ...
- Oracle 12c 静默安装(脚本自动化)
oracle 12C 自动化静默安装脚本 项目地址: github: https://github.com/spdir/oracle-single-install 下载安装脚本 wget https: ...
- Oracle 11g静默安装软件+手工创建数据库
由于是二次跳转+远程操作,无法使用图形界面,不能直接图形界面安装.采用静默安装软件+手工创建数据库的方式完成需求. 静默模式安装Oracle软件,配置监听程序 手工建库 检查各组件是否符合要求 1. ...
- ORACLE 11g 静默安装
整理下以前的文档,放到博客上面来以后能直接找到. 环境:oracle linux release 6.3 x86_84.oracle 11gR2 一.主机环境配置 1.1 gcc安装 在ISO文件的P ...
- linux 下oracle 11g静默安装(完整版)
1.操作系统及Oracle版本Linux版本:CentOS release 6.5Oracle版本:Oracle Database 11g Release 2 (11.2.0.1.0) for Lin ...
- Oracle 11g 静默安装-db_install.rsp详解
转自--------------https://blog.csdn.net/jameshadoop/article/details/48086933 :db_install.rsp详解 ####### ...
- Oracle 11g静默安装
1.检查安装包 安装依赖包 yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elf ...
- linux环境下oracle 11g 静默安装
安装环境 Linux服务器:oracle linux 6.6 64位 Oracle服务器:Oracle11gR2 64位 系统要求 1.Linux安装Oracle系统要求 系统要求 说明 内存 必须高 ...
随机推荐
- 极致21点开发DAY1
最近在学习UI框架,无奈没有完整的项目学习,四处搜索找了这款游戏源码,在Unity2018上完美运行.于是乎开始学习开发这款游戏.今天主要完成的任务时拼UI.搭建了3个场景, StartScene, ...
- 对字符串md5加密
public String getMD5(String str) { try { // 生成一个MD5加密计算摘要 MessageDigest md = MessageDigest.getInstan ...
- 在Qt Quick中一个简单Hello World加载过程
Qt5基本类图: QQmlEngine QQmlEngine类提供了一个QML引擎,用于管理由QML文档定义的对象层次架构,QML提供了一个默认的QML上下文(根上下文,获取函数QQmlEngi ...
- 和 (DFS)
和 Time Limit: 1000MS Memory Limit: 65536KB Total Submissions: 177 Accepted: 93 Share Description: ...
- latch release ......
MainControl_cfg.c brings error: not defined. /* e_TIMER_MCtrlLatchReleaseTime */ TIMER_ID_MCtr ...
- Python imprt动态模块
1.解释器内部用的动态导入 directory_variable = __improt__("directory.filename") print(directory_variab ...
- 【题解】Luogu P2057 [SHOI2007]善意的投票
原题传送门 我们一眼就能看出这是一道最小割的题 我们设不睡觉这种状态为S,睡觉这种状态为T 对于每个人,如果不想睡觉,就从S向这个人连流量为1的边,否则,就从这个人向T连流量为1的边 对于每一对朋友, ...
- Maven+SSM框架(Spring+SpringMVC+MyBatis)(二)
1.基本概念 2.开发环境搭建 3.Maven Web项目创建 4.SSM整合 此次整合我分两个配置文件: 1)分别是spring-mybatis.xml,包含spring和mybatis的配置文件, ...
- oracle 查询表结构
SELECT t1.Table_Name AS "表名称", t3.comments AS "表说明", t1.Column_Name AS "字段名 ...
- HAOI(多省联考)2019退役记
等着回头写 算了今天先写点 Day -1 打扫下机房,不想写题,不想考试.... Day 0 上午颓了一上午 下午看下考场结果去早了 ZYZ 全员进队! Day 1 上来T1,01Tire!,开码,半 ...