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

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


一、oracle 11g单机一键安装脚本分享

(一)下载所需的安装包和依赖包

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

  2. 提取码: 3783

(二)上传所需安装包和依赖包

上传所需文件至任意路径下,赋予X权限,执行一键安装脚本即可

  1. [root@myoracle ~]#sh -x oracle_single_install.sh

(三)安装过程部分截图





(四)脚本内容

  1. #!/bin/bash

  2. #一键安装oracle数据库

  3. #修改主机名

  4. hostnamectl set-hostname myoracle

  5. #添加主机名与IP对应记录

  6. public_ip=$(hostname -I| grep -o -e '[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}' |head -n 1)

  7. node_name=$(hostname)

  8. echo -e "${public_ip} ${node_name}">> /etc/hosts

  9. cat /etc/hosts

  10. #关闭Selinux

  11. sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config

  12. setenforce 0

  13. # 获取当前所在目录位置

  14. current_dir=$(pwd)

  15. echo "当前所在目录位置: $current_dir"

  16. # 目标路径

  17. target_dir="/soft"

  18. # 检查目标路径是否存在,如果不存在则创建

  19. if [ ! -d "$target_dir" ]; then

  20. mkdir -p "$target_dir"

  21. echo "已创建目录: $target_dir"

  22. fi

  23. # 移动当前目录下的所有文件到目标路径

  24. mv $current_dir/* $target_dir

  25. echo "已将当前目录下所有文件移动至 $target_dir"

  26. #添加离线yum源

  27. cd soft

  28. tar -xvf oracle_repo.tar.gz

  29. cd soft/my_oracle_repo

  30. rpm -ivh *.rpm --nodeps --force

  31. #在线yum源

  32. cd /etc/yum.repos.d/

  33. rm -rf ./*

  34. sleep 20

  35. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  36. #添加用户组及用户

  37. groupadd oinstall

  38. groupadd dba

  39. useradd -g oinstall -G dba oracle

  40. echo oracle | passwd --stdin oracle

  41. chmod 644 /etc/sysctl.conf

  42. #修改环境变量

  43. cat <<EOF >>/etc/sysctl.conf

  44. fs.aio-max-nr = 1048576

  45. fs.file-max = 6815744

  46. kernel.shmall = 2097152

  47. kernel.shmmax = 536870912

  48. kernel.shmmni = 4096

  49. kernel.sem = 250 32000 100 128

  50. net.ipv4.ip_local_port_range = 9000 65500

  51. net.core.rmem_default = 262144

  52. net.core.rmem_max = 4194304

  53. net.core.wmem_default = 262144

  54. net.core.wmem_max = 1048576

  55. EOF

  56. sysctl -p

  57. chmod 644 /etc/security/limits.conf

  58. cat <<EOF >>/etc/security/limits.conf

  59. oracle soft nproc 2047

  60. oracle hard nproc 16384

  61. oracle soft nofile 1024

  62. oracle hard nofile 65536

  63. oracle soft stack 10240

  64. oracle hard stack 10240

  65. EOF

  66. chmod 644 /etc/pam.d/login

  67. cat <<EOF >>/etc/pam.d/login

  68. session required /lib64/security/pam_limits.so

  69. session required pam_limits.so

  70. EOF

  71. chmod 644 /etc/profile

  72. cat <<EOF >>/etc/profile

  73. if [ $USER = "oracle" ]; then

  74. if [ $SHELL = "/bin/ksh" ]; then

  75. ulimit -p 16384

  76. ulimit -n 65536

  77. else

  78. ulimit -u 16384 -n 65536

  79. fi

  80. fi

  81. EOF

  82. source /etc/profile

  83. mkdir -p /u01/app/

  84. chown -R oracle:oinstall /u01/app/

  85. chmod -R 775 /u01/app/

  86. mkdir -p /usr/local/src

  87. cd /usr/local/src

  88. #解压oracle安装包

  89. mv /soft/*.zip /usr/local/src/

  90. cd /usr/local/src/

  91. unzip p13390677_112040_Linux-x86-64_1of7.zip

  92. unzip p13390677_112040_Linux-x86-64_2of7.zip

  93. mkdir /home/oracle/etc

  94. chown -R oracle.oinstall /home/oracle/etc

  95. cp /usr/local/src/database/response/* /home/oracle/etc/

  96. chmod 777 /home/oracle/etc/*.rsp

  97. chown -R oracle:oinstall /home/oracle/etc/

  98. cat <<EOF >/home/oracle/etc/db_install.rsp

  99. ####################################################################

  100. ## Copyright(c) Oracle Corporation 1998,2013. All rights reserved.##

  101. ## ##

  102. ## Specify values for the variables listed below to customize ##

  103. ## your installation. ##

  104. ## ##

  105. ## Each variable is associated with a comment. The comment ##

  106. ## can help to populate the variables with the appropriate ##

  107. ## values. ##

  108. ## ##

  109. ## IMPORTANT NOTE: This file contains plain text passwords and ##

  110. ## should be secured to have read permission only by oracle user ##

  111. ## or db administrator who owns this installation. ##

  112. ## ##

  113. ####################################################################

  114. #------------------------------------------------------------------------------

  115. # Do not change the following system generated value.

  116. #------------------------------------------------------------------------------

  117. oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

  118. #------------------------------------------------------------------------------

  119. # Specify the installation option.

  120. # It can be one of the following:

  121. # - INSTALL_DB_SWONLY

  122. # - INSTALL_DB_AND_CONFIG

  123. # - UPGRADE_DB

  124. #-------------------------------------------------------------------------------

  125. oracle.install.option=INSTALL_DB_SWONLY

  126. #-------------------------------------------------------------------------------

  127. # Specify the hostname of the system as set during the install. It can be used

  128. # to force the installation to use an alternative hostname rather than using the

  129. # first hostname found on the system. (e.g., for systems with multiple hostnames

  130. # and network interfaces)

  131. #-------------------------------------------------------------------------------

  132. ORACLE_HOSTNAME=myoracle

  133. #-------------------------------------------------------------------------------

  134. # Specify the Unix group to be set for the inventory directory.

  135. #-------------------------------------------------------------------------------

  136. UNIX_GROUP_NAME=oinstall

  137. #-------------------------------------------------------------------------------

  138. # Specify the location which holds the inventory files.

  139. # This is an optional parameter if installing on

  140. # Windows based Operating System.

  141. #-------------------------------------------------------------------------------

  142. INVENTORY_LOCATION=/u01/app/oraInventory

  143. #-------------------------------------------------------------------------------

  144. # Specify the languages in which the components will be installed.

  145. #

  146. # en : English ja : Japanese

  147. # fr : French ko : Korean

  148. # ar : Arabic es : Latin American Spanish

  149. # bn : Bengali lv : Latvian

  150. # pt_BR: Brazilian Portuguese lt : Lithuanian

  151. # bg : Bulgarian ms : Malay

  152. # fr_CA: Canadian French es_MX: Mexican Spanish

  153. # ca : Catalan no : Norwegian

  154. # hr : Croatian pl : Polish

  155. # cs : Czech pt : Portuguese

  156. # da : Danish ro : Romanian

  157. # nl : Dutch ru : Russian

  158. # ar_EG: Egyptian zh_CN: Simplified Chinese

  159. # en_GB: English (Great Britain) sk : Slovak

  160. # et : Estonian sl : Slovenian

  161. # fi : Finnish es_ES: Spanish

  162. # de : German sv : Swedish

  163. # el : Greek th : Thai

  164. # iw : Hebrew zh_TW: Traditional Chinese

  165. # hu : Hungarian tr : Turkish

  166. # is : Icelandic uk : Ukrainian

  167. # in : Indonesian vi : Vietnamese

  168. # it : Italian

  169. #

  170. # all_langs : All languages

  171. #

  172. # Specify value as the following to select any of the languages.

  173. # Example : SELECTED_LANGUAGES=en,fr,ja

  174. #

  175. # Specify value as the following to select all the languages.

  176. # Example : SELECTED_LANGUAGES=all_langs

  177. #------------------------------------------------------------------------------

  178. SELECTED_LANGUAGES=en

  179. #------------------------------------------------------------------------------

  180. # Specify the complete path of the Oracle Home.

  181. #------------------------------------------------------------------------------

  182. ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

  183. #------------------------------------------------------------------------------

  184. # Specify the complete path of the Oracle Base.

  185. #------------------------------------------------------------------------------

  186. ORACLE_BASE=/u01/app/oracle

  187. #------------------------------------------------------------------------------

  188. # Specify the installation edition of the component.

  189. #

  190. # The value should contain only one of these choices.

  191. # - EE : Enterprise Edition

  192. # - SE : Standard Edition

  193. # - SEONE : Standard Edition One

  194. # - PE : Personal Edition (WINDOWS ONLY)

  195. #------------------------------------------------------------------------------

  196. oracle.install.db.InstallEdition=EE

  197. #------------------------------------------------------------------------------

  198. # This variable is used to enable or disable custom install and is considered

  199. # only if InstallEdition is EE.

  200. #

  201. # true : Components mentioned as part of 'optionalComponents' property

  202. # are considered for install.

  203. # false : Value for 'optionalComponents' is not considered.

  204. #------------------------------------------------------------------------------

  205. oracle.install.db.EEOptionsSelection=false

  206. #------------------------------------------------------------------------------

  207. # This variable is considered only if 'EEOptionsSelection' is set to true.

  208. #

  209. # Description: List of Enterprise Edition Options you would like to enable.

  210. #

  211. # The following choices are available. You may specify any

  212. # combination of these choices. The components you choose should

  213. # be specified in the form "internal-component-name:version"

  214. # Below is a list of components you may specify to enable.

  215. #

  216. # oracle.oraolap:11.2.0.4.0 - Oracle OLAP

  217. # oracle.rdbms.dm:11.2.0.4.0 - Oracle Data Mining

  218. # oracle.rdbms.dv:11.2.0.4.0 - Oracle Database Vault

  219. # oracle.rdbms.lbac:11.2.0.4.0 - Oracle Label Security

  220. # oracle.rdbms.partitioning:11.2.0.4.0 - Oracle Partitioning

  221. # oracle.rdbms.rat:11.2.0.4.0 - Oracle Real Application Testing

  222. #------------------------------------------------------------------------------

  223. 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

  224. ###############################################################################

  225. # #

  226. # PRIVILEGED OPERATING SYSTEM GROUPS #

  227. # ------------------------------------------ #

  228. # Provide values for the OS groups to which OSDBA and OSOPER privileges #

  229. # needs to be granted. If the install is being performed as a member of the #

  230. # group "dba", then that will be used unless specified otherwise below. #

  231. # #

  232. # The value to be specified for OSDBA and OSOPER group is only for UNIX based #

  233. # Operating System. #

  234. # #

  235. ###############################################################################

  236. #------------------------------------------------------------------------------

  237. # The DBA_GROUP is the OS group which is to be granted OSDBA privileges.

  238. #------------------------------------------------------------------------------

  239. oracle.install.db.DBA_GROUP=dba

  240. #------------------------------------------------------------------------------

  241. # The OPER_GROUP is the OS group which is to be granted OSOPER privileges.

  242. # The value to be specified for OSOPER group is optional.

  243. #------------------------------------------------------------------------------

  244. oracle.install.db.OPER_GROUP=oinstall

  245. #------------------------------------------------------------------------------

  246. # Specify the cluster node names selected during the installation.

  247. # Example : oracle.install.db.CLUSTER_NODES=node1,node2

  248. #------------------------------------------------------------------------------

  249. oracle.install.db.CLUSTER_NODES=

  250. #------------------------------------------------------------------------------

  251. # This variable is used to enable or disable RAC One Node install.

  252. #

  253. # - true : Value of RAC One Node service name is used.

  254. # - false : Value of RAC One Node service name is not used.

  255. #

  256. # If left blank, it will be assumed to be false

  257. #------------------------------------------------------------------------------

  258. oracle.install.db.isRACOneInstall=

  259. #------------------------------------------------------------------------------

  260. # Specify the name for RAC One Node Service.

  261. #------------------------------------------------------------------------------

  262. oracle.install.db.racOneServiceName=

  263. #------------------------------------------------------------------------------

  264. # Specify the type of database to create.

  265. # It can be one of the following:

  266. # - GENERAL_PURPOSE/TRANSACTION_PROCESSING

  267. # - DATA_WAREHOUSE

  268. #------------------------------------------------------------------------------

  269. oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

  270. #------------------------------------------------------------------------------

  271. # Specify the Starter Database Global Database Name.

  272. #------------------------------------------------------------------------------

  273. oracle.install.db.config.starterdb.globalDBName=orcl

  274. #------------------------------------------------------------------------------

  275. # Specify the Starter Database SID.

  276. #------------------------------------------------------------------------------

  277. oracle.install.db.config.starterdb.SID=dbsrv2

  278. #------------------------------------------------------------------------------

  279. # Specify the Starter Database character set.

  280. #

  281. # It can be one of the following:

  282. # AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,

  283. # EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,

  284. # BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,

  285. # AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,

  286. # IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,

  287. # KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,

  288. # ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258

  289. #------------------------------------------------------------------------------

  290. oracle.install.db.config.starterdb.characterSet=AL32UTF8

  291. #------------------------------------------------------------------------------

  292. # This variable should be set to true if Automatic Memory Management

  293. # in Database is desired.

  294. # If Automatic Memory Management is not desired, and memory allocation

  295. # is to be done manually, then set it to false.

  296. #------------------------------------------------------------------------------

  297. oracle.install.db.config.starterdb.memoryOption=true

  298. #------------------------------------------------------------------------------

  299. # Specify the total memory allocation for the database. Value(in MB) should be

  300. # at least 256 MB, and should not exceed the total physical memory available

  301. # on the system.

  302. # Example: oracle.install.db.config.starterdb.memoryLimit=512

  303. #------------------------------------------------------------------------------

  304. oracle.install.db.config.starterdb.memoryLimit=8192

  305. #------------------------------------------------------------------------------

  306. # This variable controls whether to load Example Schemas onto

  307. # the starter database or not.

  308. #------------------------------------------------------------------------------

  309. oracle.install.db.config.starterdb.installExampleSchemas=false

  310. #------------------------------------------------------------------------------

  311. # This variable includes enabling audit settings, configuring password profiles

  312. # and revoking some grants to public. These settings are provided by default.

  313. # These settings may also be disabled.

  314. #------------------------------------------------------------------------------

  315. oracle.install.db.config.starterdb.enableSecuritySettings=true

  316. ###############################################################################

  317. # #

  318. # Passwords can be supplied for the following four schemas in the #

  319. # starter database: #

  320. # SYS #

  321. # SYSTEM #

  322. # SYSMAN (used by Enterprise Manager) #

  323. # DBSNMP (used by Enterprise Manager) #

  324. # #

  325. # Same password can be used for all accounts (not recommended) #

  326. # or different passwords for each account can be provided (recommended) #

  327. # #

  328. ###############################################################################

  329. #------------------------------------------------------------------------------

  330. # This variable holds the password that is to be used for all schemas in the

  331. # starter database.

  332. #-------------------------------------------------------------------------------

  333. oracle.install.db.config.starterdb.password.ALL=oracle

  334. #-------------------------------------------------------------------------------

  335. # Specify the SYS password for the starter database.

  336. #-------------------------------------------------------------------------------

  337. oracle.install.db.config.starterdb.password.SYS=

  338. #-------------------------------------------------------------------------------

  339. # Specify the SYSTEM password for the starter database.

  340. #-------------------------------------------------------------------------------

  341. oracle.install.db.config.starterdb.password.SYSTEM=

  342. #-------------------------------------------------------------------------------

  343. # Specify the SYSMAN password for the starter database.

  344. #-------------------------------------------------------------------------------

  345. oracle.install.db.config.starterdb.password.SYSMAN=

  346. #-------------------------------------------------------------------------------

  347. # Specify the DBSNMP password for the starter database.

  348. #-------------------------------------------------------------------------------

  349. oracle.install.db.config.starterdb.password.DBSNMP=

  350. #-------------------------------------------------------------------------------

  351. # Specify the management option to be selected for the starter database.

  352. # It can be one of the following:

  353. # - GRID_CONTROL

  354. # - DB_CONTROL

  355. #-------------------------------------------------------------------------------

  356. oracle.install.db.config.starterdb.control=DB_CONTROL

  357. #-------------------------------------------------------------------------------

  358. # Specify the Management Service to use if Grid Control is selected to manage

  359. # the database.

  360. #-------------------------------------------------------------------------------

  361. oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

  362. ###############################################################################

  363. # #

  364. # SPECIFY BACKUP AND RECOVERY OPTIONS #

  365. # ------------------------------------ #

  366. # Out-of-box backup and recovery options for the database can be mentioned #

  367. # using the entries below. #

  368. # #

  369. ###############################################################################

  370. #------------------------------------------------------------------------------

  371. # This variable is to be set to false if automated backup is not required. Else

  372. # this can be set to true.

  373. #------------------------------------------------------------------------------

  374. oracle.install.db.config.starterdb.automatedBackup.enable=false

  375. #------------------------------------------------------------------------------

  376. # Regardless of the type of storage that is chosen for backup and recovery, if

  377. # automated backups are enabled, a job will be scheduled to run daily to backup

  378. # the database. This job will run as the operating system user that is

  379. # specified in this variable.

  380. #------------------------------------------------------------------------------

  381. oracle.install.db.config.starterdb.automatedBackup.osuid=

  382. #-------------------------------------------------------------------------------

  383. # Regardless of the type of storage that is chosen for backup and recovery, if

  384. # automated backups are enabled, a job will be scheduled to run daily to backup

  385. # the database. This job will run as the operating system user specified by the

  386. # above entry. The following entry stores the password for the above operating

  387. # system user.

  388. #-------------------------------------------------------------------------------

  389. oracle.install.db.config.starterdb.automatedBackup.ospwd=

  390. #-------------------------------------------------------------------------------

  391. # Specify the type of storage to use for the database.

  392. # It can be one of the following:

  393. # - FILE_SYSTEM_STORAGE

  394. # - ASM_STORAGE

  395. #------------------------------------------------------------------------------

  396. oracle.install.db.config.starterdb.storageType=

  397. #-------------------------------------------------------------------------------

  398. # Specify the database file location which is a directory for datafiles, control

  399. # files, redo logs.

  400. #

  401. # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE

  402. #-------------------------------------------------------------------------------

  403. oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

  404. #-------------------------------------------------------------------------------

  405. # Specify the backup and recovery location.

  406. #

  407. # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE

  408. #-------------------------------------------------------------------------------

  409. oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

  410. #-------------------------------------------------------------------------------

  411. # Specify the existing ASM disk groups to be used for storage.

  412. #

  413. # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE

  414. #-------------------------------------------------------------------------------

  415. oracle.install.db.config.asm.diskGroup=

  416. #-------------------------------------------------------------------------------

  417. # Specify the password for ASMSNMP user of the ASM instance.

  418. #

  419. # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE

  420. #-------------------------------------------------------------------------------

  421. oracle.install.db.config.asm.ASMSNMPPassword=

  422. #------------------------------------------------------------------------------

  423. # Specify the My Oracle Support Account Username.

  424. #

  425. # Example : MYORACLESUPPORT_USERNAME=abc@oracle.com

  426. #------------------------------------------------------------------------------

  427. MYORACLESUPPORT_USERNAME=

  428. #------------------------------------------------------------------------------

  429. # Specify the My Oracle Support Account Username password.

  430. #

  431. # Example : MYORACLESUPPORT_PASSWORD=password

  432. #------------------------------------------------------------------------------

  433. MYORACLESUPPORT_PASSWORD=

  434. #------------------------------------------------------------------------------

  435. # Specify whether to enable the user to set the password for

  436. # My Oracle Support credentials. The value can be either true or false.

  437. # If left blank it will be assumed to be false.

  438. #

  439. # Example : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true

  440. #------------------------------------------------------------------------------

  441. SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

  442. #------------------------------------------------------------------------------

  443. # Specify whether user doesn't want to configure Security Updates.

  444. # The value for this variable should be true if you don't want to configure

  445. # Security Updates, false otherwise.

  446. #

  447. # The value can be either true or false. If left blank it will be assumed

  448. # to be false.

  449. #

  450. # Example : DECLINE_SECURITY_UPDATES=false

  451. #------------------------------------------------------------------------------

  452. DECLINE_SECURITY_UPDATES=true

  453. #------------------------------------------------------------------------------

  454. # Specify the Proxy server name. Length should be greater than zero.

  455. #

  456. # Example : PROXY_HOST=proxy.domain.com

  457. #------------------------------------------------------------------------------

  458. PROXY_HOST=

  459. #------------------------------------------------------------------------------

  460. # Specify the proxy port number. Should be Numeric and at least 2 chars.

  461. #

  462. # Example : PROXY_PORT=25

  463. #------------------------------------------------------------------------------

  464. PROXY_PORT=

  465. #------------------------------------------------------------------------------

  466. # Specify the proxy user name. Leave PROXY_USER and PROXY_PWD

  467. # blank if your proxy server requires no authentication.

  468. #

  469. # Example : PROXY_USER=username

  470. #------------------------------------------------------------------------------

  471. PROXY_USER=

  472. #------------------------------------------------------------------------------

  473. # Specify the proxy password. Leave PROXY_USER and PROXY_PWD

  474. # blank if your proxy server requires no authentication.

  475. #

  476. # Example : PROXY_PWD=password

  477. #------------------------------------------------------------------------------

  478. PROXY_PWD=

  479. #------------------------------------------------------------------------------

  480. # Specify the proxy realm. This value is used if auto-updates option is selected.

  481. #

  482. # Example : PROXY_REALM=metalink

  483. #------------------------------------------------------------------------------

  484. PROXY_REALM=

  485. #------------------------------------------------------------------------------

  486. # Specify the Oracle Support Hub URL.

  487. #

  488. # Example : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/

  489. #------------------------------------------------------------------------------

  490. COLLECTOR_SUPPORTHUB_URL=

  491. #------------------------------------------------------------------------------

  492. # Specify the auto-updates option. It can be one of the following:

  493. # - MYORACLESUPPORT_DOWNLOAD

  494. # - OFFLINE_UPDATES

  495. # - SKIP_UPDATES

  496. #------------------------------------------------------------------------------

  497. oracle.installer.autoupdates.option=

  498. #------------------------------------------------------------------------------

  499. # In case MYORACLESUPPORT_DOWNLOAD option is chosen, specify the location where

  500. # the updates are to be downloaded.

  501. # In case OFFLINE_UPDATES option is chosen, specify the location where the updates

  502. # are present.

  503. #------------------------------------------------------------------------------

  504. oracle.installer.autoupdates.downloadUpdatesLoc=

  505. #------------------------------------------------------------------------------

  506. # Specify the My Oracle Support Account Username which has the patches download privileges

  507. # to be used for software updates.

  508. # Example : AUTOUPDATES_MYORACLESUPPORT_USERNAME=abc@oracle.com

  509. #------------------------------------------------------------------------------

  510. AUTOUPDATES_MYORACLESUPPORT_USERNAME=

  511. #------------------------------------------------------------------------------

  512. # Specify the My Oracle Support Account Username password which has the patches download privileges

  513. # to be used for software updates.

  514. #

  515. # Example : AUTOUPDATES_MYORACLESUPPORT_PASSWORD=password

  516. #------------------------------------------------------------------------------

  517. AUTOUPDATES_MYORACLESUPPORT_PASSWORD=

  518. EOF

  519. chown -R oracle:oinstall /home/oracle/etc/db_install.rsp

  520. chmod 660 /home/oracle/etc/db_install.rsp

  521. cd /usr/local/src/database/

  522. su - oracle -c "/usr/local/src/database/runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp"

  523. sleep 500

  524. /u01/app/oraInventory/orainstRoot.sh

  525. /u01/app/oracle/product/11.2.0/db_1/root.sh

  526. cat <<EOF >>/home/oracle/.bash_profile

  527. #for oracle

  528. export ORACLE_BASE=/u01/app/oracle

  529. export ORACLE_SID=orcl11g

  530. export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

  531. export LANG="zh_CN.UTF-8"

  532. export ORACLE_TERM=xterm

  533. export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"

  534. export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'

  535. export PATH=/usr/sbin:\$PATH

  536. export PATH=\$ORACLE_HOME/bin:\$PATH

  537. export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib

  538. export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib

  539. EOF

  540. ####使配置文件生效###

  541. source /home/oracle/.bash_profile

  542. su - oracle -c "echo $ORACLE_HOME"

  543. echo -e "\n\n****** start listener config ******\n\n"

  544. su - oracle -c "/u01/app/oracle/product/11.2.0/db_1/bin/netca -silent -responsefile /home/oracle/etc/netca.rsp"

  545. echo -e "\n\n****** listener config completed ******\n\n"

  546. chmod 644 /home/oracle/etc/dbca.rsp

  547. cat <<EOF >>/home/oracle/etc/dbca.rsp

  548. [GENERAL]

  549. RESPONSEFILE_VERSION = "11.2.0"

  550. OPERATION_TYPE = "createDatabase"

  551. [CREATEDATABASE]

  552. GDBNAME = "orcl11g"

  553. SID = "orcl11g"

  554. TEMPLATENAME = "General_Purpose.dbc"

  555. CHARACTERSET = "AL32UTF8"

  556. sysPassword= "oracle"

  557. SYSTEMPASSWORD = "oracle"

  558. DBSNMPPASSWORD= "oracle"

  559. [SYSTEM]

  560. SYSTEM_USER_PASSWORD="oracle"

  561. [EXAMPLE]

  562. EXAMPLE_SCHEMA=FALSE

  563. EOF

  564. sleep 60

  565. echo -e "\n\n****** 开始创建数据库实例 ******\n\n"

  566. #su - oracle -c "/u01/app/oracle/product/11.2.0/db_1/bin/dbca -silent -responseFile /home/oracle/etc/dbca.rsp"

  567. ##静默安装 静默运行dbca

  568. 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 \

  569. -gdbname orcl11g -sid orcl11g -syspassword password -systempassword password \

  570. -emConfiguration NONE -characterSet ZHS16GBK -datafileDestination $ORACLE_BASE/oradata"

  571. echo -e "\n\n****** 数据库实例创建完成 ******\n\n"

说明:本脚本测试所在操作系统为centos7,如您想在其他操作系统执行,需进行测试。


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

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


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

评论