Sunday, October 1, 2023

【access log 日志分析】 #!/bin/bash # 假设格式为: $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" LOG_FILE=$1 echo "统计访问最多的10个IP" awk '{a[$1]++}END{print "UV:",length(a);for(v in a)print v,a[v]}' $LOG_FILE |sort -k2 -nr |head -10 echo "----------------------" echo "统计时间段访问最多的IP" awk '$4>="[01/Dec/2018:13:20:25" && $4<="[27/Nov/2018:16:20:49"{a[$1]++}END{for(v in a)print v,a[v]}' $LOG_FILE |sort -k2 -nr|head -10 echo "----------------------" echo "统计访问最多的10个页面" awk '{a[$7]++}END{print "PV:",length(a);for(v in a){if(a[v]>10)print v,a[v]}}' $LOG_FILE |sort -k2 -nr echo "----------------------" echo "统计访问页面状态码数量" awk '{a[$7" "$9]++}END{for(v in a){if(a[v]>5)print v,a[v]}}' 复制 【access log 查询访问量异常IP并自动添加iptables】 #!/bin/bash DATE=$(date +%d/%b/%Y:%H:%M) LOG_FILE=/usr/local/nginx/logs/demo2.access.log ABNORMAL_IP=$(tail -n5000 $LOG_FILE |grep $DATE |awk '{a[$1]++}END{for(i in a)if(a[i]>10)print i}') for IP in $ABNORMAL_IP; do if [ $(iptables -vnL |grep -c "$IP") -eq 0 ]; then iptables -I INPUT -s $IP -j DROP echo "$(date +'%F_%T') $IP" >> /tmp/drop_ip.log fi done 复制 【查看网卡实时流量】 #!/bin/bash NIC=$1 echo -e " In ------ Out" while true; do OLD_IN=$(awk '$0~"'$NIC'"{print $2}' /proc/net/dev) OLD_OUT=$(awk '$0~"'$NIC'"{print $10}' /proc/net/dev) sleep 1 NEW_IN=$(awk '$0~"'$NIC'"{print $2}' /proc/net/dev) NEW_OUT=$(awk '$0~"'$NIC'"{print $10}' /proc/net/dev) IN=$(printf "%.1f%s" "$((($NEW_IN-$OLD_IN)/1024))" "KB/s") OUT=$(printf "%.1f%s" "$((($NEW_OUT-$OLD_OUT)/1024))" "KB/s") echo "$IN $OUT" sleep 1 done 复制 【磁盘利用率】 #!/bin/bash HOST_INFO=host.info for IP in $(awk '/^[^#]/{print $1}' $HOST_INFO); do USER=$(awk -v ip=$IP 'ip==$1{print $2}' $HOST_INFO) PORT=$(awk -v ip=$IP 'ip==$1{print $3}' $HOST_INFO) TMP_FILE=/tmp/disk.tmp ssh -p $PORT $USER@$IP 'df -h' > $TMP_FILE USE_RATE_LIST=$(awk 'BEGIN{OFS="="}/^\/dev/{print $NF,int($5)}' $TMP_FILE) for USE_RATE in $USE_RATE_LIST; do PART_NAME=${USE_RATE%=*} USE_RATE=${USE_RATE#*=} if [ $USE_RATE -ge 80 ]; then echo "Warning: $PART_NAME Partition usage $USE_RATE%!" fi done done 复制 【新服务器环境初始化】 #/bin/bash # 设置时区并同步时间 ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime if ! crontab -l |grep ntpdate &>/dev/null ; then (echo "* 1 * * * ntpdate time.windows.com >/dev/null 2>&1";crontab -l) |crontab fi # 禁用selinux sed -i '/SELINUX/{s/permissive/disabled/}' /etc/selinux/config # 关闭防火墙 if egrep "7.[0-9]" /etc/redhat-release &>/dev/null; then systemctl stop firewalld systemctl disable firewalld elif egrep "6.[0-9]" /etc/redhat-release &>/dev/null; then service iptables stop chkconfig iptables off fi # 历史命令显示操作时间 if ! grep HISTTIMEFORMAT /etc/bashrc; then echo 'export HISTTIMEFORMAT="%F %T `whoami` "' >> /etc/bashrc fi # SSH超时时间 if ! grep "TMOUT=600" /etc/profile &>/dev/null; then echo "export TMOUT=600" >> /etc/profile fi # 禁止root远程登录 sed -i 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config # 禁止定时任务向发送邮件 sed -i 's/^MAILTO=root/MAILTO=""/' /etc/crontab # 设置最大打开文件数 if ! grep "* soft nofile 65535" /etc/security/limits.conf &>/dev/null; then cat >> /etc/security/limits.conf << EOF * soft nofile 65535 * hard nofile 65535 EOF fi # 系统内核优化 cat >> /etc/sysctl.conf << EOF net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_max_tw_buckets = 20480 net.ipv4.tcp_max_syn_backlog = 20480 net.core.netdev_max_backlog = 262144 net.ipv4.tcp_fin_timeout = 20 EOF # 减少SWAP使用 echo "0" > /proc/sys/vm/swappiness # 安装系统性能分析工具及其他 yum install gcc make autoconf vim sysstat net-tools iostat if 复制 【shell配置发送邮件】 # yum install mailx # vi /etc/mail.rc set from=test@exmaple.com smtp=smtp.example.com set smtp-auth-user=test@example.com smtp-auth-password=******* set smtp-auth=login

Tuesday, September 19, 2023

1、sqlplus ps -ef | grep smon \n echo $ORACLE_SID \n sqlplus / as sysdba \n set timing on time on \n 复制 复制 2、查看用户状态 复制 set line 240 \n set pages 999 \n col ACCOUNT_STATUS for a18 \n select USERNAME,ACCOUNT_STATUS,DEFAULT_TABLESPACE,TEMPORARY_TABLESPACE from dba_users; \n 复制 3、数据库启动时间 复制 复制 set line 240 \n col HOST_NAME for a30 \n select INSTANCE_NAME,HOST_NAME,VERSION,STARTUP_TIME,STATUS from gv$instance; \n 复制 4、查看ASM使用率 复制 复制 set lin 1000 pagesize 999 \n col PATH for a33 \n col NAME for a15 \n col FAILGROUP for a15 \n col path for a15 \n select GROUP_NUMBER,DISK_NUMBER,TOTAL_MB/1024,FREE_MB/1024,NAME,FAILGROUP,PATH,FAILGROUP_TYPE from v$asm_disk order by 1; \n select GROUP_NUMBER,NAME,STATE,TYPE,TOTAL_MB/1024,FREE_MB/1024,USABLE_FILE_MB/1024,HOT_USED_MB,COLD_USED_MB/1024 from v$asm_diskgroup; \n 复制 5、查看用户状态 复制 复制 set line 240 \n col profile for a20 \n set pages 999 \n col username for a25 \n col ACCOUNT_STATUS for a18 \n select USERNAME,ACCOUNT_STATUS,CREATED,LOCK_DATE,PROFILE,PASSWORD_VERSIONS,DEFAULT_TABLESPACE from dba_users where account_status='OPEN' order by CREATED asc; \n 复制 6、查看 ASM 使用率 复制 复制 set line 240 \n col HOST_NAME for a30 \n select INSTANCE_NAME,HOST_NAME,VERSION,STARTUP_TIME,STATUS from gv$instance; \n 复制 7、查看数据量 复制 复制 select sum(bytes)/1024/1024/1024 Gb from dba_segments where segment_name not like 'BIN$%';\n 复制 8、查看 LOCAL=NO 会话 复制 复制 ps -ef | grep LOCAL=NO | grep -v grep | awk '{print $2}' |wc -l \n echo "ps -ef | grep LOCAL=NO | grep -v grep | awk '{print \$2}' | xargs kill -9" \n 复制 9、查看等待事件 复制 set lines 345 pages 345 \n select event, sql_id,sid,serial#,SECONDS_IN_WAIT from gv$session \n where type <> 'BACKGROUND' and STATUS='ACTIVE' \n group by event,sql_id,sid,serial#,SECONDS_IN_WAIT \n order by SECONDS_IN_WAIT desc; \n 复制 复制 10、查看索引列 复制 SET LINE 234 \n COL INDEX_OWNER FOR A20 \n COL TABLE_OWNER FOR A20 \n COL TABLE_NAME FOR A25 \n COL INDEX_NAME FOR A30 \n COL COLUMN_NAME FOR A25 \n SELECT INDEX_OWNER,TABLE_OWNER,TABLE_NAME,INDEX_NAME,COLUMN_NAME FROM DBA_IND_COLUMNS WHERE TABLE_NAME='&tablename' and table_owner='&tb_owner' ORDER BY INDEX_NAME; \n 复制 11、连接会话总数 复制 复制 --select CON_ID,inst_id,count(*),status from gv$session where type<>'BACKGROUND' group by con_id,inst_id,status order by 1;\n select inst_id,count(*),status from gv$session where type<>'BACKGROUND' group by inst_id,status order by 1; \n 复制 12、表空间使用率 复制 --purge dba_recyclebin; \n col TABLESPACE_NAME for a30 \n set pages 456 \n SELECT a.tablespace_name,round(total/1024/1024/1024) "Total g", \n round(free/1024/1024/1024) "Free g",ROUND((total-free)/total,4)*100 "USED%" \n FROM (SELECT tablespace_name,SUM(bytes) free FROM DBA_FREE_SPACE \n GROUP BY tablespace_name ) a, \n (SELECT tablespace_name,SUM(bytes) total FROM DBA_DATA_FILES \n GROUP BY tablespace_name) b \n WHERE a.tablespace_name=b.tablespace_name \n ORDER BY 4; \n 复制 复制 13、查看有哪些 IP 连接数据库 复制 netstat -anop | grep ESTABLISHED | awk '$4 ~/:1521/' |awk '{print $5}' \n 复制 14、查数据文件大小 复制 复制 select file_id,file_name,bytes/1024/1024,AUTOEXTENSIBLE from dba_data_files where tablespace_name='&tabs_name'; \n 复制 15、查表空间内前十大表 复制 复制 col TABLE_NAME for a30 \n col OWNER for a30 \n set pagesize 200 \n set linesize 200 \n col TABLE_NAME for a30 \n select * from (select TABLESPACE_NAME,OWNER,SEGMENT_NAME "TABLE_NAME",to_number(decode(substr(BYTES/1024/1024,1,1),'.','0'||BYTES/1024/1024,BYTES/1024/1024)) total_MB \n from dba_segments where TABLESPACE_NAME ='&tablespacename' and SEGMENT_TYPE='TABLE' order by total_MB desc ) where rownum<=10; \n 复制 16、查看用户下 Lob 字段大小 复制 SET LINE 345 PAGES 456 \n COL OWNER FOR a20 \n COL TABLE_NAME FOR A40 \n COL SEGMENT_TYPE FOR A20 \n col COLUMN_NAME FOR A35 \n SELECT \n A.OWNER, \n B.TABLE_NAME, \n B.COLUMN_NAME, \n a.SEGMENT_TYPE, \n ROUND(SUM(A.BYTES/1024/1024/1024),2) G \n FROM DBA_SEGMENTS A \n LEFT JOIN DBA_LOBS B \n ON A.OWNER = B.OWNER \n AND A.SEGMENT_NAME = B.SEGMENT_NAME \n WHERE A.SEGMENT_TYPE='LOBSEGMENT' \n AND A.OWNER in('&OWNER') \n GROUP BY A.OWNER,B.TABLE_NAME,B.COLUMN_NAME,a.SEGMENT_TYPE \n ORDER BY 5 DESC; \n 复制 复制 17、查隐含参数 复制 set line 345 \n col name for a50 \n col value for a30 \n col description for a80 \n select a.ksppinm name, b.ksppstvl value,a.ksppdesc description from x$ksppi a, x$ksppcv b where a.indx = b.indx and a.ksppinm like '%&name%'; \n 复制 18、查看 ADG 延迟 复制 复制 set linesize 150; \n set pagesize 9999; \n column name format a13; \n column value format a20; \n column unit format a30; \n column TIME_COMPUTED format a30; \n select name,value,unit,datum_time,time_computed from v$dataguard_stats where name in ('transport lag','apply lag');\n 复制 19、外键没创建索引的表 复制 复制 set linesize 250 \n set pagesize 9999 \n col CONSTRAINT_NAME for a40 \n with cons as \n (select /*+materialize*/ \n owner, table_name, constraint_name \n from dba_constraints \n where owner = '&OWNER' \n and constraint_type = 'R'), \n idx as \n (select /*+materialize*/ \n table_owner, table_name, column_name \n from dba_ind_columns \n where table_owner = '&TABLE_OWNER') \n select owner, table_name, constraint_name, column_name \n from dba_cons_columns \n where (owner, table_name, constraint_name) in (select * from cons) \n and (owner, table_name, constraint_name) not in (select * from idx); \n 复制 20、需要收集直方图的列 复制 --最后一个纯属凑数,注意这个没有 \n 换行,可直接使用-- select a.owner, a.table_name, a.column_name, b.NUM_ROWS, a.num_distinct Cardinality, round(a.num_distinct / b.NUM_ROWS * 100, 2) selectivity from dba_tab_col_statistics a, dba_tables b where a.owner = b.OWNER and a.table_name = b.TABLE_NAME and a.owner = '&OWNER' and round(a.num_distinct / b.NUM_ROWS * 100, 2) < 5 and num_rows > 50000 and (a.table_name, a.column_name) in (select o.name, c.name from sys.col_usage$ u, sys.obj$ o, sys.col$ c, sys.user$ r where o.obj# = u.obj# and c.obj# = u.obj# and c.col# = u.intcol# and r.name = '&OWNER') order by 2,6;

Thursday, September 7, 2023

#!/bin/bash # # GI callout script to catch INSTANCE up event from clusterware and relocate services to preferred instance # Copy or symlink this script to $GRID_HOME/racg/usrco # 2012 Ilmar Kerm # LOGFILE=/u02/app/oracle/grid_callout/log.txt SCRIPTDIR=`dirname $0` # Determine grid home if [[ "${SCRIPTDIR:(-11)}" == "/racg/usrco" ]]; then CRS_HOME="${SCRIPTDIR:0:$(( ${#SCRIPTDIR} - 11 ))}" export CRS_HOME fi # Only execute script for INSTANCE events if [ "$1" != "INSTANCE" ]; then exit 0 fi STATUS="" DATABASE="" INSTANCE="" # Parse input arguments args=("$@") for arg in ${args[@]}; do if [[ "$arg" == *=* ]]; then KEY=${arg%=*} VALUE=${arg#*=} case "$KEY" in status) STATUS="$VALUE" ;; database) DATABASE="$VALUE" ;; instance) INSTANCE="$VALUE" ;; esac fi done # If database, status and instance values are not set, then exit # status must be up if [[ -z "$DATABASE" || -z "$INSTANCE" || "$STATUS" != "up" ]]; then exit 0 fi echo "`date`" >> "$LOGFILE" echo "[$DATABASE][`hostname`] Instance $INSTANCE up" >> "$LOGFILE" # # Read database software home directory from clusterware # DBCONFIG=`$CRS_HOME/bin/crsctl status res ora.$DATABASE.db -f | grep "ORACLE_HOME="` if [ -z "$DBCONFIG" ]; then exit 0 fi declare -r "$DBCONFIG" echo "ORACLE_HOME=$ORACLE_HOME" >> "$LOGFILE" # Array function in_array() { local hay needle=$1 shift for hay; do [[ $hay == $needle ]] && return 0 done return 1 } # # Read information about services # for service in `$CRS_HOME/bin/crsctl status res | grep -E "ora\.$DATABASE\.(.+)\.svc" | sed -rne "s/NAME=ora\.$DATABASE\.(.+)\.svc/\1/gip"`; do SERVICECONFIG=`$ORACLE_HOME/bin/srvctl config service -d $DATABASE -s $service` echo "Service $service" >> "$LOGFILE" if [[ "$SERVICECONFIG" == *"Service is enabled"* ]]; then echo " enabled" >> "$LOGFILE" PREFERRED=( `echo "$SERVICECONFIG" | grep "Preferred instances:" | sed -rne "s/.*\: ([a-zA-Z0-9]+)/\1/p" | tr "," "\n"` ) # # Check if current instance is preferred for this service # if in_array "$INSTANCE" "${PREFERRED[@]}" ; then echo " preferred" >> "$LOGFILE" # # Check if service is already running on current instance # SRVSTATUS=`$ORACLE_HOME/bin/srvctl status service -d $DATABASE -s $service` if [[ "$SRVSTATUS" == *"is not running"* ]]; then # # if service is not running, then start it # echo " service stopped, starting" >> "$LOGFILE" $ORACLE_HOME/bin/srvctl start service -d "$DATABASE" -s "$service" >> "$LOGFILE" else # # Service is running, but is it running on preferred instance? # RUNNING=( `echo "$SRVSTATUS" | sed -rne "s/.* ([a-zA-Z0-9]+)/\1/p" | tr "," "\n"` ) # echo "${RUNNING[@]} = ${PREFERRED[@]}" if ! in_array "$INSTANCE" "${RUNNING[@]}" ; then echo " not running on preferred $INSTANCE" >> "$LOGFILE" # # Find the first non-preferred running instance # CURRENT="" for inst in "${RUNNING[@]}"; do if ! in_array "$inst" "${PREFERRED[@]}" ; then CURRENT="$inst" break fi done # # Relocate # if [[ -n "$CURRENT" ]]; then echo " relocate $CURRENT -> $INSTANCE" >> "$LOGFILE" $ORACLE_HOME/bin/srvctl relocate service -d "$DATABASE" -s "$service" -i "$CURRENT" -t "$INSTANCE" >> "$LOGFILE" fi else # # Service is already running on preferred instance, no need to do anything # echo " running on preferred $INSTANCE" >> "$LOGFILE" fi fi fi fi done

Tuesday, August 1, 2023

#!/bin/bash echo "####################################################################################" echo "##Github : https://github.com/pc-study/InstallOracleshell" echo "##Version : 2.0" echo "##Function : Oracle 11g/12c/18c/19c/21c(Single and Rac) install on Linux 6/7/8" echo "####################################################################################" echo "#执行脚本前:" echo "# 1. 把脚本放入软件目录,例如:/soft" echo "# 2. 挂载ISO" echo "# 3. 把需要本地安装的rpm和software上传到软件目录" echo "# 4. 设置好主机IP" echo "####################################################################################" #################################################################################### # Parameters For Install #################################################################################### #Oracle Install Mode(RAC/Single/RESTART) SOFTWAREDIR=$(pwd) DAYTIME=$(date +%Y%m%d) RELS=$(cat /etc/system-release) OS_VER_PRI=$(echo "${RELS#*release}" | awk '{print $1}' | cut -f 1 -d '.') memTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}') swapTotal=$(grep -i 'swaptotal' /proc/meminfo | awk '{print $2}') shmTotal=$(df -k /dev/shm | awk '{print $2}' | head -n 2 | tail -n 1) HOSTNAME=orcl PUBLICIP= ORACLE_SID=orcl ISCDB=FALSE PDBNAME= ROOTPASSWD=oracle ORAPASSWD=oracle GRIDPASSWD=oracle ENV_BASE_DIR=/u01/app ORADATADIR=/oradata ARCHIVEDIR=/archivelog BACKUPDIR=/backup SCRIPTSDIR=/home/oracle/scripts CHARACTERSET=AL32UTF8 NCHARACTERSET=AL16UTF16 GRID_SID=+ASM RACPUBLICFCNAME= RACPRIVFCNAME= RACPRIVFCNAME1= RAC1PUBLICIP= RAC2PUBLICIP= RAC1VIP= RAC2VIP= RAC1PRIVIP= RAC2PRIVIP= RAC1PRIVIP1= RAC2PRIVIP1= RACSCANIP= scan_sum=0 ASMDATANAME=DATA ASMOCRNAME=OCR OCR_BASEDISK= DATA_BASEDISK= OCRREDUN=EXTERNAL DATAREDUN=EXTERNAL num1=0 num2=0 TIMESERVERIP= ONLYCONFIGOS=N ONLYINSTALLGRID=N ONLYINSTALLORACLE=N ONLYCREATEDB=N GPATCH= OPATCH= nodeNum=1 DB_VERSION= OracleInstallMode= TuXingHua=N UDEV=Y #DNS DNS=N DNSSERVER=N DNSNAME= DNSIP= ISO=Y VirtualBox=N ################################################################################### ##The following is a custom function: #################################################################################### #Type stty erase '^H' before read #stty erase '^H' #Add colors to fonts through variables #Define a c1() function here, if you want to change the font color later, you can call it directly c1() { RED_COLOR='\E[1;31m' GREEN_COLOR='\E[1;32m' YELLOW_COLOR='\E[1;33m' BLUE_COLOR='\E[1;34m' PINK_COLOR='\E[1;35m' WHITE_BLUE='\E[47;34m' DOWN_BLUE='\E[4;36m' FLASH_RED='\E[5;31m' RES='\E[0m' #Here it is judged whether the incoming parameters are not equal to 2, if not equal to 2, prompt and exit if [ $# -ne 2 ]; then echo "Usage $0 content {red|yellow|blue|green|pink|wb|db|fr}" exit fi case "$2" in red | RED) echo -e "${RED_COLOR}$1${RES}" ;; yellow | YELLOW) echo -e "${YELLOW_COLOR}$1${RES}" ;; green | GREEN) echo -e "${GREEN_COLOR}$1${RES}" ;; blue | BLUE) echo -e "${BLUE_COLOR}$1${RES}" ;; pink | PINK) echo -e "${PINK_COLOR}$1${RES}" ;; wb | WB) echo -e "${WHITE_BLUE}$1${RES}" ;; db | DB) echo -e "${DOWN_BLUE}$1${RES}" ;; fr | FR) echo -e "${FLASH_RED}$1${RES}" ;; *) echo -e "Please enter the specified color code:{red|yellow|blue|green|pink|wb|db|fr}" ;; esac } ##Example ##c1 "Program installation error!" red ##c1 "The program is successfully installed!" green ##c1 "Output related annotation information" blue SSHTrust() { DEST_USER=$1 PASSWORD=$2 HOSTS_FILE=$3 if [ $# -ne 3 ]; then echo "Usage:" echo "$0 remoteUser remotePassword hostsFile" exit 1 fi if [ "${DEST_USER}" != "root" ]; then cd /home/"${DEST_USER}"/ || return fi SSH_DIR=~/.ssh SCRIPT_PREFIX=./tmp echo =========================== # 1. prepare directory .ssh mkdir $SSH_DIR chmod 700 $SSH_DIR # 2. generat ssh key TMP_SCRIPT=$SCRIPT_PREFIX.sh { echo "#!/usr/bin/expect" echo "spawn ssh-keygen -b 1024 -t rsa" echo "expect *key*" echo "send \r" } >>$TMP_SCRIPT if [ -f $SSH_DIR/id_rsa ]; then { echo "expect *verwrite*" echo "send y\r" } >>$TMP_SCRIPT fi { echo "expect *passphrase*" echo "send \r" echo "expect *again:" echo "send \r" echo "interact" } >>$TMP_SCRIPT chmod +x $TMP_SCRIPT /usr/bin/expect $TMP_SCRIPT rm -rf $TMP_SCRIPT # 3. generat file authorized_keys cat $SSH_DIR/id_rsa.pub >>$SSH_DIR/authorized_keys # 4. chmod 600 for file authorized_keys chmod 600 $SSH_DIR/authorized_keys echo =========================== # 5. copy all files to other hosts for ip in $(<"${HOSTS_FILE}"); do if [ "x$ip" != "x" ]; then echo ------------------------- TMP_SCRIPT=${SCRIPT_PREFIX}.$ip.sh # check known_hosts val=$(ssh-keygen -F "${ip}") if [ "x$val" == "x" ]; then echo "$ip not in $SSH_DIR/known_hosts, need to add" val=$(ssh-keyscan "${ip}" 2>/dev/null) if [ "x$val" == "x" ]; then echo "ssh-keyscan $ip failed!" else echo "${val}" >>$SSH_DIR/known_hosts fi fi echo "copy $SSH_DIR to $ip" { echo "#!/usr/bin/expect" echo "spawn scp -r $SSH_DIR $DEST_USER@$ip:~/" echo "expect *assword*" echo "send $PASSWORD\r" echo "interact" } >"$TMP_SCRIPT" chmod +x "$TMP_SCRIPT" /usr/bin/expect "$TMP_SCRIPT" rm -rf "$TMP_SCRIPT" echo "copy done." fi done # 6. date ssh for ip in $(<"$HOSTS_FILE"); do if [ "x$ip" != "x" ]; then { echo "#!/usr/bin/expect" echo "spawn ssh $DEST_USER@$ip date" echo "expect *yes*" echo "send yes\r" echo "interact" } >"$TMP_SCRIPT" chmod +x "$TMP_SCRIPT" /usr/bin/expect "$TMP_SCRIPT" rm -rf "$TMP_SCRIPT" echo "copy done." fi done } help() { c1 "Desc: For ALL Oracle Silent Install" green echo c1 "Usage: OracleShellInstall [OPTIONS] OBJECT { COMMAND | help }" green echo c1 "Excute: " green c1 "1.chmod +x OracleShellInstall.sh" green echo c1 "OPTIONS: " green c1 "-i, --PUBLICIP PUBLICIP NETWORK ADDRESS" green c1 "-n, --HOSTNAME HOSTNAME(orcl)" green c1 "-o, --ORACLE_SID ORACLE_SID(orcl)" green c1 "-c, --ISCDB IS CDB OR NOT(TRUE|FALSE)" green c1 "-pb, --PDBNAME PDBNAME(pdb01)" green c1 "-op, --ORAPASSWD ORACLE USER PASSWORD(oracle)" green c1 "-b, --ENV_BASE_DIR ORACLE BASE DIR(/u01/app)" green c1 "-s, --CHARACTERSET ORACLE CHARACTERSET(ZHS16GBK|AL32UTF8)" green c1 "-ns, --NCHARACTERSET ORACLE NATIONAL CHARACTERSET(AL16UTF16|UTF8)" green c1 "-rs, --ROOTPASSWD ROOT USER PASSWORD" green c1 "-gp, --GRIDPASSWD GRID USER PASSWORD(oracle)" green c1 "-pb1, --RAC1PUBLICIP RAC NODE ONE PUBLIC IP" green c1 "-pb2, --RAC2PUBLICIP RAC NODE SECONED PUBLIC IP" green c1 "-vi1, --RAC1VIP RAC NODE ONE VIRTUAL IP" green c1 "-vi2, --RAC2VIP RAC NODE SECOND VIRTUAL IP" green c1 "-pi1, --RAC1PRIVIP RAC NODE ONE PRIVATE IP(10.10.1.1)" green c1 "-pi2, --RAC2PRIVIP RAC NODE SECOND PRIVATE IP(10.10.1.2)" green c1 "-pi3, --RAC1PRIVIP1 RAC NODE ONE PRIVATE IP(10.1.1.1)" green c1 "-pi4, --RAC2PRIVIP1 RAC NODE SECOND PRIVATE IP(10.1.1.2)" green c1 "-puf, --RACPUBLICFCNAME RAC PUBLIC FC NAME" green c1 "-prf, --RACPRIVFCNAME RAC PRIVATE FC NAME" green c1 "-prf1, --RACPRIVFCNAME1 RAC PRIVATE FC NAME" green c1 "-si, --RACSCANIP RAC SCAN IP" green c1 "-dn, --ASMDATANAME RAC ASM DATADISKGROUP NAME(DATA)" green c1 "-on, --ASMOCRNAME RAC ASM OCRDISKGROUP NAME(OCR)" green c1 "-dd, --DATA_BASEDISK RAC DATADISK DISKNAME" green c1 "-od, --OCRP_BASEDISK RAC OCRDISK DISKNAME" green c1 "-or, --OCRREDUN RAC OCR REDUNDANCY(EXTERNAL|NORMAL|HIGH)" green c1 "-dr, --DATAREDUN RAC DATA REDUNDANCY(EXTERNAL|NORMAL|HIGH)" green c1 "-tsi, --TIMESERVERIP RAC TIME SERVER IP" green c1 "-txh --TuXingHua Tu Xing Hua Install" green c1 "-udev --UDEV Whether Auto Set UDEV" green c1 "-dns --DNS RAC CONFIGURE DNS(Y|N)" green c1 "-dnss --DNSSERVER RAC CONFIGURE DNSSERVER LOCAL(Y|N)" green c1 "-dnsn --DNSNAME RAC DNSNAME(orcl.com)" green c1 "-dnsi --DNSIP RAC DNS IP" green c1 "-m, --ONLYCONFIGOS ONLY CONFIG SYSTEM PARAMETER(Y|N)" green c1 "-g, --ONLYINSTALLGRID ONLY INSTALL GRID SOFTWARE(Y|N)" green c1 "-w, --ONLYINSTALLORACLE ONLY INSTALL ORACLE SOFTWARE(Y|N)" green c1 "-ocd, --ONLYCREATEDB ONLY CREATE DATABASE(Y|N)" green c1 "-gpa, --GRID RELEASE UPDATE GRID RELEASE UPDATE(32072711)" green c1 "-opa, --ORACLE RELEASE UPDATE ORACLE RELEASE UPDATE(32072711)" green c1 "-iso, --ISO WHETHER MOUNT ISO OR YUN" green c1 "-installmode, --OracleInstallMode Oralce Install mode(single/rac)" green c1 "-dbv, --DBV Database Version(11/12/18/19)" green c1 "-vbox, --VirtualBox Vagrant VirtualBox ASM" green exit 0 } echo while [ -n "$1" ]; do #Here by judging whether $1 exists case $1 in -i | --PUBLICIP) PUBLICIP=$2 #$2 Is the parameter we want to output shift 2 ;; # Move the parameter back by 2 and enter the judgment of the next parameter -n | --HOSTNAME) HOSTNAME=$2 shift 2 ;; -o | --ORACLE_SID) ORACLE_SID=$2 shift 2 ;; -c | --ISCDB) ISCDB=$2 shift 2 ;; -pb | --PDBNAME) PDBNAME=$2 shift 2 ;; -op | --ORAPASSWD) ORAPASSWD=$2 shift 2 ;; -b | --ENV_BASE_DIR) ENV_BASE_DIR=$2 shift 2 ;; -s | --CHARACTERSET) CHARACTERSET=$2 shift 2 ;; -ns | --NCHARACTERSET) NCHARACTERSET=$2 shift 2 ;; -m | --ONLYCONFIGOS) ONLYCONFIGOS=$2 shift 2 ;; -g | --ONLYINSTALLGRID) ONLYINSTALLGRID=$2 shift 2 ;; -w | --ONLYINSTALLORACLE) ONLYINSTALLORACLE=$2 shift 2 ;; -ocd | --ONLYCREATEDB) ONLYCREATEDB=$2 shift 2 ;; -gpa | --GPATCH) GPATCH=$2 shift 2 ;; -opa | --OPATCH) OPATCH=$2 shift 2 ;; -gp | --GRIDPASSWD) GRIDPASSWD=$2 shift 2 ;; -pb1 | --RAC1PUBLICIP) RAC1PUBLICIP=$2 shift 2 ;; -pb2 | --RAC2PUBLICIP) RAC2PUBLICIP=$2 shift 2 ;; -vi1 | --RAC1VIP) RAC1VIP=$2 shift 2 ;; -vi2 | --RAC2VIP) RAC2VIP=$2 shift 2 ;; -pi1 | --RAC1PRIVIP) RAC1PRIVIP=$2 shift 2 ;; -pi2 | --RAC2PRIVIP) RAC2PRIVIP=$2 shift 2 ;; -pi3 | --RAC1PRIVIP1) RAC1PRIVIP1=$2 shift 2 ;; -pi4 | --RAC2PRIVIP1) RAC2PRIVIP1=$2 shift 2 ;; -si | --RACSCANIP) RACSCANIP=$2 shift 2 ;; -sn | --RACSCANNAME) RACSCANNAME=$2 shift 2 ;; -cn | --CLUSTERNAME) CLUSTERNAME=$2 shift 2 ;; -dn | --ASMDATANAME) ASMDATANAME=$2 shift 2 ;; -on | --ASMOCRNAME) ASMOCRNAME=$2 shift 2 ;; -dd | --DATA_BASEDISK) DATA_BASEDISK=$2 shift 2 ;; -od | --OCR_BASEDISK) OCR_BASEDISK=$2 shift 2 ;; -or | --OCRREDUN) OCRREDUN=$2 shift 2 ;; -dr | --DATAREDUN) DATAREDUN=$2 shift 2 ;; -rs | --ROOTPASSWD) ROOTPASSWD=$2 shift 2 ;; -puf | --RACPUBLICFCNAME) RACPUBLICFCNAME=$2 shift 2 ;; -prf | --RACPRIVFCNAME) RACPRIVFCNAME=$2 shift 2 ;; -prf1 | --RACPRIVFCNAME1) RACPRIVFCNAME1=$2 shift 2 ;; -tsi | --TIMESERVERIP) TIMESERVERIP=$2 shift 2 ;; -node | --nodeNum) nodeNum=$2 shift 2 ;; -installmode | --OracleInstallMode) OracleInstallMode=$2 shift 2 ;; -dbv | --DB_VERSION) DB_VERSION=$2 shift 2 ;; -txh | --TuXingHua) TuXingHua=$2 shift 2 ;; -udev | --UDEV) UDEV=$2 shift 2 ;; -dns | --DNS) DNS=$2 shift 2 ;; -dnss | --DNSSERVER) DNSSERVER=$2 shift 2 ;; -dnsn | --DNSNAME) DNSNAME=$2 shift 2 ;; -dnsi | --DNSIP) DNSIP=$2 shift 2 ;; -iso | --ISO) ISO=$2 shift 2 ;; -vbox | --VirtualBox) VirtualBox=$2 shift 2 ;; -h | --help) help ;; # function help is called --) shift break ;; # end of options -*) echo "Error: Option '$1' is unknown, try './OracleShellInstall.sh --help'." exit 1 ;; *) break ;; esac done #################################################################################### ## Log Write #################################################################################### if [ "$(find "${SOFTWAREDIR}" -maxdepth 1 -name 'oracleAllSilent_*.log' | wc -l)" -gt 0 ]; then rm -rf "${SOFTWAREDIR}"/oracleAllSilent_*.log fi oracleinstalllog="${SOFTWAREDIR}"/oracleAllSilent_$(date +"20%y%m%d%H%M%S").log logwrite() { { c1 "####################################################################################" green echo c1 "# $1" blue echo c1 "####################################################################################" green echo echo "$1 :" echo echo "$2" >"${SOFTWAREDIR}"/ex.sh chmod +x "${SOFTWAREDIR}"/ex.sh "${SOFTWAREDIR}"/ex.sh rm -rf "${SOFTWAREDIR}"/ex.sh echo } >>"${oracleinstalllog}" } ##Example ##logwrite "HostName" "hostname" ##logwrite "Firewalld" "systemctl status firewalld" echo ##Judge whether user is root, if it is not, exit if [ "$USER" != "root" ]; then echo c1 "The user must be root,and now you user is $USER,please su to root." red exit 1 fi if [ "${nodeNum}" -eq 1 ]; then echo c1 "Please Choose Oracle Install Mode(single/restart/rac) :" blue echo if [ -z "${OracleInstallMode}" ]; then read -r OracleInstallMode else echo "${OracleInstallMode}" fi echo c1 "Please Choose Oracle Database Version(11g/12c/18c/19c/21c) :" blue echo if [ -z "${DB_VERSION}" ]; then read -r DB_VERSION else echo "${DB_VERSION}" fi echo fi if [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "rac" ]; then RAC1HOSTNAME=${HOSTNAME}1 RAC2HOSTNAME=${HOSTNAME}2 fi ##Judge whether ip or dbversion is empty, if it is empty, exit if [ "${nodeNum}" -eq 1 ]; then # [WARNING] [INS-13001] Oracle Database is not supported on this operating system. Installer will not perform prerequisite checks on the system. if [ "${OS_VER_PRI}" -eq 6 ]; then if [[ "${DB_VERSION}" == "19c" ]] || [[ "${DB_VERSION}" == "19C" ]] || [[ "${DB_VERSION}" == "19" ]] || [[ "${DB_VERSION}" == "21c" ]] || [[ "${DB_VERSION}" == "21C" ]] || [[ "${DB_VERSION}" == "21" ]]; then c1 "Sorry, 19C/21C Must Install on Linux 7." red c1 "[INS-13001] Oracle Database is not supported on this operating system. Installer will not perform prerequisite checks on the system." blue exit 99 fi fi # 21c must choose cdb, otherwise dc create failed if [[ "${DB_VERSION}" == "21c" ]] || [[ "${DB_VERSION}" == "21C" ]] || [[ "${DB_VERSION}" == "21" ]]; then ISCDB=TRUE fi if [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "rac" ]; then ##IF Configure DNS if [ "${DNS}" = "y" ] || [ "${DNS}" = "Y" ]; then if [ -z "${DNSIP}" ] || [ -z "${DNSNAME}" ]; then c1 "Sorry, If you Wanna Configure DNS, you must set -dnsn and -dnsi First. " red exit 99 fi fi if [ "${OS_VER_PRI}" -eq 7 ]; then if [[ "${DB_VERSION}" == "11" ]] || [[ "${DB_VERSION}" == "11g" ]] || [[ "${DB_VERSION}" == "11G" ]]; then if [ ! -f "${SOFTWAREDIR}"/p18370031_112040_Linux-x86-64.zip ]; then c1 "Make sure the Patch 18370031 is in the ${SOFTWAREDIR} directory:" red c1 "p18370031_112040_Linux-x86-64.zip" blue exit 99 fi fi fi # 12c rac grid install on linux7 with bug if [[ "${DB_VERSION}" == "12c" ]] || [[ "${DB_VERSION}" == "12C" ]] || [[ "${DB_VERSION}" == "12" ]]; then if [ -z "${GPATCH}" ] && [ "${OS_VER_PRI}" -eq 7 ]; then c1 "Sorry, 12C RAC Grid Install on Linux 7 must -applyPSU First, Please Set -gpa patchnum." red exit 99 fi fi if [ -z "${HOSTNAME}" ] || [ -z "${RAC1PUBLICIP}" ] || [ -z "${RAC2PUBLICIP}" ] || [ -z "${RAC1VIP}" ] || [ -z "${RAC2VIP}" ] || [ -z "${RAC1PRIVIP}" ] || [ -z "${RAC2PRIVIP}" ] || [ -z "${RACSCANIP}" ] || [ -z "${DATA_BASEDISK}" ] || [ -z "${OCR_BASEDISK}" ] || [ -z "${RACPUBLICFCNAME}" ] || [ -z "${RACPRIVFCNAME}" ]; then echo c1 "IF Chosse RAC.Then HOSTNAME,RAC1PUBLICIP,RAC2PUBLICIP,RAC1VIP,RAC1PRIVIP,RAC2PRIVIP,RAC2VIP,RACSCANIP,DATA_BASEDISK,OCR_BASEDISK,RACPUBLICFCNAME,RACPRIVFCNAME are required parameters, try'./OracleShellInstall.sh --help' to execute the script" red echo exit 99 else ##create node2 script { echo -e "${SOFTWAREDIR}/OracleShellInstall.sh -i ${RAC2PUBLICIP}\c" echo -e " -n ${HOSTNAME}\c" echo -e " -o ${ORACLE_SID}\c" echo -e " -b ${ENV_BASE_DIR}\c" echo -e " -rs ${ROOTPASSWD}\c" echo -e " -op ${ORAPASSWD}\c" echo -e " -gp ${GRIDPASSWD}\c" echo -e " -s ${CHARACTERSET}\c" echo -e " -ns ${NCHARACTERSET}\c" echo -e " -pb1 ${RAC1PUBLICIP} -pb2 ${RAC2PUBLICIP}\c" echo -e " -vi1 ${RAC1VIP} -vi2 ${RAC2VIP}\c" echo -e " -pi1 ${RAC1PRIVIP} -pi2 ${RAC2PRIVIP}\c" echo -e " -si ${RACSCANIP}\c" echo -e " -dd ${DATA_BASEDISK}\c" echo -e " -od ${OCR_BASEDISK}\c" echo -e " -or ${OCRREDUN}\c" echo -e " -dr ${DATAREDUN}\c" echo -e " -puf ${RACPUBLICFCNAME} -prf ${RACPRIVFCNAME}\c" echo -e " -node 2\c" echo -e " -installmode ${OracleInstallMode}\c" echo -e " -dbv ${DB_VERSION}\c" echo -e " -txh ${TuXingHua}\c" echo -e " -udev ${UDEV}\c" echo -e " -dns ${DNS}\c" echo -e " -iso ${ISO}\c" echo -e " -vbox ${VirtualBox}\c" } >"${SOFTWAREDIR}"/racnode2.sh ##TimeServer if [ -n "${TIMESERVERIP}" ]; then echo -e " -tsi ${TIMESERVERIP}\c" >>"${SOFTWAREDIR}"/racnode2.sh fi ##Two Private ip if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ] && [ -n "${RACPRIVFCNAME1}" ]; then echo -e " -pi3 ${RAC1PRIVIP1} -pi4 ${RAC2PRIVIP1} -prf1 ${RACPRIVFCNAME1}\c" >>"${SOFTWAREDIR}"/racnode2.sh fi ## DNS Server Conf if [ "${DNSSERVER}" = "y" ] || [ "${DNSSERVER}" = "Y" ]; then echo -e " -dnss ${DNSSERVER}\c" >>"${SOFTWAREDIR}"/racnode2.sh fi ##Do not Configure local DNS Server if [ -n "${DNSIP}" ] && [ -n "${DNSNAME}" ]; then { echo -e " -dnsn ${DNSNAME}\c" echo -e " -dnsi ${DNSIP}\c" } >>"${SOFTWAREDIR}"/racnode2.sh fi fi else if [ -z "${PUBLICIP}" ]; then echo c1 "PUBLICIP and DB_VERSION is a required parameter, try'./OracleShellInstall.sh --help' to execute the script" red echo exit 99 fi fi fi { c1 "####################################################################################" green echo c1 "# Installation Logging" wb echo c1 "####################################################################################" green echo } >>"${oracleinstalllog}" #################################################################################### # OS Version #################################################################################### if [ "$OS_VER_PRI" -eq 7 ]; then OS_VERSION=linux7 elif [ "$OS_VER_PRI" -eq 6 ]; then OS_VERSION=linux6 elif [ "$OS_VER_PRI" -eq 8 ]; then OS_VERSION=linux8 else c1 "sorry, this operating system is not supported!!!" red exit 99 fi logwrite "OS Version" "echo ${OS_VERSION}" #################################################################################### # Choice DB Version #################################################################################### if [[ "${DB_VERSION}" == "21c" ]] || [[ "${DB_VERSION}" == "21C" ]] || [[ "${DB_VERSION}" == "21" ]]; then DB_VERSION=21.3.0.0 elif [[ "${DB_VERSION}" == "19c" ]] || [[ "${DB_VERSION}" == "19C" ]] || [[ "${DB_VERSION}" == "19" ]]; then DB_VERSION=19.3.0.0 elif [[ "${DB_VERSION}" == "18c" ]] || [[ "${DB_VERSION}" == "18C" ]] || [[ "${DB_VERSION}" == "18" ]]; then DB_VERSION=18.0.0.0 elif [[ "${DB_VERSION}" == "12c" ]] || [[ "${DB_VERSION}" == "12C" ]] || [[ "${DB_VERSION}" == "12" ]]; then DB_VERSION=12.2.0.1 elif [[ "${DB_VERSION}" == "11g" ]] || [[ "${DB_VERSION}" == "11G" ]] || [[ "${DB_VERSION}" == "11" ]]; then DB_VERSION=11.2.0.4 else c1 "Sorry, DB VERSION Input Error, exit" red exit 99 fi logwrite "DB Version" "echo ${DB_VERSION}" #################################################################################### # ScanIP #################################################################################### SCANIParse() { for i in ${RACSCANIP//,/ }; do scan_sum=$((scan_sum + 1)) if [ "${scan_sum}" = "0" ]; then c1 "Sorry, Please Set SCANIP by -si!" red exit 99 elif [ "${scan_sum}" = "1" ]; then RACSCANIP1="${i}" elif [ "${scan_sum}" = "2" ]; then RACSCANIP2="${i}" elif [ "${scan_sum}" = "3" ]; then RACSCANIP3="${i}" else c1 "Sorry, Only Support 3 SCANIP!" red exit 99 fi done } #################################################################################### # Choice DB HOME #################################################################################### ENV_ORACLE_BASE=$ENV_BASE_DIR/oracle ENV_GRID_BASE=$ENV_BASE_DIR/grid ENV_ORACLE_INVEN=$ENV_BASE_DIR/oraInventory if [ "${DB_VERSION}" = "11.2.0.4" ]; then ENV_ORACLE_HOME=$ENV_ORACLE_BASE/product/11.2.0/db ENV_GRID_HOME=$ENV_BASE_DIR/11.2.0/grid elif [ "${DB_VERSION}" = "12.2.0.1" ]; then ENV_ORACLE_HOME=$ENV_ORACLE_BASE/product/12.2.0/db ENV_GRID_HOME=$ENV_BASE_DIR/12.2.0/grid elif [ "${DB_VERSION}" = "18.0.0.0" ]; then ENV_ORACLE_HOME=$ENV_ORACLE_BASE/product/18.0.0/db ENV_GRID_HOME=$ENV_BASE_DIR/18.0.0/grid elif [ "${DB_VERSION}" = "19.3.0.0" ]; then ENV_ORACLE_HOME=$ENV_ORACLE_BASE/product/19.3.0/db ENV_GRID_HOME=$ENV_BASE_DIR/19.3.0/grid elif [ "${DB_VERSION}" = "21.3.0.0" ]; then ENV_ORACLE_HOME=$ENV_ORACLE_BASE/product/21.3.0/db ENV_GRID_HOME=$ENV_BASE_DIR/21.3.0/grid else c1 "Sorry, Error database version! please check again!" red exit fi #################################################################################### # Check Swap #################################################################################### SwapCheck() { COUNT= if [ "${memTotal}" -ge 1048576 ] && [ "${memTotal}" -le 2097152 ]; then swapNeed=$((memTotal * 3 / 2)) if [[ ${swapNeed} -gt ${swapTotal} ]]; then COUNT=$((swapNeed - swapTotal)) fi elif [ "${memTotal}" -gt 2097152 ] && [ "${memTotal}" -le 16777216 ]; then swapNeed=$memTotal if [[ ${swapNeed} -gt ${swapTotal} ]]; then COUNT=$((swapNeed - swapTotal)) fi elif [ "${memTotal}" -gt 16777216 ]; then swapNeed=16777216 if [[ ${swapNeed} -gt ${swapTotal} ]]; then COUNT=$((swapNeed - swapTotal)) fi else echo c1 "At least 1 GB RAM for Oracle Database installations. 2 GB RAM recommended." red exit 99 fi ##set swap space if [ -n "${COUNT}" ] && [ ! -f /swapfile ] && [ ${COUNT} -gt 40 ]; then c1 "Now Setting SWAP SPACE........" blue COUNT=$((COUNT / 1024 / 1024 + 1)) dd if=/dev/zero of=/swapfile bs=1G count=${COUNT} mkswap /swapfile swapon /swapfile echo "/swapfile swap swap defaults 0 0" >>/etc/fstab fi } if [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "rac" ]; then # echo # c1 "Please Choose Current node(1 or 2):" blue # echo # read -r nodeNum # echo if [ "${nodeNum}" -eq 1 ]; then c1 "Current node:1" wb hostname=${RAC1HOSTNAME} GRID_SIDTemp=${GRID_SID}$nodeNum ORACLE_SIDTemp=${ORACLE_SID}$nodeNum elif [ "${nodeNum}" -eq 2 ]; then c1 "Current node:2" wb hostname=${RAC2HOSTNAME} GRID_SIDTemp=${GRID_SID}$nodeNum ORACLE_SIDTemp=${ORACLE_SID}$nodeNum else c1 "Node Number Input Error, exit" red exit fi elif [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then hostname=${HOSTNAME} ORACLE_SIDTemp=${ORACLE_SID} GRID_SIDTemp=${GRID_SID} else hostname=${HOSTNAME} ORACLE_SIDTemp=${ORACLE_SID} fi ##get scanname and clustername if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then RACSCANNAME=${HOSTNAME}-scan CLUSTERNAME=${HOSTNAME}-cluster fi #################################################################################### #install rpm that oracle is necessary for installing #################################################################################### InstallRPM() { #################################################################################### # Judge ISO file mount status #################################################################################### if [ "${ISO}" = "Y" ]; then mountPatch=$(mount | grep -E "iso|ISO" | awk '{print $3}') if [ ! "${mountPatch}" ]; then echo c1 "The ISO file is not mounted on system." red exit 99 else ## move all repo bak mkdir /etc/yum.repos.d/bak -p mv /etc/yum.repos.d/* /etc/yum.repos.d/bak ##if [ ! -f /etc/yum.repos.d/local.repo ]; then if [ "${OS_VERSION}" = "linux6" ] || [ "${OS_VERSION}" = "linux7" ]; then { echo "[server]" echo "name=server" echo "baseurl=file://""${mountPatch}" echo "enabled=1" echo "gpgcheck=0" } >/etc/yum.repos.d/local.repo elif [ "${OS_VERSION}" = "linux8" ]; then { echo "[BaseOS]" echo "name=BaseOS" echo "baseurl=file:///${mountPatch}/BaseOS" echo "enabled=1" echo "gpgcheck=0" echo "[AppStream]" echo "name=AppStream" echo "baseurl=file:///${mountPatch}/AppStream" echo "enabled=1" echo "gpgcheck=0" } >/etc/yum.repos.d/local.repo ##fi ##rpm --import "${mountPatch}"/RPM-GPG-KEY-redhat-release fi fi fi ## For Chinese Linux ENV export LC_ALL=en_US.UTF-8 if [ "${OS_VERSION}" = "linux6" ]; then if [ "${TuXingHua}" = "y" ] || [ "${TuXingHua}" = "Y" ]; then #LINUX 6 yum groupinstall -y "X Window System" yum groupinstall -y "Desktop" yum install -y nautilus-open-terminal yum install -y tigervnc* fi if [ "$(rpm -q bc binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ elfutils-libelf elfutils-libelf-devel glibc glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXrender make net-tools smartmontools sysstat e2fsprogs e2fsprogs-libs expect unzip openssh-clients readline readline-devel psmisc ksh nfs-utils --qf '%{name}.%{arch}\n' | grep -E -c "not installed")" -gt 0 ] || [ "$(rpm -q bc binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ elfutils-libelf elfutils-libelf-devel glibc glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXrender make net-tools smartmontools sysstat e2fsprogs e2fsprogs-libs expect unzip openssh-clients readline readline-devel psmisc ksh nfs-utils --qf '%{name}.%{arch}\n' | grep -E -c "未安装软件包")" -gt 0 ]; then yum install -y bc \ binutils \ compat-libcap1 \ compat-libstdc++-33 \ gcc \ gcc-c++ \ elfutils-libelf \ elfutils-libelf-devel \ glibc \ glibc-devel \ libaio libaio-devel \ libgcc \ libstdc++ \ libstdc++-devel \ libxcb \ libX11 \ libXau \ libXi \ libXrender \ make \ net-tools \ smartmontools \ sysstat \ e2fsprogs \ e2fsprogs-libs \ expect \ unzip \ openssh-clients \ readline \ readline-devel \ psmisc \ ksh \ nfs-utils --skip-broken fi elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then if [ "${TuXingHua}" = "y" ] || [ "${TuXingHua}" = "Y" ]; then #LINUX 7 && LINUX 8 yum groupinstall -y "Server with GUI" yum install -y tigervnc* fi if [ "$(rpm -q bc binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ elfutils-libelf elfutils-libelf-devel glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make net-tools nfs-utils smartmontools sysstat e2fsprogs e2fsprogs-libs fontconfig-devel expect unzip openssh-clients readline readline-devel psmisc --qf '%{name}.%{arch}\n' | grep -E -c "not installed")" -gt 0 ] || [ "$(rpm -q bc binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ elfutils-libelf elfutils-libelf-devel glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make net-tools nfs-utils smartmontools sysstat e2fsprogs e2fsprogs-libs fontconfig-devel expect unzip openssh-clients readline readline-devel psmisc --qf '%{name}.%{arch}\n' | grep -E -c "未安装软件包")" -gt 0 ]; then yum install -y bc \ binutils \ compat-libcap1 \ compat-libstdc++-33 \ gcc \ gcc-c++ \ elfutils-libelf \ elfutils-libelf-devel \ glibc \ glibc-devel \ ksh \ libaio \ libaio-devel \ libgcc \ libstdc++ \ libstdc++-devel \ libxcb \ libX11 \ libXau \ libXi \ libXtst \ libXrender \ libXrender-devel \ make \ net-tools \ nfs-utils \ smartmontools \ sysstat \ e2fsprogs \ e2fsprogs-libs \ fontconfig-devel \ expect \ unzip \ openssh-clients \ readline \ readline-devel \ psmisc --skip-broken fi ##Solutions: error while loading shared libraries: libnsl.so.1: cannot open shared object ##Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1) if [ "${OS_VERSION}" = "linux8" ]; then dnf install -y librdmacm dnf install -y libnsl* dnf install -y libibverbs ##Linux Troubleshooting – semanage command not found in CentOS 7/8 And RHEL 7/8 dnf install -y policycoreutils-python-utils fi fi ## yum install -y openssh if [ "$nodeNum" -eq 1 ]; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then if echo "${ROOTPASSWD}" | passwd --stdin root; then EXPECT=/usr/bin/expect USER_PROMPT="*# " $EXPECT <"${SOFTWAREDIR}"/sshhostList.cfg $RAC2PUBLICIP EOF rm -rf /root/.ssh if echo "${ROOTPASSWD}" | passwd --stdin root; then SSHTrust root "${ROOTPASSWD}" "${SOFTWAREDIR}/sshhostList.cfg" fi if [ -f "${SOFTWAREDIR}"/sshhostList.cfg ]; then rm -rf "${SOFTWAREDIR}"/sshhostList.cfg fi fi fi if [ "${OS_VERSION}" = "linux7" ]; then if [ "$nodeNum" -eq 1 ]; then if [ "${DB_VERSION}" = "11.2.0.4" ]; then if [ -f "${SOFTWAREDIR}"/pdksh-5.2.14-37.el5.x86_64.rpm ]; then if rpm -e ksh-20120801-142.el7.x86_64; then if rpm -ivh pdksh-5.2.14-37.el5.x86_64.rpm; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then scp "${SOFTWAREDIR}"/pdksh-5.2.14-37.el5.x86_64.rpm "${RAC2PUBLICIP}":/root ssh "$RAC2PUBLICIP" rpm -ivh /root/pdksh-5.2.14-37.el5.x86_64.rpm fi rm -rf "${SOFTWAREDIR}"/pdksh-5.2.14-37.el5.x86_64.rpm fi fi fi fi if [ -f "${SOFTWAREDIR}"/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm ]; then if rpm -ivh "${SOFTWAREDIR}"/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then scp "${SOFTWAREDIR}"/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm "${RAC2PUBLICIP}":/root ssh "$RAC2PUBLICIP" rpm -ivh /root/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm fi rm -rf "${SOFTWAREDIR}"/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm fi fi fi fi # libc.so.6: version `GLIBC_2.14' not found # if [ "${OS_VERSION}" = "linux6" ] && [ "${DB_VERSION}" = "19.3.0.0" ] && [ "$(strings /lib64/libc.so.6 | grep -c GLIBC_2.14)" -eq 0 ]; then # if [ -f "${SOFTWAREDIR}"/glibc-2.14.tar.gz ]; then # tar -xvf "${SOFTWAREDIR}"/glibc-2.14.tar.gz # cd "${SOFTWAREDIR}"/glibc-2.14 || return # mkdir build && cd build && ../configure --prefix=/usr && make -j4 && make install && make localedata/install-locales # export LD_LIBRARY_PATH=/opt/glibc-2.14/lib:$LD_LIBRARY_PATH # else # c1 "Sorry ,glibc-2.14.tar.gz is not found in the directory ${SOFTWAREDIR},Please Upload it." # exit 99 # fi # fi if [ "${OS_VERSION}" = "linux6" ]; then logwrite "RPM Check" "rpm -q bc binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ elfutils-libelf elfutils-libelf-devel glibc glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXrender make net-tools smartmontools sysstat e2fsprogs e2fsprogs-libs expect unzip openssh-clients readline readline-devel" elif [ "${OS_VERSION}" = "linux7" ]; then logwrite "RPM Check" "rpm -q bc binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ elfutils-libelf elfutils-libelf-devel glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make net-tools nfs-utils smartmontools sysstat e2fsprogs e2fsprogs-libs fontconfig-devel expect unzip openssh-clients readline readline-devel" elif [ "${OS_VERSION}" = "linux8" ]; then logwrite "RPM Check" "rpm -q bc binutils gcc gcc-c++ elfutils-libelf elfutils-libelf-devel glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make net-tools nfs-utils smartmontools sysstat e2fsprogs e2fsprogs-libs fontconfig-devel expect unzip openssh-clients readline readline-devel librdmacm libnsl libibverbs policycoreutils-python-utils" fi } #################################################################################### # Configure hostname #################################################################################### SetHostName() { if [ "${OS_VERSION}" = "linux6" ]; then Hostname=$(grep -E "HOSTNAME=" /etc/sysconfig/network) if [[ $(grep -E "${hostname}" /etc/sysconfig/network) != "${hostname}" ]]; then /bin/hostname "$hostname" sed -i "s/${Hostname}/HOSTNAME=${hostname}/" /etc/sysconfig/network fi elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then if [[ $(grep -E "${hostname}" /etc/hostname) != "${hostname}" ]]; then /usr/bin/hostnamectl set-hostname "${hostname}" fi fi } logwrite "HOSTNAME" "echo ${hostname}" #################################################################################### # Configure /etc/hosts #################################################################################### SetHosts() { if [ "$(grep -E -c "#OracleBegin" /etc/hosts)" -eq 0 ]; then [ ! -f /etc/hosts."${DAYTIME}" ] && cp /etc/hosts /etc/hosts."${DAYTIME}" if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then ##Configure DNS HOSTS if [ "${DNS}" = "y" ] || [ "${DNS}" = "Y" ]; then cat <>/etc/hosts ##OracleBegin ##Public IP $RAC1PUBLICIP ${RAC1HOSTNAME}.${DNSNAME} $RAC1HOSTNAME $RAC2PUBLICIP ${RAC2HOSTNAME}.${DNSNAME} $RAC2HOSTNAME ##Private IP $RAC1PRIVIP $RAC1HOSTNAME-priv $RAC2PRIVIP $RAC2HOSTNAME-priv ##Virtual IP $RAC1VIP $RAC1HOSTNAME-vip $RAC2VIP $RAC2HOSTNAME-vip EOF if [ "${scan_sum}" = "1" ]; then cat <>/etc/hosts ##SCAN IP ##${RACSCANIP1} ${RACSCANNAME}.${DNSNAME} ${RACSCANNAME} EOF elif [ "${scan_sum}" = "2" ]; then cat <>/etc/hosts ##SCAN IP ##${RACSCANIP1} ${RACSCANNAME}.${DNSNAME} ${RACSCANNAME} ##${RACSCANIP2} ${RACSCANNAME}.${DNSNAME} ${RACSCANNAME} EOF elif [ "${scan_sum}" = "3" ]; then cat <>/etc/hosts ##SCAN IP ##${RACSCANIP1} ${RACSCANNAME}.${DNSNAME} ${RACSCANNAME} ##${RACSCANIP2} ${RACSCANNAME}.${DNSNAME} ${RACSCANNAME} ##${RACSCANIP3} ${RACSCANNAME}.${DNSNAME} ${RACSCANNAME} EOF fi if [ -n "${RAC1PRIVIP1}" ]; then cat <>/etc/hosts ##Private IP 2 $RAC1PRIVIP1 $RAC1HOSTNAME-priv1 $RAC2PRIVIP1 $RAC2HOSTNAME-priv1 EOF fi else cat <>/etc/hosts ##OracleBegin ##Public IP $RAC1PUBLICIP $RAC1HOSTNAME $RAC2PUBLICIP $RAC2HOSTNAME ##Private IP $RAC1PRIVIP $RAC1HOSTNAME-priv $RAC2PRIVIP $RAC2HOSTNAME-priv EOF ##add private1 if [ -n "${RAC1PRIVIP1}" ]; then cat <>/etc/hosts ##Private IP 2 $RAC1PRIVIP1 $RAC1HOSTNAME-priv1 $RAC2PRIVIP1 $RAC2HOSTNAME-priv1 ##Virtual IP $RAC1VIP $RAC1HOSTNAME-vip $RAC2VIP $RAC2HOSTNAME-vip ##Scan IP $RACSCANIP $RACSCANNAME EOF else cat <>/etc/hosts ##Virtual IP $RAC1VIP $RAC1HOSTNAME-vip $RAC2VIP $RAC2HOSTNAME-vip ##Scan IP $RACSCANIP $RACSCANNAME EOF fi fi else cat <>/etc/hosts ##OracleBegin #Public IP $PUBLICIP $HOSTNAME EOF fi fi logwrite "/etc/hosts" "cat /etc/hosts" } #################################################################################### # DNS SERVER CONFIGURE #################################################################################### DNSServerConf() { ##install bind yum install -y bind-libs bind bind-utils if [ "${OS_VERSION}" = "linux6" ]; then chkconfig named on elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then systemctl enable named fi if [ "$nodeNum" -eq 1 ]; then RacPublicIPFX=$(echo "${RAC1PUBLICIP}" | awk 'BEGIN {FS="."}{print $3"."$2"."$1"."}') RacPrivFX=$(echo "${RAC1PRIVIP}" | awk 'BEGIN {FS="."}{print $3"."$2"."$1"."}') RacPriv1FX=$(echo "${RAC1PRIVIP1}" | awk 'BEGIN {FS="."}{print $3"."$2"."$1"."}') Rac1Public=$(echo "${RAC1PUBLICIP}" | awk 'BEGIN {FS="."}{print $4}') Rac2Public=$(echo "${RAC2PUBLICIP}" | awk 'BEGIN {FS="."}{print $4}') Rac1Priv=$(echo "${RAC1PRIVIP}" | awk 'BEGIN {FS="."}{print $4}') Rac2Priv=$(echo "${RAC2PRIVIP}" | awk 'BEGIN {FS="."}{print $4}') Rac1Priv1=$(echo "${RAC1PRIVIP1}" | awk 'BEGIN {FS="."}{print $4}') Rac2Priv1=$(echo "${RAC2PRIVIP1}" | awk 'BEGIN {FS="."}{print $4}') Rac1Vip=$(echo "${RAC1VIP}" | awk 'BEGIN {FS="."}{print $4}') Rac2Vip=$(echo "${RAC2VIP}" | awk 'BEGIN {FS="."}{print $4}') RacScan1=$(echo "${RACSCANIP1}" | awk 'BEGIN {FS="."}{print $4}') RacScan2=$(echo "${RACSCANIP2}" | awk 'BEGIN {FS="."}{print $4}') RacScan3=$(echo "${RACSCANIP3}" | awk 'BEGIN {FS="."}{print $4}') cat </etc/named.conf options { listen-on port 53 { any; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; recursing-file "/var/named/data/named.recursing"; secroots-file "/var/named/data/named.secroots"; allow-query { any; }; recursion yes; dnssec-enable yes; dnssec-validation yes; bindkeys-file "/etc/named.root.key"; managed-keys-directory "/var/named/dynamic"; pid-file "/run/named/named.pid"; session-keyfile "/run/named/session.key"; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; zone "." IN { type hint; file "named.ca"; }; include "/etc/named.rfc1912.zones"; include "/etc/named.root.key"; EOF if [ "$(grep -E -c "#OracleBegin" /etc/named.rfc1912.zones)" -eq 0 ]; then [ ! -f /etc/named.rfc1912.zones."${DAYTIME}" ] && cp /etc/named.rfc1912.zones /etc/named.rfc1912.zones."${DAYTIME}" >/dev/null 2>&1 cat <>/etc/named.rfc1912.zones #OracleBegin zone "${DNSNAME}" IN { type master; file "${DNSNAME}.zone"; allow-update { none; }; }; zone "${RacPublicIPFX}in-addr.arpa." IN { type master; file "${RacPublicIPFX}arpa"; allow-update { none; }; }; zone "${RacPrivFX}in-addr.arpa." IN { type master; file "${RacPrivFX}arpa"; allow-update { none; }; }; EOF if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ] && [ -n "${RACPRIVFCNAME1}" ]; then if [ "$(grep -E -c "${RacPriv1FX}in-addr.arpa" /etc/named.rfc1912.zones)" -eq 0 ]; then cat <>/etc/named.rfc1912.zones zone "${RacPriv1FX}in-addr.arpa." IN { type master; file "${RacPriv1FX}arpa"; allow-update { none; }; }; #OracleEnd EOF else cat <>/etc/named.rfc1912.zones #OracleBegin EOF fi fi fi cat </var/named/"${DNSNAME}".zone \$TTL 1D @ IN SOA ${DNSNAME}. root.${DNSNAME}. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS ns.${DNSNAME}. ns IN A ${DNSIP} $RAC1HOSTNAME IN A ${RAC1PUBLICIP} $RAC2HOSTNAME IN A ${RAC2PUBLICIP} $RAC1HOSTNAME-priv IN A ${RAC1PRIVIP} $RAC2HOSTNAME-priv IN A ${RAC2PRIVIP} $RAC1HOSTNAME-vip IN A ${RAC1VIP} $RAC2HOSTNAME-vip IN A ${RAC2VIP} EOF cat </var/named/"${RacPublicIPFX}"arpa \$TTL 1D @ IN SOA ${DNSNAME}. root.${DNSNAME}. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS ns.${DNSNAME}. ns A ${DNSIP} ${Rac1Public} PTR $RAC1HOSTNAME.${DNSNAME}. ${Rac2Public} PTR $RAC2HOSTNAME.${DNSNAME}. ${Rac1Vip} PTR $RAC1HOSTNAME-vip.${DNSNAME}. ${Rac2Vip} PTR $RAC2HOSTNAME-vip.${DNSNAME}. EOF if [ "${scan_sum}" = "1" ]; then cat <>/var/named/"${RacPublicIPFX}"arpa ${RacScan1} PTR $RACSCANNAME.${DNSNAME}. EOF cat <>/var/named/"${DNSNAME}".zone $RACSCANNAME IN A ${RACSCANIP1} EOF elif [ "${scan_sum}" = "2" ]; then cat <>/var/named/"${RacPublicIPFX}"arpa ${RacScan1} PTR $RACSCANNAME.${DNSNAME}. ${RacScan2} PTR $RACSCANNAME.${DNSNAME}. EOF cat <>/var/named/"${DNSNAME}".zone $RACSCANNAME IN A ${RACSCANIP1} $RACSCANNAME IN A ${RACSCANIP2} EOF elif [ "${scan_sum}" = "3" ]; then cat <>/var/named/"${RacPublicIPFX}"arpa ${RacScan1} PTR $RACSCANNAME.${DNSNAME}. ${RacScan2} PTR $RACSCANNAME.${DNSNAME}. ${RacScan3} PTR $RACSCANNAME.${DNSNAME}. EOF cat <>/var/named/"${DNSNAME}".zone $RACSCANNAME IN A ${RACSCANIP1} $RACSCANNAME IN A ${RACSCANIP2} $RACSCANNAME IN A ${RACSCANIP3} EOF fi ##Configure Private ip arpa cat </var/named/"${RacPrivFX}"arpa \$TTL 1D @ IN SOA ${DNSNAME}. root.${DNSNAME}. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS ns.${DNSNAME}. ns A ${DNSIP} ${Rac1Priv} PTR $RAC1HOSTNAME-priv.${DNSNAME}. ${Rac2Priv} PTR $RAC2HOSTNAME-priv.${DNSNAME}. EOF ##Two Private IP Need to add 2 rules if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ] && [ -n "${RACPRIVFCNAME1}" ]; then cat <>/var/named/"${DNSNAME}".zone $RAC1HOSTNAME-priv1 IN A ${RAC1PRIVIP1} $RAC2HOSTNAME-priv1 IN A ${RAC2PRIVIP1} EOF ##Configure Private ip arpa cat </var/named/"${RacPriv1FX}"arpa \$TTL 1D @ IN SOA ${DNSNAME}. root.${DNSNAME}. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS ns.${DNSNAME}. ns A ${DNSIP} ${Rac1Priv1} PTR $RAC1HOSTNAME-priv1.${DNSNAME}. ${Rac2Priv1} PTR $RAC2HOSTNAME-priv1.${DNSNAME}. EOF fi fi systemctl restart named } #################################################################################### # Nslookup Check Function #################################################################################### NslookupFunc() { ##install bind yum install -y bind-libs bind bind-utils ssh "${RAC2HOSTNAME}" "yum install -y bind-libs bind bind-utils" cat </etc/resolv.conf search ${DNSNAME} nameserver ${DNSIP} options rotate options timeout:2 options attempts:5 EOF scp /etc/resolv.conf "${RAC2HOSTNAME}":/etc/ nslookup "${RAC1HOSTNAME}" nslookup "${RAC2HOSTNAME}" nslookup "${RAC1HOSTNAME}"-priv nslookup "${RAC2HOSTNAME}"-priv if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ]; then nslookup "${RAC1HOSTNAME}"-priv1 nslookup "${RAC2HOSTNAME}"-priv1 fi nslookup "${RAC1HOSTNAME}"-vip nslookup "${RAC2HOSTNAME}"-vip nslookup "${RACSCANNAME}" logwrite "NSLOOKUP CHECK" "host -l ${DNSNAME}" } #################################################################################### # create user and groups #################################################################################### CreateUsersAndDirs() { #################################################################################### # create user and groups #################################################################################### if [ "$(grep -E -c "oinstall" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54321 oinstall fi if [ "$(grep -E -c "dba" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54322 dba fi if [ "$(grep -E -c "oper" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54323 oper fi if [ "$(grep -E -c "backupdba" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54324 backupdba fi if [ "$(grep -E -c "dgdba" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54325 dgdba fi if [ "$(grep -E -c "kmdba" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54326 kmdba fi if [ "$(grep -E -c "racdba" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54330 racdba fi if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then if [ "$(grep -E -c "asmdba" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54327 asmdba fi if [ "$(grep -E -c "asmoper" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54328 asmoper fi if [ "$(grep -E -c "asmadmin" /etc/group)" -eq 0 ]; then /usr/sbin/groupadd -g 54329 asmadmin fi ##Create grid user if [ "$(grep -E -c "grid" /etc/passwd)" -eq 0 ]; then if ! /usr/sbin/useradd -u 11012 -g oinstall -G asmadmin,asmdba,asmoper,dba,racdba,oper grid; then echo "Command failed to adding user grid." exit 93 fi else /usr/sbin/usermod -g oinstall -G asmadmin,asmdba,asmoper,dba,racdba,oper grid fi ##Set user grid's password if ! echo "${GRIDPASSWD}" | passwd --stdin grid; then c1 "User grid is not existing." red exit 92 fi logwrite "Create user and groups(grid)" "id grid" fi if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then ##Create oracle user with RAC if [ "$(grep -E -c "oracle" /etc/passwd)" -eq 0 ]; then if ! /usr/sbin/useradd -u 54321 -g oinstall -G asmdba,dba,backupdba,dgdba,kmdba,racdba,oper oracle; then echo "Command failed to adding user --oracle." exit 93 fi else /usr/sbin/usermod -g oinstall -G asmdba,dba,backupdba,dgdba,kmdba,racdba,oper oracle fi else ##Create oracle user with Single if [ "$(grep -E -c "oracle" /etc/passwd)" -eq 0 ]; then if ! /usr/sbin/useradd -u 54321 -g oinstall -G dba,backupdba,dgdba,kmdba,racdba,oper oracle; then echo "Command failed to adding user --oracle." exit 93 fi else /usr/sbin/usermod -g oinstall -G dba,backupdba,dgdba,kmdba,racdba,oper oracle fi fi ##Set user oracle's password if ! echo "${ORAPASSWD}" | passwd --stdin oracle; then c1 "User oracle is not existing." red exit 92 fi logwrite "Create user and groups(oracle)" "id oracle" #################################################################################### #make directory #################################################################################### if [ "${ONLYCREATEDB}" = 'N' ]; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then [ ! -d "${ENV_GRID_BASE}" ] && mkdir -p "${ENV_GRID_BASE}" [ ! -d "${ENV_GRID_HOME}" ] && mkdir -p "${ENV_GRID_HOME}" [ ! -d "${ENV_ORACLE_HOME}" ] && mkdir -p "${ENV_ORACLE_HOME}" [ ! -d "${ENV_ORACLE_INVEN}" ] && mkdir -p "${ENV_ORACLE_INVEN}" [ ! -d "${BACKUPDIR}" ] && mkdir -p "${BACKUPDIR}" [ ! -d "${SCRIPTSDIR}" ] && mkdir -p "${SCRIPTSDIR}" chown -R oracle:oinstall "${SCRIPTSDIR}" chown -R oracle:oinstall "${BACKUPDIR}" chown -R grid:oinstall "${ENV_BASE_DIR}" chown -R grid:oinstall "${ENV_GRID_HOME}" chown -R grid:oinstall "${ENV_ORACLE_INVEN}" chown -R oracle:oinstall "${ENV_ORACLE_BASE}" chmod -R 775 "${ENV_BASE_DIR}" else [ ! -d "${ENV_ORACLE_HOME}" ] && mkdir -p "${ENV_ORACLE_HOME}" [ ! -d "${ENV_ORACLE_INVEN}" ] && mkdir -p "${ENV_ORACLE_INVEN}" [ ! -d "${ORADATADIR}" ] && mkdir -p "${ORADATADIR}" [ ! -d "${ARCHIVEDIR}" ] && mkdir -p "${ARCHIVEDIR}" [ ! -d "${BACKUPDIR}" ] && mkdir -p "${BACKUPDIR}" [ ! -d "${SCRIPTSDIR}" ] && mkdir -p "${SCRIPTSDIR}" chown -R oracle:oinstall "${SCRIPTSDIR}" chown -R oracle:oinstall "${ORADATADIR}" chown -R oracle:oinstall "${ARCHIVEDIR}" chown -R oracle:oinstall "${BACKUPDIR}" chown -R oracle:oinstall "${ENV_BASE_DIR}" chmod -R 775 "${ENV_BASE_DIR}" fi fi if [ "${DB_VERSION}" = "12.2.0.1" ]; then touch /etc/oraInst.loc echo "inventory_loc=${ENV_ORACLE_INVEN}" >>/etc/oraInst.loc echo "inst_group=oinstall" >>/etc/oraInst.loc fi } #################################################################################### # Configure SSH #################################################################################### Rac_Auto_SSH() { cat <"${SOFTWAREDIR}"/sshhostList.cfg $RAC1HOSTNAME $RAC2HOSTNAME $RAC1HOSTNAME-priv $RAC2HOSTNAME-priv EOF if [ -n "${RAC1PRIVIP1}" ]; then cat <>"${SOFTWAREDIR}"/sshhostList.cfg $RAC1HOSTNAME-priv1 $RAC2HOSTNAME-priv1 EOF fi rm -rf /root/.ssh rm -rf /home/oracle/.ssh rm -rf /home/grid/.ssh ## change root password if echo "${ROOTPASSWD}" | passwd --stdin root; then SSHTrust root "${ROOTPASSWD}" "${SOFTWAREDIR}/sshhostList.cfg" fi export -f SSHTrust su grid -c "SSHTrust grid ${GRIDPASSWD} ${SOFTWAREDIR}/sshhostList.cfg" su oracle -c "SSHTrust oracle ${ORAPASSWD} ${SOFTWAREDIR}/sshhostList.cfg" } #################################################################################### #Configure Udev+Multipath ASMDISK #################################################################################### UDEV_ASMDISK() { if [ "${UDEV}" = "Y" ] || [ "${UDEV}" = "y" ]; then # Install multipath yum install -y device-mapper-multipath mpathconf --enable --with_multipathd y # Configure multipath cat </etc/multipath.conf defaults { user_friendly_names yes } blacklist { devnode "^sda" } multipaths { EOF fi ocrdisk_sum=0 if [ -n "${OCR_BASEDISK}" ]; then for i in ${OCR_BASEDISK//,/ }; do ##judge whether disk is null,if disk is not null ocrdisk_size=$(lsblk "${i}" | awk '{print $4}' | head -n 2 | tail -n 1) ocrdisk_size=${ocrdisk_size//G/} ocrdisk_sum=$((ocrdisk_sum + ocrdisk_size)) if [ "$nodeNum" -eq 1 ]; then if [ "$(hexdump -n 1024 -C "${i}" | grep -c "${ASMOCRNAME}")" -gt 0 ]; then c1 "[FATAL] [INS-30516] Please specify unique disk groups." red echo echo "${i} :" hexdump -n 1024 -C "${i}" | grep "${ASMOCRNAME}" echo c1 "The ""${ASMOCRNAME}"" diskgroup name provided already exists on the disk. Whether Format the disk $i ?(Y|N)" blue read -r formatocrdisk if [ "$formatocrdisk" = "Y" ] || [ "$formatocrdisk" = "y" ]; then c1 "Now Formatting Disk ${i} ........" red dd if=/dev/zero of="${i}" bs=10M count=10 else c1 "Install Failed. [INS-30516] Please specify unique disk groups." red exit 99 fi fi fi ##Configure multipath.conf if [ "${UDEV}" = "Y" ] || [ "${UDEV}" = "y" ]; then ## VirtualBox if [ "${VirtualBox}" = "y" ] || [ "${VirtualBox}" = "Y" ]; then num1=$((num1 + 1)) if [ "${OS_VERSION}" = "linux6" ]; then cat <>/etc/multipath.conf multipath { wwid "$(echo $(scsi_id -g -u "${i}") | sed 's/1ATA_//')" alias ocr_${num1} } EOF elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then cat <>/etc/multipath.conf multipath { wwid "$(echo $(/usr/lib/udev/scsi_id -g -u "${i}") | sed 's/1ATA_//')" alias ocr_${num1} } EOF fi else num1=$((num1 + 1)) if [ "${OS_VERSION}" = "linux6" ]; then cat <>/etc/multipath.conf multipath { wwid "$(scsi_id -g -u "${i}")" alias ocr_${num1} } EOF elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then cat <>/etc/multipath.conf multipath { wwid "$(/usr/lib/udev/scsi_id -g -u "${i}")" alias ocr_${num1} } EOF fi fi fi done fi if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then if [ "${DB_VERSION}" = "12.2.0.1" ]; then if [ "$OCRREDUN" = "NORMAL" ]; then ocrdisk_sum=$((ocrdisk_sum / 2)) elif [ "$OCRREDUN" = "HIGH" ]; then ocrdisk_sum=$((ocrdisk_sum / 3)) fi if [ $ocrdisk_sum -lt 40 ]; then c1 "Install Failed. OCR DISK SIZE ${ocrdisk_sum}G MUST GRATER THAN 40G." red exit 99 fi fi fi if [ -n "${DATA_BASEDISK}" ]; then for i in ${DATA_BASEDISK//,/ }; do if [ "$nodeNum" -eq 1 ]; then if [ "$(hexdump -n 1024 -C "${i}" | grep -c "${ASMDATANAME}")" -gt 0 ]; then c1 "[FATAL] [INS-30516] Please specify unique disk groups." red echo "${i} :" hexdump -n 1024 -C "${i}" | grep "${ASMDATANAME}" echo c1 "The ""${ASMDATANAME}"" diskgroup name provided already exists on the disk. Whether Format the disk $i ?(Y|N)" blue read -r formatdatadisk if [ "$formatdatadisk" = "Y" ] || [ "$formatdatadisk" = "y" ]; then c1 "Now Formatting Disk ${i} ........" red dd if=/dev/zero of="${i}" bs=10M count=10 else c1 "Install Failed. [INS-30516] Please specify unique disk groups." red exit 99 fi fi fi ##Configure multipath.conf if [ "${UDEV}" = "Y" ] || [ "${UDEV}" = "y" ]; then ## VirtualBox if [ "${VirtualBox}" = "y" ] || [ "${VirtualBox}" = "Y" ]; then num2=$((num2 + 1)) if [ "${OS_VERSION}" = "linux6" ]; then cat <>/etc/multipath.conf multipath { wwid "$(echo $(scsi_id -g -u "${i}") | sed 's/1ATA_//')" alias data_${num2} } EOF elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then cat <>/etc/multipath.conf multipath { wwid "$(echo $(/usr/lib/udev/scsi_id -g -u "${i}") | sed 's/1ATA_//')" alias data_${num2} } EOF fi else num2=$((num2 + 1)) if [ "${OS_VERSION}" = "linux6" ]; then cat <>/etc/multipath.conf multipath { wwid "$(scsi_id -g -u "${i}")" alias data_${num2} } EOF elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then cat <>/etc/multipath.conf multipath { wwid "$(/usr/lib/udev/scsi_id -g -u "${i}")" alias data_${num2} } EOF fi fi fi done fi ##Configure multipath.conf if [ "${UDEV}" = "Y" ] || [ "${UDEV}" = "y" ]; then echo "}" >>/etc/multipath.conf multipath -F multipath -v2 multipath -r multipath -F multipath -v2 fi logwrite "multipath info:" "multipath -ll" #################################################################################### # Configure udev #################################################################################### if [ "${UDEV}" = "Y" ] || [ "${UDEV}" = "y" ]; then if [ -f /dev/mapper/udev_info ]; then rm -rf /dev/mapper/udev_info fi cd /dev/mapper || return for i in ocr_* data_*; do printf "%s %s\n" "$i" "$(udevadm info --query=all --name=/dev/mapper/"$i" | grep -i dm_uuid)" >>udev_info done cd ~ || return ##remove /etc/udev/rules.d/99-oracle-asmdevices.rules if [ ! -f /etc/udev/rules.d/99-oracle-asmdevices.rules ]; then rm -rf /etc/udev/rules.d/99-oracle-asmdevices.rules fi while read -r line; do dm_uuid=$(echo "$line" | awk -F'=' '{print $2}') disk_name=$(echo "$line" | awk '{print $1}') echo "KERNEL==\"dm-*\",ENV{DM_UUID}==\"${dm_uuid}\",SYMLINK+=\"asm_${disk_name}\",OWNER=\"grid\",GROUP=\"asmadmin\",MODE=\"0660\"" >>/etc/udev/rules.d/99-oracle-asmdevices.rules done >ocr_temp echo -n "${i}",, >>ocr_fail_temp OCRDISK=$(cat ocr_temp) OCRFailureDISK=$(cat ocr_fail_temp) OCRDISK=${OCRDISK%*,} OCRFailureDISK=${OCRFailureDISK%*,} done if [ -f "${SOFTWAREDIR}"/data_temp ]; then rm -rf "${SOFTWAREDIR}"/data_temp fi if [ -f "${SOFTWAREDIR}"/data_fail_temp ]; then rm -rf "${SOFTWAREDIR}"/data_fail_temp fi cd "${SOFTWAREDIR}" || return for i in /dev/asm_data*; do if [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then echo -n "${i}", >>data_temp echo -n "${i}",, >>data_fail_temp DATAFailureDISK=$(cat data_fail_temp) DATAFailureDISK=${DATAFailureDISK%*,} else echo -n "'${i}'," >>data_temp fi DATADISK=$(cat data_temp) DATADISK=${DATADISK%*,} done logwrite "udev asm info:" "ls /dev/asm_*" if [ "$(find "${SOFTWAREDIR}" -mindepth 1 -name '*temp' | wc -l)" -gt 0 ]; then rm -rf "${SOFTWAREDIR}"/*temp fi } #################################################################################### # NODE2 Excute shell script #################################################################################### NodeTwoExec() { ##rac send node2 script and & excute ssh "$RAC2PUBLICIP" mkdir "${SOFTWAREDIR}" ##cp racnode2.sh to node2 scp "${SOFTWAREDIR}"/racnode2.sh "${RAC2PUBLICIP}":"${SOFTWAREDIR}" ##cp OracleShellInstall.sh to node2 scp "${SOFTWAREDIR}"/OracleShellInstall.sh "${RAC2PUBLICIP}":"${SOFTWAREDIR}" #excute racnode2.sh on node2 c1 "Now Excute Script on Node2:" blue ssh "$RAC2PUBLICIP" chmod +x "${SOFTWAREDIR}"/racnode2.sh ##https://www.cnblogs.com/youngerger/p/9104144.html ssh -t "$RAC2PUBLICIP" "cd ${SOFTWAREDIR};sh ${SOFTWAREDIR}/racnode2.sh" if [ -f "${SOFTWAREDIR}"/racnode2.sh ]; then rm -rf "${SOFTWAREDIR}"/racnode2.sh fi c1 "Node2 Setup Finish." blue } #################################################################################### #Time dependent Settings #################################################################################### TimeDepSet() { if [ "${OS_VERSION}" = "linux6" ]; then if [ "$(grep -E -c "Asia/Shanghai" /etc/sysconfig/clock)" -eq 0 ]; then [ ! -f /etc/sysconfig/clock."${DAYTIME}" ] && cp /etc/sysconfig/clock /etc/sysconfig/clock."${DAYTIME}" cat </etc/sysconfig/clock ZONE="Asia/Shanghai" EOF /bin/cp -rf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime fi if [ "$(chkconfig --list | grep ntpd | grep -c on)" -gt 0 ]; then service ntpd stop chkconfig ntpd off fi logwrite "ntpd" "service ntpd status" [ -f /etc/ntp.conf ] && mv /etc/ntp.conf /etc/ntp.conf.orig elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then yum install -y chrony timedatectl set-timezone Asia/Shanghai if [ "$(systemctl status chronyd | grep -c running)" -gt 0 ]; then systemctl stop chronyd.service systemctl disable chronyd.service fi logwrite "chronyd" "systemctl status chronyd" fi ##ntpdate configure if [[ -n "${TIMESERVERIP}" ]]; then if [ "${OS_VERSION}" = "linux6" ] || [ "${OS_VERSION}" = "linux7" ]; then yum install -y ntpdate if [ ! -f /var/spool/cron/root ]; then echo "##For ntpupdate" >>/var/spool/cron/root fi if [ "$(grep -E -c "#OracleBegin" /var/spool/cron/root)" -eq 0 ]; then [ ! -f /var/spool/cron/root."${DAYTIME}" ] && cp /var/spool/cron/root /var/spool/cron/root."${DAYTIME}" >/dev/null 2>&1 { echo "#OracleBegin" echo "00 12 * * * /usr/sbin/ntpdate -u ${TIMESERVERIP} && /usr/sbin/hwclock -w" echo "#OracleEnd" } >>/var/spool/cron/root fi /usr/sbin/ntpdate -u "${TIMESERVERIP}" && /usr/sbin/hwclock -w elif [ "${OS_VERSION}" = "linux8" ]; then if [ ! -f /var/spool/cron/root ]; then echo "##For ntpupdate" >>/var/spool/cron/root fi if [ "$(grep -E -c "#OracleBegin" /var/spool/cron/root)" -eq 0 ]; then [ ! -f /var/spool/cron/root."${DAYTIME}" ] && cp /var/spool/cron/root /var/spool/cron/root."${DAYTIME}" >/dev/null 2>&1 { echo "#OracleBegin" echo "00 12 * * * /usr/sbin/chronyd -q \"server ${TIMESERVERIP} iburst \" && timedatectl set-local-rtc 0" echo " #OracleEnd" } >>/var/spool/cron/root fi chronyd -q "server ${TIMESERVERIP} iburst" && timedatectl set-local-rtc 0 fi logwrite "Time ntpdate" "crontab -l" fi logwrite "Time dependent" "date" } #################################################################################### #Stop avahi deamon #################################################################################### Disableavahi() { if [ "${OS_VERSION}" = "linux6" ]; then yum install -y avahi* if [ "$(chkconfig --list | grep avahi-daemon | grep -c '3:on')" -gt 0 ]; then service avahi-daemon stop chkconfig avahi-daemon off fi logwrite "avahi-daemon" "service avahi-daemon status" elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then yum install -y avahi* if [ "$(systemctl status avahi-daemon | grep -c running)" -gt 0 ]; then systemctl stop avahi-daemon.socket systemctl stop avahi-daemon.service pgrep -f avahi-daemon | awk '{print "kill -9 "$2}' fi systemctl disable avahi-daemon.service systemctl disable avahi-daemon.socket logwrite "avahi-daemon" "systemctl status avahi-daemon" fi } #################################################################################### # Stop firefall #################################################################################### DisableFirewall() { if [ "${OS_VERSION}" = "linux6" ]; then if [ "$(chkconfig --list | grep tables | grep -c on)" -gt 0 ]; then service iptables stop chkconfig iptables off service ip6tables stop chkconfig ip6tables off fi logwrite "Iptables" "service iptables status" elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then if [ "$(systemctl status firewalld.service | grep -c running)" -gt 0 ]; then systemctl stop firewalld.service systemctl disable firewalld.service fi logwrite "Firewalld" "systemctl status firewalld" fi } #################################################################################### # Disable Selinux #################################################################################### DisableSelinux() { if [[ "$(/usr/sbin/getenforce)" != "Disabled" ]]; then /usr/sbin/setenforce 0 fi if [ "$(grep -E -c "SELINUX=enforcing" /etc/selinux/config)" -gt 0 ]; then [ ! -f /etc/selinux/config."${DAYTIME}" ] && cp /etc/selinux/config /etc/selinux/config."${DAYTIME}" sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config fi logwrite "SELINUX" "getenforce" } #################################################################################### # Disable transparent_hugepages&&numa #################################################################################### DisableTHPAndNUMA() { if [ "${OS_VERSION}" = "linux6" ]; then if [ "$(grep -E -c "/sys/kernel/mm/transparent_hugepage/enabled" /etc/rc.d/rc.local)" -eq 0 ]; then cat >>/etc/rc.d/rc.local < /sys/kernel/mm/transparent_hugepage/enabled fi if test -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi EOF fi if [ "$(grep -E -c "numa=off" /boot/grub/grub.conf)" -eq 0 ]; then [ ! -f /boot/grub/grub.conf."${DAYTIME}" ] && cp /boot/grub/grub.conf /boot/grub/grub.conf."${DAYTIME}" sed -i 's/quiet/quiet numa=off/' /boot/grub/grub.conf fi logwrite "/boot/grub/grub.conf" "cat /boot/grub/grub.conf" elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then if [ "$(grep -E -c "transparent_hugepage=never numa=off" /etc/default/grub)" -eq 0 ]; then [ ! -f /etc/default/grub."${DAYTIME}" ] && cp /etc/default/grub /etc/default/grub."${DAYTIME}" if [ "${DB_VERSION}" = "21.3.0.0" ]; then sed -i 's/quiet/quiet transparent_hugepage=never numa=off clocksource=tsc tsc=reliable/' /etc/default/grub else sed -i 's/quiet/quiet transparent_hugepage=never numa=off/' /etc/default/grub fi grub2-mkconfig -o /boot/grub2/grub.cfg fi logwrite "/etc/default/grub" "cat /etc/default/grub" fi logwrite "Transparent_hugepages" "cat /sys/kernel/mm/transparent_hugepage/enabled" logwrite "NUMA" "cat /proc/cmdline" } #################################################################################### # Disable NetworkManager #################################################################################### DisableNetworkManager() { if [ "${OS_VERSION}" = "linux6" ]; then if [ "$(chkconfig --list | grep NetworkManager | grep -c on)" -gt 0 ]; then service NetworkManager stop chkconfig NetworkManager off service NetworkManager off fi logwrite "NetworkManager" "service NetworkManager status" elif [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then #Turn off the NetworkManager(Linux 7) if [ "$(systemctl status NetworkManager.service | grep -c running)" -gt 0 ]; then systemctl stop NetworkManager.service systemctl disable NetworkManager.service fi logwrite "NetworkManager" "systemctl status NetworkManager" fi } EditParaFiles() { #################################################################################### # Edit sysctl.conf #################################################################################### ##shmmal's Calculation formula: physical memory 8G:(8*1024*1024*1024)/4096=2097152 ##shmmax's Calculation formula: physical memory 8G:(8/2)*1024*1024*1024 -1=4294967295 totalMemory=$((memTotal / 2048)) shmall=$((memTotal / 4)) if [ $shmall -lt 2097152 ]; then shmall=2097152 fi shmmax=$((memTotal * 1024 - 1)) if [ "$shmmax" -lt 4294967295 ]; then shmmax=4294967295 fi if [ "$(grep -E -c "#OracleBegin" /etc/sysctl.conf)" -eq 0 ]; then [ ! -f /etc/sysctl.conf."${DAYTIME}" ] && cp /etc/sysctl.conf /etc/sysctl.conf."${DAYTIME}" cat <>/etc/sysctl.conf #OracleBegin ##shmmal's Calculation formula: physical memory 8G:(8*1024*1024*1024)/4096=2097152 ##shmmax's Calculation formula: physical memory 8G:(8/2)*1024*1024*1024 -1=4294967295 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = $shmall kernel.shmmax = $shmmax 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 EOF if [ "${OS_VERSION}" = "linux8" ]; then cat <>/etc/sysctl.conf # sysctl kernel.numa_balancing kernel.numa_balancing = 0 EOF fi if [ -n "${RACPUBLICFCNAME}" ] && [ -n "${RACPRIVFCNAME}" ]; then cat <>/etc/sysctl.conf net.ipv4.conf.${RACPUBLICFCNAME}.rp_filter = 1 net.ipv4.conf.${RACPRIVFCNAME}.rp_filter = 2 EOF fi if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ] && [ -n "${RACPRIVFCNAME1}" ]; then cat <>/etc/sysctl.conf net.ipv4.conf.${RACPRIVFCNAME1}.rp_filter = 2 #OracleEnd EOF else cat <>/etc/sysctl.conf #OracleEnd EOF fi sysctl -p logwrite "/etc/sysctl.conf" "sysctl -p" fi #################################################################################### # Edit nsysctl.conf #################################################################################### if [ "$(grep -E -c "#OracleBegin" /etc/sysconfig/network)" -eq 0 ]; then [ ! -f /etc/sysconfig/network."${DAYTIME}" ] && cp /etc/sysconfig/network /etc/sysconfig/network."${DAYTIME}" { echo "#OracleBegin" echo "NOZEROCONF=yes" echo "#OracleEnd" } >>/etc/sysconfig/network fi logwrite "NOZEROCONF" "cat /etc/sysconfig/network" #################################################################################### # Edit RemoveIPC=no #################################################################################### if [ "${OS_VERSION}" = "linux7" ] || [ "${OS_VERSION}" = "linux8" ]; then if [ "$(grep -E -c "#RemoveIPC=no" /etc/systemd/logind.conf)" -gt 0 ]; then sed -i 's/#RemoveIPC=no/RemoveIPC=no/g' /etc/systemd/logind.conf systemctl daemon-reload systemctl restart systemd-logind fi fi logwrite "RemoveIPC" "cat /etc/systemd/logind.conf | grep -v \"^\$\"|grep -v \"^#\"" #################################################################################### # Edit limits.conf #################################################################################### if [ "${OS_VERSION}" = "linux7" ]; then sed -i 's/* soft nproc 4096/* - nproc 16384/g' /etc/security/limits.d/20-nproc.conf logwrite "/etc/security/limits.d/20-nproc.conf" "cat /etc/security/limits.d/20-nproc.conf | grep -v \"^\$\"|grep -v \"^#\"" fi if [ "$(grep -E -c "#OracleBegin" /etc/security/limits.conf)" -eq 0 ]; then [ ! -f /etc/security/limits.conf."${DAYTIME}" ] && cp /etc/security/limits.conf /etc/security/limits.conf."${DAYTIME}" if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then cat <>/etc/security/limits.conf #OracleBegin oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768 oracle soft nproc 2047 oracle hard nproc 16384 oracle hard memlock 134217728 oracle soft memlock 134217728 grid soft nofile 1024 grid hard nofile 65536 grid soft stack 10240 grid hard stack 32768 grid soft nproc 2047 grid hard nproc 16384 #OracleEnd EOF else cat <>/etc/security/limits.conf #OracleBegin oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768 oracle soft nproc 2047 oracle hard nproc 16384 oracle hard memlock 134217728 oracle soft memlock 134217728 #OracleEnd EOF fi fi logwrite "/etc/security/limits.conf" "cat /etc/security/limits.conf | grep -v \"^\$\"|grep -v \"^#\"" ##Configure pam.d if [ "$(grep -E -c "#OracleBegin" /etc/pam.d/login)" -eq 0 ]; then cat <>/etc/pam.d/login #OracleBegin session required pam_limits.so session required /lib64/security/pam_limits.so #OracleEnd EOF fi logwrite "/etc/pam.d/login" "cat /etc/pam.d/login | grep -v \"^\$\"|grep -v \"^#\"" #################################################################################### # Configure /dev/shm #################################################################################### if [ "$(grep -E -c "/dev/shm" /etc/fstab)" -eq 0 ]; then [ ! -f /etc/fstab."${DAYTIME}" ] && cp /etc/fstab /etc/fstab."${DAYTIME}" cat <>/etc/fstab tmpfs /dev/shm tmpfs size=${memTotal}k 0 0 EOF mount -o remount /dev/shm else if [ "$shmTotal" -lt "$memTotal" ]; then shmTotal=$memTotal [ ! -f /etc/fstab."${DAYTIME}" ] && cp /etc/fstab /etc/fstab."${DAYTIME}" line=$(grep -n "/dev/shm" /etc/fstab | awk -F ":" '{print $1}') sed -i "${line} d" /etc/fstab cat <>/etc/fstab tmpfs /dev/shm tmpfs size=${memTotal}k 0 0 EOF mount -o remount /dev/shm fi fi logwrite "/etc/fstab" "cat /etc/fstab | grep -v \"^\$\"|grep -v \"^#\"" logwrite "shm" "df -Th /dev/shm" logwrite "df -hP" "df -hP" #################################################################################### # Edit bash_profile #################################################################################### ##ROOT: root_profile=/root/.bash_profile if [ "$(grep -E -c "#OracleBegin" ${root_profile})" -eq 0 ]; then cat <>${root_profile} ################OracleBegin######################### alias so='su - oracle' export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ ' EOF if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then cat <>${root_profile} alias crsctl='${ENV_GRID_HOME}/bin/crsctl' alias sg='su - grid' ################OracleEnd########################### EOF else cat <>${root_profile} ################OracleEnd########################### EOF fi fi logwrite "ROOT Profile" "cat ${root_profile} | grep -v \"^\$\"|grep -v \"^#\"" ##ORALCE: if [ "$(grep -E -c "#OracleBegin" /home/oracle/.bash_profile)" -eq 0 ]; then cat <>/home/oracle/.bash_profile ################OracleBegin######################### umask 022 export TMP=/tmp export TMPDIR=\$TMP export NLS_LANG=AMERICAN_AMERICA.${CHARACTERSET} #AL32UTF8,ZHS16GBK export ORACLE_BASE=${ENV_ORACLE_BASE} export ORACLE_HOME=${ENV_ORACLE_HOME} export ORACLE_HOSTNAME=${hostname} export ORACLE_TERM=xterm export TNS_ADMIN=\$ORACLE_HOME/network/admin export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib export ORACLE_SID=${ORACLE_SIDTemp} export PATH=/usr/sbin:\$PATH export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH alias sas='sqlplus / as sysdba' alias alert='tail -500f \$ORACLE_BASE/diag/rdbms/\$ORACLE_SID/\$ORACLE_SID/trace/alert_\$ORACLE_SID.log|more' export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ ' EOF ##Users are strongly recommended to go with 19.9 DB RU (or later) to minimize the number of Patches to be installed.19.9 OJVM & OCW RU Patches are also recommended to be applied,during/after the Installation. if [ "${OS_VERSION}" = "linux8" ]; then cat <>/home/oracle/.bash_profile export CV_ASSUME_DISTID=OL7 EOF fi if rlwrap -v >/dev/null 2>&1; then cat <>/home/oracle/.bash_profile alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' alias lsnrctl='rlwrap lsnrctl' alias asmcmd='rlwrap asmcmd' alias adrci='rlwrap adrci' alias ggsci='rlwrap ggsci' alias dgmgrl='rlwrap dgmgrl' ################OracleEnd########################### EOF else cat <>/home/oracle/.bash_profile ################OracleEnd########################### EOF fi else cp /home/oracle/.bash_profile /home/oracle/.bash_profile_bak chown -R oracle:oinstall /home/oracle/.bash_profile_bak ##if oraclesid oraclehome oraclebase is not the same of bash_profile , will update oracleSid=$(grep "ORACLE_SID=" /home/oracle/.bash_profile | awk '{print $2}') oracleSid=${oracleSid#*=} oracleHostname=$(grep "ORACLE_HOSTNAME=" /home/oracle/.bash_profile | awk '{print $2}') oracleHostname=${oracleHostname#*=} oracleBase=$(grep "ORACLE_BASE=" /home/oracle/.bash_profile | awk '{print $2}') oracleBase=${oracleBase#*=} oracleHome=$(grep "ORACLE_HOME=" /home/oracle/.bash_profile | awk '{print $2}') oracleHome=${oracleHome#*=} if [ "${oracleSid}" != "${ORACLE_SIDTemp}" ]; then sed -i "s/ORACLE_SID=${oracleSid}/ORACLE_SID=${ORACLE_SIDTemp}/" /home/oracle/.bash_profile fi if [ "${oracleHostname}" != "${hostname}" ]; then sed -i "s/ORACLE_HOSTNAME=${oracleHostname}/ORACLE_HOSTNAME=${hostname}/" /home/oracle/.bash_profile fi if [ "${oracleBase}" != "${ENV_ORACLE_BASE}" ]; then sed -i "s#ORACLE_BASE=${oracleBase}#ORACLE_BASE=${ENV_ORACLE_BASE}#" /home/oracle/.bash_profile fi if [ "${oracleHome}" != "${ENV_ORACLE_HOME}" ]; then sed -i "s#ORACLE_HOME=${oracleHome}#ORACLE_HOME=${ENV_ORACLE_HOME}#" /home/oracle/.bash_profile fi fi logwrite "Oracle Profile" "cat /home/oracle/.bash_profile | grep -v \"^\$\"|grep -v \"^#\"" ##GRID: if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then if [ "$(grep -E -c "#OracleBegin" /home/grid/.bash_profile)" -eq 0 ]; then cat <>/home/grid/.bash_profile ################OracleBegin######################### umask 022 export TMP=/tmp export TMPDIR=\$TMP export NLS_LANG=AMERICAN_AMERICA.${CHARACTERSET} #AL32UTF8,ZHS16GBK export ORACLE_BASE=${ENV_GRID_BASE} export ORACLE_HOME=${ENV_GRID_HOME} export ORACLE_TERM=xterm export TNS_ADMIN=\$ORACLE_HOME/network/admin export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib export ORACLE_SID=${GRID_SIDTemp} export PATH=/usr/sbin:\$PATH export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH alias sas='sqlplus / as sysasm' export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ ' EOF if rlwrap -v >/dev/null 2>&1; then cat <>/home/grid/.bash_profile alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' alias lsnrctl='rlwrap lsnrctl' alias asmcmd='rlwrap asmcmd' alias adrci='rlwrap adrci' ################OracleEnd########################### EOF else cat <>/home/grid/.bash_profile ################OracleEnd########################### EOF fi fi logwrite "Grid Profile" "cat /home/grid/.bash_profile | grep -v \"^\$\"|grep -v \"^#\"" fi } #################################################################################### # Install rlwrap #################################################################################### InstallRlwrap() { if [ "$(find "${SOFTWAREDIR}" -maxdepth 1 -name 'rlwrap-*.gz' | wc -l)" -gt 0 ]; then if ! rlwrap -v >/dev/null 2>&1; then yum install -y tar mkdir "${SOFTWAREDIR}"/rlwrap tar -zxvf "${SOFTWAREDIR}"/rlwrap*tar.gz --strip-components 1 -C "${SOFTWAREDIR}"/rlwrap cd "${SOFTWAREDIR}"/rlwrap || return ./configure && make && make install fi logwrite "rlwrap" "rlwrap -v" if [ "$(find "${SOFTWAREDIR}" -mindepth 1 -name 'rlwrap*' | wc -l)" -gt 0 ]; then cd ~ || return rm -rf "${SOFTWAREDIR}/"rlwrap* fi fi } #################################################################################### #unzip Grid #################################################################################### UnzipGridSoft() { ##remove ORACLE_HOME's files ##echo "${ORACLE_HOME}" | awk -F"/" '{if($NF=="") {print "rm -rf "$0"*"} else {print "rm -rf "$0"/*"}}' | bash if [ "${DB_VERSION}" = "11.2.0.4" ]; then if [ -d "${SOFTWAREDIR}"/grid ]; then cd ~ || return rm -rf "${SOFTWAREDIR}"/grid fi if unzip -o "${SOFTWAREDIR}"/p13390677_112040_Linux-x86-64_3of7.zip -d "${SOFTWAREDIR}"; then ##rm -rf "${SOFTWAREDIR}"/p13390677_112040_Linux-x86-64_3of7.zip chown -R grid:oinstall "${SOFTWAREDIR}"/grid else c1 "Make sure the grid installation package is in the ${SOFTWAREDIR} directory:" red c1 "p13390677_112040_Linux-x86-64_3of7.zip" blue exit 99 fi elif [ "${DB_VERSION}" = "12.2.0.1" ]; then if [ -f "${ENV_GRID_HOME}" ]; then if [ "$(find "${ENV_GRID_HOME}" -mindepth 1 | wc -l)" -gt 0 ]; then cd ~ || return rm -rf "${ENV_GRID_HOME}" rm -rf "${ENV_GRID_HOME}/".* fi fi if unzip -o "${SOFTWAREDIR}"/LINUX.X64_122010_grid_home.zip -d "${ENV_GRID_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/LINUX.X64_122010_grid_home.zip chown -R grid:oinstall "${ENV_GRID_HOME}" else c1 "Make sure the grid installation package is in the ${SOFTWAREDIR} directory:" red c1 "LINUX.X64_122010_grid_home.zip" blue exit 99 fi elif [ "${DB_VERSION}" = "18.0.0.0" ]; then if [ -f "${ENV_GRID_HOME}" ]; then if [ "$(find "${ENV_GRID_HOME}" -mindepth 1 | wc -l)" -gt 0 ]; then cd ~ || return rm -rf "${ENV_GRID_HOME}" rm -rf "${ENV_GRID_HOME}/".* fi fi if unzip -o "${SOFTWAREDIR}"/LINUX.X64_180000_grid_home.zip -d "${ENV_GRID_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/LINUX.X64_180000_grid_home.zip chown -R grid:oinstall "${ENV_GRID_HOME}" else c1 "Make sure the grid installation package is in the ${SOFTWAREDIR} directory:" red c1 "LINUX.X64_180000_grid_home.zip" blue exit 99 fi elif [ "${DB_VERSION}" = "19.3.0.0" ]; then if [ -f "${ENV_GRID_HOME}" ]; then if [ "$(find "${ENV_GRID_HOME}" -mindepth 1 | wc -l)" -gt 0 ]; then cd ~ || return rm -rf "${ENV_GRID_HOME}" rm -rf "${ENV_GRID_HOME}/".* fi fi if unzip -o "${SOFTWAREDIR}"/LINUX.X64_193000_grid_home.zip -d "${ENV_GRID_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/LINUX.X64_193000_grid_home.zip chown -R grid:oinstall "${ENV_GRID_HOME}" else c1 "Make sure the grid installation package is in the ${SOFTWAREDIR} directory:" red c1 "LINUX.X64_193000_grid_home.zip" blue exit 99 fi elif [ "${DB_VERSION}" = "21.3.0.0" ]; then if [ -f "${ENV_GRID_HOME}" ]; then if [ "$(find "${ENV_GRID_HOME}" -mindepth 1 | wc -l)" -gt 0 ]; then cd ~ || return rm -rf "${ENV_GRID_HOME}" rm -rf "${ENV_GRID_HOME}/".* fi fi if unzip -o "${SOFTWAREDIR}"/LINUX.X64_213000_grid_home.zip -d "${ENV_GRID_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/LINUX.X64_213000_grid_home.zip chown -R grid:oinstall "${ENV_GRID_HOME}" else c1 "Make sure the grid installation package is in the ${SOFTWAREDIR} directory:" red c1 "LINUX.X64_213000_grid_home.zip" blue exit 99 fi else c1 "Error grid version! please check again!" red exit fi ## Install cvuqdisk if [ "${DB_VERSION}" = "11.2.0.4" ]; then if [ "$(rpm -qa | grep -c cvuqdisk)" -eq 0 ]; then if [ -f "${SOFTWAREDIR}"/grid/rpm/cvuqdisk-1.0.9-1.rpm ]; then rpm -ivh "${SOFTWAREDIR}"/grid/rpm/cvuqdisk-1.0.9-1.rpm if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then scp "${SOFTWAREDIR}"/grid/rpm/cvuqdisk-1.0.9-1.rpm "$RAC2HOSTNAME":"${SOFTWAREDIR}" ssh "$RAC2HOSTNAME" rpm -ivh "${SOFTWAREDIR}"/cvuqdisk-1.0.9-1.rpm ssh "$RAC2HOSTNAME" rm -rf "${SOFTWAREDIR}"/cvuqdisk-1.0.9-1.rpm fi else c1 "Make sure the cvuqdisk installation package is in the ${SOFTWAREDIR}/grid/rpm directory:" red c1 "cvuqdisk-1.0.9-1.rpm" blue exit 99 fi fi elif [ "${DB_VERSION}" = "12.2.0.1" ] || [ "${DB_VERSION}" = "18.0.0.0" ] || [ "${DB_VERSION}" = "19.3.0.0" ] || [ "${DB_VERSION}" = "21.3.0.0" ]; then if [ "$(rpm -qa | grep -c cvuqdisk)" -eq 0 ]; then if [ -f "${ENV_GRID_HOME}"/cv/rpm/cvuqdisk-1.0.10-1.rpm ]; then rpm -ivh "${ENV_GRID_HOME}"/cv/rpm/cvuqdisk-1.0.10-1.rpm if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then scp "${ENV_GRID_HOME}"/cv/rpm/cvuqdisk-1.0.10-1.rpm "$RAC2HOSTNAME":"${SOFTWAREDIR}" ssh "$RAC2HOSTNAME" rpm -ivh "${SOFTWAREDIR}"/cvuqdisk-1.0.10-1.rpm ssh "$RAC2HOSTNAME" rm -rf "${SOFTWAREDIR}"/cvuqdisk-1.0.10-1.rpm fi else c1 "Make sure the cvuqdisk installation package is in the ${ENV_GRID_HOME}/cv/rpm directory:" red c1 "cvuqdisk-1.0.10-1.rpm" blue exit 99 fi fi else c1 "Error database version! please check again!" red exit fi } #################################################################################### # runcluvfy.sh #################################################################################### Runcluvfy() { if [[ "${DB_VERSION}" == "11.2.0.4" ]]; then if [ -f "${SOFTWAREDIR}"/grid/runcluvfy.sh ]; then su - grid -c "${SOFTWAREDIR}/grid/runcluvfy.sh stage -pre crsinst -n $RAC1HOSTNAME,$RAC2HOSTNAME -fixup -verbose" | tee "${SOFTWAREDIR}"/runcluvfy.out fi elif [[ "${DB_VERSION}" == "12.2.0.1" ]] || [[ "${DB_VERSION}" == "18.0.0.0" ]]; then if [ -f "${ENV_GRID_HOME}"/runcluvfy.sh ]; then # /tmp/$cvufix/runfixup.sh # if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then # ssh "$RAC2HOSTNAME" /tmp/$cvufix/runfixup.sh # fi EXPECT=/usr/bin/expect USER_PROMPT="*# " $EXPECT <>"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v11_2_0 INVENTORY_LOCATION=${ENV_ORACLE_INVEN} SELECTED_LANGUAGES=en oracle.install.option=CRS_CONFIG ORACLE_BASE=${ENV_GRID_BASE} ORACLE_HOME=${ENV_GRID_HOME} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.gpnp.scanName=${RACSCANNAME} oracle.install.crs.config.gpnp.scanPort=1521 oracle.install.crs.config.clusterName=${CLUSTERNAME} oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.storageOption=ASM_STORAGE oracle.install.crs.config.sharedFileSystemStorage.diskDriveMapping= oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations= oracle.install.crs.config.sharedFileSystemStorage.votingDiskRedundancy=NORMAL oracle.install.crs.config.sharedFileSystemStorage.ocrLocations= oracle.install.crs.config.sharedFileSystemStorage.ocrRedundancy=NORMAL oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMOCRNAME} oracle.install.asm.diskGroup.redundancy=${OCRREDUN} oracle.install.asm.diskGroup.AUSize=1 oracle.install.asm.diskGroup.disks=${OCRDISK} oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.crs.upgrade.clusterNodes= oracle.install.asm.upgradeASM=false oracle.installer.autoupdates.option=SKIP_UPDATES oracle.installer.autoupdates.downloadUpdatesLoc= AUTOUPDATES_MYORACLESUPPORT_USERNAME= AUTOUPDATES_MYORACLESUPPORT_PASSWORD= PROXY_HOST= PROXY_PORT=0 PROXY_USER= PROXY_PWD= PROXY_REALM= EOF if [ "${DNS}" = "y" ] || [ "${DNS}" = "Y" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp ORACLE_HOSTNAME=${hostname}.${DNSNAME} oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}.${DNSNAME}:${RAC1HOSTNAME}-vip.${DNSNAME},${RAC2HOSTNAME}.${DNSNAME}:${RAC2HOSTNAME}-vip.${DNSNAME} EOF else cat <>"${SOFTWAREDIR}"/grid.rsp ORACLE_HOSTNAME=${hostname} oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}:${RAC1HOSTNAME}-vip,${RAC2HOSTNAME}:${RAC2HOSTNAME}-vip EOF fi if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ] && [ -n "${RACPRIVFCNAME1}" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:2,$RACPRIVFCNAME1:${RAC1PRIVIP1%.*}.0:2 EOF else cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:2 EOF fi elif [ "${DB_VERSION}" = "12.2.0.1" ]; then cat <"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v12.2.0 INVENTORY_LOCATION=${ENV_ORACLE_INVEN} oracle.install.option=CRS_CONFIG ORACLE_BASE=${ENV_GRID_BASE} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.gpnp.scanName=${RACSCANNAME} oracle.install.crs.config.gpnp.scanPort=1521 oracle.install.crs.config.ClusterConfiguration=STANDALONE oracle.install.crs.config.configureAsExtendedCluster=false oracle.install.crs.config.memberClusterManifestFile= oracle.install.crs.config.clusterName=${CLUSTERNAME} oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.gpnp.gnsOption= oracle.install.crs.config.gpnp.gnsClientDataFile= oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.sites= oracle.install.asm.configureGIMRDataDG=false oracle.install.crs.config.storageOption= oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.storageOption=ASM oracle.install.asmOnNAS.ocrLocation= oracle.install.asmOnNAS.configureGIMRDataDG=false oracle.install.asmOnNAS.gimrLocation= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMOCRNAME} oracle.install.asm.diskGroup.redundancy=${OCRREDUN} oracle.install.asm.diskGroup.AUSize=4 oracle.install.asm.diskGroup.FailureGroups= oracle.install.asm.diskGroup.disksWithFailureGroupNames=${OCRFailureDISK} oracle.install.asm.diskGroup.disks=${OCRDISK} oracle.install.asm.diskGroup.quorumFailureGroupNames= oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.asm.gimrDG.name= oracle.install.asm.gimrDG.redundancy= oracle.install.asm.gimrDG.AUSize=1 oracle.install.asm.gimrDG.FailureGroups= oracle.install.asm.gimrDG.disksWithFailureGroupNames= oracle.install.asm.gimrDG.disks= oracle.install.asm.gimrDG.quorumFailureGroupNames= oracle.install.asm.configureAFD=true oracle.install.crs.configureRHPS=false oracle.install.crs.config.ignoreDownNodes=false oracle.install.config.managementOption=NONE oracle.install.config.omsHost= oracle.install.config.omsPort=0 oracle.install.config.emAdminUser= oracle.install.config.emAdminPassword= oracle.install.crs.rootconfig.executeRootScript=false oracle.install.crs.rootconfig.configMethod= oracle.install.crs.rootconfig.sudoPath= oracle.install.crs.rootconfig.sudoUserName= oracle.install.crs.config.batchinfo= oracle.install.crs.app.applicationAddress= EOF if [ "${DNS}" = "y" ] || [ "${DNS}" = "Y" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}.${DNSNAME}:${RAC1HOSTNAME}-vip.${DNSNAME}:HUB,${RAC2HOSTNAME}.${DNSNAME}:${RAC2HOSTNAME}-vip.${DNSNAME}:HUB EOF else cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}:${RAC1HOSTNAME}-vip:HUB,${RAC2HOSTNAME}:${RAC2HOSTNAME}-vip:HUB EOF fi if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ] && [ -n "${RACPRIVFCNAME1}" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:5,$RACPRIVFCNAME1:${RAC1PRIVIP1%.*}.0:5 EOF else cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:5 EOF fi elif [ "${DB_VERSION}" = "18.0.0.0" ]; then cat <"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v18.0.0 INVENTORY_LOCATION=${ENV_ORACLE_INVEN} oracle.install.option=CRS_CONFIG ORACLE_BASE=${ENV_GRID_BASE} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.scanType=LOCAL_SCAN oracle.install.crs.config.SCANClientDataFile= oracle.install.crs.config.gpnp.scanName=${RACSCANNAME} oracle.install.crs.config.gpnp.scanPort=1521 oracle.install.crs.config.ClusterConfiguration=STANDALONE oracle.install.crs.config.configureAsExtendedCluster=false oracle.install.crs.config.memberClusterManifestFile= oracle.install.crs.config.clusterName=${CLUSTERNAME} oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.gpnp.gnsOption= oracle.install.crs.config.gpnp.gnsClientDataFile= oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.sites= oracle.install.crs.configureGIMR=false oracle.install.asm.configureGIMRDataDG=false oracle.install.crs.config.storageOption= oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.storageOption=ASM oracle.install.asmOnNAS.ocrLocation= oracle.install.asmOnNAS.configureGIMRDataDG=false oracle.install.asmOnNAS.gimrLocation= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMOCRNAME} oracle.install.asm.diskGroup.redundancy=${OCRREDUN} oracle.install.asm.diskGroup.AUSize=4 oracle.install.asm.diskGroup.FailureGroups= oracle.install.asm.diskGroup.disksWithFailureGroupNames=${OCRFailureDISK} oracle.install.asm.diskGroup.disks=${OCRDISK} oracle.install.asm.diskGroup.quorumFailureGroupNames= oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.asm.gimrDG.name= oracle.install.asm.gimrDG.redundancy= oracle.install.asm.gimrDG.AUSize=1 oracle.install.asm.gimrDG.FailureGroups= oracle.install.asm.gimrDG.disksWithFailureGroupNames= oracle.install.asm.gimrDG.disks= oracle.install.asm.gimrDG.quorumFailureGroupNames= oracle.install.asm.configureAFD=false oracle.install.crs.configureRHPS=false oracle.install.crs.config.ignoreDownNodes=false oracle.install.config.managementOption=NONE oracle.install.config.omsHost= oracle.install.config.omsPort=0 oracle.install.config.emAdminUser= oracle.install.config.emAdminPassword= oracle.install.crs.rootconfig.executeRootScript=false oracle.install.crs.rootconfig.configMethod= oracle.install.crs.rootconfig.sudoPath= oracle.install.crs.rootconfig.sudoUserName= oracle.install.crs.config.batchinfo= oracle.install.crs.app.applicationAddress= oracle.install.crs.deleteNode.nodes= EOF if [ "${DNS}" = "y" ] || [ "${DNS}" = "Y" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}.${DNSNAME}:${RAC1HOSTNAME}-vip.${DNSNAME}:HUB,${RAC2HOSTNAME}.${DNSNAME}:${RAC2HOSTNAME}-vip.${DNSNAME}:HUB EOF else cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}:${RAC1HOSTNAME}-vip:HUB,${RAC2HOSTNAME}:${RAC2HOSTNAME}-vip:HUB EOF fi if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ] && [ -n "${RACPRIVFCNAME1}" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:5,$RACPRIVFCNAME1:${RAC1PRIVIP1%.*}.0:5 EOF else cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:5 EOF fi elif [ "${DB_VERSION}" = "19.3.0.0" ]; then cat <"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v19.0.0 INVENTORY_LOCATION=${ENV_ORACLE_INVEN} oracle.install.option=CRS_CONFIG ORACLE_BASE=${ENV_GRID_BASE} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.scanType=LOCAL_SCAN oracle.install.crs.config.SCANClientDataFile= oracle.install.crs.config.gpnp.scanName=${RACSCANNAME} oracle.install.crs.config.gpnp.scanPort=1521 oracle.install.crs.config.ClusterConfiguration=STANDALONE oracle.install.crs.config.configureAsExtendedCluster=false oracle.install.crs.config.memberClusterManifestFile= oracle.install.crs.config.clusterName=${CLUSTERNAME} oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.gpnp.gnsOption= oracle.install.crs.config.gpnp.gnsClientDataFile= oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.sites= oracle.install.crs.configureGIMR=false oracle.install.asm.configureGIMRDataDG=false oracle.install.crs.config.storageOption=CLIENT_ASM_STORAGE oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations= oracle.install.crs.config.sharedFileSystemStorage.ocrLocations= oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMOCRNAME} oracle.install.asm.diskGroup.redundancy=${OCRREDUN} oracle.install.asm.diskGroup.AUSize=4 oracle.install.asm.diskGroup.FailureGroups= oracle.install.asm.diskGroup.disksWithFailureGroupNames=${OCRFailureDISK} oracle.install.asm.diskGroup.disks=${OCRDISK} oracle.install.asm.diskGroup.quorumFailureGroupNames= oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.asm.gimrDG.name= oracle.install.asm.gimrDG.redundancy= oracle.install.asm.gimrDG.AUSize=1 oracle.install.asm.gimrDG.FailureGroups= oracle.install.asm.gimrDG.disksWithFailureGroupNames= oracle.install.asm.gimrDG.disks= oracle.install.asm.gimrDG.quorumFailureGroupNames= oracle.install.asm.configureAFD=false oracle.install.crs.configureRHPS=false oracle.install.crs.config.ignoreDownNodes=false oracle.install.config.managementOption=NONE oracle.install.config.omsHost= oracle.install.config.omsPort=0 oracle.install.config.emAdminUser= oracle.install.config.emAdminPassword= oracle.install.crs.rootconfig.executeRootScript=false oracle.install.crs.rootconfig.configMethod= oracle.install.crs.rootconfig.sudoPath= oracle.install.crs.rootconfig.sudoUserName= oracle.install.crs.config.batchinfo= oracle.install.crs.app.applicationAddress= oracle.install.crs.deleteNode.nodes= EOF if [ "${DNS}" = "y" ] || [ "${DNS}" = "Y" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}.${DNSNAME}:${RAC1HOSTNAME}-vip.${DNSNAME},${RAC2HOSTNAME}.${DNSNAME}:${RAC2HOSTNAME}-vip.${DNSNAME} EOF else cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}:${RAC1HOSTNAME}-vip,${RAC2HOSTNAME}:${RAC2HOSTNAME}-vip EOF fi if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ] && [ -n "${RACPRIVFCNAME1}" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:5,$RACPRIVFCNAME1:${RAC1PRIVIP1%.*}.0:5 EOF else cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:5 EOF fi elif [ "${DB_VERSION}" = "21.3.0.0" ]; then cat <"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v21.0.0 INVENTORY_LOCATION=${ENV_ORACLE_INVEN} oracle.install.option=CRS_CONFIG ORACLE_BASE=${ENV_GRID_BASE} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.scanType=LOCAL_SCAN oracle.install.crs.config.SCANClientDataFile= oracle.install.crs.config.gpnp.scanName=${RACSCANNAME} oracle.install.crs.config.gpnp.scanPort=1521 oracle.install.crs.config.ClusterConfiguration=STANDALONE oracle.install.crs.config.configureAsExtendedCluster=false oracle.install.crs.config.clusterName=${CLUSTERNAME} oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.gpnp.gnsOption= oracle.install.crs.config.gpnp.gnsClientDataFile= oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.sites= oracle.install.crs.config.storageOption=FLEX_ASM_STORAGE oracle.install.crs.exascale.vault.name= oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations= oracle.install.crs.config.sharedFileSystemStorage.ocrLocations= oracle.install.asm.ClientDataFile= oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcBinpath= oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMOCRNAME} oracle.install.asm.diskGroup.redundancy=${OCRREDUN} oracle.install.asm.diskGroup.AUSize=4 oracle.install.asm.diskGroup.FailureGroups= oracle.install.asm.diskGroup.disksWithFailureGroupNames=${OCRFailureDISK} oracle.install.asm.diskGroup.disks=${OCRDISK} oracle.install.asm.diskGroup.quorumFailureGroupNames= oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.asm.configureAFD=false oracle.install.crs.configureRHPS=false oracle.install.crs.config.ignoreDownNodes=false oracle.install.crs.configureGIMR=false oracle.install.crs.configureRemoteGIMR=false oracle.install.crs.RemoteGIMRCredFile= oracle.install.asm.configureGIMRDataDG=false oracle.install.asm.gimrDG.name= oracle.install.asm.gimrDG.redundancy= oracle.install.asm.gimrDG.AUSize=1 oracle.install.asm.gimrDG.FailureGroups= oracle.install.asm.gimrDG.disksWithFailureGroupNames= oracle.install.asm.gimrDG.disks= oracle.install.asm.gimrDG.quorumFailureGroupNames= oracle.install.config.managementOption=NONE oracle.install.config.omsHost= oracle.install.config.omsPort=0 oracle.install.config.emAdminUser= oracle.install.config.emAdminPassword= oracle.install.crs.rootconfig.executeRootScript=false oracle.install.crs.rootconfig.configMethod= oracle.install.crs.rootconfig.sudoPath= oracle.install.crs.rootconfig.sudoUserName= oracle.install.crs.config.batchinfo= oracle.install.crs.deleteNode.nodes= EOF if [ "${DNS}" = "y" ] || [ "${DNS}" = "Y" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}.${DNSNAME}:${RAC1HOSTNAME}-vip.${DNSNAME},${RAC2HOSTNAME}.${DNSNAME}:${RAC2HOSTNAME}-vip.${DNSNAME} EOF else cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.clusterNodes=${RAC1HOSTNAME}:${RAC1HOSTNAME}-vip,${RAC2HOSTNAME}:${RAC2HOSTNAME}-vip EOF fi if [ -n "${RAC1PRIVIP1}" ] && [ -n "${RAC2PRIVIP1}" ] && [ -n "${RACPRIVFCNAME1}" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:5,$RACPRIVFCNAME1:${RAC1PRIVIP1%.*}.0:5 EOF else cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.crs.config.networkInterfaceList=$RACPUBLICFCNAME:${RAC1PUBLICIP%.*}.0:1,$RACPRIVFCNAME:${RAC1PRIVIP%.*}.0:5 EOF fi fi elif [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then if [ ${DB_VERSION} = 11.2.0.4 ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v11_2_0 ORACLE_HOSTNAME=${hostname} INVENTORY_LOCATION=${ENV_ORACLE_INVEN} SELECTED_LANGUAGES=en oracle.install.option=HA_CONFIG ORACLE_BASE=${ENV_GRID_BASE} ORACLE_HOME=${ENV_GRID_HOME} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.gpnp.scanName= oracle.install.crs.config.gpnp.scanPort= oracle.install.crs.config.clusterName= oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.clusterNodes= oracle.install.crs.config.networkInterfaceList= oracle.install.crs.config.storageOption= oracle.install.crs.config.sharedFileSystemStorage.diskDriveMapping= oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations= oracle.install.crs.config.sharedFileSystemStorage.votingDiskRedundancy=NORMAL oracle.install.crs.config.sharedFileSystemStorage.ocrLocations= oracle.install.crs.config.sharedFileSystemStorage.ocrRedundancy=NORMAL oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMDATANAME} oracle.install.asm.diskGroup.redundancy=${DATAREDUN} oracle.install.asm.diskGroup.AUSize=1 oracle.install.asm.diskGroup.disks=${DATADISK} oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.crs.upgrade.clusterNodes= oracle.install.asm.upgradeASM=false oracle.installer.autoupdates.option=SKIP_UPDATES oracle.installer.autoupdates.downloadUpdatesLoc= AUTOUPDATES_MYORACLESUPPORT_USERNAME= AUTOUPDATES_MYORACLESUPPORT_PASSWORD= PROXY_HOST= PROXY_PORT=0 PROXY_USER= PROXY_PWD= PROXY_REALM= EOF elif [ "${DB_VERSION}" = "12.2.0.1" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v12.2.0 INVENTORY_LOCATION=${ENV_ORACLE_INVEN} oracle.install.option=HA_CONFIG ORACLE_BASE=${ENV_GRID_BASE} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.gpnp.scanName= oracle.install.crs.config.gpnp.scanPort= oracle.install.crs.config.ClusterConfiguration=STANDALONE oracle.install.crs.config.configureAsExtendedCluster=false oracle.install.crs.config.memberClusterManifestFile= oracle.install.crs.config.clusterName= oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.gpnp.gnsOption=CREATE_NEW_GNS oracle.install.crs.config.gpnp.gnsClientDataFile= oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.sites= oracle.install.crs.config.clusterNodes= oracle.install.crs.config.networkInterfaceList= oracle.install.asm.configureGIMRDataDG=false oracle.install.crs.config.storageOption= oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.storageOption=ASM oracle.install.asmOnNAS.ocrLocation= oracle.install.asmOnNAS.configureGIMRDataDG=false oracle.install.asmOnNAS.gimrLocation= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMDATANAME} oracle.install.asm.diskGroup.redundancy=${DATAREDUN} oracle.install.asm.diskGroup.AUSize=4 oracle.install.asm.diskGroup.FailureGroups= oracle.install.asm.diskGroup.disksWithFailureGroupNames=${DATAFailureDISK} oracle.install.asm.diskGroup.disks=${DATADISK} oracle.install.asm.diskGroup.quorumFailureGroupNames= oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.asm.gimrDG.name= oracle.install.asm.gimrDG.redundancy= oracle.install.asm.gimrDG.AUSize=1 oracle.install.asm.gimrDG.FailureGroups= oracle.install.asm.gimrDG.disksWithFailureGroupNames= oracle.install.asm.gimrDG.disks= oracle.install.asm.gimrDG.quorumFailureGroupNames= oracle.install.asm.configureAFD=false oracle.install.crs.configureRHPS=false oracle.install.crs.config.ignoreDownNodes=false oracle.install.config.managementOption=NONE oracle.install.config.omsHost= oracle.install.config.omsPort=0 oracle.install.config.emAdminUser= oracle.install.config.emAdminPassword= oracle.install.crs.rootconfig.executeRootScript=false oracle.install.crs.rootconfig.configMethod= oracle.install.crs.rootconfig.sudoPath= oracle.install.crs.rootconfig.sudoUserName= oracle.install.crs.config.batchinfo= oracle.install.crs.app.applicationAddress= EOF elif [ "${DB_VERSION}" = "18.0.0.0" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v18.0.0 INVENTORY_LOCATION=${ENV_ORACLE_INVEN} oracle.install.option=HA_CONFIG ORACLE_BASE=${ENV_GRID_BASE} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.scanType=LOCAL_SCAN oracle.install.crs.config.SCANClientDataFile= oracle.install.crs.config.gpnp.scanName= oracle.install.crs.config.gpnp.scanPort= oracle.install.crs.config.ClusterConfiguration=STANDALONE oracle.install.crs.config.configureAsExtendedCluster=false oracle.install.crs.config.memberClusterManifestFile= oracle.install.crs.config.clusterName= oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.gpnp.gnsOption=CREATE_NEW_GNS oracle.install.crs.config.gpnp.gnsClientDataFile= oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.sites= oracle.install.crs.config.clusterNodes= oracle.install.crs.config.networkInterfaceList= oracle.install.crs.configureGIMR=true oracle.install.asm.configureGIMRDataDG=false oracle.install.crs.config.storageOption= oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.storageOption=ASM oracle.install.asmOnNAS.ocrLocation= oracle.install.asmOnNAS.configureGIMRDataDG=false oracle.install.asmOnNAS.gimrLocation= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMDATANAME} oracle.install.asm.diskGroup.redundancy=${DATAREDUN} oracle.install.asm.diskGroup.AUSize=4 oracle.install.asm.diskGroup.FailureGroups= oracle.install.asm.diskGroup.disksWithFailureGroupNames=${DATAFailureDISK} oracle.install.asm.diskGroup.disks=${DATADISK} oracle.install.asm.diskGroup.quorumFailureGroupNames= oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.asm.gimrDG.name= oracle.install.asm.gimrDG.redundancy= oracle.install.asm.gimrDG.AUSize=1 oracle.install.asm.gimrDG.FailureGroups= oracle.install.asm.gimrDG.disksWithFailureGroupNames= oracle.install.asm.gimrDG.disks= oracle.install.asm.gimrDG.quorumFailureGroupNames= oracle.install.asm.configureAFD=false oracle.install.crs.configureRHPS=false oracle.install.crs.config.ignoreDownNodes=false oracle.install.config.managementOption=NONE oracle.install.config.omsHost= oracle.install.config.omsPort=0 oracle.install.config.emAdminUser= oracle.install.config.emAdminPassword= oracle.install.crs.rootconfig.executeRootScript=false oracle.install.crs.rootconfig.configMethod= oracle.install.crs.rootconfig.sudoPath= oracle.install.crs.rootconfig.sudoUserName= oracle.install.crs.config.batchinfo= oracle.install.crs.app.applicationAddress= oracle.install.crs.deleteNode.nodes= EOF elif [ "${DB_VERSION}" = "19.3.0.0" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v19.0.0 INVENTORY_LOCATION=${ENV_ORACLE_INVEN} oracle.install.option=HA_CONFIG ORACLE_BASE=${ENV_GRID_BASE} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.scanType=LOCAL_SCAN oracle.install.crs.config.SCANClientDataFile= oracle.install.crs.config.gpnp.scanName= oracle.install.crs.config.gpnp.scanPort= oracle.install.crs.config.ClusterConfiguration=STANDALONE oracle.install.crs.config.configureAsExtendedCluster=false oracle.install.crs.config.memberClusterManifestFile= oracle.install.crs.config.clusterName= oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.gpnp.gnsOption=CREATE_NEW_GNS oracle.install.crs.config.gpnp.gnsClientDataFile= oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.sites= oracle.install.crs.config.clusterNodes= oracle.install.crs.config.networkInterfaceList= oracle.install.crs.configureGIMR=false oracle.install.asm.configureGIMRDataDG=false oracle.install.crs.config.storageOption= oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations= oracle.install.crs.config.sharedFileSystemStorage.ocrLocations= oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMDATANAME} oracle.install.asm.diskGroup.redundancy=${DATAREDUN} oracle.install.asm.diskGroup.AUSize=4 oracle.install.asm.diskGroup.FailureGroups= oracle.install.asm.diskGroup.disksWithFailureGroupNames=${DATAFailureDISK} oracle.install.asm.diskGroup.disks=${DATADISK} oracle.install.asm.diskGroup.quorumFailureGroupNames= oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.asm.gimrDG.name= oracle.install.asm.gimrDG.redundancy= oracle.install.asm.gimrDG.AUSize=1 oracle.install.asm.gimrDG.FailureGroups= oracle.install.asm.gimrDG.disksWithFailureGroupNames= oracle.install.asm.gimrDG.disks= oracle.install.asm.gimrDG.quorumFailureGroupNames= oracle.install.asm.configureAFD=false oracle.install.crs.configureRHPS=false oracle.install.crs.config.ignoreDownNodes=false oracle.install.config.managementOption=NONE oracle.install.config.omsHost= oracle.install.config.omsPort=0 oracle.install.config.emAdminUser= oracle.install.config.emAdminPassword= oracle.install.crs.rootconfig.executeRootScript=false oracle.install.crs.rootconfig.configMethod= oracle.install.crs.rootconfig.sudoPath= oracle.install.crs.rootconfig.sudoUserName= oracle.install.crs.config.batchinfo= oracle.install.crs.app.applicationAddress= oracle.install.crs.deleteNode.nodes= EOF fi elif [ "${DB_VERSION}" = "21.3.0.0" ]; then cat <>"${SOFTWAREDIR}"/grid.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v21.0.0 INVENTORY_LOCATION=${ENV_ORACLE_INVEN} oracle.install.option=HA_CONFIG ORACLE_BASE=${ENV_GRID_BASE} oracle.install.asm.OSDBA=asmdba oracle.install.asm.OSOPER=asmoper oracle.install.asm.OSASM=asmadmin oracle.install.crs.config.scanType=LOCAL_SCAN oracle.install.crs.config.SCANClientDataFile= oracle.install.crs.config.gpnp.scanName= oracle.install.crs.config.gpnp.scanPort= oracle.install.crs.config.ClusterConfiguration=STANDALONE oracle.install.crs.config.configureAsExtendedCluster=false oracle.install.crs.config.clusterName= oracle.install.crs.config.gpnp.configureGNS=false oracle.install.crs.config.autoConfigureClusterNodeVIP=false oracle.install.crs.config.gpnp.gnsOption=CREATE_NEW_GNS oracle.install.crs.config.gpnp.gnsClientDataFile= oracle.install.crs.config.gpnp.gnsSubDomain= oracle.install.crs.config.gpnp.gnsVIPAddress= oracle.install.crs.config.sites= oracle.install.crs.config.storageOption= oracle.install.crs.exascale.vault.name= oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations= oracle.install.crs.config.sharedFileSystemStorage.ocrLocations= oracle.install.asm.ClientDataFile= oracle.install.crs.config.useIPMI=false oracle.install.crs.config.ipmi.bmcBinpath= oracle.install.crs.config.ipmi.bmcUsername= oracle.install.crs.config.ipmi.bmcPassword= oracle.install.asm.SYSASMPassword=${GRIDPASSWD} oracle.install.asm.diskGroup.name=${ASMOCRNAME} oracle.install.asm.diskGroup.redundancy=${OCRREDUN} oracle.install.asm.diskGroup.AUSize=4 oracle.install.asm.diskGroup.FailureGroups= oracle.install.asm.diskGroup.disksWithFailureGroupNames=${OCRFailureDISK} oracle.install.asm.diskGroup.disks=${OCRDISK} oracle.install.asm.diskGroup.quorumFailureGroupNames= oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm* oracle.install.asm.monitorPassword=${GRIDPASSWD} oracle.install.asm.configureAFD=false oracle.install.crs.configureRHPS=false oracle.install.crs.config.ignoreDownNodes=false oracle.install.crs.configureGIMR=false oracle.install.crs.configureRemoteGIMR=false oracle.install.crs.RemoteGIMRCredFile= oracle.install.asm.configureGIMRDataDG=false oracle.install.asm.gimrDG.name= oracle.install.asm.gimrDG.redundancy= oracle.install.asm.gimrDG.AUSize=1 oracle.install.asm.gimrDG.FailureGroups= oracle.install.asm.gimrDG.disksWithFailureGroupNames= oracle.install.asm.gimrDG.disks= oracle.install.asm.gimrDG.quorumFailureGroupNames= oracle.install.config.managementOption=NONE oracle.install.config.omsHost= oracle.install.config.omsPort=0 oracle.install.config.emAdminUser= oracle.install.config.emAdminPassword= oracle.install.crs.rootconfig.executeRootScript=false oracle.install.crs.rootconfig.configMethod= oracle.install.crs.rootconfig.sudoPath= oracle.install.crs.rootconfig.sudoUserName= oracle.install.crs.config.batchinfo= oracle.install.crs.deleteNode.nodes= EOF fi logwrite "${SOFTWAREDIR}/grid.rsp" "cat ${SOFTWAREDIR}/grid.rsp" #Install Database software chown grid:oinstall "${SOFTWAREDIR}" if [[ "${DB_VERSION}" == "11.2.0.4" ]]; then if ! su - grid -c "${SOFTWAREDIR}/grid/runInstaller -silent -showProgress -ignoreSysPrereqs -ignorePrereq -waitForCompletion -responseFile ${SOFTWAREDIR}/grid.rsp"; then c1 "Sorry, Grid Install Failed." red exit 99 fi elif [[ "${DB_VERSION}" == "12.2.0.1" ]] || [ "${DB_VERSION}" = "18.0.0.0" ] || [[ "${DB_VERSION}" == "19.3.0.0" ]] || [[ "${DB_VERSION}" == "21.3.0.0" ]]; then if [ -n "${GPATCH}" ]; then if [[ "${DB_VERSION}" == "12.2.0.1" ]]; then if ! su - grid -c "${ENV_GRID_HOME}/gridSetup.sh -silent -force -responseFile ${SOFTWAREDIR}/grid.rsp -ignorePrereqFailure -waitForCompletion -skipPrereqs -applyPSU ${SOFTWAREDIR}/${GPATCH}"; then c1 "Sorry, Grid Install Failed." red exit 99 fi elif [ "${DB_VERSION}" = "18.0.0.0" ] || [[ "${DB_VERSION}" == "19.3.0.0" ]] || [[ "${DB_VERSION}" == "21.3.0.0" ]]; then if ! su - grid -c "${ENV_GRID_HOME}/gridSetup.sh -silent -force -responseFile ${SOFTWAREDIR}/grid.rsp -waitForCompletion -skipPrereqs -applyRU ${SOFTWAREDIR}/${GPATCH}"; then c1 "Sorry, Grid Install Failed." red exit 99 fi fi else if ! su - grid -c "${ENV_GRID_HOME}/gridSetup.sh -silent -force -responseFile ${SOFTWAREDIR}/grid.rsp -waitForCompletion -skipPrereqs"; then c1 "Sorry, Grid Install Failed." red exit 99 fi fi fi logwrite "Grid OPatch Version" "su - grid -c \"opatch version\"" ##Patch 18370031 if [ "${DB_VERSION}" = "11.2.0.4" ] && [ "${OS_VERSION}" = "linux7" ]; then chown -R grid:oinstall "${SOFTWAREDIR}"/p18370031_112040_Linux-x86-64.zip if ! su - grid -c "unzip -o ${SOFTWAREDIR}/p18370031_112040_Linux-x86-64.zip -d ${SOFTWAREDIR}"; then c1 "Make sure the Patch 18370031 is in the ${SOFTWAREDIR} directory:" red c1 "p18370031_112040_Linux-x86-64.zip" blue exit 92 else ##rm -rf "${SOFTWAREDIR}"/p18370031_112040_Linux-x86-64.zip su - grid -c "${ENV_GRID_HOME}/OPatch/opatch napply -oh ${ENV_GRID_HOME} -local ${SOFTWAREDIR}/18370031 -silent" ##RAC scp to node 2 if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then scp -r "${SOFTWAREDIR}"/18370031 "$RAC2HOSTNAME":"${SOFTWAREDIR}" ssh "$RAC2HOSTNAME" chown -R grid:oinstall "${SOFTWAREDIR}"/18370031 su - grid -c "ssh ${RAC2HOSTNAME} ${ENV_GRID_HOME}/OPatch/opatch napply -oh ${ENV_GRID_HOME} -local ${SOFTWAREDIR}/18370031 -silent" fi rm -rf "${SOFTWAREDIR}"/18370031 fi fi #CLSRSC-614: failed to get the list of configured diskgroups #Died at /u01/app/12.2.0/grid/crs/install/oraasm.pm line 2069 # The command '/u01/app/12.2.0/grid/perl/bin/perl -I/u01/app/12.2.0/grid/perl/lib -I/u01/app/12.2.0/grid/crs/install /u01/app/12.2.0/grid/crs/install/rootcrs.pl ' execution failed if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then if [ "${DB_VERSION}" = "12.2.0.1" ]; then /usr/bin/make -f "${ENV_GRID_HOME}"/rdbms/lib/ins_rdbms.mk client_sharedlib libasmclntsh12.ohso libasmperl12.ohso ORACLE_HOME="${ENV_GRID_HOME}" ssh "$RAC2HOSTNAME" /usr/bin/make -f "${ENV_GRID_HOME}"/rdbms/lib/ins_rdbms.mk client_sharedlib libasmclntsh12.ohso libasmperl12.ohso ORACLE_HOME="${ENV_GRID_HOME}" fi if [ "${DB_VERSION}" = "18.0.0.0" ]; then /usr/bin/make -f "${ENV_GRID_HOME}"/rdbms/lib/ins_rdbms.mk client_sharedlib libasmclntsh18.ohso libasmperl18.ohso ORACLE_HOME="${ENV_GRID_HOME}" ssh "$RAC2HOSTNAME" /usr/bin/make -f "${ENV_GRID_HOME}"/rdbms/lib/ins_rdbms.mk client_sharedlib libasmclntsh18.ohso libasmperl18.ohso ORACLE_HOME="${ENV_GRID_HOME}" fi fi if [ -f "${ENV_ORACLE_INVEN}"/orainstRoot.sh ] || [ -f "${ENV_GRID_HOME}"/root.sh ]; then if [ -f "${ENV_ORACLE_INVEN}"/orainstRoot.sh ]; then "${ENV_ORACLE_INVEN}"/orainstRoot.sh if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then ssh "$RAC2HOSTNAME" "$ENV_ORACLE_INVEN"/orainstRoot.sh fi fi if [ -f "${ENV_GRID_HOME}"/root.sh ]; then # if [ "${DB_VERSION}" = "11.2.0.4" ] && [ "${OS_VERSION}" = "linux7" ]; then # # "${SOFTWAREDIR}"/start_ohas.sh & # "${ENV_GRID_HOME}"/root.sh # if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then # ssh "$RAC2HOSTNAME" nohup "${SOFTWAREDIR}"/start_ohas.sh >/dev/null 2>&1 & # ssh "$RAC2HOSTNAME" "$ENV_GRID_HOME"/root.sh # fi # else "${ENV_GRID_HOME}"/root.sh if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then ssh "$RAC2HOSTNAME" "$ENV_GRID_HOME"/root.sh fi # fi fi else echo c1 "Grid software installation failed, please check the log." red exit 99 fi ## Complete Grid Infrastructure Configuration Assistant(Plug-in) if OUI is not Available (Doc ID 1360798.1) if [ -f /home/grid/cfgrsp.propertiesc ]; then rm -rf /home/grid/cfgrsp.propertiesc fi if [ ! -f /home/grid/cfgrsp.propertiesc ]; then if [[ "${DB_VERSION}" == "11.2.0.4" ]]; then cat <>/home/grid/cfgrsp.properties oracle.assistants.asm|S_ASMPASSWORD=${GRIDPASSWD} oracle.assistants.asm|S_ASMMONITORPASSWORD=${GRIDPASSWD} EOF fi fi if [[ "${DB_VERSION}" == "11.2.0.4" ]]; then if su - grid -c "$ENV_GRID_HOME/cfgtoollogs/configToolAllCommands RESPONSE_FILE=/home/grid/cfgrsp.properties"; then rm -rf /home/grid/cfgrsp.properties fi ## How to Use ASMCA in Silent Mode to Configure ASM For a Stand-Alone Server (Doc ID 1068788.1) if [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then if [ "$(pgrep -f "asm_smon_+ASM" | wc -l)" -eq 0 ]; then su - grid -c "$ENV_GRID_HOME/bin/asmca -silent -sysAsmPassword ${GRIDPASSWD} -asmsnmpPassword ${GRIDPASSWD} -oui_internal -configureASM -diskString '/dev/asm*' -diskGroupName ${ASMDATANAME} -diskList ${DATADISK} -redundancy ${DATAREDUN} -au_size 1" fi fi else ## 12.2:Post upgrade steps for Grid infrastructure reports INS-32601 error (Doc ID 2380863.1) su - grid -c "$ENV_GRID_HOME/gridSetup.sh -executeConfigTools -all -responseFile ${SOFTWAREDIR}/grid.rsp -silent" fi ## 11G grid software install successful , then patch PSU if [ "${DB_VERSION}" = "11.2.0.4" ]; then if [ -n "${GPATCH}" ]; then if ! su - grid -c "unzip -o ${SOFTWAREDIR}/p6880880_112000_Linux-x86-64.zip -d ${ENV_GRID_HOME}"; then c1 "Make sure the Patch 6880880 is in the ${SOFTWAREDIR} directory:" red c1 "p6880880_112000_Linux-x86-64.zip" blue exit 92 fi ## scp OPatch if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then scp -r "${ENV_GRID_HOME}"/OPatch "${RAC2HOSTNAME}":"${ENV_GRID_HOME}" ssh "${RAC2HOSTNAME}" chown -R grid:oinstall "${ENV_GRID_HOME}"/OPatch fi ##bug with linux7 install 11g rac and PSU,but without apply opatch to fix # if [ "${OS_VERSION}" = "linux7" ]; then # ##edit scripts opatch restart_ohas.sh # cat <"${SOFTWAREDIR}"/opatch_restart_ohas.sh # #/bin/bash # ${ENV_GRID_HOME}/OPatch/opatch auto ${SOFTWAREDIR}/${GPATCH} -oh ${ENV_GRID_HOME} | tee ${SOFTWAREDIR}/opatchauto-${GPATCH}.log # while true; do # if [ \$(grep -c "CRS-4124" <${SOFTWAREDIR}/opatchauto-${GPATCH}.log) -gt 0 ] || [ \$(grep -c "CRS-4000" <${SOFTWAREDIR}/opatchauto-${GPATCH}.log) -gt 0 ]; then # systemctl restart ohas.service # ${ENV_GRID_HOME}/bin/crsctl start crs # break # elif [ \$(grep -c "CRS-4123" <${SOFTWAREDIR}/opatchauto-${GPATCH}.log) -gt 0 ]; then # break # fi # done # EOF # chmod +x "${SOFTWAREDIR}"/opatch_restart_ohas.sh ## node1 # sh "${SOFTWAREDIR}"/opatch_restart_ohas.sh # if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then # ## node2 # scp "${SOFTWAREDIR}"/opatch_restart_ohas.sh "$RAC2HOSTNAME":"${SOFTWAREDIR}" # ssh "$RAC2HOSTNAME" "chmod +x ""${SOFTWAREDIR}""/opatch_restart_ohas.sh" # ssh "$RAC2HOSTNAME" "sh ${SOFTWAREDIR}/opatch_restart_ohas.sh" # fi # else ## node1 "${ENV_GRID_HOME}"/OPatch/opatch auto "${SOFTWAREDIR}/""${GPATCH}" -oh "${ENV_GRID_HOME}" if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then ## node2 ssh "$RAC2HOSTNAME" "${ENV_GRID_HOME}"/OPatch/opatch auto "${SOFTWAREDIR}/""${GPATCH}" -oh "${ENV_GRID_HOME}" fi # fi fi fi logwrite "Grid RDBMS" "su - grid -c \"sqlplus -V\"" logwrite "Grid Status" "su - grid -c \"crsctl stat res -t\"" logwrite "OPatch lspatches" "su - grid -c \"opatch lspatches\"" } #################################################################################### # ASM CREATE DATA DISKGROUP #################################################################################### ASM_DATA_CREATE() { if ! su - grid -c "asmca -silent -createDiskGroup -diskGroupName ${ASMDATANAME} -diskList ${DATADISK} -redundancy ${DATAREDUN}"; then c1 "Sorry, Asm group ${ASMDATANAME} create filed" red exit 99 fi cat <>/home/grid/selectasm.sql set line222 col name for a20 col state for a20 col Per_Free for a20 col path for a60 select NAME,TOTAL_MB/1024 "TOTAL/G",FREE_MB/1024 "FREE/G",round(FREE_MB/TOTAL_MB*100)||'%' Per_Free,state from v\$asm_diskgroup; select mode_status,name,state,path from v\$asm_disk; exit; EOF logwrite "ASM CHECK" "su - grid -c \"sqlplus / as sysasm @/home/grid/selectasm.sql\"" } #################################################################################### # Unzip DB Software #################################################################################### UnzipDBSoft() { if [ "${DB_VERSION}" = "11.2.0.4" ]; then if [ -d "${SOFTWAREDIR}"/database ]; then cd ~ || return rm -rf "${SOFTWAREDIR}"/database fi if unzip -o "${SOFTWAREDIR}"/p13390677_112040_Linux-x86-64_1of7.zip -d "${SOFTWAREDIR}"; then ##rm -rf "${SOFTWAREDIR}"/p13390677_112040_Linux-x86-64_1of7.zip chown -R oracle:oinstall "${SOFTWAREDIR}"/database else c1 "Make sure the database installation package is in the ${SOFTWAREDIR} directory:" red c1 "p13390677_112040_Linux-x86-64_1of7.zip" blue exit 99 fi if unzip -o "${SOFTWAREDIR}"/p13390677_112040_Linux-x86-64_2of7.zip -d "${SOFTWAREDIR}"; then ##rm -rf "${SOFTWAREDIR}"/p13390677_112040_Linux-x86-64_2of7.zip chown -R oracle:oinstall "${SOFTWAREDIR}"/database else c1 "Make sure the database installation package is in the ${SOFTWAREDIR} directory:" red c1 "p13390677_112040_Linux-x86-64_2of7.zip" blue exit 99 fi elif [ "${DB_VERSION}" = "12.2.0.1" ]; then if [ -d "${SOFTWAREDIR}"/database ]; then cd ~ || return rm -rf "${SOFTWAREDIR}"/database fi if unzip -o "${SOFTWAREDIR}"/LINUX.X64_122010_db_home.zip -d "${SOFTWAREDIR}"; then ##rm -rf "${SOFTWAREDIR}"/LINUX.X64_122010_db_home.zip chown -R oracle:oinstall "${SOFTWAREDIR}"/database else c1 "Make sure the database installation package is in the ${SOFTWAREDIR} directory:" red c1 "LINUX.X64_122010_db_home.zip" blue exit 99 fi elif [ "${DB_VERSION}" = "18.0.0.0" ]; then if [ "$(find "${ENV_ORACLE_HOME}" -mindepth 1 | wc -l)" -gt 0 ]; then cd ~ || return rm -rf "${ENV_ORACLE_HOME}" fi if unzip -o "${SOFTWAREDIR}"/LINUX.X64_180000_db_home.zip -d "${ENV_ORACLE_HOME}"; then ## rm -rf "${SOFTWAREDIR}"/LINUX.X64_180000_db_home.zip chown -R oracle:oinstall "${ENV_ORACLE_HOME}" else c1 "Make sure the database installation package is in the ${SOFTWAREDIR} directory:" red c1 "LINUX.X64_180000_db_home.zip" blue exit 99 fi elif [ "${DB_VERSION}" = "19.3.0.0" ]; then if [ "$(find "${ENV_ORACLE_HOME}" -mindepth 1 | wc -l)" -gt 0 ]; then cd ~ || return rm -rf "${ENV_ORACLE_HOME}" fi if unzip -o "${SOFTWAREDIR}"/LINUX.X64_193000_db_home.zip -d "${ENV_ORACLE_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/LINUX.X64_193000_db_home.zip chown -R oracle:oinstall "${ENV_ORACLE_HOME}" else c1 "Make sure the database installation package is in the ${SOFTWAREDIR} directory:" red c1 "LINUX.X64_193000_db_home.zip" blue exit 99 fi elif [ "${DB_VERSION}" = "21.3.0.0" ]; then if [ "$(find "${ENV_ORACLE_HOME}" -mindepth 1 | wc -l)" -gt 0 ]; then cd ~ || return rm -rf "${ENV_ORACLE_HOME}" fi if unzip -o "${SOFTWAREDIR}"/LINUX.X64_213000_db_home.zip -d "${ENV_ORACLE_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/LINUX.X64_213000_db_home.zip chown -R oracle:oinstall "${ENV_ORACLE_HOME}" else c1 "Make sure the database installation package is in the ${SOFTWAREDIR} directory:" red c1 "LINUX.X64_213000_db_home.zip" blue exit 99 fi else c1 "Error database version! please check again!" red exit fi } #################################################################################### # Install DB Software #################################################################################### InstallDBsoftware() { #################################################################################### # Unzip oracle OPATCH&&RU #################################################################################### if [ -n "${OPATCH}" ] || [ -n "${GPATCH}" ]; then ## 18C if [ "${DB_VERSION}" = "18.0.0.0" ]; then if su - oracle -c "unzip -o ${SOFTWAREDIR}/p6880880_180000_Linux-x86-64.zip -d ${ENV_ORACLE_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/p6880880_180000_Linux-x86-64.zip echo "unzip p6880880 successful" else c1 "Make sure the Patch 6880880 is in the ${SOFTWAREDIR} directory:" red c1 "p6880880_180000_Linux-x86-64.zip" blue exit 92 fi ## 19C elif [ "${DB_VERSION}" = "19.3.0.0" ]; then if su - oracle -c "unzip -o ${SOFTWAREDIR}/p6880880_190000_Linux-x86-64.zip -d ${ENV_ORACLE_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/p6880880_190000_Linux-x86-64.zip echo "unzip p6880880 successful" else c1 "Make sure the Patch 6880880 is in the ${SOFTWAREDIR} directory:" red c1 "p6880880_190000_Linux-x86-64.zip" blue exit 92 fi ## 21C elif [ "${DB_VERSION}" = "21.3.0.0" ]; then if su - oracle -c "unzip -o ${SOFTWAREDIR}/p6880880_210000_Linux-x86-64.zip -d ${ENV_ORACLE_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/p6880880_210000_Linux-x86-64.zip echo "unzip p6880880 successful" else c1 "Make sure the Patch 6880880 is in the ${SOFTWAREDIR} directory:" red c1 "p6880880_210000_Linux-x86-64.zip" blue exit 92 fi fi ##IF GPATCH IS NOT EXISTS , THEN CHECK OPATCH if [ -z "${GPATCH}" ]; then if [ ! -d "${SOFTWAREDIR}"/"${OPATCH}" ]; then chown -R oracle:oinstall "${SOFTWAREDIR}" if su - oracle -c "unzip -o ${SOFTWAREDIR}/*p${OPATCH}* -d ${SOFTWAREDIR}"; then rm -rf "${SOFTWAREDIR}"/*p"${OPATCH}"* else c1 "Make sure the database release update ${OPATCH} is in the ${SOFTWAREDIR} directory:" red c1 "p${OPATCH}.......zip" blue exit 99 fi fi fi fi ## chown oracle&&grid Patch chown -R oracle:oinstall "${SOFTWAREDIR}"/"${GPATCH}" chown -R oracle:oinstall "${SOFTWAREDIR}"/"${OPATCH}" chmod -R 775 "${SOFTWAREDIR}"/"${GPATCH}" chmod -R 775 "${SOFTWAREDIR}"/"${OPATCH}" #Create db.rsp if [ -f "${SOFTWAREDIR}"/db.rsp ]; then rm -rf "${SOFTWAREDIR}"/db.rsp fi if [ ${DB_VERSION} = 11.2.0.4 ]; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=${hostname} UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ENV_BASE_DIR}/oraInventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=${ENV_ORACLE_HOME} ORACLE_BASE=${ENV_ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper oracle.install.db.CLUSTER_NODES=${RAC1HOSTNAME},${RAC2HOSTNAME} DECLINE_SECURITY_UPDATES=true oracle.installer.autoupdates.option=SKIP_UPDATES EOF else cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=${hostname} UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ENV_BASE_DIR}/oraInventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=${ENV_ORACLE_HOME} ORACLE_BASE=${ENV_ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper DECLINE_SECURITY_UPDATES=true oracle.installer.autoupdates.option=SKIP_UPDATES EOF fi elif [ "${DB_VERSION}" = "12.2.0.1" ]; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ENV_ORACLE_INVEN} ORACLE_HOME=${ENV_ORACLE_HOME} ORACLE_BASE=${ENV_ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba oracle.install.db.CLUSTER_NODES=${RAC1HOSTNAME},${RAC2HOSTNAME} EOF else cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall ORACLE_HOME=${ENV_ORACLE_HOME} INVENTORY_LOCATION=${ENV_ORACLE_INVEN} ORACLE_BASE=${ENV_ORACLE_BASE} SELECTED_LANGUAGES=en,zh_CN oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba EOF fi elif [ "${DB_VERSION}" = "18.0.0.0" ]; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v18.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ENV_ORACLE_INVEN} ORACLE_BASE=${ENV_ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba oracle.install.db.CLUSTER_NODES=${RAC1HOSTNAME},${RAC2HOSTNAME} EOF else cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v18.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ENV_ORACLE_INVEN} ORACLE_BASE=${ENV_ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba EOF fi elif [ "${DB_VERSION}" = "19.3.0.0" ]; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ENV_ORACLE_INVEN} ORACLE_BASE=${ENV_ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba oracle.install.db.CLUSTER_NODES=${RAC1HOSTNAME},${RAC2HOSTNAME} oracle.install.db.rootconfig.executeRootScript=false oracle.install.db.rootconfig.configMethod= EOF else cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ENV_ORACLE_INVEN} ORACLE_BASE=${ENV_ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba oracle.install.db.rootconfig.executeRootScript=false oracle.install.db.rootconfig.configMethod= EOF fi elif [ "${DB_VERSION}" = "21.3.0.0" ]; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v21.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ENV_ORACLE_INVEN} ORACLE_BASE=${ENV_ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba oracle.install.db.CLUSTER_NODES=${RAC1HOSTNAME},${RAC2HOSTNAME} oracle.install.db.rootconfig.executeRootScript=false oracle.install.db.rootconfig.configMethod= EOF else cat <>"${SOFTWAREDIR}"/db.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v21.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ENV_ORACLE_INVEN} ORACLE_BASE=${ENV_ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba oracle.install.db.rootconfig.executeRootScript=false oracle.install.db.rootconfig.configMethod= EOF fi fi logwrite "${SOFTWAREDIR}/db.rsp" "cat ${SOFTWAREDIR}/db.rsp" #Install Database software chown oracle:oinstall "${SOFTWAREDIR}"/db.rsp ##Juge whether ${ENV_ORACLE_INVEN}/ContentsXML/inventory.xml contains ${ENV_ORACLE_HOME},if exists ,delete it # if [ -f "${ENV_ORACLE_INVEN}/ContentsXML/inventory.xml" ] && [ "$(grep -E -c "${ENV_ORACLE_HOME}" "${ENV_ORACLE_INVEN}"/ContentsXML/inventory.xml)" -gt 0 ]; then # line=$(grep -n "${ENV_ORACLE_HOME}" "${ENV_ORACLE_INVEN}"/ContentsXML/inventory.xml | awk -F ":" '{print $1}') # sed -i "${line} d" "${ENV_ORACLE_INVEN}"/ContentsXML/inventory.xml # fi if [[ "${DB_VERSION}" == "12.2.0.1" ]] || [[ "${DB_VERSION}" == "11.2.0.4" ]]; then ##INSTALL DB SOFTWARE if ! su - oracle -c "${SOFTWAREDIR}/database/runInstaller -silent -force -showProgress -ignoreSysPrereqs -waitForCompletion -responseFile ${SOFTWAREDIR}/db.rsp -ignorePrereq"; then c1 "Sorry, ORALCE Software Install Failed." red exit 99 fi ## 18C, 19C, 21C -applyRU elif [ "${DB_VERSION}" = "18.0.0.0" ] || [[ "${DB_VERSION}" == "19.3.0.0" ]] || [[ "${DB_VERSION}" == "21.3.0.0" ]]; then if [ -n "${GPATCH}" ]; then ##RAC OR RESTART su - oracle -c "${ENV_ORACLE_HOME}/runInstaller -silent -force -responseFile ${SOFTWAREDIR}/db.rsp -ignorePrereq -waitForCompletion -applyRU ${SOFTWAREDIR}/${GPATCH}" elif [ -n "${OPATCH}" ]; then ##RAC OR RESTART su - oracle -c "${ENV_ORACLE_HOME}/runInstaller -silent -force -responseFile ${SOFTWAREDIR}/db.rsp -ignorePrereq -waitForCompletion -applyRU ${SOFTWAREDIR}/${OPATCH}" else ##NO PATCH su - oracle -c "${ENV_ORACLE_HOME}/runInstaller -silent -force -responseFile ${SOFTWAREDIR}/db.rsp -ignorePrereq -waitForCompletion" fi fi if [ -d "/${SOFTWAREDIR}/"database ]; then cd ~ || return rm -rf "/${SOFTWAREDIR:?}/"database fi if [ -f "${ENV_ORACLE_INVEN}"/orainstRoot.sh ] || [ -f "${ENV_ORACLE_HOME}"/root.sh ]; then if [ -f "${ENV_ORACLE_INVEN}"/orainstRoot.sh ]; then "${ENV_ORACLE_INVEN}"/orainstRoot.sh if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then ssh "$RAC2HOSTNAME" "${ENV_ORACLE_INVEN}"/orainstRoot.sh fi fi if [ -f "${ENV_ORACLE_HOME}"/root.sh ]; then "${ENV_ORACLE_HOME}"/root.sh if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then ssh "$RAC2HOSTNAME" "${ENV_ORACLE_HOME}"/root.sh fi fi else echo c1 "Oracle software installation failed, please check the log." red exit 99 fi ##Oracle APPLY Patches ## 11G AND 12C opatch auto / opatchauto ## AFTER INSTALL ,APPLY PATCH if [ -n "${GPATCH}" ] || [ -n "${OPATCH}" ]; then ## 11G if [ "${DB_VERSION}" = "11.2.0.4" ]; then if su - oracle -c "unzip -o ${SOFTWAREDIR}/p6880880_112000_Linux-x86-64.zip -d ${ENV_ORACLE_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/p6880880_112000_Linux-x86-64.zip echo "unzip p6880880 successful" else c1 "Make sure the Patch 6880880 is in the ${SOFTWAREDIR} directory:" red c1 "p6880880_112000_Linux-x86-64.zip" blue exit 92 fi ## 12C elif [ "${DB_VERSION}" = "12.2.0.1" ]; then if su - oracle -c "unzip -o ${SOFTWAREDIR}/p6880880_122010_Linux-x86-64.zip -d ${ENV_ORACLE_HOME}"; then ##rm -rf "${SOFTWAREDIR}"/p6880880_122010_Linux-x86-64.zip echo "unzip p6880880 successful" else c1 "Make sure the Patch 6880880 is in the ${SOFTWAREDIR} directory:" red c1 "p6880880_122010_Linux-x86-64.zip" blue exit 92 fi fi ## RAC if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then ## scp OPatch if [ "${DB_VERSION}" = "11.2.0.4" ] || [ "${DB_VERSION}" = "12.2.0.1" ]; then scp -r "${ENV_ORACLE_HOME}"/OPatch "${RAC2HOSTNAME}":"${ENV_ORACLE_HOME}" ssh "${RAC2HOSTNAME}" chown -R oracle:oinstall "${ENV_ORACLE_HOME}"/OPatch ssh "${RAC2HOSTNAME}" chown -R oracle:oinstall "${SOFTWAREDIR}/""${GPATCH}" fi fi if [[ "${DB_VERSION}" == "11.2.0.4" ]]; then "${ENV_ORACLE_HOME}"/OPatch/opatch auto "${SOFTWAREDIR}/""${GPATCH}" -oh "${ENV_ORACLE_HOME}" if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then ssh "$RAC2HOSTNAME" "${ENV_ORACLE_HOME}"/OPatch/opatch auto "${SOFTWAREDIR}/""${GPATCH}" -oh "${ENV_ORACLE_HOME}" fi elif [ "${DB_VERSION}" = "12.2.0.1" ]; then "${ENV_ORACLE_HOME}"/OPatch/opatchauto apply "${SOFTWAREDIR}/""${GPATCH}" -oh "${ENV_ORACLE_HOME}" if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then ssh "$RAC2HOSTNAME" "${ENV_ORACLE_HOME}"/OPatch/opatchauto apply "${SOFTWAREDIR}/""${GPATCH}" -oh "${ENV_ORACLE_HOME}" fi fi else if [ "${DB_VERSION}" = "11.2.0.4" ] || [[ "${DB_VERSION}" == "12.2.0.1" ]]; then ## NOT RAC su - oracle </home/oracle/oracleParaset.sql --set db_create_file_dest ALTER SYSTEM SET DB_CREATE_FILE_DEST='${ASMDATANAME}'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=${ASMDATANAME}'; exit; EOF else cat </home/oracle/oracleParaset.sql --set db_create_file_dest ALTER SYSTEM SET DB_CREATE_FILE_DEST='+${ASMDATANAME}'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=+${ASMDATANAME}'; exit; EOF fi else cat </home/oracle/oracleParaset.sql --set db_create_file_dest ALTER SYSTEM SET DB_CREATE_FILE_DEST='${ORADATADIR}'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=${ARCHIVEDIR}'; exit; EOF fi su - oracle -c "sqlplus / as sysdba @/home/oracle/oracleParaset.sql" #################################################################################### # Create PDB and Set pdb autostart with cdb #################################################################################### if [ "${ISCDB}" = "TRUE" ] && [ -n "${PDBNAME}" ]; then if [ ! -f /home/oracle/pdbs_save_state.sql ]; then cat <>/home/oracle/pdbs_save_state.sql --create pluggable database create pluggable database ${PDBNAME} admin user admin identified by oracle; --open pluggable database alter pluggable database all open; --set pdb autostart with cdb alter pluggable database all save state; exit EOF fi su - oracle -c "sqlplus / as sysdba @/home/oracle/pdbs_save_state.sql" #################################################################################### # Add pdb TNS #################################################################################### if [ -f "${ENV_ORACLE_HOME}"/network/admin/tnsnames.ora ] && [ "$(grep -E -c "#OracleBegin" "${ENV_ORACLE_HOME}"/network/admin/tnsnames.ora)" -eq 0 ]; then [ ! -f "${ENV_ORACLE_HOME}"/network/admin/tnsnames.ora."${DAYTIME}" ] && cp "${ENV_ORACLE_HOME}"/network/admin/tnsnames.ora "${ENV_ORACLE_HOME}"/network/admin/tnsnames.ora."${DAYTIME}" su - oracle -c "cat <>${ENV_ORACLE_HOME}/network/admin/tnsnames.ora #OracleBegin ${PDBNAME} = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ${hostname})(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ${PDBNAME}) ) ) #OracleEnd EOF " else su - oracle -c "cat <${ENV_ORACLE_HOME}/network/admin/tnsnames.ora #OracleBegin ${PDBNAME} = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ${hostname})(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ${PDBNAME}) ) ) #OracleEnd EOF " fi if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then scp "${ENV_ORACLE_HOME}"/network/admin/tnsnames.ora "${RAC2HOSTNAME}":"${ENV_ORACLE_HOME}"/network/admin/ fi fi #################################################################################### # Configure instances autostart with OS start #################################################################################### if [ "$(grep -E -c "#OracleBegin" /etc/oratab)" -eq 0 ]; then [ ! -f /etc/oratab."${DAYTIME}" ] && cp /etc/oratab /etc/oratab."${DAYTIME}" sed -i 's/db:N/db:Y/' /etc/oratab if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ] || [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then if [ "${DB_VERSION}" = "11.2.0.4" ]; then "${ENV_GRID_HOME}"/bin/crsctl modify resource "ora.${ORACLE_SID}.db" -attr "AUTO_START=always" elif [ "${DB_VERSION}" = "12.2.0.1" ] || [ "${DB_VERSION}" = "18.0.0.0" ] || [[ "${DB_VERSION}" == "19.3.0.0" ]] || [[ "${DB_VERSION}" == "21.3.0.0" ]]; then "${ENV_GRID_HOME}"/bin/crsctl modify resource "ora.${ORACLE_SID}.db" -attr "AUTO_START=always" -unsupported fi else sed -i 's/ORACLE_HOME_LISTNER=$1/ORACLE_HOME_LISTNER=$ORACLE_HOME/' "${ENV_ORACLE_HOME}"/bin/dbstart cat <>/etc/rc.d/rc.local #OracleBegin su oracle -lc "${ENV_ORACLE_HOME}/bin/lsnrctl start" su oracle -lc ${ENV_ORACLE_HOME}/bin/dbstart #OracleEnd EOF chmod +x /etc/rc.d/rc.local fi fi #################################################################################### # Configure del_arch.sh to crontab #################################################################################### ##create del_arch.sh if [ ! -f ${SCRIPTSDIR}/del_arch.sh ]; then { echo '#!/bin/bash' echo 'source ~/.bash_profile' echo 'deltime=`date +"20%y%m%d%H%M%S"`' echo "rman target / nocatalog msglog ${SCRIPTSDIR}/del_arch_\${deltime}.log<>${SCRIPTSDIR}/del_arch.sh fi ##create dbbackup_lv0.sh if [ ! -f ${SCRIPTSDIR}/dbbackup_lv0.sh ]; then { echo '#!/bin/sh' echo 'source ~/.bash_profile' echo 'backtime=`date +"20%y%m%d%H%M%S"`' echo "rman target / log=${BACKUPDIR}/level0_backup_\${backtime}.log<>${SCRIPTSDIR}/dbbackup_lv0.sh fi ##create dbbackup_lv1.sh if [ ! -f ${SCRIPTSDIR}/dbbackup_lv1.sh ]; then { echo '#!/bin/sh' echo 'source ~/.bash_profile' echo 'backtime=`date +"20%y%m%d%H%M%S"`' echo "rman target / log=${BACKUPDIR}/level1_backup_\${backtime}.log<>${SCRIPTSDIR}/dbbackup_lv1.sh fi ##create dbbackup_lv2.sh if [ ! -f ${SCRIPTSDIR}/dbbackup_lv2.sh ]; then { echo '#!/bin/sh' echo 'source ~/.bash_profile' echo 'backtime=$(date +"20%y%m%d%H%M%S")' echo "rman target / log=${BACKUPDIR}/level2_backup_\${backtime}.log<>${SCRIPTSDIR}/dbbackup_lv2.sh fi #################################################################################### # Configure scripts to crontab #################################################################################### ##Set to oracle crontab if [ ! -f /var/spool/cron/oracle ]; then echo "##For oracle" >>/var/spool/cron/oracle fi if [ "$(grep -E -c "#OracleBegin" /var/spool/cron/oracle)" -eq 0 ]; then [ ! -f /var/spool/cron/oracle."${DAYTIME}" ] && cp /var/spool/cron/oracle /var/spool/cron/oracle."${DAYTIME}" >/dev/null 2>&1 chown -R oracle:oinstall ${SCRIPTSDIR}/d* chmod +x ${SCRIPTSDIR}/d* { echo "#OracleBegin" echo "#12 00 * * * ${SCRIPTSDIR}/del_arch.sh" echo "#00 00 * * 0 ${SCRIPTSDIR}/dbbackup_lv0.sh" echo "#00 00 * * 1,2,4,5 ${SCRIPTSDIR}/dbbackup_lv1.sh" echo "#00 00 * * 3,6 ${SCRIPTSDIR}/dbbackup_lv2.sh" echo "#OracleEnd" } >>/var/spool/cron/oracle fi #################################################################################### # Configure PASSWORD_LIFE_TIME UNLIMITED #################################################################################### if [ "${ISCDB}" = "TRUE" ] && [ -n "${PDBNAME}" ]; then cat </home/oracle/password_unlimt.sql ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; ALTER SYSTEM SET AUDIT_TRAIL=NONE SCOPE=SPFILE; alter system set processes=1000 scope=spfile; ALTER SYSTEM SET DEFERRED_SEGMENT_CREATION=FALSE; ALTER SYSTEM SET "_OPTIMIZER_CARTESIAN_ENABLED"=FALSE; ALTER SYSTEM SET "_USE_SINGLE_LOG_WRITER"=FALSE SCOPE=SPFILE; ALTER SYSTEM SET RESULT_CACHE_MAX_SIZE= 0; ALTER SYSTEM SET event='10949 trace name context forever:28401 trace name context forever,level 1:10849 trace name context forever, level 1:19823 trace name context forever, level 90' scope=spfile; ALTER SESSION SET CONTAINER=${PDBNAME}; ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; GRANT DBA TO ADMIN; exit; EOF else cat </home/oracle/password_unlimt.sql ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; ALTER SYSTEM SET AUDIT_TRAIL=NONE SCOPE=SPFILE; alter system set processes=1000 scope=spfile; ALTER SYSTEM SET DEFERRED_SEGMENT_CREATION=FALSE; ALTER SYSTEM SET "_OPTIMIZER_CARTESIAN_ENABLED"=FALSE; --ALTER SYSTEM SET "_USE_SINGLE_LOG_WRITER"=FALSE SCOPE=SPFILE; ALTER SYSTEM SET RESULT_CACHE_MAX_SIZE= 0; ALTER SYSTEM SET event='10949 trace name context forever:28401 trace name context forever,level 1:10849 trace name context forever, level 1:19823 trace name context forever, level 90' scope=spfile; exit; EOF fi su - oracle -c "sqlplus / as sysdba @/home/oracle/password_unlimt.sql" cat </home/oracle/Impliedparameters.sql col name for a40 col VALUE for a10 col DESCRIB for a60 set lines 200 SHOW PARAMETER AUDIT_TRAIL SHOW PARAMETER DEFERRED_SEGMENT_CREATION SHOW PARAMETER RESULT_CACHE_MAX_SIZE SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ FROM SYS.x\$ksppi x, SYS.x\$ksppcv y WHERE x.inst_id = USERENV ('Instance') AND y.inst_id = USERENV ('Instance') AND x.indx = y.indx and x.ksppinm in ('_optimizer_cartesian_enabled','_use_single_log_writer','_use_adaptive_log_file_sync'); exit; EOF logwrite "Oracle Implied parameters" "su - oracle -c \"sqlplus / as sysdba @/home/oracle/Impliedparameters.sql\"" #################################################################################### # Sqlnet.ora Configure lower Oracle client to connect #################################################################################### if [ "${DB_VERSION}" = "18.0.0.0" ] || [[ "${DB_VERSION}" == "19.3.0.0" ]] || [[ "${DB_VERSION}" == "12.2.0.1" ]] || [[ "${DB_VERSION}" == "21.3.0.0" ]]; then if [ -f "${ENV_ORACLE_HOME}"/network/admin/sqlnet.ora ] && [ "$(grep -E -c "#OracleBegin" "${ENV_ORACLE_HOME}"/network/admin/sqlnet.ora)" -eq 0 ]; then [ ! -f "${ENV_ORACLE_HOME}"/network/admin/sqlnet.ora."${DAYTIME}" ] && cp "${ENV_ORACLE_HOME}"/network/admin/sqlnet.ora "${ENV_ORACLE_HOME}"/network/admin/sqlnet.ora."${DAYTIME}" su - oracle -c "cat <>${ENV_ORACLE_HOME}/network/admin/sqlnet.ora #OracleBegin SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8 SQLNET.ALLOWED_LOGON_VERSION_SERVER=8 #OracleEnd EOF " else su - oracle -c "cat <${ENV_ORACLE_HOME}/network/admin/sqlnet.ora #OracleBegin SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8 SQLNET.ALLOWED_LOGON_VERSION_SERVER=8 #OracleEnd EOF " fi if [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then scp "${ENV_ORACLE_HOME}"/network/admin/sqlnet.ora "${RAC2HOSTNAME}":"${ENV_ORACLE_HOME}"/network/admin/ fi fi #################################################################################### # Configure glogin.sql #################################################################################### if [ "$(grep -E -c "OracleBegin" "${ENV_ORACLE_HOME}"/sqlplus/admin/glogin.sql)" -eq 0 ]; then [ ! -f "${ENV_ORACLE_HOME}"/sqlplus/admin/glogin.sql."${DAYTIME}" ] && cp "${ENV_ORACLE_HOME}"/sqlplus/admin/glogin.sql "${ENV_ORACLE_HOME}"/sqlplus/admin/glogin.sql."${DAYTIME}" cat <"${ENV_ORACLE_HOME}"/sqlplus/admin/glogin.sql --OracleBegin define _editor=vi set serveroutput on size 1000000 set long 200 set timing on set linesize 500 set pagesize 9999 set trimspool on col Name format a80 set termout off col global_name new_value gname define gname=idle select lower(user) || '@' || substr( global_name, 1, decode( dot, 0,length(global_name), dot-1) ) global_name from (select global_name, instr(global_name,'.') dot from global_name ); set sqlprompt '&gname _DATE> ' ALTER SESSION SET nls_date_format = 'HH24:MI:SS'; set termout on --OracleEnd EOF fi if [ "$(find "/home/oracle" -maxdepth 1 -name '*.sql' | wc -l)" -gt 0 ]; then cd ~ || return rm -rf /home/oracle/*.sql fi } if [ "${OracleInstallMode}" = "single" ] || [ "${OracleInstallMode}" = "SINGLE" ]; then ##FOR SINGLE SwapCheck InstallRPM SetHostName SetHosts CreateUsersAndDirs TimeDepSet Disableavahi DisableFirewall DisableSelinux DisableTHPAndNUMA #DisableNetworkManager InstallRlwrap EditParaFiles if [ "${ONLYCREATEDB}" = 'N' ]; then UnzipDBSoft fi ##If ONLY INSTALL ORACLE SOFTWARE if [ "${ONLYCONFIGOS}" = 'N' ]; then if [ "${ONLYINSTALLORACLE}" = 'Y' ]; then InstallDBsoftware createNetca c1 "Congratulations, Install Successful!" blue else if [ "${ONLYCREATEDB}" = 'Y' ]; then createDB DBParaSet c1 "Congratulations, Install Successful!" blue else InstallDBsoftware createNetca createDB DBParaSet c1 "Congratulations, Install Successful! Please Reboot Later." blue fi fi fi elif [ "${OracleInstallMode}" = "rac" ] || [ "${OracleInstallMode}" = "RAC" ]; then #For Rac SCANIParse SwapCheck InstallRPM SetHostName SetHosts TimeDepSet CreateUsersAndDirs UDEV_ASMDISK if [ "${DNSSERVER}" = "y" ] || [ "${DNSSERVER}" = "Y" ]; then DNSServerConf fi if [ "$nodeNum" -eq 1 ]; then ##NODE 2 EXCUTE SCRIPT NodeTwoExec ##SSHHOST if [ ! -f "${SOFTWAREDIR}"/sshhostList.cfg ]; then Rac_Auto_SSH fi ##DNS Configure if [ "${DNS}" = "y" ] || [ "${DNS}" = "Y" ]; then NslookupFunc fi fi Disableavahi DisableFirewall DisableSelinux DisableTHPAndNUMA #DisableNetworkManager InstallRlwrap EditParaFiles if [ "$nodeNum" -eq 1 ]; then if [ "${ONLYCREATEDB}" = 'N' ]; then UnzipGridSoft UnzipDBSoft fi fi ##Just nodenum 1 to excute if [ "$nodeNum" -eq 1 ]; then ##If ONLY INSTALL GRID SOFTWARE if [ "${ONLYCONFIGOS}" = 'N' ]; then if [ "${ONLYINSTALLGRID}" = "Y" ]; then Runcluvfy InstallGridsoftware ASM_DATA_CREATE c1 "Congratulations, Install Successful!" blue else if [ "${ONLYINSTALLORACLE}" = "Y" ]; then InstallDBsoftware c1 "Congratulations, Install Successful!" blue else if [ "${ONLYCREATEDB}" = "Y" ]; then createDB DBParaSet c1 "Congratulations, Install Successful!" blue else Runcluvfy InstallGridsoftware ASM_DATA_CREATE InstallDBsoftware createDB DBParaSet c1 "Congratulations, Install Successful! Please Reboot Later." blue fi fi fi fi fi elif [ "${OracleInstallMode}" = "restart" ] || [ "${OracleInstallMode}" = "RESTART" ]; then #For RESTART SwapCheck InstallRPM SetHostName SetHosts CreateUsersAndDirs UDEV_ASMDISK TimeDepSet Disableavahi DisableFirewall DisableSelinux DisableTHPAndNUMA #DisableNetworkManager InstallRlwrap EditParaFiles if [ "${ONLYCREATEDB}" = 'N' ]; then UnzipGridSoft UnzipDBSoft fi ##If ONLY INSTALL GRID SOFTWARE if [ "${ONLYCONFIGOS}" = 'N' ]; then if [ "${ONLYINSTALLGRID}" = "Y" ]; then InstallGridsoftware c1 "Congratulations, Install Successful!" blue else if [ "${ONLYINSTALLORACLE}" = "Y" ]; then InstallDBsoftware c1 "Congratulations, Install Successful!" blue else if [ "${ONLYCREATEDB}" = "Y" ]; then createDB DBParaSet c1 "Congratulations, Install Successful!" blue else InstallGridsoftware InstallDBsoftware createDB DBParaSet c1 "Congratulations, Install Successful! Please Reboot Later." blue fi fi fi fi else c1 "Oracle Install Mode Input Error, exit" red exit 99 fi