返回首页DA系统C#IDE文件同步服务屏保 今天是: 2026-05-05    "立夏"  夏季的第一个节气,表示盛夏时节的正式开始

搜索
热搜: linux 技术
Hi~登录注册
查看: 2178|回复: 0

[转载] 【转载】纯Linux命令安装Oracle12c

[复制链接]
发表于 2022-8-22 12:58:00 | 显示全部楼层 |阅读模式

少侠不来段修仙之旅吗~

您需要 登录 才可以下载或查看,没有帐号?注册成为修仙之旅的少年~

x
本帖最后由 da11 于 2023-8-2 17:47 编辑

纯Linux命令安装Oracle12c



Linux命令行安装Oracle12c

===============================================
1.下载Oracle12c
2.配置主机名和IP的映射
3.Oracle安装的先决条件
    3.1手动设置
        3.1.1配置内核参数
        3.1.2限制oracle用户资源使用
        3.1.3安装依赖软件包
        3.1.4创建新组和新用户
    3.2附加设置
        3.2.1为oracle用户设置密码
        3.2.2修改设置SELINUX
        3.2.3确保禁用防火墙
        3.2.4创建Oracle安装目录
        3.2.5配置Oracle环境变量并验证
4.Oracle安装
    4.1上传解压
    4.2修改响应文件
    4.3静默安装Oracle
5.数据库创建
6.数据库监听配置

===================================================

1.下载Oracle12c
下载Oracle12.2.0.1.0版本,选择Linux x86-64安装包


2.配置主机名和IP的映射
vi /etc/hosts,添加配置项192.168.1.200 solang //本机ip 和 机器名称

  1. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  2. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
复制代码


3.Oracle安装的先决条件
参见Oracle Database 12c Release 2 (12.2) Installation On Oracle Linux 6 (OL6) and 7 (OL7)

  1. Perform either the Automatic Setup or the Manual Setup to complete the
  2. basic prerequisites. The Additional Setup is required for all installations.
  3. 执行自动设置或手动设置完成基本先决条件。所有安装都需要进行附加设置。
复制代码


这里我们选择手动设置先决条件
3.1手动设置
3.1.1配置内核参数

  1. [root@solang ~]# vi /etc/sysctl.conf
复制代码


添加如下行:
  1. fs.file-max = 6815744
  2. kernel.sem = 250 32000 100 128
  3. kernel.shmmni = 4096
  4. kernel.shmall = 1073741824
  5. kernel.shmmax = 4398046511104
  6. kernel.panic_on_oops = 1
  7. net.core.rmem_default = 262144
  8. net.core.rmem_max = 4194304
  9. net.core.wmem_default = 262144
  10. net.core.wmem_max = 1048576
  11. net.ipv4.conf.all.rp_filter = 2
  12. net.ipv4.conf.default.rp_filter = 2
  13. fs.aio-max-nr = 1048576
  14. net.ipv4.ip_local_port_range = 9000 65500
复制代码

运行sysctl -p命令更改当前内核参数
  1. [root@solang ~]# sysctl -p
  2. net.ipv6.conf.all.disable_ipv6 = 1
  3. net.ipv6.conf.default.disable_ipv6 = 1
  4. net.ipv6.conf.lo.disable_ipv6 = 1
  5. vm.swappiness = 0
  6. net.ipv4.neigh.default.gc_stale_time = 120
  7. net.ipv4.conf.all.rp_filter = 0
  8. net.ipv4.conf.default.rp_filter = 0
  9. net.ipv4.conf.default.arp_announce = 2
  10. net.ipv4.conf.lo.arp_announce = 2
  11. net.ipv4.conf.all.arp_announce = 2
  12. net.ipv4.tcp_max_tw_buckets = 5000
  13. net.ipv4.tcp_syncookies = 1
  14. net.ipv4.tcp_max_syn_backlog = 1024
  15. net.ipv4.tcp_synack_retries = 2
  16. fs.file-max = 6815744
  17. kernel.sem = 250 32000 100 128
  18. kernel.shmmni = 4096
  19. kernel.shmall = 1073741824
  20. kernel.shmmax = 4398046511104
  21. kernel.panic_on_oops = 1
  22. net.core.rmem_default = 262144
  23. net.core.rmem_max = 4194304
  24. net.core.wmem_default = 262144
  25. net.core.wmem_max = 1048576
  26. net.ipv4.conf.all.rp_filter = 2
  27. net.ipv4.conf.default.rp_filter = 2
  28. fs.aio-max-nr = 1048576
  29. net.ipv4.ip_local_port_range = 9000 65500
复制代码

3.1.2限制oracle用户资源使用
  1. [root@solang ~]# vi /etc/security/limits.conf
复制代码

添加如下行:
  1. oracle   soft   nofile    1024
  2. oracle   hard   nofile    65536
  3. oracle   soft   nproc    16384
  4. oracle   hard   nproc    16384
  5. oracle   soft   stack    10240
  6. oracle   hard   stack    32768
  7. oracle   hard   memlock    134217728
  8. oracle   soft   memlock    134217728
复制代码


3.1.3安装依赖软件包
  1. yum install binutils -y
  2. yum install compat-libcap1 -y
  3. yum install compat-libstdc++-33 -y
  4. yum install compat-libstdc++-33.i686 -y
  5. yum install glibc -y
  6. yum install glibc.i686 -y
  7. yum install glibc-devel -y
  8. yum install glibc-devel.i686 -y
  9. yum install ksh -y
  10. yum install libaio -y
  11. yum install libaio.i686 -y
  12. yum install libaio-devel -y
  13. yum install libaio-devel.i686 -y
  14. yum install libX11 -y
  15. yum install libX11.i686 -y
  16. yum install libXau -y
  17. yum install libXau.i686 -y
  18. yum install libXi -y
  19. yum install libXi.i686 -y
  20. yum install libXtst -y
  21. yum install libXtst.i686 -y
  22. yum install libgcc -y
  23. yum install libgcc.i686 -y
  24. yum install libstdc++ -y
  25. yum install libstdc++.i686 -y
  26. yum install libstdc++-devel -y
  27. yum install libstdc++-devel.i686 -y
  28. yum install libxcb -y
  29. yum install libxcb.i686 -y
  30. yum install make -y
  31. yum install nfs-utils -y
  32. yum install net-tools -y
  33. yum install smartmontools -y
  34. yum install sysstat -y
  35. yum install unixODBC -y
  36. yum install unixODBC-devel -y
复制代码


或者执行以下命令:
  1. yum -y install binutils compat-libcap1compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-devel gcc gcc-c++gcc-c++glibc*.i686 glibc glibc-devel glibc-devel*.i686 ksh libgcc*.i686libgcclibstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686libaiolibaio*.i686 libaio-devel libaio-devel*.i686 make sysstat unixODBCunixODBC*.i686 unixODBC-devel unixODBC-devel*.i686 libXp
复制代码


3.1.4创建新组和新用户
  1. groupadd oinstall
  2. groupadd dba
  3. groupadd oper
  4. useradd -g  oinstall  -G dba,oper oracle         
  5. #将oracle用户的组变为oinstall,扩展组为dba,oper oracle
复制代码


不必非要按照叫oinstall,和dba,只不过一般文档上就这么叫
oinstall组用于安装数据库
dba组用于管理数据库
-g 表示这个用户的主组
-G 标识这个用户的其它组
一个用户可以属于多个用户组,但是一个用户只能指定一个组作为其主组


3.2附加设置
  1. The following steps must be performed, whether you did the manual or automatic setup.
  2. 无论是手动还是自动设置,都必须执行以下步骤。
复制代码

3.2.1为oracle用户设置密码
  1. [oracle@solang ~]$ passwd oracle
复制代码


3.2.2修改设置SELINUX
  1. [root@solang ~]# vi /etc/selinux/config
复制代码

将SELINUX永久修改为permissive
  1. SELINUX=permissive
  2. [root@solang ~]# setenforce Permissive
  3. setenforce: SELinux is disabled
复制代码


3.2.3确保禁用防火墙
  1. [root@solang ~]# systemctl stop firewalld
  2. [root@solang ~]# systemctl disable firewalld
复制代码


3.2.4创建Oracle安装目录
  1. [root@solang ~]# mkdir -p /usr/local/products/oracle12c
  2. [root@solang ~]# chown -R oracle:oinstall /usr/local
  3. [root@solang ~]# chmod -R 775 /usr/local/
复制代码

也可以按照Oracle安装文档上的路径进行设置

3.2.5配置Oracle环境变量并验证

切换到新添加的oracle用户名下,在oracle用户下配置环境变量
这个时候要注意 orcl是你的实例名字,如果需要起别的名字下面所有的orcl都改成你的实例名字。
  1. [root@solang ~]# su oracle
  2. [oracle@solang ~]$ vi ~/.bash_profile
复制代码

  1. export TMP=/tmp
  2. export TMPDIR=$TMP

  3. export ORACLE_HOSTNAME=solang
  4. export ORACLE_UNQNAME=orcl
  5. export ORACLE_BASE=/usr/local/products
  6. export ORACLE_HOME=$ORACLE_BASE/oracle12c
  7. export ORACLE_SID=orcl

  8. export PATH=/usr/sbin:/usr/local/bin:$PATH
  9. export PATH=$ORACLE_HOME/bin:$PATH

  10. export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
  11. export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
复制代码



使配置立即生效
  1. [oracle@solang ~]$ source ~/.bash_profile
  2. [oracle@solang ~]$ echo $ORACLE_HOME
  3. /usr/local/products/oracle12c
复制代码


4.Oracle安装
4.1上传解压
将下载的linuxx64_12201_database.zip上传到Linux系统/home/oracle目录下
解压


  1. [oracle@solang ~]$ unzip linuxx64_12201_database.zip
复制代码


4.2修改响应文件(修改前建议先备份一份以防不时之需
压缩包解压完成后得到名为database的文件夹,其中包含安装文件。

  1. [oracle@solang ~]$ cd database/response/
  2. [oracle@solang response]$ vi db_install.rsp
复制代码


此数据库安装响应文件db_install.rsp修改的地方,参见Oracle Universal Installer (OUI) Silent Installations中12cR2进行设置
  1. oracle.install.option=INSTALL_DB_SWONLY
  2. UNIX_GROUP_NAME=oinstall
  3. INVENTORY_LOCATION=/usr/local/oraInventory
  4. ORACLE_HOME=/usr/local/products/oracle12c
  5. ORACLE_BASE=/usr/local/products
  6. oracle.install.db.InstallEdition=EE
  7. oracle.install.db.OSDBA_GROUP=dba
  8. oracle.install.db.OSBACKUPDBA_GROUP=dba
  9. oracle.install.db.OSDGDBA_GROUP=dba
  10. oracle.install.db.OSKMDBA_GROUP=dba
  11. DECLINE_SECURITY_UPDATES=true
复制代码


由于安装时本人将指定保存清单文件的位置设置到了$ORACLE_BASE目录下,出现了警告
  1. WARNING The Central Inventory is located in the Oracle base.
  2. ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
  3. 警告 中央清单位于Oracle base中。
  4. 操作:Oracle建议将此中央清单放在Oracle基本目录之外的位置。
复制代码


建议将清单文件位置修改为INVENTORY_LOCATION=/usr/local/oraInventory,不在$ORACLE_BASE目录下即可。

注意:如果不想修改db_install.rsp,可以采用命令行方式直接指定参数进行安装,参见4.3静默安装Oracle

db_install.rsp完整内容如下
  1. ####################################################################
  2. ## Copyright(c) Oracle Corporation 1998,2017. 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. # Do not change the following system generated value.
  18. #-------------------------------------------------------------------------------
  19. oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0

  20. #-------------------------------------------------------------------------------
  21. # Specify the installation option.
  22. # It can be one of the following:
  23. #   - INSTALL_DB_SWONLY
  24. #   - INSTALL_DB_AND_CONFIG
  25. #   - UPGRADE_DB
  26. #-------------------------------------------------------------------------------
  27. oracle.install.option=INSTALL_DB_SWONLY

  28. #-------------------------------------------------------------------------------
  29. # Specify the Unix group to be set for the inventory directory.  
  30. #-------------------------------------------------------------------------------
  31. UNIX_GROUP_NAME=oinstall

  32. #-------------------------------------------------------------------------------
  33. # Specify the location which holds the inventory files.
  34. # This is an optional parameter if installing on
  35. # Windows based Operating System.
  36. #-------------------------------------------------------------------------------
  37. INVENTORY_LOCATION=/usr/local/oraInventory
  38. #-------------------------------------------------------------------------------
  39. # Specify the complete path of the Oracle Home.
  40. #-------------------------------------------------------------------------------
  41. ORACLE_HOME=/usr/local/products/oracle12c

  42. #-------------------------------------------------------------------------------
  43. # Specify the complete path of the Oracle Base.
  44. #-------------------------------------------------------------------------------
  45. ORACLE_BASE=/usr/local/products

  46. #-------------------------------------------------------------------------------
  47. # Specify the installation edition of the component.                     
  48. #                                                            
  49. # The value should contain only one of these choices.  
  50. #   - EE     : Enterprise Edition
  51. #   - SE2     : Standard Edition 2


  52. #-------------------------------------------------------------------------------

  53. oracle.install.db.InstallEdition=EE
  54. ###############################################################################
  55. #                                                                             #
  56. # PRIVILEGED OPERATING SYSTEM GROUPS                                          #
  57. # ------------------------------------------                                  #
  58. # Provide values for the OS groups to which SYSDBA and SYSOPER privileges     #
  59. # needs to be granted. If the install is being performed as a member of the   #
  60. # group "dba", then that will be used unless specified otherwise below.       #
  61. #                                                                             #
  62. # The value to be specified for OSDBA and OSOPER group is only for UNIX based #
  63. # Operating System.                                                           #
  64. #                                                                             #
  65. ###############################################################################

  66. #------------------------------------------------------------------------------
  67. # The OSDBA_GROUP is the OS group which is to be granted SYSDBA privileges.
  68. #-------------------------------------------------------------------------------
  69. oracle.install.db.OSDBA_GROUP=dba

  70. #------------------------------------------------------------------------------
  71. # The OSOPER_GROUP is the OS group which is to be granted SYSOPER privileges.
  72. # The value to be specified for OSOPER group is optional.
  73. #------------------------------------------------------------------------------
  74. oracle.install.db.OSOPER_GROUP=dba

  75. #------------------------------------------------------------------------------
  76. # The OSBACKUPDBA_GROUP is the OS group which is to be granted SYSBACKUP privileges.
  77. #------------------------------------------------------------------------------
  78. oracle.install.db.OSBACKUPDBA_GROUP=dba

  79. #------------------------------------------------------------------------------
  80. # The OSDGDBA_GROUP is the OS group which is to be granted SYSDG privileges.
  81. #------------------------------------------------------------------------------
  82. oracle.install.db.OSDGDBA_GROUP=dba

  83. #------------------------------------------------------------------------------
  84. # The OSKMDBA_GROUP is the OS group which is to be granted SYSKM privileges.
  85. #------------------------------------------------------------------------------
  86. oracle.install.db.OSKMDBA_GROUP=dba

  87. #------------------------------------------------------------------------------
  88. # The OSRACDBA_GROUP is the OS group which is to be granted SYSRAC privileges.
  89. #------------------------------------------------------------------------------
  90. DECLINE_SECURITY_UPDATES=true

  91. ###############################################################################
  92. #                                                                             #
  93. #                               Grid Options                                  #
  94. #                                                                             #
  95. ###############################################################################
  96. #------------------------------------------------------------------------------
  97. # Specify the type of Real Application Cluster Database
  98. #
  99. #   - ADMIN_MANAGED: Admin-Managed
  100. #   - POLICY_MANAGED: Policy-Managed
  101. #
  102. # If left unspecified, default will be ADMIN_MANAGED
  103. #------------------------------------------------------------------------------
  104. oracle.install.db.rac.configurationType=

  105. #------------------------------------------------------------------------------
  106. # Value is required only if RAC database type is ADMIN_MANAGED
  107. #
  108. # Specify the cluster node names selected during the installation.
  109. # Leaving it blank will result in install on local server only (Single Instance)
  110. #
  111. # Example : oracle.install.db.CLUSTER_NODES=node1,node2
  112. #------------------------------------------------------------------------------
  113. oracle.install.db.CLUSTER_NODES=

  114. #------------------------------------------------------------------------------
  115. # This variable is used to enable or disable RAC One Node install.
  116. #
  117. #   - true  : Value of RAC One Node service name is used.
  118. #   - false : Value of RAC One Node service name is not used.
  119. #
  120. # If left blank, it will be assumed to be false.
  121. #------------------------------------------------------------------------------
  122. oracle.install.db.isRACOneInstall=

  123. #------------------------------------------------------------------------------
  124. # Value is required only if oracle.install.db.isRACOneInstall is true.
  125. #
  126. # Specify the name for RAC One Node Service
  127. #------------------------------------------------------------------------------
  128. oracle.install.db.racOneServiceName=

  129. #------------------------------------------------------------------------------
  130. # Value is required only if RAC database type is POLICY_MANAGED
  131. #
  132. # Specify a name for the new Server pool that will be configured
  133. # Example : oracle.install.db.rac.serverpoolName=pool1
  134. #------------------------------------------------------------------------------
  135. oracle.install.db.rac.serverpoolName=

  136. #------------------------------------------------------------------------------
  137. # Value is required only if RAC database type is POLICY_MANAGED
  138. #
  139. # Specify a number as cardinality for the new Server pool that will be configured
  140. # Example : oracle.install.db.rac.serverpoolCardinality=2
  141. #------------------------------------------------------------------------------
  142. oracle.install.db.rac.serverpoolCardinality=

  143. ###############################################################################
  144. #                                                                             #
  145. #                        Database Configuration Options                       #
  146. #                                                                             #
  147. ###############################################################################

  148. #-------------------------------------------------------------------------------
  149. # Specify the type of database to create.
  150. # It can be one of the following:
  151. #   - GENERAL_PURPOSE                       
  152. #   - DATA_WAREHOUSE
  153. # GENERAL_PURPOSE: A starter database designed for general purpose use or transaction-heavy applications.
  154. # DATA_WAREHOUSE : A starter database optimized for data warehousing applications.
  155. #-------------------------------------------------------------------------------
  156. oracle.install.db.config.starterdb.type=

  157. #-------------------------------------------------------------------------------
  158. # Specify the Starter Database Global Database Name.
  159. #-------------------------------------------------------------------------------
  160. oracle.install.db.config.starterdb.globalDBName=

  161. #-------------------------------------------------------------------------------
  162. # Specify the Starter Database SID.
  163. #-------------------------------------------------------------------------------
  164. oracle.install.db.config.starterdb.SID=

  165. #-------------------------------------------------------------------------------
  166. # Specify whether the database should be configured as a Container database.
  167. # The value can be either "true" or "false". If left blank it will be assumed
  168. # to be "false".
  169. #-------------------------------------------------------------------------------
  170. oracle.install.db.ConfigureAsContainerDB=

  171. #-------------------------------------------------------------------------------
  172. # Specify the  Pluggable Database name for the pluggable database in Container Database.
  173. #-------------------------------------------------------------------------------
  174. oracle.install.db.config.PDBName=

  175. #-------------------------------------------------------------------------------
  176. # Specify the Starter Database character set.
  177. #                                               
  178. #  One of the following
  179. #  AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
  180. #  EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
  181. #  BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
  182. #  AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
  183. #  IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
  184. #  KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
  185. #  ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
  186. #-------------------------------------------------------------------------------
  187. oracle.install.db.config.starterdb.characterSet=

  188. #------------------------------------------------------------------------------
  189. # This variable should be set to true if Automatic Memory Management
  190. # in Database is desired.
  191. # If Automatic Memory Management is not desired, and memory allocation
  192. # is to be done manually, then set it to false.
  193. #------------------------------------------------------------------------------
  194. oracle.install.db.config.starterdb.memoryOption=

  195. #-------------------------------------------------------------------------------
  196. # Specify the total memory allocation for the database. Value(in MB) should be
  197. # at least 256 MB, and should not exceed the total physical memory available
  198. # on the system.
  199. # Example: oracle.install.db.config.starterdb.memoryLimit=512
  200. #-------------------------------------------------------------------------------
  201. oracle.install.db.config.starterdb.memoryLimit=

  202. #-------------------------------------------------------------------------------
  203. # This variable controls whether to load Example Schemas onto
  204. # the starter database or not.
  205. # The value can be either "true" or "false". If left blank it will be assumed
  206. # to be "false".
  207. #-------------------------------------------------------------------------------
  208. oracle.install.db.config.starterdb.installExampleSchemas=

  209. ###############################################################################
  210. #                                                                             #
  211. # Passwords can be supplied for the following four schemas in the             #
  212. # starter database:                                                           #
  213. #   SYS                                                                       #
  214. #   SYSTEM                                                                    #
  215. #   DBSNMP (used by Enterprise Manager)                                       #
  216. #                                                                             #
  217. # Same password can be used for all accounts (not recommended)                #
  218. # or different passwords for each account can be provided (recommended)       #
  219. #                                                                             #
  220. ###############################################################################

  221. #------------------------------------------------------------------------------
  222. # This variable holds the password that is to be used for all schemas in the
  223. # starter database.
  224. #-------------------------------------------------------------------------------
  225. oracle.install.db.config.starterdb.password.ALL=

  226. #-------------------------------------------------------------------------------
  227. # Specify the SYS password for the starter database.
  228. #-------------------------------------------------------------------------------
  229. oracle.install.db.config.starterdb.password.SYS=

  230. #-------------------------------------------------------------------------------
  231. # Specify the SYSTEM password for the starter database.
  232. #-------------------------------------------------------------------------------
  233. oracle.install.db.config.starterdb.password.SYSTEM=

  234. #-------------------------------------------------------------------------------
  235. # Specify the DBSNMP password for the starter database.
  236. # Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
  237. #-------------------------------------------------------------------------------
  238. oracle.install.db.config.starterdb.password.DBSNMP=

  239. #-------------------------------------------------------------------------------
  240. # Specify the PDBADMIN password required for creation of Pluggable Database in the Container Database.
  241. #-------------------------------------------------------------------------------
  242. oracle.install.db.config.starterdb.password.PDBADMIN=

  243. #-------------------------------------------------------------------------------
  244. # Specify the management option to use for managing the database.
  245. # Options are:
  246. # 1. CLOUD_CONTROL - If you want to manage your database with Enterprise Manager Cloud Control along with Database Express.
  247. # 2. DEFAULT   -If you want to manage your database using the default Database Express option.
  248. #-------------------------------------------------------------------------------
  249. oracle.install.db.config.starterdb.managementOption=

  250. #-------------------------------------------------------------------------------
  251. # Specify the OMS host to connect to Cloud Control.
  252. # Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
  253. #-------------------------------------------------------------------------------
  254. oracle.install.db.config.starterdb.omsHost=

  255. #-------------------------------------------------------------------------------
  256. # Specify the OMS port to connect to Cloud Control.
  257. # Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
  258. #-------------------------------------------------------------------------------
  259. oracle.install.db.config.starterdb.omsPort=

  260. #-------------------------------------------------------------------------------
  261. # Specify the EM Admin user name to use to connect to Cloud Control.
  262. # Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
  263. #-------------------------------------------------------------------------------
  264. oracle.install.db.config.starterdb.emAdminUser=

  265. #-------------------------------------------------------------------------------
  266. # Specify the EM Admin password to use to connect to Cloud Control.
  267. # Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
  268. #-------------------------------------------------------------------------------
  269. oracle.install.db.config.starterdb.emAdminPassword=

  270. ###############################################################################
  271. #                                                                             #
  272. # SPECIFY RECOVERY OPTIONS                                                    #
  273. # ------------------------------------                                        #
  274. # Recovery options for the database can be mentioned using the entries below  #
  275. #                                                                             #
  276. ###############################################################################

  277. #------------------------------------------------------------------------------
  278. # This variable is to be set to false if database recovery is not required. Else
  279. # this can be set to true.
  280. #-------------------------------------------------------------------------------
  281. oracle.install.db.config.starterdb.enableRecovery=

  282. #-------------------------------------------------------------------------------
  283. # Specify the type of storage to use for the database.
  284. # It can be one of the following:
  285. #   - FILE_SYSTEM_STORAGE
  286. #   - ASM_STORAGE
  287. #-------------------------------------------------------------------------------
  288. oracle.install.db.config.starterdb.storageType=

  289. #-------------------------------------------------------------------------------
  290. # Specify the database file location which is a directory for datafiles, control
  291. # files, redo logs.         
  292. #
  293. # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
  294. #-------------------------------------------------------------------------------
  295. oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

  296. #-------------------------------------------------------------------------------
  297. # Specify the recovery location.
  298. #
  299. # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
  300. #-------------------------------------------------------------------------------
  301. oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

  302. #-------------------------------------------------------------------------------
  303. # Specify the existing ASM disk groups to be used for storage.
  304. #
  305. # Applicable only when oracle.install.db.config.starterdb.storageType=ASM_STORAGE
  306. #-------------------------------------------------------------------------------
  307. oracle.install.db.config.asm.diskGroup=

  308. #-------------------------------------------------------------------------------
  309. # Specify the password for ASMSNMP user of the ASM instance.                 
  310. #
  311. # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE
  312. #-------------------------------------------------------------------------------
  313. oracle.install.db.config.asm.ASMSNMPPassword=

  314. #------------------------------------------------------------------------------
  315. # Specify the My Oracle Support Account Username.
  316. #
  317. #  Example   : MYORACLESUPPORT_USERNAME=abc@oracle.com
  318. #------------------------------------------------------------------------------
  319. MYORACLESUPPORT_USERNAME=

  320. #------------------------------------------------------------------------------
  321. # Specify the My Oracle Support Account Username password.
  322. #
  323. # Example    : MYORACLESUPPORT_PASSWORD=password
  324. #------------------------------------------------------------------------------
  325. MYORACLESUPPORT_PASSWORD=

  326. #------------------------------------------------------------------------------
  327. # Specify whether to enable the user to set the password for
  328. # My Oracle Support credentials. The value can be either true or false.
  329. # If left blank it will be assumed to be false.
  330. #
  331. # Example    : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
  332. #------------------------------------------------------------------------------
  333. SECURITY_UPDATES_VIA_MYORACLESUPPORT=

  334. #------------------------------------------------------------------------------
  335. # Specify whether user doesn't want to configure Security Updates.
  336. # The value for this variable should be true if you don't want to configure
  337. # Security Updates, false otherwise.
  338. #
  339. # The value can be either true or false. If left blank it will be assumed
  340. # to be true.
  341. #
  342. # Example    : DECLINE_SECURITY_UPDATES=false
  343. #------------------------------------------------------------------------------
  344. DECLINE_SECURITY_UPDATES=

  345. #------------------------------------------------------------------------------
  346. # Specify the Proxy server name. Length should be greater than zero.
  347. #
  348. # Example    : PROXY_HOST=proxy.domain.com
  349. #------------------------------------------------------------------------------
  350. PROXY_HOST=

  351. #------------------------------------------------------------------------------
  352. # Specify the proxy port number. Should be Numeric and at least 2 chars.
  353. #
  354. # Example    : PROXY_PORT=25
  355. #------------------------------------------------------------------------------
  356. PROXY_PORT=

  357. #------------------------------------------------------------------------------
  358. # Specify the proxy user name. Leave PROXY_USER and PROXY_PWD
  359. # blank if your proxy server requires no authentication.
  360. #
  361. # Example    : PROXY_USER=username
  362. #------------------------------------------------------------------------------
  363. PROXY_USER=

  364. #------------------------------------------------------------------------------
  365. # Specify the proxy password. Leave PROXY_USER and PROXY_PWD  
  366. # blank if your proxy server requires no authentication.
  367. #
  368. # Example    : PROXY_PWD=password
  369. #------------------------------------------------------------------------------
  370. PROXY_PWD=

  371. #------------------------------------------------------------------------------
  372. # Specify the Oracle Support Hub URL.
  373. #
  374. # Example    : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/
  375. #------------------------------------------------------------------------------
  376. COLLECTOR_SUPPORTHUB_URL=
复制代码




4.3静默安装Oracle
静默安装参见Oracle Universal Installer (OUI) Silent Installations,找到12cR2的安装方式进行安装

4.3.1 命令行方式安装

  1. An alternative to the response file approach is to specify all the parameter values directly on the command line. For simple actions, this looks a lot clearer as you only have to specify non-default values for the action you are trying to perform.
  2. 响应文件方法的另一种方式是在命令行上直接指定所有的参数值。对于简单的操作,这看起来更清楚,因为您只需为正在执行的操作指定非默认值。

  3. [oracle@solang response]$ cd ~/database
  4. [oracle@solang database]$ ./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \
  5. -showProgress -silent -responseFile /home/oracle/database/response/db_install.rsp \
  6. oracle.install.option=INSTALL_DB_SWONLY \
  7. UNIX_GROUP_NAME=oinstall \
  8. INVENTORY_LOCATION=/usr/local/oraInventory
  9. ORACLE_HOME=/usr/local/products/oracle12c \
  10. ORACLE_BASE=/usr/local/products \
  11. oracle.install.db.InstallEdition=EE \
  12. oracle.install.db.OSDBA_GROUP=dba \
  13. oracle.install.db.OSBACKUPDBA_GROUP=dba \
  14. oracle.install.db.OSDGDBA_GROUP=dba \
  15. oracle.install.db.OSKMDBA_GROUP=dba \
  16. DECLINE_SECURITY_UPDATES=true
复制代码


4.3.2 响应文件方式安装
  1. [oracle@solang response]$ cd ~/database
  2. [oracle@solang database]$ ./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \ -showProgress -silent -responseFile /home/oracle/database/response/db_install.rsp

  3. Starting Oracle Universal Installer...

  4. Checking Temp space: must be greater than 500 MB.   Actual 21922 MB    Passed
  5. Checking swap space: must be greater than 150 MB.   Actual 511 MB    Passed
  6. Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-05-25_04-36-06PM. Please wait ...WARNING The Central Inventory is located in the Oracle base.
  7.    ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
  8. You can find the log of this install session at:
  9. /usr/local/products/oracle12c/oraInventory/logs/installActions2018-05-25_04-36-06PM.log

  10. Prepare in progress.
  11. ..................................................   8% Done.

  12. Prepare successful.

  13. Copy files in progress.
  14. ..................................................   17% Done.
  15. ..................................................   22% Done.
  16. ..................................................   27% Done.
  17. ..................................................   32% Done.
  18. ..................................................   40% Done.
  19. ..................................................   45% Done.
  20. ..................................................   50% Done.
  21. ..................................................   55% Done.
  22. ..................................................   60% Done.
  23. ..................................................   65% Done.
  24. ..................................................   70% Done.
  25. ..................................................   75% Done.
  26. ..................................................   80% Done.
  27. ....................
  28. Copy files successful.

  29. Link binaries in progress.
  30. ..........
  31. Link binaries successful.

  32. Setup files in progress.
  33. ..............................
  34. Setup files successful.

  35. Setup Inventory in progress.

  36. Setup Inventory successful.

  37. Finish Setup successful.
  38. The installation of Oracle Database 12c was successful.
  39. Please check '/usr/local/products/oracle12c/oraInventory/logs/silentInstall2018-05-25_04-36-06PM.log' for more details.

  40. Setup Oracle Base in progress.

  41. Setup Oracle Base successful.
  42. ..................................................   95% Done.

  43. As a root user, execute the following script(s):
  44.     1. /usr/local/products/oracle12c/oraInventory/orainstRoot.sh
  45.     2. /usr/local/products/oracle12c/root.sh



  46. ..................................................   100% Done.

  47. Successfully Setup Software.
复制代码


安装完毕后切换到root用户执行以下脚本
As a root user, execute the following script(s):

  1. [root@solang ~]# /usr/local/oraInventory/orainstRoot.sh
  2. Changing permissions of /usr/local/products/oracle12c/oraInventory.
  3. Adding read,write permissions for group.
  4. Removing read,write,execute permissions for world.

  5. Changing groupname of /usr/local/products/oracle12c/oraInventory to oinstall.
  6. The execution of the script is complete.
复制代码


执行命令sqlplus / as sysdba
  1. [oracle@solang ~]$ sqlplus / as sysdba

  2. SQL*Plus: Release 12.2.0.1.0 Production on Sun May 27 11:52:01 2018

  3. Copyright (c) 1982, 2016, Oracle.  All rights reserved.

  4. Connected to an idle instance.

  5. SQL>
复制代码


此时数据库软件安装成功。

5.数据库创建

参见Database Configuration Assistant (DBCA) : Creating Databases in Silent Mode,使用数据库配置助手DBCA静默模式下创建数据库,具体设置参见Database Configuration Assistant Command Reference for Silent Mode

执行命令
  1. [oracle@solang ~]$ dbca -silent -createDatabase \ -templateName /usr/local/products/oracle12c/assistants/dbca/templates/General_Purpose.dbc \ -gdbname orcl -sid orcl -responseFile /home/oracle/database/response/dbca.rsp \ -characterSet AL32UTF8 \ -sysPassword Password123 \ -systemPassword Password123 \ -createAsContainerDatabase true \ -numberOfPDBs 1 \ -pdbName pdb1 \ -pdbAdminPassword Password123 \ -automaticMemoryManagement false \ -ignorePreReqs
复制代码



数据文件目录datafileDestination默认安装在$ORACLE_BASE/oradata下
注意:密码设置需要密码长度至少8位,包含至少1个大写字符,1个小写字符和1个数字[0-9]。
否则会有如下警告:

  1. [WARNING] [DBT-06208] The ‘SYS’ password entered does not conform to the Oracle recommended standards.
  2. CAUSE:
  3. a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
  4. b.The password entered is a keyword that Oracle does not recommend to be used as password
  5. ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
  6. [WARNING] [DBT-06208] The ‘SYSTEM’ password entered does not conform to the Oracle recommended standards.
  7. CAUSE:
  8. a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
  9. b.The password entered is a keyword that Oracle does not recommend to be used as password
  10. ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
  11. [WARNING] [DBT-06208] The ‘PDBADMIN’ password entered does not conform to the Oracle recommended standards.
  12. CAUSE:
  13. a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
  14. b.The password entered is a keyword that Oracle does not recommend to be used as password
  15. ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
复制代码


重新执行命令:
  1. [oracle@solang ~]$ dbca -silent -createDatabase \ -templateName /usr/local/products/oracle12c/assistants/dbca/templates/General_Purpose.dbc \ -gdbname orcl -sid orcl -responseFile /home/oracle/database/response/dbca.rsp \ -characterSet AL32UTF8 \ -sysPassword Password123 \ -systemPassword Password123 \ -createAsContainerDatabase true \ -numberOfPDBs 1 \ -pdbName pdb1 \ -pdbAdminPassword Password123 \ -automaticMemoryManagement false \ -ignorePreReqs
复制代码

  1. Copying database files
  2. 1% complete
  3. 13% complete
  4. 25% complete
  5. Creating and starting Oracle instance
  6. 26% complete
  7. 30% complete
  8. 31% complete
  9. 35% complete
  10. 38% complete
  11. 39% complete
  12. 41% complete
  13. Completing Database Creation
  14. 42% complete
  15. 43% complete
  16. 44% complete
  17. 46% complete
  18. 49% complete
  19. 50% complete
  20. Creating Pluggable Databases
  21. 55% complete
  22. 75% complete
  23. Executing Post Configuration Actions
  24. 100% complete
  25. Look at the log file “/usr/local/products/cfgtoollogs/dbca/orcl/orcl.log” for further details.

复制代码


再次执行命令sqlplus / as sysdba

  1. [oracle@solang ~]$ sqlplus / as sysdba
  2. SQL*Plus: Release 12.2.0.1.0 Production on Sun May 27 15:28:18 2018

  3. Copyright © 1982, 2016, Oracle. All rights reserved.

  4. Connected to:
  5. Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

  6. SQL> select status from v$instance;

  7. STATUS
  8. OPEN

  9. SQL>

复制代码
此时数据库创建成功。

6.数据库监听配置未配置监听前执行lsnrctl status
  1. [oracle@solang ~]$ lsnrctl status

  2. LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 27-MAY-2018 17:20:08

  3. Copyright © 1991, 2016, Oracle. All rights reserved.

  4. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
  5. TNS-12541: TNS:no listener
  6. TNS-12560: TNS:protocol adapter error
  7. TNS-00511: No listener
  8. Linux Error: 111: Connection refused
复制代码


使用默认的netca.rsp文件
​执行命令

  1. [oracle@solang ~]$ netca -silent -responseFile /home/oracle/database/response/netca.rsp

  2. Parsing command line arguments:
  3. Parameter “silent” = true
  4. Parameter “responsefile” = /home/oracle/database/response/netca.rsp
  5. Done parsing command line arguments.
  6. Oracle Net Services Configuration:
  7. Profile configuration complete.
  8. Oracle Net Listener Startup:
  9. Running Listener Control:
  10. /usr/local/products/oracle12c/bin/lsnrctl start LISTENER
  11. Listener Control complete.
  12. Listener started successfully.
  13. Listener configuration complete.
  14. Oracle Net Services configuration successful. The exit code is 0

复制代码


再次执行命令lsnrctl status
  1. [oracle@solang ~]$ lsnrctl status

  2. LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 27-MAY-2018 18:04:32

  3. Copyright © 1991, 2016, Oracle. All rights reserved.

  4. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=solang)(PORT=1521)))
  5. STATUS of the LISTENER
  6. Alias LISTENER
  7. Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
  8. Start Date 27-MAY-2018 18:03:02
  9. Uptime 0 days 0 hr. 1 min. 30 sec
  10. Trace Level off
  11. Security ON: Local OS Authentication
  12. SNMP OFF
  13. Listener Parameter File /usr/local/products/oracle12c/network/admin/listener.ora
  14. Listener Log File /usr/local/products/diag/tnslsnr/solang/listener/alert/log.xml
  15. Listening Endpoints Summary…
  16. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=solang)(PORT=1521)))
  17. (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  18. Services Summary…
  19. Service “6d2bd82e6b445902e053f05313acb216” has 1 instance(s).
  20. Instance “cdb1”, status READY, has 1 handler(s) for this service…
  21. Service “cdb1” has 1 instance(s).
  22. Instance “cdb1”, status READY, has 1 handler(s) for this service…
  23. Service “cdb1XDB” has 1 instance(s).
  24. Instance “cdb1”, status READY, has 1 handler(s) for this service…
  25. Service “pdb1” has 1 instance(s).
  26. Instance “cdb1”, status READY, has 1 handler(s) for this service…
  27. The command completed successfully
复制代码

此时数据库监听配置成功。

启动或关闭监听


  1. lsnrctl start 启动监听
  2. lsnrctl stop 关闭监听
复制代码


至此,oracle数据库已经安装完毕了!

 楼主| 发表于 2023-8-2 17:53:20 | 显示全部楼层
注意:使用lsnrctl start 启动监听时,如果显示The listener supports no services,则查看https://www.swztdza.cn/dalt/foru ... ge=1&extra=#pid1161 链接解决!!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2023-8-2 19:18:13 | 显示全部楼层
注意:安装完成后,$TNS_ADMIN变量内的路径,一般没有tnsnames.ora文件,需要自行编写,这里提供模板文件供参考下载!

【原创】Oracle12c 网络连接ora文件分享 - Linux技术交流 - DA 论坛 - Powered by Discuz! (swztdza.cn)
回复 支持 反对

使用道具 举报

游客
回复
*滑块验证:

DA论坛飞机票来了~
快速回复 返回顶部 返回列表