測試環境:centos 6.9 X64 mini 版
Oracle版本:11g r2
Oracle軟件包:db_112040_Linux-x86-64_1of7.zip;db_112040_Linux-x86-64_2of7.zip
靜默安裝的應答原文件路徑:/home/soft/database/response
一、環境准備
環境初始化腳本:來源於網上做了個小修改
功能:實現環境的修改和補丁的補全
1 #!/bin/bash 2 # oracle 11g R2 for linux 安裝輔助腳本 3 # Redkey 4 # version 1.3 5 # date 2017.10.19 6 #定義常量 7 SYSCTL=/etc/sysctl.conf 8 LIMITS=/etc/security/limits.conf 9 PAM=/etc/pam.d/login 10 PROFILE=/etc/profile 11 BASH_PROFILE=/home/oracle/.bash_profile 12 #循環變量 13 i=1 14 #定義顯示顏色 15 #顏色定義 信息(33黃色) 警示(31紅色) 過程(36淺藍) 16 #判斷執行用戶是否root 17 isroot() 18 { 19 if [ $USER != "root" ];then 20 echo -e "\n\e[1;31m the user must be root,and now you user is $USER,please su to root. \e[0m" 21 exit4 22 else 23 echo -e "\n\e[1;36m check root ... OK! \e[0m" 24 fi 25 } 26 yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel pdksh compat-db control-center libstdc++ libstdc++-devel xscreensaver openmotif21 ksh* compat-libcap* zip unzip 27 #掛在光盤到/mnt/cdrom目錄下 28 #mount_cdrom() 29 #{ 30 #echo -e "\n\e[1;31m please insert RHEL to CDROM,press any key ...\e[0m" 31 #read -n 1 32 #if [ -d /mnt/cdrom ];then 33 # mount -t auto -o ro /dev/cdrom /mnt/cdrom 34 #else 35 # mkdir -p /mnt/cdrom 36 # mount -t auto -o ro /dev/cdrom /mnt/cdrom 37 #fi 38 #if [ $? -eq 0 ];then 39 # echo -e "\n\e[1;36m CDROM mount on /mnt/cdrom ... OK! \e[0m" 40 #fi 41 #} 42 #設置yum本地光盤源 43 #yum_repo() 44 #{ 45 # rm -rf /etc/yum.repos.d/* && cat <<EOF >> /etc/yum.repos.d/Server.repo 46 #[Server] 47 #name=MyRPM 48 #baseurl=file:///mnt/cdrom/Server 49 #enabled=1 50 #gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release 51 #EOF 52 #if [ $? -eq 0 ];then 53 #echo -e "\n\e[1;36m /etc/yum.repos.d/Server.repo ... OK! \e[0m" 54 #fi 55 #} 56 #添加oracle用戶,添加oracle用戶所屬組oinstall及附加組dba 57 ouseradd() 58 { 59 if [[ `grep "oracle" /etc/passwd` != "" ]];then 60 userdel -r oracle 61 fi 62 if [[ `grep "oinstall" /etc/group` = "" ]];then 63 groupadd oinstall 64 fi 65 if [[ `grep "dba" /etc/group` = "" ]];then 66 groupadd dba 67 fi 68 useradd oracle -g oinstall -G dba && echo $1 |passwd oracle --stdin 69 if [ $? -eq 0 ];then 70 echo -e "\n\e[1;36m oracle's password updated successfully --- OK! \e[0m" 71 else 72 echo -e "\n\e[1;31m oracle's password set faild. --- NO!\e[0m" 73 fi 74 } 75 #檢查oracle所需軟件包並安裝 76 packagecheck() 77 { 78 for package in binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel make sysstat 79 do 80 rpm -q $package 2> /dev/null 81 if [ $? != 0 ];then 82 yum -y install $package 83 echo -e "\n\e[1;36m $package is already installed ... OK! \e[0m" 84 fi 85 done 86 } 87 #安裝桌面套件 X Window System / Desktop 88 #xdesk() 89 #{ 90 # yum -y groupinstall "X Window System" "Desktop" 91 #} 92 # 設置內核參數 93 94 kernelset() 95 { 96 cp $SYSCTL{,.bak} && cat <<EOF >>$SYSCTL 97 fs.aio-max-nr = 1048576 98 fs.file-max = 6815744 99 kernel.shmall = 2097152 100 kernel.shmmax = 4294967295 101 kernel.shmmni = 4096 102 kernel.sem = 250 32000 100 128 103 net.ipv4.ip_local_port_range = 9000 65500 104 net.core.rmem_default = 262144 105 net.core.rmem_max = 4194304 106 net.core.wmem_default = 262144 107 net.core.wmem_max = 1048575 108 EOF 109 if [ $? -eq 0 ];then 110 echo -e "\n\e[1;36m kernel parameters updated successfully --- OK! \e[0m" 111 fi 112 sysctl -p 113 } 114 #設置oracle資源限制 115 oralimit() 116 { 117 cp $LIMITS{,.bak} && cat <<EOF >> $LIMITS 118 oracle soft nproc 2047 119 oracle hard nproc 16384 120 oracle soft nofile 1024 121 oracle hard nofile 65536 122 oracle soft stack 10240 123 EOF 124 if [ $? -eq 0 ];then 125 echo -e "\n\e[1;36m $LIMITS updated successfully ... OK! \e[0m" 126 fi 127 } 128 #設置login文件 129 setlogin() 130 { 131 cp $PAM{,.bak} && cat <<EOF >>$PAM 132 session required pam_limits.so 133 EOF 134 if [ $? -eq 0 ];then 135 echo -e "\n\e[1;36m $PAM updated successfully ... OK! \e[0m" 136 fi 137 } 138 #設置profile文件 139 setprofile() 140 { 141 cp $PROFILE{,.bak} && cat <<EOF >>$PROFILE 142 if [ $USER = "oracle" ];then 143 if [ $SHELL = "/bin/ksh" ];then 144 ulimit -p 16384 145 ulimit -n 65536 146 else 147 ulimit -u 16384 -n 65536 148 fi 149 fi 150 EOF 151 if [ $? -eq 0 ];then 152 echo -e "\n\e[1;36m $PROFILE updated successfully ... OK! \e[0m" 153 fi 154 } 155 #設置oracle的profile文件 156 setbash_profile() 157 { 158 cp $BASH_PROFILE{,.bak} && cat <<EOF >> $BASH_PROFILE 159 umask 022 160 ORACLE_BASE=/home/oracle/app 161 ORACLE_HOME=/home/oracle/app/product/11.2.0/db_1 162 ORACLE_SID=orcl 163 PATH=$ORACLE_HOME/bin/:$PATH 164 LANG=en_US.UTF-8 165 stty erase ^H 166 export ORACLE_BASE ORACLE_HOME ORACLE_SID 167 EOF 168 if [ $? -eq 0 ];then 169 echo -e "\n\e[1;36m $BASH_PROFILE updated successfully ... OK! \e[0m" 170 fi 171 . $BASH_PROFILE 172 } 173 #系統環境檢查 174 oscheck() 175 { 176 #查看內存大小是否大於1G 177 echo -e "\n check MEM Size ..." 178 if [ `cat /proc/meminfo | grep MemTotal | awk '{print $2}'` -lt 1048576 ];then 179 echo -e "\n\e[1;33m Memory Small \e[0m" 180 exit 1 181 else 182 echo -e "\n\e[1;36m Memory checked PASS \e[0m" 183 fi 184 #查看tmp空間大小 185 echo -e "\n check tmpfs Size ..." 186 cp /etc/fstab{,.bak} 187 while true;do 188 if [ `df | awk '/tmpfs/ {print $2}'` -lt 1048576 ];then 189 echo -e "\n\e[1;33m tmpfs Smaill \e[0m" 190 sed -i '/tmpfs/s/defaults/defaults,size=1G/' /etc/fstab && mount -o remount /dev/shm 191 if [ $? != 0 ];then 192 i=i+1 193 if [ $i -eq 3 ];then 194 echo -e "\n\e[1;31m set tmpfs faild. \e[0m" 195 exit 3 196 fi 197 else 198 echo -e "\n\e[1;36 tmpfs updated successfully. \e[0m" 199 break 200 fi 201 else 202 echo -e "\n\e[1;36m tmpfs checked PASS \e[0m" 203 break 204 fi 205 done 206 } 207 #停止防火牆IPTABLES 208 service iptables stop 209 chkconfig iptables off 210 #關閉SELINUX 211 cp /etc/selinux/config{,.bak} && sed -i '/SELINUX/s/enforcing/disabled/;/SELINUX/s/permissive/disabled/' /etc/selinux/config 212 setenforce 0 213 #執行以上函數 214 isroot 215 oscheck 216 packagecheck 217 xdesk 218 kernelset 219 oralimit 220 setlogin 221 setprofile 222 echo -e "\n\e[1;33m please input oracle's user passwd: \e[0m" 223 read oraclepw 224 ouseradd $oraclepw 225 setbash_profile 226 echo -e "\n\e[1;33m please input oracle install PATH(default /home/oracle/app) \e[0m" 227 read oraclepath 228 if [ -z $oraclepath ];then 229 oraclepath=/home/oracle/app 230 fi 231 echo -e "\n\e[1;33m please input oracle_sid (default orcl) \e[0m" 232 read orasid 233 if [ -z orasid ];then 234 orasid=orcl 235 fi 236 setbash_profile $oraclepath $orasid 237 mkdir -p $oraclepath && chown -R oracle:oinstall $oraclepath && chmod -R 755 $oraclepath && mkdir -p /home/oracle/app/oraInventory && chown -R oracle:oinstall /home/oracle/ 238 unset i 239 echo -e "\n\e[1;35m Oracle install pre-setting finish! && please run oracle installer as user oracle \e[0m"
1、首先復制上面的文本進行創建腳本文件並授可執行權限,並執行腳本
[root@oracle ~]vim oracleinstall.sh 復制腳本粘貼進來
[root@oracle ~]chmod +x oracleinstall.sh && ./oracleinstall.sh
2、執行腳本需要輸入oracle用戶密碼,其它的兩個可以保持默認
3、然后切換到oracle賬戶
[root@oracle ~] su - oracel
4、新建一個soft文件夾
[oracle@oracle ~]mkdir soft
切換到目錄
我實際上是建在home目下面的
需要在root用戶下授於oracle:orinstall的權限
[root@oracle ~]chown -R oracle:oinstall /home/soft
[root@oracle ~]cd /home/soft/
4、上傳並解壓db_112040_Linux-x86-64_1of7.zip;db_112040_Linux-x86-64_2of7.zip
推薦使用rz上傳命令(在初始化腳本時已安裝)
解壓命令:unzip db_112040_Linux-x86-64_1of7.zip && unzip db_112040_Linux-x86-64_2of7.zip
二、安裝數據庫軟件
靜默安裝腳本內容:
1 #################################################################### 2 ## Copyright(c) Oracle Corporation 1998,2013. All rights reserved.## 3 ## ## 4 ## Specify values for the variables listed below to customize ## 5 ## your installation. ## 6 ## ## 7 ## Each variable is associated with a comment. The comment ## 8 ## can help to populate the variables with the appropriate ## 9 ## values. ## 10 ## ## 11 ## IMPORTANT NOTE: This file contains plain text passwords and ## 12 ## should be secured to have read permission only by oracle user ## 13 ## or db administrator who owns this installation. ## 14 ## ## 15 #################################################################### 16 17 #------------------------------------------------------------------------------ 18 # Do not change the following system generated value. 19 #------------------------------------------------------------------------------ 20 oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 21 22 #------------------------------------------------------------------------------ 23 # Specify the installation option. 24 # It can be one of the following: 25 # - INSTALL_DB_SWONLY 26 # - INSTALL_DB_AND_CONFIG 27 # - UPGRADE_DB 28 #------------------------------------------------------------------------------- 29 oracle.install.option=INSTALL_DB_SWONLY 30 31 #------------------------------------------------------------------------------- 32 # Specify the hostname of the system as set during the install. It can be used 33 # to force the installation to use an alternative hostname rather than using the 34 # first hostname found on the system. (e.g., for systems with multiple hostnames 35 # and network interfaces) 36 #------------------------------------------------------------------------------- 37 ORACLE_HOSTNAME=oracle 38 39 #------------------------------------------------------------------------------- 40 # Specify the Unix group to be set for the inventory directory. 41 #------------------------------------------------------------------------------- 42 UNIX_GROUP_NAME=oinstall 43 44 #------------------------------------------------------------------------------- 45 # Specify the location which holds the inventory files. 46 # This is an optional parameter if installing on 47 # Windows based Operating System. 48 #------------------------------------------------------------------------------- 49 INVENTORY_LOCATION=/home/oracle/app/oraInventory 50 51 #------------------------------------------------------------------------------- 52 # Specify the languages in which the components will be installed. 53 # 54 # en : English ja : Japanese 55 # fr : French ko : Korean 56 # ar : Arabic es : Latin American Spanish 57 # bn : Bengali lv : Latvian 58 # pt_BR: Brazilian Portuguese lt : Lithuanian 59 # bg : Bulgarian ms : Malay 60 # fr_CA: Canadian French es_MX: Mexican Spanish 61 # ca : Catalan no : Norwegian 62 # hr : Croatian pl : Polish 63 # cs : Czech pt : Portuguese 64 # da : Danish ro : Romanian 65 # nl : Dutch ru : Russian 66 # ar_EG: Egyptian zh_CN: Simplified Chinese 67 # en_GB: English (Great Britain) sk : Slovak 68 # et : Estonian sl : Slovenian 69 # fi : Finnish es_ES: Spanish 70 # de : German sv : Swedish 71 # el : Greek th : Thai 72 # iw : Hebrew zh_TW: Traditional Chinese 73 # hu : Hungarian tr : Turkish 74 # is : Icelandic uk : Ukrainian 75 # in : Indonesian vi : Vietnamese 76 # it : Italian 77 # 78 # all_langs : All languages 79 # 80 # Specify value as the following to select any of the languages. 81 # Example : SELECTED_LANGUAGES=en,fr,ja 82 # 83 # Specify value as the following to select all the languages. 84 # Example : SELECTED_LANGUAGES=all_langs 85 #------------------------------------------------------------------------------ 86 SELECTED_LANGUAGES=en,zh_CN 87 88 #------------------------------------------------------------------------------ 89 # Specify the complete path of the Oracle Home. 90 #------------------------------------------------------------------------------ 91 ORACLE_HOME=/home/oracle/app/product/11.2.0/db_1 92 93 #------------------------------------------------------------------------------ 94 # Specify the complete path of the Oracle Base. 95 #------------------------------------------------------------------------------ 96 ORACLE_BASE=/home/oracle/app 97 98 #------------------------------------------------------------------------------ 99 # Specify the installation edition of the component. 100 # 101 # The value should contain only one of these choices. 102 # - EE : Enterprise Edition 103 # - SE : Standard Edition 104 # - SEONE : Standard Edition One 105 # - PE : Personal Edition (WINDOWS ONLY) 106 #------------------------------------------------------------------------------ 107 oracle.install.db.InstallEdition=EE 108 109 #------------------------------------------------------------------------------ 110 # This variable is used to enable or disable custom install and is considered 111 # only if InstallEdition is EE. 112 # 113 # true : Components mentioned as part of 'optionalComponents' property 114 # are considered for install. 115 # false : Value for 'optionalComponents' is not considered. 116 #------------------------------------------------------------------------------ 117 oracle.install.db.EEOptionsSelection=true 118 119 #------------------------------------------------------------------------------ 120 # This variable is considered only if 'EEOptionsSelection' is set to true. 121 # 122 # Description: List of Enterprise Edition Options you would like to enable. 123 # 124 # The following choices are available. You may specify any 125 # combination of these choices. The components you choose should 126 # be specified in the form "internal-component-name:version" 127 # Below is a list of components you may specify to enable. 128 # 129 # oracle.oraolap:11.2.0.4.0 - Oracle OLAP 130 # oracle.rdbms.dm:11.2.0.4.0 - Oracle Data Mining 131 # oracle.rdbms.dv:11.2.0.4.0 - Oracle Database Vault 132 # oracle.rdbms.lbac:11.2.0.4.0 - Oracle Label Security 133 # oracle.rdbms.partitioning:11.2.0.4.0 - Oracle Partitioning 134 # oracle.rdbms.rat:11.2.0.4.0 - Oracle Real Application Testing 135 #------------------------------------------------------------------------------ 136 oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0 137 138 ############################################################################### 139 # # 140 # PRIVILEGED OPERATING SYSTEM GROUPS # 141 # ------------------------------------------ # 142 # Provide values for the OS groups to which OSDBA and OSOPER privileges # 143 # needs to be granted. If the install is being performed as a member of the # 144 # group "dba", then that will be used unless specified otherwise below. # 145 # # 146 # The value to be specified for OSDBA and OSOPER group is only for UNIX based # 147 # Operating System. # 148 # # 149 ############################################################################### 150 151 #------------------------------------------------------------------------------ 152 # The DBA_GROUP is the OS group which is to be granted OSDBA privileges. 153 #------------------------------------------------------------------------------ 154 oracle.install.db.DBA_GROUP=dba 155 156 #------------------------------------------------------------------------------ 157 # The OPER_GROUP is the OS group which is to be granted OSOPER privileges. 158 # The value to be specified for OSOPER group is optional. 159 #------------------------------------------------------------------------------ 160 oracle.install.db.OPER_GROUP=oinstall 161 162 #------------------------------------------------------------------------------ 163 # Specify the cluster node names selected during the installation. 164 # Example : oracle.install.db.CLUSTER_NODES=node1,node2 165 #------------------------------------------------------------------------------ 166 oracle.install.db.CLUSTER_NODES= 167 168 #------------------------------------------------------------------------------ 169 # This variable is used to enable or disable RAC One Node install. 170 # 171 # - true : Value of RAC One Node service name is used. 172 # - false : Value of RAC One Node service name is not used. 173 # 174 # If left blank, it will be assumed to be false 175 #------------------------------------------------------------------------------ 176 oracle.install.db.isRACOneInstall= 177 178 #------------------------------------------------------------------------------ 179 # Specify the name for RAC One Node Service. 180 #------------------------------------------------------------------------------ 181 oracle.install.db.racOneServiceName= 182 183 #------------------------------------------------------------------------------ 184 # Specify the type of database to create. 185 # It can be one of the following: 186 # - GENERAL_PURPOSE/TRANSACTION_PROCESSING 187 # - DATA_WAREHOUSE 188 #------------------------------------------------------------------------------ 189 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE 190 191 #------------------------------------------------------------------------------ 192 # Specify the Starter Database Global Database Name. 193 #------------------------------------------------------------------------------ 194 oracle.install.db.config.starterdb.globalDBName=orcl 195 196 #------------------------------------------------------------------------------ 197 # Specify the Starter Database SID. 198 #------------------------------------------------------------------------------ 199 oracle.install.db.config.starterdb.SID=orcl 200 201 #------------------------------------------------------------------------------ 202 # Specify the Starter Database character set. 203 # 204 # It can be one of the following: 205 # AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2, 206 # EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257, 207 # BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6, 208 # AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8, 209 # IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE, 210 # KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950, 211 # ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258 212 #------------------------------------------------------------------------------ 213 oracle.install.db.config.starterdb.characterSet=AL32UTF8 214 215 #------------------------------------------------------------------------------ 216 # This variable should be set to true if Automatic Memory Management 217 # in Database is desired. 218 # If Automatic Memory Management is not desired, and memory allocation 219 # is to be done manually, then set it to false. 220 #------------------------------------------------------------------------------ 221 oracle.install.db.config.starterdb.memoryOption=true 222 223 #------------------------------------------------------------------------------ 224 # Specify the total memory allocation for the database. Value(in MB) should be 225 # at least 256 MB, and should not exceed the total physical memory available 226 # on the system. 227 # Example: oracle.install.db.config.starterdb.memoryLimit=512 228 #------------------------------------------------------------------------------ 229 oracle.install.db.config.starterdb.memoryLimit= 230 231 #------------------------------------------------------------------------------ 232 # This variable controls whether to load Example Schemas onto 233 # the starter database or not. 234 #------------------------------------------------------------------------------ 235 oracle.install.db.config.starterdb.installExampleSchemas=false 236 237 #------------------------------------------------------------------------------ 238 # This variable includes enabling audit settings, configuring password profiles 239 # and revoking some grants to public. These settings are provided by default. 240 # These settings may also be disabled. 241 #------------------------------------------------------------------------------ 242 oracle.install.db.config.starterdb.enableSecuritySettings=true 243 244 ############################################################################### 245 # # 246 # Passwords can be supplied for the following four schemas in the # 247 # starter database: # 248 # SYS # 249 # SYSTEM # 250 # SYSMAN (used by Enterprise Manager) # 251 # DBSNMP (used by Enterprise Manager) # 252 # # 253 # Same password can be used for all accounts (not recommended) # 254 # or different passwords for each account can be provided (recommended) # 255 # # 256 ############################################################################### 257 258 #------------------------------------------------------------------------------ 259 # This variable holds the password that is to be used for all schemas in the 260 # starter database. 261 #------------------------------------------------------------------------------- 262 oracle.install.db.config.starterdb.password.ALL=111111 263 264 #------------------------------------------------------------------------------- 265 # Specify the SYS password for the starter database. 266 #------------------------------------------------------------------------------- 267 oracle.install.db.config.starterdb.password.SYS= 268 269 #------------------------------------------------------------------------------- 270 # Specify the SYSTEM password for the starter database. 271 #------------------------------------------------------------------------------- 272 oracle.install.db.config.starterdb.password.SYSTEM= 273 274 #------------------------------------------------------------------------------- 275 # Specify the SYSMAN password for the starter database. 276 #------------------------------------------------------------------------------- 277 oracle.install.db.config.starterdb.password.SYSMAN= 278 279 #------------------------------------------------------------------------------- 280 # Specify the DBSNMP password for the starter database. 281 #------------------------------------------------------------------------------- 282 oracle.install.db.config.starterdb.password.DBSNMP= 283 284 #------------------------------------------------------------------------------- 285 # Specify the management option to be selected for the starter database. 286 # It can be one of the following: 287 # - GRID_CONTROL 288 # - DB_CONTROL 289 #------------------------------------------------------------------------------- 290 oracle.install.db.config.starterdb.control=DB_CONTROL 291 292 #------------------------------------------------------------------------------- 293 # Specify the Management Service to use if Grid Control is selected to manage 294 # the database. 295 #------------------------------------------------------------------------------- 296 oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL= 297 298 ############################################################################### 299 # # 300 # SPECIFY BACKUP AND RECOVERY OPTIONS # 301 # ------------------------------------ # 302 # Out-of-box backup and recovery options for the database can be mentioned # 303 # using the entries below. # 304 # # 305 ############################################################################### 306 307 #------------------------------------------------------------------------------ 308 # This variable is to be set to false if automated backup is not required. Else 309 # this can be set to true. 310 #------------------------------------------------------------------------------ 311 oracle.install.db.config.starterdb.automatedBackup.enable=false 312 313 #------------------------------------------------------------------------------ 314 # Regardless of the type of storage that is chosen for backup and recovery, if 315 # automated backups are enabled, a job will be scheduled to run daily to backup 316 # the database. This job will run as the operating system user that is 317 # specified in this variable. 318 #------------------------------------------------------------------------------ 319 oracle.install.db.config.starterdb.automatedBackup.osuid= 320 321 #------------------------------------------------------------------------------- 322 # Regardless of the type of storage that is chosen for backup and recovery, if 323 # automated backups are enabled, a job will be scheduled to run daily to backup 324 # the database. This job will run as the operating system user specified by the 325 # above entry. The following entry stores the password for the above operating 326 # system user. 327 #------------------------------------------------------------------------------- 328 oracle.install.db.config.starterdb.automatedBackup.ospwd= 329 330 #------------------------------------------------------------------------------- 331 # Specify the type of storage to use for the database. 332 # It can be one of the following: 333 # - FILE_SYSTEM_STORAGE 334 # - ASM_STORAGE 335 #------------------------------------------------------------------------------ 336 oracle.install.db.config.starterdb.storageType= 337 338 #------------------------------------------------------------------------------- 339 # Specify the database file location which is a directory for datafiles, control 340 # files, redo logs. 341 # 342 # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE 343 #------------------------------------------------------------------------------- 344 oracle.install.db.config.starterdb.fileSystemStorage.dataLocation= 345 346 #------------------------------------------------------------------------------- 347 # Specify the backup and recovery location. 348 # 349 # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE 350 #------------------------------------------------------------------------------- 351 oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation= 352 353 #------------------------------------------------------------------------------- 354 # Specify the existing ASM disk groups to be used for storage. 355 # 356 # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE 357 #------------------------------------------------------------------------------- 358 oracle.install.db.config.asm.diskGroup= 359 360 #------------------------------------------------------------------------------- 361 # Specify the password for ASMSNMP user of the ASM instance. 362 # 363 # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE 364 #------------------------------------------------------------------------------- 365 oracle.install.db.config.asm.ASMSNMPPassword= 366 367 #------------------------------------------------------------------------------ 368 # Specify the My Oracle Support Account Username. 369 # 370 # Example : MYORACLESUPPORT_USERNAME=abc@oracle.com 371 #------------------------------------------------------------------------------ 372 MYORACLESUPPORT_USERNAME= 373 374 #------------------------------------------------------------------------------ 375 # Specify the My Oracle Support Account Username password. 376 # 377 # Example : MYORACLESUPPORT_PASSWORD=password 378 #------------------------------------------------------------------------------ 379 MYORACLESUPPORT_PASSWORD= 380 381 #------------------------------------------------------------------------------ 382 # Specify whether to enable the user to set the password for 383 # My Oracle Support credentials. The value can be either true or false. 384 # If left blank it will be assumed to be false. 385 # 386 # Example : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true 387 #------------------------------------------------------------------------------ 388 SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 389 390 #------------------------------------------------------------------------------ 391 # Specify whether user doesn't want to configure Security Updates. 392 # The value for this variable should be true if you don't want to configure 393 # Security Updates, false otherwise. 394 # 395 # The value can be either true or false. If left blank it will be assumed 396 # to be false. 397 # 398 # Example : DECLINE_SECURITY_UPDATES=false 399 #------------------------------------------------------------------------------ 400 DECLINE_SECURITY_UPDATES=true 401 402 #------------------------------------------------------------------------------ 403 # Specify the Proxy server name. Length should be greater than zero. 404 # 405 # Example : PROXY_HOST=proxy.domain.com 406 #------------------------------------------------------------------------------ 407 PROXY_HOST= 408 409 #------------------------------------------------------------------------------ 410 # Specify the proxy port number. Should be Numeric and at least 2 chars. 411 # 412 # Example : PROXY_PORT=25 413 #------------------------------------------------------------------------------ 414 PROXY_PORT= 415 416 #------------------------------------------------------------------------------ 417 # Specify the proxy user name. Leave PROXY_USER and PROXY_PWD 418 # blank if your proxy server requires no authentication. 419 # 420 # Example : PROXY_USER=username 421 #------------------------------------------------------------------------------ 422 PROXY_USER= 423 424 #------------------------------------------------------------------------------ 425 # Specify the proxy password. Leave PROXY_USER and PROXY_PWD 426 # blank if your proxy server requires no authentication. 427 # 428 # Example : PROXY_PWD=password 429 #------------------------------------------------------------------------------ 430 PROXY_PWD= 431 432 #------------------------------------------------------------------------------ 433 # Specify the proxy realm. This value is used if auto-updates option is selected. 434 # 435 # Example : PROXY_REALM=metalink 436 #------------------------------------------------------------------------------ 437 PROXY_REALM= 438 439 #------------------------------------------------------------------------------ 440 # Specify the Oracle Support Hub URL. 441 # 442 # Example : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/ 443 #------------------------------------------------------------------------------ 444 COLLECTOR_SUPPORTHUB_URL= 445 446 #------------------------------------------------------------------------------ 447 # Specify the auto-updates option. It can be one of the following: 448 # - MYORACLESUPPORT_DOWNLOAD 449 # - OFFLINE_UPDATES 450 # - SKIP_UPDATES 451 #------------------------------------------------------------------------------ 452 oracle.installer.autoupdates.option= 453 #------------------------------------------------------------------------------ 454 # In case MYORACLESUPPORT_DOWNLOAD option is chosen, specify the location where 455 # the updates are to be downloaded. 456 # In case OFFLINE_UPDATES option is chosen, specify the location where the updates 457 # are present. 458 #------------------------------------------------------------------------------ 459 oracle.installer.autoupdates.downloadUpdatesLoc= 460 #------------------------------------------------------------------------------ 461 # Specify the My Oracle Support Account Username which has the patches download privileges 462 # to be used for software updates. 463 # Example : AUTOUPDATES_MYORACLESUPPORT_USERNAME=abc@oracle.com 464 #------------------------------------------------------------------------------ 465 AUTOUPDATES_MYORACLESUPPORT_USERNAME= 466 467 #------------------------------------------------------------------------------ 468 # Specify the My Oracle Support Account Username password which has the patches download privileges 469 # to be used for software updates. 470 # 471 # Example : AUTOUPDATES_MYORACLESUPPORT_PASSWORD=password 472 #------------------------------------------------------------------------------ 473 AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
在解壓目錄執行如下命令:
[oracle@oracle database]$./runInstaller -silent -responseFile /home/oracle/soft/database/response/db_install.rsp
出現警告可以不用管
可以另開窗口查看安裝進度:
[oracle@oracle response]$tailf /home/oracle/app/oraInventory/logs/installActions2017-08-02_02-37-56AM.log
安裝到最后出會出現:
切換到ROOT賬戶執行兩個腳本
[oracle@oracle response]$sh /home/oracle/app/oraInventory/orainstRoot.sh
[oracle@oracle response]$sh /home/oracle/app/product/11.2.0/db_1/root.sh
數據庫安裝完成
三、監聽靜默安裝
[oracle@oracle response]$ netca /silent /responsefile /home/soft/database/response/netca.rsp
netca.rsp腳本內容如下
1 Parsing command line arguments: 2 Parameter "silent" = true 3 Parameter "responsefile" = /home/soft/database/response/netca.rsp 4 Done parsing command line arguments. 5 Oracle Net Services Configuration: 6 Profile configuration complete. 7 Oracle Net Listener Startup: 8 Running Listener Control: 9 /home/oracle/app/product/11.2.0/db_1/bin/lsnrctl start LISTENER 10 Listener Control complete. 11 Listener started successfully. 12 Listener configuration complete. 13 Oracle Net Services configuration successful. The exit code is 0
[oracle@oracle response]$ vim /home/oracle/app/product/11.2.0/db_1/network/admin/listener.ora
修改前
查看監聽狀態:
[oracle@oracle response]$ lsnrctl status
停止監聽
[oracle@oracle response]$ lsnrctl stop
[oracle@oracle response]$ lsnrctl start
四、靜默創建數據庫
數據庫腳本
dbca_orcl.rsp內容如下:
1 [GENERAL] 2 RESPONSEFILE_VERSION = "11.2.0" 3 OPERATION_TYPE = "createDatabase" 4 [CREATEDATABASE] 5 GDBNAME = "orcl" 6 SID = "orcl" 7 TEMPLATENAME = "General_Purpose.dbc" 8 STORAGETYPE=FS 9 DATAFILEDESTINATION =/home/oracle/app/oradata 10 #RECOVERYAREADESTINATION=/opt/app/flash_recovery_area 11 12 13 CHARACTERSET = "AL32UTF8" 14 NATIONALCHARACTERSET= "AL16UTF16" 15 LISTENERS=LISTENER 16 TOTALMEMORY = "700" 17 SYSPASSWORD = "111111" 18 SYSTEMPASSWORD = "111111"
[oracle@oracle response]$ dbca -silent -responseFile ./dbca_orcl.rsp
遇到的問題
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
解決辦法:
可能是初始化腳本有問題造成的,於是修改環境變量的SID值為 orcl
執行sqlplus / as sysdba 成功
用sqldeveloper 連接
歡迎大家交流