暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle linux 6.6一键安装oracle 11g脚本分享

热衷于分享各种干货知识,大家有想看或者想学的可以评论区留言,秉承着“开源知识来源于互联网,回归于互联网”的理念,分享一些日常工作中能用到或者比较重要的内容,希望大家能够喜欢,不足之处请大家多宝贵地意见,我们一起提升,守住自己的饭碗。

正文开始

背景

在搞数据库迁移时,为了快速安装数据库,我们一般会使用自动化安装脚本,在Oracle linux6上面部署11g时,误用7版本的安装脚本,导致安装错误,今日分享在6版本上安装oracle 11g数据库。

下载所需的安装包和依赖包

安装包、镜像和脚本大家可以网盘自行获取:

链接: https://pan.baidu.com/s/1H3mniT_PmfsTIO5TmpwZQg

提取码: 45p5


将下载的安装包依赖包上传至服务器任意目录下,执行安装脚本即可。

  1. [root@localhost~]#sh-x oracle_19c_single_install.sh

脚本内容

  1. #!/bin/bash
  2. #一键安装oracle数据库
  3. #修改主机名
  4. start_time=$(date+%s)
  5. hostnamectlset-hostname myoracle
  6. #添加主机名与IP对应记录
  7. public_ip=$(hostname-I|grep-o-e'[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}'|head-n1)
  8. node_name=$(hostname)
  9. echo-e"${public_ip} ${node_name}">>/etc/hosts
  10. cat/etc/hosts
  11. service iptables stop
  12. chkconfig iptables off
  13. #关闭Selinux
  14. sed-i"s/SELINUX=enforcing/SELINUX=disabled/"/etc/selinux/config
  15. setenforce0
  16. # 获取当前所在目录位置
  17. current_dir=$(pwd)
  18. echo"当前所在目录位置: $current_dir"
  19. # 目标路径
  20. target_dir="/soft"
  21. # 检查目标路径是否存在,如果不存在则创建
  22. if[!-d"$target_dir"];then
  23. mkdir-p"$target_dir"
  24. echo"已创建目录: $target_dir"
  25. fi
  26. # 移动当前目录下的所有文件到目标路径
  27. mv $current_dir/* $target_dir
  28. echo "已将当前目录下所有文件移动至 $target_dir"
  29. #添加离线yum源
  30. cd soft
  31. #tar -xvf oracle_repo.tar.gz
  32. #cd soft/my_oracle_repo
  33. #rpm -ivh *.rpm --nodeps --force
  34. cd /etc/yum.repos.d
  35. rm -rf *.repo
  36. #注意将iso镜像挂载
  37. echo "[EL]" >> hellodba.repo
  38. echo "name=oracle linux 6.6" >> hellodba.repo
  39. echo "baseurl=file:///mnt" >> hellodba.repo
  40. echo "gpgcheck=0" >> hellodba.repo
  41. echo "enabled=1" >> hellodba.repo
  42. mount /dev/sr0 /mnt
  43. yum clean all
  44. yum makecache
  45. yum -y install binutils*
  46. yum -y install compat-libcap1*
  47. yum -y install compat-libstdc++-33*
  48. yum -y install gcc-*
  49. yum -y install gcc-c*
  50. yum -y install glibc*
  51. yum -y install glibc-devel*
  52. yum -y install ksh*
  53. yum -y install libaio*
  54. yum -y install libaio-devel*
  55. yum -y install libgcc*
  56. yum -y install libstdc++*
  57. yum -y install libstdc++-devel*
  58. yum -y install libXi*
  59. yum -y install libXtst*
  60. yum -y install *make*
  61. yum -y install sysstat*
  62. yum -y install unixODBC
  63. yum -y install elfutils-libelf*
  64. #添加用户组及用户
  65. groupadd oinstall
  66. groupadd dba
  67. useradd -g oinstall -G dba oracle
  68. echo oracle | passwd --stdin oracle
  69. chmod 644 /etc/sysctl.conf
  70. #修改环境变量
  71. cat <<EOF >>/etc/sysctl.conf
  72. #ORACLE SETTING
  73. #可以拥有的异步IO请求数
  74. fs.aio-max-nr = 1048576
  75. #允许文件句柄的最大数目
  76. fs.file-max = 6815744
  77. #信号参数
  78. kernel.sem = 250 32000 100 128
  79. #IP V4的端口范围
  80. net.ipv4.ip_local_port_range = 9000 65500
  81. #缓存区的缺省值
  82. net.core.rmem_default = 262144
  83. #缓存区的最大值
  84. net.core.rmem_max = 4194304
  85. #发送缓存区的缺省值
  86. net.core.wmem_default = 262144
  87. #发送缓存区的最大值
  88. net.core.wmem_max = 1048586
  89. #当系统检测到oops时,重新启动系统,以便系统能够重新初始化恢复正常工作
  90. kernel.panic_on_oops = 1
  91. #单个共享内存段最大值,让数据库在一个共享段里面的可以容纳整个SGA
  92. #最大值:比物理内存小1字节
  93. #(kernel.shmmax = 物理内存*1024*1024*1024-1)
  94. kernel.shmmax = 2684354560
  95. #控制共享内存页数(kernel.shmall = shmmax/4096)
  96. kernel.shmall = 655360
  97. #共享内存的最大数量
  98. kernel.shmmni = 4096
  99. #当系统内存使用90%的时候开始使用交换页面
  100. vm.swappiness=10
  101. #默认是100,增大这个参数设置了虚拟内存回收directory和i-node缓冲的倾向,这个值越大。越容易回收。
  102. vm.vfs_cache_pressure=200
  103. EOF
  104. sysctl -p
  105. chmod 644 /etc/security/limits.conf
  106. cat <<EOF >>/etc/security/limits.conf
  107. oracle soft nproc 16384
  108. oracle hard nproc 16384
  109. oracle soft nofile 65536
  110. oracle hard nofile 65536
  111. oracle soft stack 32768
  112. oracle hard stack 32768
  113. oracle soft memlock unlimited
  114. oracle hard memlock unlimited
  115. oracle soft core unlimited
  116. oracle hard core unlimited
  117. EOF
  118. EOF
  119. chmod 644 /etc/pam.d/login
  120. cat <<EOF >>/etc/pam.d/login
  121. session required /lib64/security/pam_limits.so
  122. session required pam_limits.so
  123. EOF
  124. chmod 644 /etc/profile
  125. cat <<EOF >>/etc/profile
  126. if [ $USER = "oracle" ]; then
  127. if [ $SHELL = "/bin/ksh" ]; then
  128. ulimit -p 16384
  129. ulimit -n 65536
  130. else
  131. ulimit -u 16384 -n 65536
  132. fi
  133. fi
  134. EOF
  135. source /etc/profile
  136. mkdir -p /u01/app/
  137. chown -R oracle:oinstall /u01/app/
  138. chmod -R 775 /u01/app/
  139. mkdir -p /usr/local/src
  140. cd /usr/local/src
  141. #解压oracle安装包
  142. mv /soft/*.zip /usr/local/src/
  143. cd /usr/local/src/
  144. unzip p13390677_112040_Linux-x86-64_1of7.zip
  145. unzip p13390677_112040_Linux-x86-64_2of7.zip
  146. mkdir /home/oracle/etc
  147. chown -R oracle.oinstall /home/oracle/etc
  148. cp /usr/local/src/database/response/* /home/oracle/etc/
  149. chmod 777 /home/oracle/etc/*.rsp
  150. chown -R oracle:oinstall /home/oracle/etc/
  151. cat <<EOF >/home/oracle/etc/db_install.rsp
  152. ####################################################################
  153. ## Copyright(c) Oracle Corporation 1998,2013. All rights reserved.##
  154. ## ##
  155. ## Specify values for the variables listed below to customize ##
  156. ## your installation. ##
  157. ## ##
  158. ## Each variable is associated with a comment. The comment ##
  159. ## can help to populate the variables with the appropriate ##
  160. ## values. ##
  161. ## ##
  162. ## IMPORTANT NOTE: This file contains plain text passwords and ##
  163. ## should be secured to have read permission only by oracle user ##
  164. ## or db administrator who owns this installation. ##
  165. ## ##
  166. ####################################################################
  167. #------------------------------------------------------------------------------
  168. # Do not change the following system generated value.
  169. #------------------------------------------------------------------------------
  170. oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
  171. #------------------------------------------------------------------------------
  172. # Specify the installation option.
  173. # It can be one of the following:
  174. # - INSTALL_DB_SWONLY
  175. # - INSTALL_DB_AND_CONFIG
  176. # - UPGRADE_DB
  177. #-------------------------------------------------------------------------------
  178. oracle.install.option=INSTALL_DB_SWONLY
  179. #-------------------------------------------------------------------------------
  180. # Specify the hostname of the system as set during the install. It can be used
  181. # to force the installation to use an alternative hostname rather than using the
  182. # first hostname found on the system. (e.g., for systems with multiple hostnames
  183. # and network interfaces)
  184. #-------------------------------------------------------------------------------
  185. ORACLE_HOSTNAME=myoracle
  186. #-------------------------------------------------------------------------------
  187. # Specify the Unix group to be set for the inventory directory.
  188. #-------------------------------------------------------------------------------
  189. UNIX_GROUP_NAME=oinstall
  190. #-------------------------------------------------------------------------------
  191. # Specify the location which holds the inventory files.
  192. # This is an optional parameter if installing on
  193. # Windows based Operating System.
  194. #-------------------------------------------------------------------------------
  195. INVENTORY_LOCATION=/u01/app/oraInventory
  196. #-------------------------------------------------------------------------------
  197. # Specify the languages in which the components will be installed.
  198. #
  199. # en : English ja : Japanese
  200. # fr : French ko : Korean
  201. # ar : Arabic es : Latin American Spanish
  202. # bn : Bengali lv : Latvian
  203. # pt_BR: Brazilian Portuguese lt : Lithuanian
  204. # bg : Bulgarian ms : Malay
  205. # fr_CA: Canadian French es_MX: Mexican Spanish
  206. # ca : Catalan no : Norwegian
  207. # hr : Croatian pl : Polish
  208. # cs : Czech pt : Portuguese
  209. # da : Danish ro : Romanian
  210. # nl : Dutch ru : Russian
  211. # ar_EG: Egyptian zh_CN: Simplified Chinese
  212. # en_GB: English (Great Britain) sk : Slovak
  213. # et : Estonian sl : Slovenian
  214. # fi : Finnish es_ES: Spanish
  215. # de : German sv : Swedish
  216. # el : Greek th : Thai
  217. # iw : Hebrew zh_TW: Traditional Chinese
  218. # hu : Hungarian tr : Turkish
  219. # is : Icelandic uk : Ukrainian
  220. # in : Indonesian vi : Vietnamese
  221. # it : Italian
  222. #
  223. # all_langs : All languages
  224. #
  225. # Specify value as the following to select any of the languages.
  226. # Example : SELECTED_LANGUAGES=en,fr,ja
  227. #
  228. # Specify value as the following to select all the languages.
  229. # Example : SELECTED_LANGUAGES=all_langs
  230. #------------------------------------------------------------------------------
  231. SELECTED_LANGUAGES=en
  232. #------------------------------------------------------------------------------
  233. # Specify the complete path of the Oracle Home.
  234. #------------------------------------------------------------------------------
  235. ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
  236. #------------------------------------------------------------------------------
  237. # Specify the complete path of the Oracle Base.
  238. #------------------------------------------------------------------------------
  239. ORACLE_BASE=/u01/app/oracle
  240. #------------------------------------------------------------------------------
  241. # Specify the installation edition of the component.
  242. #
  243. # The value should contain only one of these choices.
  244. # - EE : Enterprise Edition
  245. # - SE : Standard Edition
  246. # - SEONE : Standard Edition One
  247. # - PE : Personal Edition (WINDOWS ONLY)
  248. #------------------------------------------------------------------------------
  249. oracle.install.db.InstallEdition=EE
  250. #------------------------------------------------------------------------------
  251. # This variable is used to enable or disable custom install and is considered
  252. # only if InstallEdition is EE.
  253. #
  254. # true : Components mentioned as part of 'optionalComponents' property
  255. # are considered for install.
  256. # false : Value for 'optionalComponents' is not considered.
  257. #------------------------------------------------------------------------------
  258. oracle.install.db.EEOptionsSelection=false
  259. #------------------------------------------------------------------------------
  260. # This variable is considered only if 'EEOptionsSelection' is set to true.
  261. #
  262. # Description: List of Enterprise Edition Options you would like to enable.
  263. #
  264. # The following choices are available. You may specify any
  265. # combination of these choices. The components you choose should
  266. # be specified in the form "internal-component-name:version"
  267. # Below is a list of components you may specify to enable.
  268. #
  269. # oracle.oraolap:11.2.0.4.0 - Oracle OLAP
  270. # oracle.rdbms.dm:11.2.0.4.0 - Oracle Data Mining
  271. # oracle.rdbms.dv:11.2.0.4.0 - Oracle Database Vault
  272. # oracle.rdbms.lbac:11.2.0.4.0 - Oracle Label Security
  273. # oracle.rdbms.partitioning:11.2.0.4.0 - Oracle Partitioning
  274. # oracle.rdbms.rat:11.2.0.4.0 - Oracle Real Application Testing
  275. #------------------------------------------------------------------------------
  276. 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
  277. ###############################################################################
  278. # #
  279. # PRIVILEGED OPERATING SYSTEM GROUPS #
  280. # ------------------------------------------ #
  281. # Provide values for the OS groups to which OSDBA and OSOPER privileges #
  282. # needs to be granted. If the install is being performed as a member of the #
  283. # group "dba", then that will be used unless specified otherwise below. #
  284. # #
  285. # The value to be specified for OSDBA and OSOPER group is only for UNIX based #
  286. # Operating System. #
  287. # #
  288. ###############################################################################
  289. #------------------------------------------------------------------------------
  290. # The DBA_GROUP is the OS group which is to be granted OSDBA privileges.
  291. #------------------------------------------------------------------------------
  292. oracle.install.db.DBA_GROUP=dba
  293. #------------------------------------------------------------------------------
  294. # The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
  295. # The value to be specified for OSOPER group is optional.
  296. #------------------------------------------------------------------------------
  297. oracle.install.db.OPER_GROUP=oinstall
  298. #------------------------------------------------------------------------------
  299. # Specify the cluster node names selected during the installation.
  300. # Example : oracle.install.db.CLUSTER_NODES=node1,node2
  301. #------------------------------------------------------------------------------
  302. oracle.install.db.CLUSTER_NODES=
  303. #------------------------------------------------------------------------------
  304. # This variable is used to enable or disable RAC One Node install.
  305. #
  306. # - true : Value of RAC One Node service name is used.
  307. # - false : Value of RAC One Node service name is not used.
  308. #
  309. # If left blank, it will be assumed to be false
  310. #------------------------------------------------------------------------------
  311. oracle.install.db.isRACOneInstall=
  312. #------------------------------------------------------------------------------
  313. # Specify the name for RAC One Node Service.
  314. #------------------------------------------------------------------------------
  315. oracle.install.db.racOneServiceName=
  316. #------------------------------------------------------------------------------
  317. # Specify the type of database to create.
  318. # It can be one of the following:
  319. # - GENERAL_PURPOSE/TRANSACTION_PROCESSING
  320. # - DATA_WAREHOUSE
  321. #------------------------------------------------------------------------------
  322. oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
  323. #------------------------------------------------------------------------------
  324. # Specify the Starter Database Global Database Name.
  325. #------------------------------------------------------------------------------
  326. oracle.install.db.config.starterdb.globalDBName=orcl
  327. #------------------------------------------------------------------------------
  328. # Specify the Starter Database SID.
  329. #------------------------------------------------------------------------------
  330. oracle.install.db.config.starterdb.SID=dbsrv2
  331. #------------------------------------------------------------------------------
  332. # Specify the Starter Database character set.
  333. #
  334. # It can be one of the following:
  335. # AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
  336. # EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
  337. # BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
  338. # AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
  339. # IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
  340. # KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
  341. # ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
  342. #------------------------------------------------------------------------------
  343. oracle.install.db.config.starterdb.characterSet=AL32UTF8
  344. #------------------------------------------------------------------------------
  345. # This variable should be set to true if Automatic Memory Management
  346. # in Database is desired.
  347. # If Automatic Memory Management is not desired, and memory allocation
  348. # is to be done manually, then set it to false.
  349. #------------------------------------------------------------------------------
  350. oracle.install.db.config.starterdb.memoryOption=true
  351. #------------------------------------------------------------------------------
  352. # Specify the total memory allocation for the database. Value(in MB) should be
  353. # at least 256 MB, and should not exceed the total physical memory available
  354. # on the system.
  355. # Example: oracle.install.db.config.starterdb.memoryLimit=512
  356. #------------------------------------------------------------------------------
  357. oracle.install.db.config.starterdb.memoryLimit=8192
  358. #------------------------------------------------------------------------------
  359. # This variable controls whether to load Example Schemas onto
  360. # the starter database or not.
  361. #------------------------------------------------------------------------------
  362. oracle.install.db.config.starterdb.installExampleSchemas=false
  363. #------------------------------------------------------------------------------
  364. # This variable includes enabling audit settings, configuring password profiles
  365. # and revoking some grants to public. These settings are provided by default.
  366. # These settings may also be disabled.
  367. #------------------------------------------------------------------------------
  368. oracle.install.db.config.starterdb.enableSecuritySettings=true
  369. ###############################################################################
  370. # #
  371. # Passwords can be supplied for the following four schemas in the #
  372. # starter database: #
  373. # SYS #
  374. # SYSTEM #
  375. # SYSMAN (used by Enterprise Manager) #
  376. # DBSNMP (used by Enterprise Manager) #
  377. # #
  378. # Same password can be used for all accounts (not recommended) #
  379. # or different passwords for each account can be provided (recommended) #
  380. # #
  381. ###############################################################################
  382. #------------------------------------------------------------------------------
  383. # This variable holds the password that is to be used for all schemas in the
  384. # starter database.
  385. #-------------------------------------------------------------------------------
  386. oracle.install.db.config.starterdb.password.ALL=oracle
  387. #-------------------------------------------------------------------------------
  388. # Specify the SYS password for the starter database.
  389. #-------------------------------------------------------------------------------
  390. oracle.install.db.config.starterdb.password.SYS=
  391. #-------------------------------------------------------------------------------
  392. # Specify the SYSTEM password for the starter database.
  393. #-------------------------------------------------------------------------------
  394. oracle.install.db.config.starterdb.password.SYSTEM=
  395. #-------------------------------------------------------------------------------
  396. # Specify the SYSMAN password for the starter database.
  397. #-------------------------------------------------------------------------------
  398. oracle.install.db.config.starterdb.password.SYSMAN=
  399. #-------------------------------------------------------------------------------
  400. # Specify the DBSNMP password for the starter database.
  401. #-------------------------------------------------------------------------------
  402. oracle.install.db.config.starterdb.password.DBSNMP=
  403. #-------------------------------------------------------------------------------
  404. # Specify the management option to be selected for the starter database.
  405. # It can be one of the following:
  406. # - GRID_CONTROL
  407. # - DB_CONTROL
  408. #-------------------------------------------------------------------------------
  409. oracle.install.db.config.starterdb.control=DB_CONTROL
  410. #-------------------------------------------------------------------------------
  411. # Specify the Management Service to use if Grid Control is selected to manage
  412. # the database.
  413. #-------------------------------------------------------------------------------
  414. oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
  415. ###############################################################################
  416. # #
  417. # SPECIFY BACKUP AND RECOVERY OPTIONS #
  418. # ------------------------------------ #
  419. # Out-of-box backup and recovery options for the database can be mentioned #
  420. # using the entries below. #
  421. # #
  422. ###############################################################################
  423. #------------------------------------------------------------------------------
  424. # This variable is to be set to false if automated backup is not required. Else
  425. # this can be set to true.
  426. #------------------------------------------------------------------------------
  427. oracle.install.db.config.starterdb.automatedBackup.enable=false
  428. #------------------------------------------------------------------------------
  429. # Regardless of the type of storage that is chosen for backup and recovery, if
  430. # automated backups are enabled, a job will be scheduled to run daily to backup
  431. # the database. This job will run as the operating system user that is
  432. # specified in this variable.
  433. #------------------------------------------------------------------------------
  434. oracle.install.db.config.starterdb.automatedBackup.osuid=
  435. #-------------------------------------------------------------------------------
  436. # Regardless of the type of storage that is chosen for backup and recovery, if
  437. # automated backups are enabled, a job will be scheduled to run daily to backup
  438. # the database. This job will run as the operating system user specified by the
  439. # above entry. The following entry stores the password for the above operating
  440. # system user.
  441. #-------------------------------------------------------------------------------
  442. oracle.install.db.config.starterdb.automatedBackup.ospwd=
  443. #-------------------------------------------------------------------------------
  444. # Specify the type of storage to use for the database.
  445. # It can be one of the following:
  446. # - FILE_SYSTEM_STORAGE
  447. # - ASM_STORAGE
  448. #------------------------------------------------------------------------------
  449. oracle.install.db.config.starterdb.storageType=
  450. #-------------------------------------------------------------------------------
  451. # Specify the database file location which is a directory for datafiles, control
  452. # files, redo logs.
  453. #
  454. # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
  455. #-------------------------------------------------------------------------------
  456. oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
  457. #-------------------------------------------------------------------------------
  458. # Specify the backup and recovery location.
  459. #
  460. # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
  461. #-------------------------------------------------------------------------------
  462. oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
  463. #-------------------------------------------------------------------------------
  464. # Specify the existing ASM disk groups to be used for storage.
  465. #
  466. # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE
  467. #-------------------------------------------------------------------------------
  468. oracle.install.db.config.asm.diskGroup=
  469. #-------------------------------------------------------------------------------
  470. # Specify the password for ASMSNMP user of the ASM instance.
  471. #
  472. # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE
  473. #-------------------------------------------------------------------------------
  474. oracle.install.db.config.asm.ASMSNMPPassword=
  475. #------------------------------------------------------------------------------
  476. # Specify the My Oracle Support Account Username.
  477. #
  478. # Example : MYORACLESUPPORT_USERNAME=abc@oracle.com
  479. #------------------------------------------------------------------------------
  480. MYORACLESUPPORT_USERNAME=
  481. #------------------------------------------------------------------------------
  482. # Specify the My Oracle Support Account Username password.
  483. #
  484. # Example : MYORACLESUPPORT_PASSWORD=password
  485. #------------------------------------------------------------------------------
  486. MYORACLESUPPORT_PASSWORD=
  487. #------------------------------------------------------------------------------
  488. # Specify whether to enable the user to set the password for
  489. # My Oracle Support credentials. The value can be either true or false.
  490. # If left blank it will be assumed to be false.
  491. #
  492. # Example : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
  493. #------------------------------------------------------------------------------
  494. SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
  495. #------------------------------------------------------------------------------
  496. # Specify whether user doesn't want to configure Security Updates.
  497. # The value for this variable should be true if you don't want to configure
  498. # Security Updates, false otherwise.
  499. #
  500. # The value can be either true or false. If left blank it will be assumed
  501. # to be false.
  502. #
  503. # Example : DECLINE_SECURITY_UPDATES=false
  504. #------------------------------------------------------------------------------
  505. DECLINE_SECURITY_UPDATES=true
  506. #------------------------------------------------------------------------------
  507. # Specify the Proxy server name. Length should be greater than zero.
  508. #
  509. # Example : PROXY_HOST=proxy.domain.com
  510. #------------------------------------------------------------------------------
  511. PROXY_HOST=
  512. #------------------------------------------------------------------------------
  513. # Specify the proxy port number. Should be Numeric and at least 2 chars.
  514. #
  515. # Example : PROXY_PORT=25
  516. #------------------------------------------------------------------------------
  517. PROXY_PORT=
  518. #------------------------------------------------------------------------------
  519. # Specify the proxy user name. Leave PROXY_USER and PROXY_PWD
  520. # blank if your proxy server requires no authentication.
  521. #
  522. # Example : PROXY_USER=username
  523. #------------------------------------------------------------------------------
  524. PROXY_USER=
  525. #------------------------------------------------------------------------------
  526. # Specify the proxy password. Leave PROXY_USER and PROXY_PWD
  527. # blank if your proxy server requires no authentication.
  528. #
  529. # Example : PROXY_PWD=password
  530. #------------------------------------------------------------------------------
  531. PROXY_PWD=
  532. #------------------------------------------------------------------------------
  533. # Specify the proxy realm. This value is used if auto-updates option is selected.
  534. #
  535. # Example : PROXY_REALM=metalink
  536. #------------------------------------------------------------------------------
  537. PROXY_REALM=
  538. #------------------------------------------------------------------------------
  539. # Specify the Oracle Support Hub URL.
  540. #
  541. # Example : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/
  542. #------------------------------------------------------------------------------
  543. COLLECTOR_SUPPORTHUB_URL=
  544. #------------------------------------------------------------------------------
  545. # Specify the auto-updates option. It can be one of the following:
  546. # - MYORACLESUPPORT_DOWNLOAD
  547. # - OFFLINE_UPDATES
  548. # - SKIP_UPDATES
  549. #------------------------------------------------------------------------------
  550. oracle.installer.autoupdates.option=
  551. #------------------------------------------------------------------------------
  552. # In case MYORACLESUPPORT_DOWNLOAD option is chosen, specify the location where
  553. # the updates are to be downloaded.
  554. # In case OFFLINE_UPDATES option is chosen, specify the location where the updates
  555. # are present.
  556. #------------------------------------------------------------------------------
  557. oracle.installer.autoupdates.downloadUpdatesLoc=
  558. #------------------------------------------------------------------------------
  559. # Specify the My Oracle Support Account Username which has the patches download privileges
  560. # to be used for software updates.
  561. # Example : AUTOUPDATES_MYORACLESUPPORT_USERNAME=abc@oracle.com
  562. #------------------------------------------------------------------------------
  563. AUTOUPDATES_MYORACLESUPPORT_USERNAME=
  564. #------------------------------------------------------------------------------
  565. # Specify the My Oracle Support Account Username password which has the patches download privileges
  566. # to be used for software updates.
  567. #
  568. # Example : AUTOUPDATES_MYORACLESUPPORT_PASSWORD=password
  569. #------------------------------------------------------------------------------
  570. AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
  571. EOF
  572. chown -R oracle:oinstall /home/oracle/etc/db_install.rsp
  573. chmod 660 /home/oracle/etc/db_install.rsp
  574. cd /usr/local/src/database/
  575. su - oracle -c "/usr/local/src/database/runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp"
  576. sleep 500
  577. /u01/app/oraInventory/orainstRoot.sh
  578. /u01/app/oracle/product/11.2.0/db_1/root.sh
  579. cat <<EOF >>/home/oracle/.bash_profile
  580. #for oracle
  581. export ORACLE_BASE=/u01/app/oracle
  582. export ORACLE_SID=szycq1
  583. export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
  584. export LANG="zh_CN.UTF-8"
  585. export ORACLE_TERM=xterm
  586. export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
  587. export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
  588. export PATH=/usr/sbin:\$PATH
  589. export PATH=\$ORACLE_HOME/bin:\$PATH
  590. export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
  591. export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
  592. EOF
  593. ####使配置文件生效###
  594. source /home/oracle/.bash_profile
  595. su - oracle -c "echo $ORACLE_HOME"
  596. echo -e "\n\n****** start listener config ******\n\n"
  597. su - oracle -c "/u01/app/oracle/product/11.2.0/db_1/bin/netca -silent -responsefile /home/oracle/etc/netca.rsp"
  598. echo -e "\n\n****** listener config completed ******\n\n"
  599. chmod 644 /home/oracle/etc/dbca.rsp
  600. cat <<EOF >>/home/oracle/etc/dbca.rsp
  601. [GENERAL]
  602. RESPONSEFILE_VERSION = "11.2.0"
  603. OPERATION_TYPE = "createDatabase"
  604. [CREATEDATABASE]
  605. GDBNAME = "orcl11g"
  606. SID = "orcl11g"
  607. TEMPLATENAME = "General_Purpose.dbc"
  608. CHARACTERSET = "AL32UTF8"
  609. sysPassword= "oracle"
  610. SYSTEMPASSWORD = "oracle"
  611. DBSNMPPASSWORD= "oracle"
  612. [SYSTEM]
  613. SYSTEM_USER_PASSWORD="oracle"
  614. [EXAMPLE]
  615. EXAMPLE_SCHEMA=FALSE
  616. EOF
  617. sleep 60
  618. echo -e "\n\n****** start db instance create ******\n\n"
  619. #su - oracle -c "/u01/app/oracle/product/11.2.0/db_1/bin/dbca -silent -responseFile /home/oracle/etc/dbca.rsp"
  620. ##静默安装 静默运行dbca
  621. su - oracle -c "/u01/app/oracle/product/11.2.0/db_1/bin/dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc \
  622. -gdbname orcl11g -sid orcl11g -syspassword password -systempassword password \
  623. -emConfiguration NONE -characterSet ZHS16GBK -datafileDestination $ORACLE_BASE/oradata"
  624. end_time=$(date +%s)
  625. execution_time=$((end_time - start_time))
  626. echo "脚本执行时间:${execution_time} 秒"
  627. echo -e "\n\n****** db instance create complete ******\n\n"

总结

一键安装脚本可以提高安装效率 ,节省时间和人力,无需手动逐个执行复杂的安装命令和配置步骤,只需运行脚本,即可自动完成软件或系统的安装过程,大大缩短安装时间,减少人工操作的工作量。在大规模部署软件或系统时,如企业内部多台计算机需要安装相同软件,一键安装脚本可同时在多台设备上运行,实现快速、统一的部署。简化操作流程,减少错误发生,手动安装过程中,容易因误操作导致安装失败或配置错误。而一键安装脚本按照预设的正确步骤执行,降低了因人为失误而引发问题的概率,提高了安装的成功率和稳定性。


END
往期文章回顾


往期精彩文章:

实战!Oracle 11g单机一键安装脚本分享

入门级Oracle 11g日常运维命令总结

Oracle 11g DataGuard搭建保姆级教程

Oracle 11g RAC集群日常运维命令总结

护工级Oracle 11g RAC集群实战安装教程


文中的概念来源于互联网,如有侵权,请联系我删除。

欢迎关注公众号:小周的数据库进阶之路,一起交流数据库、中间件和云计算等技术。如果觉得读完本文有收获,可以转发给其他朋友,大家一起学习进步!感兴趣的朋友可以加我微信,拉您进群与业界的大佬们一起交流学习。



文章转载自小周的数据库进阶之路,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论