且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

RHEL5 Silent方式安装Oracle 11gR2指南

更新时间:2022-09-10 10:08:11

 Oracle单实例的安装文档网上比比皆是,其中也不乏很好的文章,其实oracle***的安装文档莫过于联机手册,但是手册的安装步骤太过详细,所以很多大侠为了方便就整理了许多不同版本的安装文档,本人自学oracle已经快一年了,学到的也只是皮毛,但是谈起安装oracle,特别是11g R2,那还是有一点点心得的,大概是走过太多的弯路,下面来简要介绍下silent方式安装oracle软件,配置监听器,创建数据库的操作步骤

 


  1. 一:检查服务器的存储环境,各个版本的oracle安装需求都不一样,以oracle联机文档为准  
  2. [root@localhost ~]# df -h /u01  
  3. Filesystem            Size  Used Avail Use% Mounted on  
  4. /dev/mapper/VolGroup00-lv_www  
  5.                       160G  188M  152G   1% /u01  
  6.  
  7. [root@localhost ~]# grep MemTotal /proc/meminfo  
  8. MemTotal:      1351664 kB  
  9.  
  10. [root@localhost ~]#  grep SwapTotal /proc/meminfo  
  11. SwapTotal:     4096564 kB  
  12.  
  13.  
  14. [root@localhost ~]#  df -h /tmp  
  15. Filesystem            Size  Used Avail Use% Mounted on  
  16. /dev/sda3             1.9G   36M  1.8G   2% /tmp  
  17.  
  18. 二:检查服务器软件环境,下面的包都可以在系统光盘上找到  
  19. The following packages (or later versions) must be installed:   
  20. binutils-2.17.50.0.6  
  21. compat-libstdc++-33-3.2.3  
  22. elfutils-libelf-0.125  
  23. elfutils-libelf-devel-0.125  
  24. elfutils-libelf-devel-static-0.125  
  25. gcc-4.1.2  
  26. gcc-c++-4.1.2  
  27. glibc-2.5-24  
  28. glibc-common-2.5  
  29. glibc-devel-2.5  
  30. glibc-headers-2.5  
  31. kernel-headers-2.6.18  
  32. ksh-20060214  
  33. libaio-0.3.106  
  34. libaio-devel-0.3.106   
  35. libgcc-4.1.2  
  36. libgomp-4.1.2  
  37. libstdc++-4.1.2   
  38. libstdc++-devel-4.1.2  
  39. make-3.81  
  40. numactl-devel-0.9.8.i386  
  41. sysstat-7.0.2  
  42.  
  43. 三:修改内核参数如下,并使其生效  
  44. [root@localhost ~]# vi /etc/sysctl.conf   
  45. fs.aio-max-nr = 1048576 
  46. fs.file-max = 6815744 
  47. kernel.shmall = 2097152 
  48. kernel.shmmax = 536870912 
  49. kernel.shmmni = 4096 
  50. kernel.sem = 250 32000 100 128  
  51. net.ipv4.ip_local_port_range = 9000 65500  
  52. net.core.rmem_default = 262144 
  53. net.core.rmem_max = 4194304 
  54. net.core.wmem_default = 262144 
  55. net.core.wmem_max = 1048586 
  56.  
  57. [root@localhost ~]# sysctl -p  
  58.  
  59. 四:添加oracle用户和相关的组,若使用ASM自动存储管理,需要添加额外的几个组,具体可以参考联机文档  
  60. [root@localhost ~]# /usr/sbin/groupadd oinstall  
  61. [root@localhost ~]# /usr/sbin/groupadd dba  
  62. [root@localhost ~]# /usr/sbin/groupadd oper  
  63. [root@localhost ~]# /usr/sbin/useradd -g oinstall -G dba,oper -d /u01/oracle oracle  
  64. [root@localhost ~]# id oracle  
  65. uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper)  
  66.  
  67. [root@localhost ~]# echo 'oracle' |passwd --stdin oracle  
  68. Changing password for user oracle.  
  69. passwd: all authentication tokens updated successfully.  
  70.  
  71. 五:修改oracle用户的系统资源限制和权限  
  72. [root@localhost ~]# grep 'limits' /etc/pam.d/system-auth  
  73. session     required      pam_limits.so  
  74. [root@localhost ~]# vi /etc/security/limits.conf   
  75. oracle              soft    nproc   2047  
  76. oracle              hard    nproc   16384  
  77. oracle              soft    nofile  1024  
  78. oracle              hard    nofile  65536  
  79. oracle              soft    stack   10240  
  80.  
  81. [root@localhost ~]# chown -R oracle.oinstall /u01/  
  82.  
  83. 六:创建oratab文件(该文件用于控制oracle的自动启动和关闭,也可用service脚本实现)和清单目录  
  84. [root@localhost ~]# touch /etc/oratab  
  85. [root@localhost ~]# cat /etc/oraInst.loc   
  86. inventory_loc=/u01/oraInventory  
  87. inst_group=oinstall 
  88.  
  89. 七:配置主机名和解析,需要重启才能生效  
  90. [root@localhost ~]# vi /etc/sysconfig/network  
  91. NETWORKING=yes 
  92. NETWORKING_IPV6=yes 
  93. HOSTNAME=redora.766.com   
  94.  
  95. [root@localhost ~]# vi /etc/hosts  
  96. 127.0.0.1               localhost.localdomain localhost  
  97. ::1                     localhost6.localdomain6 localhost6  
  98. 192.168.50.195          redora.766.com  redora  
  99.  
  100. 八:配置oracle用户环境变量  
  101. [root@redora ~]# su - oracle  
  102. [oracle@redora ~]$ vi .bash_profile   
  103. ORACLE_BASE=/u01  
  104. ORACLE_HOME=/u01/oracle  
  105. ORACLE_SID=orac 
  106. PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$PATH  
  107.  
  108. export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID  
  109.  
  110. [oracle@redora ~]$ source .bash_profile   
  111. [oracle@redora ~]$ env |grep ORA  
  112. ORACLE_SID=orac 
  113. ORACLE_BASE=/u01  
  114. ORACLE_HOME=/u01/oracle  
  115.  
  116. 九:上传oracle软件包到服务器并解压  
  117. [oracle@redora ~]$ cd /u01/  
  118. [oracle@redora u01]$ unzip linux.x64_11gR2_database_1of2.zip   
  119. [oracle@redora u01]$ unzip linux.x64_11gR2_database_2of2.zip   
  120.  
  121. [oracle@redora~]$ ls /u01/database/response/  
  122. dbca.rsp  db_install.rsp  netca.rsp  
  123.  

十:配置DISPLAY环境变量,(这里使用win7上的secureCRT软件和xmanager软件连接服务器,xmanager软件需要开启被动模式)因为是第一次安装oracle,所以需要一个模板响应文件,若存在这个文件,可以直接跳过这步(网上介绍采用 -record -destinationFile 选项记录安装文件的方式在11g R2中不适用)
[oracle@redora ~]$ export  DISPLAY=192.168.50.40:0
[oracle@redora database]$ ./runInstaller  //使用图形化工具选择安装oracle软件的选项,在最后选择保存响应文件并退出,如下图所示:

RHEL5 Silent方式安装Oracle 11gR2指南



  1. 十一:使用响应文件安装oracle软件  
  2. [oracle@redora database]$ ./runInstaller -silent -responseFile /u01/oracle/auto_install_db.rsp  
  3. Starting Oracle Universal Installer...  
  4.  
  5. Checking Temp space: must be greater than 120 MB.   Actual 1800 MB    Passed  
  6. Checking swap space: must be greater than 150 MB.   Actual 4000 MB    Passed  
  7.  
  8. [INS-32016] The selected Oracle home contains directories or files.  
  9.    CAUSE: The selected Oracle home contained directories or files.  
  10.    ACTION: To start with an empty Oracle home, either remove its contents or choose another location.  
  11. [WARNING] [INS-32016] The selected Oracle home contains directories or files.  
  12.    CAUSE: The selected Oracle home contained directories or files.  
  13.    ACTION: To start with an empty Oracle home, either remove its contents or choose another location.  
  14. You can find the log of this install session at:  
  15.  /u01/oraInventory/logs/installActions2010-12-27_10-03-09PM.log  
  16. [WARNING] [INS-32016] The selected Oracle home contains directories or files.  
  17.    CAUSE: The selected Oracle home contained directories or files.  
  18.    ACTION: To start with an empty Oracle home, either remove its contents or choose another location.  
  19. The following configuration scripts need to be executed as the "root" user.   
  20.  #!/bin/sh   
  21.  #Root scripts to run  
  22.  
  23. /u01/oracle/root.sh  
  24. To execute the configuration scripts:  
  25.          1. Open a terminal window   
  26.          2. Log in as "root"   
  27.          3. Run the scripts   
  28.          4. Return to this window and hit "Enter" key to continue   
  29.  
  30. Successfully Setup Software.  
  31.  
  32. 十二:以root用户身份执行root.sh脚本并验证安装是否成功,可具体查看相关日志  
  33. [root@redora ~]# /u01/oracle/root.sh  
  34. Check /u01/oracle/install/root_redora.766.com_2010-12-27_22-15-47.log for the output of root script  
  35. [oracle@redora ~]$ sqlplus /nolog  
  36.  
  37. SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 27 22:16:35 2010  
  38.  
  39. Copyright (c) 1982, 2009, Oracle.  All rights reserved.  
  40.  
  41. SQL>   
  42.  
  43. 十三:配置侦听器,需要复制模板文件并修改相关内容如下  
  44. [oracle@redora ~]$ cp /u01/database/response/netca.rsp ./  
  45.  
  46. [oracle@redora ~]$ grep -v '^#' netca.rsp  |grep -v '^$'  
  47. [GENERAL]  
  48. RESPONSEFILE_VERSION="11.2" 
  49. CREATE_TYPE="CUSTOM" 
  50. [oracle.net.ca]  
  51. INSTALLED_COMPONENTS={"server","net8","javavm"}  
  52. INSTALL_TYPE=""custom""  
  53. LISTENER_NUMBER=1 
  54. LISTENER_NAMES={"LISTENER"}  
  55. LISTENER_PROTOCOLS={"TCP;1521"}  
  56. LISTENER_START=""LISTENER""  
  57. NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}  
  58. NSN_NUMBER=1 
  59. NSN_NAMES={"EXTPROC_CONNECTION_DATA"}  
  60. NSN_SERVICE={"PLSExtProc"}  
  61. NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}  
  62.  
  63. [oracle@redora ~]$ netca -silent -responseFile /u01/oracle/netca.rsp   
  64.  
  65. Parsing command line arguments:  
  66.     Parameter "silent" = true  
  67.     Parameter "responsefile" = /u01/oracle/netca.rsp  
  68. Done parsing command line arguments.  
  69. Oracle Net Services Configuration:  
  70. Configuring Listener:LISTENER  
  71. Listener configuration complete.  
  72. Oracle Net Listener Startup:  
  73.     Running Listener Control:   
  74.       /u01/oracle/bin/lsnrctl start LISTENER  
  75.     Listener Control complete.  
  76.     Listener started successfully.  
  77. Profile configuration complete.  
  78. Oracle Net Services configuration successful. The exit code is 0  
  79.  
  80. 十四:安装数据库,需要复制模板文件并修改相关内容如下  
  81. [oracle@redora ~]$ cp /u01/database/response/dbca.rsp ./  
  82.  
  83. [oracle@redora ~]$ grep -v '^#' dbca.rsp |grep -v '^$'  
  84. [GENERAL]  
  85. RESPONSEFILE_VERSION = "11.2.0" 
  86. OPERATION_TYPE = "createDatabase" 
  87. [CREATEDATABASE]  
  88. GDBNAME = "redora.766.com" 
  89. SID = "orac" 
  90. TEMPLATENAME = "General_Purpose.dbc" 
  91.  
  92. [CONFIGUREDATABASE]  
  93. EMCONFIGURATION = "LOCAL" 
  94. SYSMANPASSWORD = "123456" 
  95. DBSNMPPASSWORD = "123456" 
  96.  
  97. [oracle@redora ~]$ dbca -silent -createdatabase -responseFile /u01/oracle/dbca.rsp   
  98. Enter SYS user password:    
  99. Enter SYSTEM user password:    
  100. Copying database files  
  101. 1% complete  
  102. 3% complete  
  103. 11% complete  
  104. 18% complete  
  105. 26% complete  
  106. 37% complete  
  107. Creating and starting Oracle instance  
  108. 40% complete  
  109. 45% complete  
  110. 50% complete  
  111. 55% complete  
  112. 56% complete  
  113. 60% complete  
  114. 62% complete  
  115. Completing Database Creation  
  116. 66% complete  
  117. 70% complete  
  118. 73% complete  
  119. 85% complete  
  120. 96% complete  
  121. 100% complete  
  122. Look at the log file "/u01/cfgtoollogs/dbca/redora/redora.log" for further details.  
  123.  
  124. 十五:验证安装是否成功  
  125. [oracle@redora ~]$ ps -ef |grep ora  |wc -l  
  126. 28  
  127. [oracle@redora ~]$ sqlplus /nolog  
  128.  
  129. SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 27 23:04:34 2010  
  130.  
  131. Copyright (c) 1982, 2009, Oracle.  All rights reserved.  
  132.  
  133. SQL> conn /as sysdba  
  134. Connected.  
  135. SQL> select sysdate from dual;  
  136.  
  137. SYSDATE  
  138. ---------  
  139. 27-DEC-10  
  140.  
  141. SQL> show user;  
  142. USER is "SYS"  
  143. SQL> show sga;  
  144.  
  145. Total System Global Area  551165952 bytes  
  146. Fixed Size                  2215224 bytes  
  147. Variable Size             339739336 bytes  
  148. Database Buffers          201326592 bytes  
  149. Redo Buffers                7884800 bytes  
  150.  

 本文转自斩月博客51CTO博客,原文链接http://blog.51cto.com/ylw6006/465727如需转载请自行联系原作者


ylw6006