前言 安装过很多个生产数据库,但是没有研究过官方文档,这几日拿来实操研究了一下。 发现很多东西都没有,同时存在一些坑,可能是简单的官方文档。 本次操作系统为centos 7,存在一些包缺失,手动下载上传给安装上去了。这不是一份可以拿来当生产系统的参考文档。缺少部分必要的步骤。
参考文档: Oracle Database Quick Installation Guide 11g Release 2 (11.2) for Linux x86-64 E24326-09
关于本手册的概述 1.配置系统以支持Oracle数据库 2.使用经典模式,在本地文件系统安装Oracle数据库 3.配置 general-purpose Oracle数据库安装(数据库文件存储使用本地文件系统)
yum groupinstall "X Window System" --安装这个包,则无需安装下面软件包
#补充:调用Oracle软件安装界面,涉及到2个命令xhost和xdpyinfo,需要以下2个包。红帽Linux6.6可能默认没有安装。我使用的CENTOS 7已自动安装。 xhost xorg-x11-server-utils-7.7-2.el6.x86_64 : X.Org X11 X server utilities xdpyinfo: xorg-x11-utils-7.5-6.el6.x86_64 : X.Org X11 X client utilities
1.检查硬件要求
1.1内存要求 1)最小1GB 2)推荐2GB及以上
# grep MemTotal /proc/meminfo --查看内存
swap的计算 1.内存在1GB到2GB之间,swap为内存的1.5倍 2.内存在2GB到16GB之间,swap和内存的一样 3.内存大于16GB的时候,swap为16GB
note:在Linux上,Hugepages特性使用内存映射文件为大页表分配不可交换的内存。 如果启用了Hugepages,那么在计算交换空间之前,您可以从可用的RAM中扣除分配给Hugepages的内存。
# grep SwapTotal /proc/meminfo --查看swap
# free
自动内存管理 如果开始自动内存管理,那么 /dev/shm/的大小应该等于MEMORY_MAX_TARGET、MEMORY_TARGET 中的较大者 # df -h /dev/shm/
如果LOCK_SGA以及linux的大页内存被使用的话,则无法使用 MEMORY_MAX_TARGET 和 MEMORY_TARGET 。
1.2系统架构 # uname -m x86_64
1.3磁盘空间要求
1)/tmp 至少1GB 2)oracle 安装文件至少 4.7GB(企业版),4.6GB(标准版) 3)数据文件至少1.7GB(企业版),1.5GB(标准版)
# df -h /tmp
2.检查软件要求
Oracle Universal Installer对系统执行检查,以验证它是否满足列出的要求。 要确保这些检查通过,需要在启动Oracle Universal Installer之前验证这些要求。
2.1操作系统要求 11.2支持的系统: ■ Asianux Server 3 SP2 ■ Asianux Server 4 SP3 ■ Oracle Linux 4 Update 7 ■ Oracle Linux 5 Update 2 (with Red Hat Compatible Kernel) ■ Oracle Linux 5 Update 5 ■ Oracle Linux 6 ■ Oracle Linux 6 (with Red Hat Compatible Kernel) ■ Oracle Linux 7 ■ Oracle Linux 7 (with the Red Hat Compatible Kernel) ■ Red Hat Enterprise Linux 4 Update 7 ■ Red Hat Enterprise Linux 5 Update 2 ■ Red Hat Enterprise Linux 6 ■ Red Hat Enterprise Linux 7 ■ SUSE Linux Enterprise Server 10 SP2 ■ SUSE Linux Enterprise Server 11 ■ SUSE Linux Enterprise Server 12 SP1 ■ NeoKylin Linux Advanced Server 6 ■ NeoKylin Linux Advanced Server 7
# cat /proc/version
2.2内核要求 11.2支持的内核 ■ On Oracle Linux 4 and Red Hat Enterprise Linux 4 2.6.9 or later ■ On Oracle Linux 5 Update 2 with Red Hat Compatible Kernel 2.6.18 or later ■ On Oracle Linux 5 Update 5 with Red Hat Compatible Kernel 2.6.18 or later ■ On Oracle Linux 5 Update 5 with Unbreakable Enterprise Kernel 2.6.32-100.0.19 or later ■ On Oracle Linux 6 2.6.32-100.28.5.el6.x86_64 or later ■ On Oracle Linux 6 with Red Hat Compatible Kernel 2.6.32-71.el6.x86_64 or later ■ On Oracle Linux 7 3.8.13-33.el7uek.x86_64 or later ■ On Oracle Linux 7 with Red Hat Compatible Kernel 3.10.0-54.0.1.el7.x86_64 or later ■ On Red Hat Enterprise Linux 5 Update 2 2.6.18 or later ■ On Red Hat Enterprise Linux 5 Update 5 2.6.18 or later ■ On Red Hat Enterprise Linux 6 2.6.32-71.el6.x86_64 or later ■ On Red Hat Enterprise Linux 7 3.10.0-54.0.1.el7.x86_64 or later ■ On Asianux Server 3 2.6.18 or later ■ On Asianux Server 4 2.6.32-71.el6.x86_64 or later ■ On SUSE Linux Enterprise Server 10 2.6.16.21 or later ■ On SUSE Linux Enterprise Server 11 2.6.27.19 or later ■ On SUSE Linux Enterprise Server 12 3.12.49-11 or later ■ On NeoKylin Linux Advanced Server 6 2.6.32-431.el6.x86_64 or later ■ On NeoKylin Linux Advanced Server 7 3.10.0-327.el7.x86_64 or later
# uname -r
2.3Package要求
The following or later version of packages for Oracle Linux 7, and Red Hat Enterprise Linux 7 must be installed:
binutils-2.23.52.0.1-12.el7.x86_64 compat-libcap1-1.10-3.el7.x86_64 compat-libstdc++-33-3.2.3-71.el7.i686 compat-libstdc++-33-3.2.3-71.el7.x86_64 gcc-4.8.2-3.el7.x86_64 gcc-c++-4.8.2-3.el7.x86_64 glibc-2.17-36.el7.i686 glibc-2.17-36.el7.x86_64 glibc-devel-2.17-36.el7.i686 glibc-devel-2.17-36.el7.x86_64 ksh libaio-0.3.109-9.el7.i686 libaio-0.3.109-9.el7.x86_64 libaio-devel-0.3.109-9.el7.i686 libaio-devel-0.3.109-9.el7.x86_64 libgcc-4.8.2-3.el7.i686 libgcc-4.8.2-3.el7.x86_64 libstdc++-4.8.2-3.el7.i686 libstdc++-4.8.2-3.el7.x86_64 libstdc++-devel-4.8.2-3.el7.i686 libstdc++-devel-4.8.2-3.el7.x86_64 libXi-1.7.2-1.el7.i686 libXi-1.7.2-1.el7.x86_64 libXtst-1.2.2-1.el7.i686 libXtst-1.2.2-1.el7.x86_64 make-3.82-19.el7.x86_64 sysstat-10.1.5-1.el7.x86_64
其他操作系统的RPM要求可以参见文档
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
vi /etc/yum.repos.d/dvd.repo [dvd-source] name=RHEL 7.0 dvd repo baseurl=file:///mnt/cdrom enabled=1 gpgcheck=0
yum clean all yum makecache
yum install -y binutils-* yum install -y compat-libcap1-* yum install -y compat-libstdc++-* yum install -y gcc-* yum install -y glibc-* yum install -y ksh yum install -y libaio-* yum install -y libgcc-* yum install -y libstdc++-* yum install -y libXi-* yum install -y libXtst-* yum install -y make-* yum install -y sysstat-* yum install -y unixODBC-*
2.5其他软件要求
On Oracle Linux 7, and Red Hat Enterprise Linux 7: - unixODBC-2.3.1-6.el7.x86_64 or later - unixODBC-2.3.1-6.el7.i686 or later - unixODBC-devel-2.3.1-6.el7.x86_64 or later - unixODBC-devel-2.3.1-6.el7.i686 or later
3.创建要求的操作系统组和用户
■ The Oracle Inventory group (typically, oinstall) ■ The OSDBA group (typically, dba) ■ The Oracle software owner (typically, oracle) ■ The OSOPER group (optional. Typically, oper)
3.1确认oinstall是否存在 #more /etc/oraInst.loc 如果存在: inventory_loc=/u01/app/oraInventory inst_group=oinstall
3.2检查dba是否存在 # grep dba /etc/group 3.3如果都不存在,则创建 # /usr/sbin/groupadd oinstall # /usr/sbin/groupadd dba
3.4创建Oracle用户 # /usr/sbin/useradd -g oinstall -G dba oracle
3.5修改密码 # passwd oracle
4.配置内存参数以及资源限制 以下为推荐的最小值:
注:如果现有参数的值比表格的大,无需改动。 检查各个参数的命令:
ParameterCommandsemmsl, semmns, semopm, and semmni# /sbin/sysctl -a | grep sem shmall, shmmax, and shmmni# /sbin/sysctl -a | grep shm file-max# /sbin/sysctl -a | grep file-max ip_local_port_ range# /sbin/sysctl -a | grep ip_local_port_range rmem_default# /sbin/sysctl -a | grep rmem_default rmem_max# /sbin/sysctl -a | grep rmem_max wmem_default# /sbin/sysctl -a | grep wmem_default wmem_max# /sbin/sysctl -a | grep wmem_max
如果参数值比推荐值小,可以在 /etc/sysctl.conf 中修改或者添加 # 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 = 1048576
修改完后参数生效 /sbin/sysctl -p
检查Oracle用户的资源限制 ----------------------------------------------------------------------------------------------------------------------------------- Resource Shell Limit Resource Soft Limit Hard Limit ----------------------------------------------------------------------------------------------------------------------------------- Open file descriptors nofile at least 1024 at least 65536 Number of processes available nproc at least 2047 at least 16384 to a single user Size of the stack segment of stack at least 10240 KB at least 10240 KB, and at the process most 32768 KB -----------------------------------------------------------------------------------------------------------------------------------
检查nofile $ ulimit -Sn 4096 $ ulimit -Hn 65536
检查nproc $ ulimit -Su 2047 $ ulimit -Hu 16384
检查stack $ ulimit -Ss 10240 $ ulimit -Hs 32768 vi /etc/security/limits.conf oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768
5.创建要求的目录 1)ORACLE_BASE目录 2)可选目录Oracle数据文件目录
ORACLE_BASE目录至少3GB,如果还要存放数据文件的话那至少4GB
注:不推荐将数据文件放置在ORACLE_BASE目录下面
# mkdir -p /u01/app/ # chown -R oracle:oinstall /u01/app/ # chmod -R 775 /u01/app/
6.配置Oracle用户的环境变量
vi /home/oracle/.bash_profile umask 022 export DISPLAY=local_host:0.0 export TMP=/tmp export TMPDIR=/tmp export ORACLE_BASE=/u01/app/oracle #export ORACLE_HOME= -->oracle建议不设置ORACLE_HOME,由OUI来决定安装的默认位置 export ORACLE_SID=orcl -->安装软件和实例的时候,数据库名默认叫orcl export PS1=['$LOGNAME'"@"`hostname`":"'$PWD'' ''$ORACLE_SID']"$" -->方便多个实例管理
--------------------------------------------------------------------------------------------------------------------------------------Screen Recommended Action -------------------------------------------------------------------------------------------------------------------------------------- Configure Security Updates Enter your e-mail address, preferably your My Oracle Support e-mail address or user name in the Email field. You can select the I wish to receive security updates via My Oracle Support check box to receive security updates. Enter your My Oracle Support password in the My Oracle Support Password field. Click Next. -------------------------------------------------------------------------------------------------------------------------------------- Download Software Updates Starting with Oracle Database 11g Release 2 (11.2.0.2), you can use the Software Updates feature to dynamically download and apply latest updates. Select one of the following options and click Next: ■ Use My Oracle Support credentials for download: Select this option to download and apply the latest software updates. Click Proxy Settings to configure a proxy for Oracle Universal Installer to use to connect to the Internet. Provide the proxy server information for your site, along with a user account that has access to the local area network through which the server is connecting. Starting with Oracle Database 11g Release 2 (11.2.0.3), you can enter the Proxy Realm information if required. The proxy realm information is case-sensitive. Click Test Connection to ensure that your proxy settings are correctly entered, and the installer can download the updates. ■ Use pre-downloaded software updates: Select this option to apply previously downloaded software updates. ■ Skip Software Updates: Select this option if you do not want to apply any updates. ----------------------------------------------------------------------------------------------------- Apply Software Updates This screen is displayed if you select to download the software updates or provide the pre-downloaded software downloads location. If you selected Use My Oracle Support credentials for download in the previous screen, select Download and apply all updates, and then click Next. If you selected Use pre-downloaded software updates in the previous screen, select Apply all updates, and then click Next. -------------------------------------------------------------------------------------------------------------------------------------- Select Installation Option Select Create and configure a database from the following list of available options, then click Next: ■ Create and configure a database ■ Install database software only ■ Upgrade an existing database -------------------------------------------------------------------------------------------------------------------------------------- System Class Select Server Class from the following options to install the database, and click Next. ■ Desktop Class: Choose this option if you are installing on a laptop or desktop class system. ■ Server Class: Choose this option if you are installing on a server class system, such as what you would use when deploying Oracle in a production data center. -------------------------------------------------------------------------------------------------------------------------------------- Grid Installation Options Select Single instance database installation for the type of database installation you want to perform, and click Next. ■ Single instance database installation: This option installs the database and the listener. ■ Real Application Clusters database installation: This option installs Oracle Real Application Clusters. ■ Oracle RAC One Node database installation: This option installs the Oracle RAC One Node database. Note: Oracle RAC One Node is supported only with Oracle Clusterware. -------------------------------------------------------------------------------------------------------------------------------------- Select Install Type Select Typical Install as the installation type from the following options, and click Next: ■ Typical Install: This installation method is selected by default. It lets you quickly install Oracle Database using minimal input. ■ Advanced Install: This installation method enables to perform more complex installations. -------------------------------------------------------------------------------------------------------------------------------------- Typical Install Configuration Enter the following information according to your requirements: Oracle base: The Oracle base path appears by default. You can change the path based on your requirement. Software location: In the Software Location section, accept the default value or enter the Oracle home directory path in which you want to install Oracle components. The directory path should not contain spaces. Storage Type: Select File System, or Oracle Automatic Storage Management as the database storage option. Database file location: If you select File System as your storage type, then click Browse and specify a database file location. ASMSNMP Password: If you select Oracle Automatic Storage Management as your Storage Type, then specify the password for the ASMSNMP user. Database edition: Select the database edition to install. OSDBA Group: The OSDBA group is selected by default. You can also select the OSDBA group from the list. Global database name: Specify the Global Database Name using the following syntax: database_name.domain For example, sales.us.example.com Administrative password: Enter the password for the privileged database account. Confirm Password: Reenter, and confirm the password for the privileged database account. Click Next to continue. -------------------------------------------------------------------------------------------------------------------------------------- Create Inventory This screen is displayed only during the first installation of Oracle products on a system. Specify the full path of the Oracle Inventory directory. Ensure that the operating system group selected is oinstall. Click Next to continue. -------------------------------------------------------------------------------------------------------------------------------------- Perform Prerequisite Checks Verify that all the prerequisite checks succeed, and then click Next. Oracle Universal Installer checks the system to verify that it is configured correctly to run Oracle software. If you have completed all the preinstallation steps in this guide, all the checks should pass. If a check fails, then review the cause of the failure listed for that check on the screen. If possible, rectify the problem and rerun the check. Alternatively, if you are satisfied that your system meets the requirements, then you can select the check box for the failed check to manually verify the requirement. Note: Oracle recommends that you use caution in checking the Ignore All option. If you check this option, then Oracle Universal Installer may not confirm if your system can install Oracle Database successfully. -------------------------------------------------------------------------------------------------------------------------------------- Summary Review the information displayed on this screen, and then click Install. Note: Starting with Oracle Database 11g Release 2 (11.2), you can save all the installation steps into a response file by clicking Save Response File. Later, this file can be used for a silent installation. -------------------------------------------------------------------------------------------------------------------------------------- Install Product This screen states the progress of a database installation. After the database is installed, you are prompted to execute some root configuration script for new inventory as the root user. Click Next. This screen then displays the status information for the configuration assistants that configure the software and create a database. Finally, a message is displayed at the end of Database Configuration Assistant process, and click OK. Execute the root.sh script as the root user to complete the installation and click OK. -------------------------------------------------------------------------------------------------------------------------------------- Finish This screen is shown automatically when all the configuration tools are successful. Click Close. --------------------------------------------------------------------------------------------------------------------------------------
以上为Oracle官方推荐的安装选项,以下为本次安装的过程
字符设置问题,LANG=C,重新启动后不再存在乱码,不接受Oracle的安全更新信息
跳过更新
创建并配置一个数据库
选择server class类型,作为数据库服务器
安装一个单实例数据库
修改数据文件路径,因为我直接挂了个盘放数据文件,所以改成/oradata,同时修改管理员密码,数据库文件默认放在$ORACLE_BASE/oradata,Oracle自动创建ORACLE_HOME
oracle 自动创建oraInventory
检查存在问题
处理后直接开始安装数据库和创建实例。
完成后修改Oracle的环境变量
#vi /home/oracle/.bash_profile export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 export PATH=$PATH:$ORACLE_HOME/bin