Oracle单实例的安装文档网上比比皆是,其中也不乏很好的文章,其实oracle最好的安装文档莫过于联机手册,但是手册的安装步骤太过详细,所以很多大侠为了方便就整理了许多不同版本的安装文档,本人自学oracle已经快一年了,学到的也只是皮毛,但是谈起安装oracle,特别是11g R2,那还是有一点点心得的,大概是走过太多的弯路,下面来简要介绍下silent方式安装oracle软件,配置监听器,创建数据库的操作步骤
- 一:检查服务器的存储环境,各个版本的oracle安装需求都不一样,以oracle联机文档为准
- [root@localhost ~]# df -h /u01
- Filesystem Size Used Avail Use% Mounted on
- /dev/mapper/VolGroup00-lv_www
- 160G 188M 152G 1% /u01
- [root@localhost ~]# grep MemTotal /proc/meminfo
- MemTotal: 1351664 kB
- [root@localhost ~]# grep SwapTotal /proc/meminfo
- SwapTotal: 4096564 kB
- [root@localhost ~]# df -h /tmp
- Filesystem Size Used Avail Use% Mounted on
- /dev/sda3 1.9G 36M 1.8G 2% /tmp
- 二:检查服务器软件环境,下面的包都可以在系统光盘上找到
- The following packages (or later versions) must be installed:
- binutils-2.17.50.0.6
- compat-libstdc++-33-3.2.3
- elfutils-libelf-0.125
- elfutils-libelf-devel-0.125
- elfutils-libelf-devel-static-0.125
- gcc-4.1.2
- gcc-c++-4.1.2
- glibc-2.5-24
- glibc-common-2.5
- glibc-devel-2.5
- glibc-headers-2.5
- kernel-headers-2.6.18
- ksh-20060214
- libaio-0.3.106
- libaio-devel-0.3.106
- libgcc-4.1.2
- libgomp-4.1.2
- libstdc++-4.1.2
- libstdc++-devel-4.1.2
- make-3.81
- numactl-devel-0.9.8.i386
- sysstat-7.0.2
- 三:修改内核参数如下,并使其生效
- [root@localhost ~]# vi /etc/sysctl.conf
- fs.aio-max-nr = 1048576
- fs.file-max = 6815744
- kernel.shmall = 2097152
- kernel.shmmax = 536870912
- kernel.shmmni = 4096
- kernel.sem = 250 32000 100 128
- net.ipv4.ip_local_port_range = 9000 65500
- net.core.rmem_default = 262144
- net.core.rmem_max = 4194304
- net.core.wmem_default = 262144
- net.core.wmem_max = 1048586
- [root@localhost ~]# sysctl -p
- 四:添加oracle用户和相关的组,若使用ASM自动存储管理,需要添加额外的几个组,具体可以参考联机文档
- [root@localhost ~]# /usr/sbin/groupadd oinstall
- [root@localhost ~]# /usr/sbin/groupadd dba
- [root@localhost ~]# /usr/sbin/groupadd oper
- [root@localhost ~]# /usr/sbin/useradd -g oinstall -G dba,oper -d /u01/oracle oracle
- [root@localhost ~]# id oracle
- uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper)
- [root@localhost ~]# echo 'oracle' |passwd --stdin oracle
- Changing password for user oracle.
- passwd: all authentication tokens updated successfully.
- 五:修改oracle用户的系统资源限制和权限
- [root@localhost ~]# grep 'limits' /etc/pam.d/system-auth
- session required pam_limits.so
- [root@localhost ~]# vi /etc/security/limits.conf
- oracle soft nproc 2047
- oracle hard nproc 16384
- oracle soft nofile 1024
- oracle hard nofile 65536
- oracle soft stack 10240
- [root@localhost ~]# chown -R oracle.oinstall /u01/
- 六:创建oratab文件(该文件用于控制oracle的自动启动和关闭,也可用service脚本实现)和清单目录
- [root@localhost ~]# touch /etc/oratab
- [root@localhost ~]# cat /etc/oraInst.loc
- inventory_loc=/u01/oraInventory
- inst_group=oinstall
- 七:配置主机名和解析,需要重启才能生效
- [root@localhost ~]# vi /etc/sysconfig/network
- NETWORKING=yes
- NETWORKING_IPV6=yes
- HOSTNAME=redora.766.com
- [root@localhost ~]# vi /etc/hosts
- 127.0.0.1 localhost.localdomain localhost
- ::1 localhost6.localdomain6 localhost6
- 192.168.50.195 redora.766.com redora
- 八:配置oracle用户环境变量
- [root@redora ~]# su - oracle
- [oracle@redora ~]$ vi .bash_profile
- ORACLE_BASE=/u01
- ORACLE_HOME=/u01/oracle
- ORACLE_SID=orac
- PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$PATH
- export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID
- [oracle@redora ~]$ source .bash_profile
- [oracle@redora ~]$ env |grep ORA
- ORACLE_SID=orac
- ORACLE_BASE=/u01
- ORACLE_HOME=/u01/oracle
- 九:上传oracle软件包到服务器并解压
- [oracle@redora ~]$ cd /u01/
- [oracle@redora u01]$ unzip linux.x64_11gR2_database_1of2.zip
- [oracle@redora u01]$ unzip linux.x64_11gR2_database_2of2.zip
- [oracle@redora~]$ ls /u01/database/response/
- dbca.rsp db_install.rsp netca.rsp
十:配置DISPLAY环境变量,(这里使用win7上的secureCRT软件和xmanager软件连接服务器,xmanager软件需要开启被动模式)因为是第一次安装oracle,所以需要一个模板响应文件,若存在这个文件,可以直接跳过这步(网上介绍采用 -record -destinationFile 选项记录安装文件的方式在11g R2中不适用)
[oracle@redora ~]$ export DISPLAY=192.168.50.40:0
[oracle@redora database]$ ./runInstaller //使用图形化工具选择安装oracle软件的选项,在最后选择保存响应文件并退出,如下图所示:
- 十一:使用响应文件安装oracle软件
- [oracle@redora database]$ ./runInstaller -silent -responseFile /u01/oracle/auto_install_db.rsp
- Starting Oracle Universal Installer...
- Checking Temp space: must be greater than 120 MB. Actual 1800 MB Passed
- Checking swap space: must be greater than 150 MB. Actual 4000 MB Passed
- [INS-32016] The selected Oracle home contains directories or files.
- CAUSE: The selected Oracle home contained directories or files.
- ACTION: To start with an empty Oracle home, either remove its contents or choose another location.
- [WARNING] [INS-32016] The selected Oracle home contains directories or files.
- CAUSE: The selected Oracle home contained directories or files.
- ACTION: To start with an empty Oracle home, either remove its contents or choose another location.
- You can find the log of this install session at:
- /u01/oraInventory/logs/installActions2010-12-27_10-03-09PM.log
- [WARNING] [INS-32016] The selected Oracle home contains directories or files.
- CAUSE: The selected Oracle home contained directories or files.
- ACTION: To start with an empty Oracle home, either remove its contents or choose another location.
- The following configuration scripts need to be executed as the "root" user.
- #!/bin/sh
- #Root scripts to run
- /u01/oracle/root.sh
- To execute the configuration scripts:
- 1. Open a terminal window
- 2. Log in as "root"
- 3. Run the scripts
- 4. Return to this window and hit "Enter" key to continue
- Successfully Setup Software.
- 十二:以root用户身份执行root.sh脚本并验证安装是否成功,可具体查看相关日志
- [root@redora ~]# /u01/oracle/root.sh
- Check /u01/oracle/install/root_redora.766.com_2010-12-27_22-15-47.log for the output of root script
- [oracle@redora ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 27 22:16:35 2010
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL>
- 十三:配置侦听器,需要复制模板文件并修改相关内容如下
- [oracle@redora ~]$ cp /u01/database/response/netca.rsp ./
- [oracle@redora ~]$ grep -v '^#' netca.rsp |grep -v '^$'
- [GENERAL]
- RESPONSEFILE_VERSION="11.2"
- CREATE_TYPE="CUSTOM"
- [oracle.net.ca]
- INSTALLED_COMPONENTS={"server","net8","javavm"}
- INSTALL_TYPE=""custom""
- LISTENER_NUMBER=1
- LISTENER_NAMES={"LISTENER"}
- LISTENER_PROTOCOLS={"TCP;1521"}
- LISTENER_START=""LISTENER""
- NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
- NSN_NUMBER=1
- NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
- NSN_SERVICE={"PLSExtProc"}
- NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
- [oracle@redora ~]$ netca -silent -responseFile /u01/oracle/netca.rsp
- Parsing command line arguments:
- Parameter "silent" = true
- Parameter "responsefile" = /u01/oracle/netca.rsp
- Done parsing command line arguments.
- Oracle Net Services Configuration:
- Configuring Listener:LISTENER
- Listener configuration complete.
- Oracle Net Listener Startup:
- Running Listener Control:
- /u01/oracle/bin/lsnrctl start LISTENER
- Listener Control complete.
- Listener started successfully.
- Profile configuration complete.
- Oracle Net Services configuration successful. The exit code is 0
- 十四:安装数据库,需要复制模板文件并修改相关内容如下
- [oracle@redora ~]$ cp /u01/database/response/dbca.rsp ./
- [oracle@redora ~]$ grep -v '^#' dbca.rsp |grep -v '^$'
- [GENERAL]
- RESPONSEFILE_VERSION = "11.2.0"
- OPERATION_TYPE = "createDatabase"
- [CREATEDATABASE]
- GDBNAME = "redora.766.com"
- SID = "orac"
- TEMPLATENAME = "General_Purpose.dbc"
- [CONFIGUREDATABASE]
- EMCONFIGURATION = "LOCAL"
- SYSMANPASSWORD = "123456"
- DBSNMPPASSWORD = "123456"
- [oracle@redora ~]$ dbca -silent -createdatabase -responseFile /u01/oracle/dbca.rsp
- Enter SYS user password:
- Enter SYSTEM user password:
- Copying database files
- 1% complete
- 3% complete
- 11% complete
- 18% complete
- 26% complete
- 37% complete
- Creating and starting Oracle instance
- 40% complete
- 45% complete
- 50% complete
- 55% complete
- 56% complete
- 60% complete
- 62% complete
- Completing Database Creation
- 66% complete
- 70% complete
- 73% complete
- 85% complete
- 96% complete
- 100% complete
- Look at the log file "/u01/cfgtoollogs/dbca/redora/redora.log" for further details.
- 十五:验证安装是否成功
- [oracle@redora ~]$ ps -ef |grep ora |wc -l
- 28
- [oracle@redora ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 27 23:04:34 2010
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn /as sysdba
- Connected.
- SQL> select sysdate from dual;
- SYSDATE
- ---------
- 27-DEC-10
- SQL> show user;
- USER is "SYS"
- SQL> show sga;
- Total System Global Area 551165952 bytes
- Fixed Size 2215224 bytes
- Variable Size 339739336 bytes
- Database Buffers 201326592 bytes
- Redo Buffers 7884800 bytes
本文转自斩月博客51CTO博客,原文链接http://blog.51cto.com/ylw6006/465727如需转载请自行联系原作者
ylw6006