在 Oracle Linux 6.5 上安装 Oracle 11g 单实例数据库
Checking the Hardware Requirements
系统必须满足下面最小的硬件要求
Memory Requirements
Minimum: 1 GB of RAM
Recommended: 2 GB of RAM or more
To determine the RAM size, enter the following command:
# grep MemTotal /proc/meminfo
The following table describes the relationship between the installed RAM and the configured swap space recommendation:
注意: On Linux, the HugePages feature allocates non-swappable memory for large page tables using memory-mapped files. If you enable HugePages, then you should deduct the memory allocated to HugePages from the available RAM before calculating swap space.
简单说明:如果使用 HugePages 功能,在计算交换空间时,要先从内存中减去分配给 HugePages 的内存。
To determine the size of the configured swap space, enter the following command:
# grep SwapTotal /proc/meminfo
注:If necessary, see the operating system documentation for information about how to configure additional swap space.
To determine the available RAM and swap space, enter the following command:
# free
Automatic Memory Management
Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors. The size of the shared memory must be at least the greater of the MEMORY_MAX_TARGET and MEMORY_TARGET parameters for each Oracle instance on the computer. If the MEMORY_MAX_TARGET parameter or the MEMORY_TARGET parameter is set to a nonzero value, and an incorrect size is assigned to the shared memory, it results in an ORA-00845 error at startup. On Linux systems, if the operating system /dev/shm mount size is too small for the Oracle system global area (SGA) and program global area (PGA), it results in an ORA-00845 error.
简单说明:在使用AMM情况下,共享内存 /dev/shm 大小必须大于 MEMORY_MAX_TARGET 参数设置的大小。
The number of file descriptors for each Oracle instance must be at least 512*PROCESSES. The limit of descriptors for each process must be at least 512. If file descriptors are not sized correctly, you see an ORA-27123 error from various Oracle processes and potentially Linux Error EMFILE (Too many open files) in non-Oracle processes.
简单说明:每个 Oracle 进程文件描述符的数量必须至少是512个。
To determine the amount of shared memory available, enter the following command:
# df -h /dev/shm/
注意: The MEMORY_MAX_TARGET and MEMORY_TARGET parameters cannot be used when the LOCK_SGA parameter is enabled, or with HugePages on Linux.
The workaround, if you encounter the ORA-00845 error, is to increase the /dev/shm mountpoint size.
For example:
# mount -t tmpfs shmfs -o size=7g /dev/shm
To make this change persistent across system restarts, add an entry in /etc/fstab similar to the following:
shmfs /dev/shm tmpfs size=7g 0
其他说明:
1. On the Initialization Parameters page, note the Memory Size (SGA and PGA), which sets the initialization parameter MEMORY_TARGET or MEMORY_MAX_TARGET. The initialization parameters cannot be greater than the shared memory file system on the operating system. For example, if the shared memory file system allocation on your system is 1 GB, but you set Memory Size (MEMORY_TARGET) to 2 GB, then the following error messages are displayed during database startup:
ORA-00845: MEMORY_TARGET not supported on this system ORA-01078: Failure in processing system parameters
2. In addition, if you click All Initialization Parameters and the global database name is longer than eight characters, then the database name value (in the DB_NAME parameter) is truncated to the first eight characters, and the DB_UNIQUE_NAME parameter value is set to the global name.
System Architecture
To determine if the system architecture can run the software, enter the following command:
# uname -m
Disk Space Requirements
1 GB of space in the /tmp directory
To determine the amount of space available in the /tmp directory, enter the following command:
# df -h /tmp
If the free space available in the /tmp directory is less than what is required, then complete one of the following steps:
Delete unnecessary files from the /tmp directory to meet the disk space requirement.
Set the TMP and TMPDIR environment variables when setting the oracle user’s environment.
Extend the file system that contains the /tmp directory.
The following tables describe the disk space requirements for software files and data files for each installation type on Linux x86-64:
To determine the amount of free disk space on the system, enter the following command:
# df -h
Additional disk space, either on a file system or on an Oracle ASM disk group is required for the fast recovery area if you configure automated backups.
Display Requirements
The minimum resolution for Oracle Database 11g Release 2 (11.2) is 1024 x 768 or higher.
Checking the Software Requirements
根据打算安装的产品,确认系统上安装了以下软件:
注意:Oracle Universal Installer performs checks on the system to verify that it meets the listed requirements. To ensure that these checks pass, verify the requirements before you start Oracle Universal Installer.
Operating System Requirements
The following operating system versions (or later) are required for Oracle Database 11g Release 2 (11.2):
关于具体的操作系统版本要求参见 Database Installation Guide for Linux(P51)
注意:
Starting with Oracle Database 11g Release 2 (11.2.0.4), Oracle Linux 7 and Red Hat Enterprise Linux 7 are supported on Linux x86-64.
Starting with Oracle Database 11g Release 2 (11.2.0.3), Oracle Linux 6 and Red Hat Enterprise Linux 6 are supported on Linux x86 and Linux x86-64.
Starting with Oracle Database 11g Release 2 (11.2), the Security Enhanced Linux (SELinux) feature is supported for Oracle Linux 4, Oracle Linux 5, Oracle Linux 6, Red Hat Enterprise Linux 4, Red Hat Enterprise Linux 5, and Red Hat Enterprise Linux 6.
To determine the distribution and version of Linux installed, enter the following command:
# cat /proc/version
You can also enter the following command on some distributions of Linux:
# lsb_release -id
Kernel Requirements
The following are the kernel requirements for Oracle Database 11g Release 2 (11.2):
关于具体的内核要求参见 Database Installation Guide for Linux(P54)
To determine if the required kernel is installed, enter the following command:
# uname -r
Package Requirements
The following are the list of packages required for Oracle Database 11g Release 2 (11.2):
关于不同系统架构的不同操作系统版本的包要求参见 Database Installation Guide for Linux(P56)
注意: Starting with Oracle Database 11g Release 2 (11.2.0.2), all the 32-bit packages, except for gcc-32bit-4.3, listed in the following table are no longer required for installing a database on Linux x86-64.
下面给出在 Oracle Linux 6 X86_64中所需软件包列表:
binutils-2.20.51.0.2-5.11.el6 (x86_64) compat-libcap1-1.10-1 (x86_64) compat-libstdc++-33-3.2.3-69.el6 (x86_64) compat-libstdc++-33-3.2.3-69.el6.i686 gcc-4.4.4-13.el6 (x86_64) gcc-c++-4.4.4-13.el6 (x86_64) glibc-2.12-1.7.el6 (i686) glibc-2.12-1.7.el6 (x86_64) glibc-devel-2.12-1.7.el6 (x86_64) glibc-devel-2.12-1.7.el6.i686 ksh libgcc-4.4.4-13.el6 (i686) libgcc-4.4.4-13.el6 (x86_64) libstdc++-4.4.4-13.el6 (x86_64) libstdc++-4.4.4-13.el6.i686 libstdc++-devel-4.4.4-13.el6 (x86_64) libstdc++-devel-4.4.4-13.el6.i686 libaio-0.3.107-10.el6 (x86_64) libaio-0.3.107-10.el6.i686 libaio-devel-0.3.107-10.el6 (x86_64) libaio-devel-0.3.107-10.el6.i686 make-3.81-19.el6 sysstat-9.0.4-11.el6 (x86_64)
To determine if the required packages are installed, enter commands similar to the following:
# rpm -q package_name
If a package is not installed, then install it from the Linux distribution media or download the required package version from the Linux vendor’s website.
下面通过配置本地YUM的方式来安装所需的软件包:
YUM源来自 Linux distribution media,可以将介质挂载到服务器上,也可以将介质中的RPM软件包copy到操作系统中的某个文件内。
可以通过下面方式手工创建YUM仓库:
1. 将所有的YUM文件拷贝到一个目录下
2. 通过rpm命令手工安装createrepo软件
3. 运行命令 createrepo -v /yum-package
注:创建好之后本机可以通过file方式直接使用,如果需要作为对外的YUM仓库服务器,可以通过HTTP、FTP或NFS协议共享出去。
YUM为了提供速度会缓存很多信息,但有时候缓存会造成一些故障,可以通过以下命令来清除缓存
yum clean all;
每次运行安装或查询类命令会重建yum缓存。
通过下面方法确定未安装的软件包:
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \ compat-libcap1 \ compat-libstdc++-33 \ gcc \ gcc-c++ \ glibc \ glibc-devel \ ksh \ libgcc \ libstdc++ \ libstdc++-devel \ libaio \ libaio-devel \ make \ sysstat
通过下面命令安装软件包:
yum install software-name
Compiler Requirements
有关编译器的描述可以参见 Database Installation Guide for Linux(P68)
Additional Software Requirements
Depending on the components you want to use, you must ensure that the following software is installed:
Oracle ODBC Drivers Oracle JDBC/OCI Drivers Linux-PAM Library Oracle Messaging Gateway Programming Languages Browser Requirements Oracle Database Vault Preinstallation Requirement
下面以安装ODBC来举例说明:
To use ODBC on Linux x86-64, the following additional ODBC RPMs are required:
On Oracle Linux 6, Red Hat Enterprise Linux 6, and Asianux Server 4:
unixODBC-2.2.14-11.el6 (x86_64) or later unixODBC-2.2.14-11.el6.i686 or later unixODBC-devel-2.2.14-11.el6 (x86_64) or later unixODBC-devel-2.2.14-11.el6.i686 or later
有关其他软件的描述可以参见 Database Installation Guide for Linux(P69)
Reviewing Operating System Security Common Practices
Secure operating systems are an important basis for general system security. Ensure that your operating system deployment is in compliance with common security practices as described in your operating system vendor security guide.
Installation Fixup Scripts
During installation, for certain prerequisite verification failures, click Fix & Check Again to generate a fixup script (runfixup.sh). You can run this script as the root user to complete the required preinstallation steps.
The fixup script:
Checks for and sets kernel parameters to values required for successful installation, including:
– Shared memory parameters
– Open file descriptor and UDP send/receive parameters
Oracle recommends that you do not modify the contents of the generated fixup script.
Verifying UDP and TCP Kernel Parameters
If the lower value of the range you have is greater than 9000, and the range is large enough for your anticipated workload, then you can ignore OUI warnings regarding the ephemeral port range.
$ cat /proc/sys/net/ipv4/ip_local_port_range
If necessary, update the UDP and TCP ephemeral port range to a range high enough for anticipated system workloads, and to ensure that the ephemeral port range starts at 9000 and above. For example:
# echo 9000 65500 > /proc/sys/net/ipv4/ip_local_port_range
Oracle recommends that you make these settings permanent. For example, as root, use a text editor to open /etc/sysctl.conf, and add or change to the following:
net.ipv4.ip_local_port_range = 9000 65500, and then restart the network (#/etc/rc.d/init.d/network restart).
Installing the cvuqdisk Package for Linux
Install the operating system package cvuqdisk. Without cvuqdisk, the Cluster Verification Utility (CVU) cannot find shared disks, and you receive a "Package cvuqdisk not installed" error when you run the Cluster Verification Utility.
To install the cvuqdisk RPM, complete the following procedure:
1. Locate the cvuqdisk RPM package, which is in the directory rpm on the installation media. If you installed Oracle Grid Infrastructure, then it is in the directory oracle_home1/cv/rpm.
2. Log in as root.
3. Use the following command to find if you have an existing version of the cvuqdisk package:
# rpm -qi cvuqdisk
If you have an existing version, then enter the following command to deinstall the existing version:
# rpm -e cvuqdisk
4. Set the environment variable CVUQDISK_GRP to point to the group that owns cvuqdisk, typically oinstall, for example:
# CVUQDISK_GRP=oinstall; export CVUQDISK_GRP
5. In the directory where you have saved the cvuqdisk RPM, use the following command to install the cvuqdisk package:
rpm -iv package
注意:
If you prefer, you can disable Cluster Verification Utility shared disk checks by adding the following line to the file oracle_home1/cv/admin/cvu_config:
CV_RAW_CHECK_ENABLED=FALSE
In this example, oracle_home1 is the Oracle home directory where the database is installed.
Confirming Host Name Resolution
Ensure that the computer host name is resolvable through a Domain Name System (DNS), a network information service (NIS), or a centrally-maintained TCP/IP host file, such as /etc/hosts. Use the ping command to ensure that your computer host name is resolvable. For example:
ping hostname
Disabling Transparent HugePages
Starting with Red Hat Enterprise Linux 6, Oracle Linux 6, SUSE 11 and Unbreakable Enterprise Kernel 2 (UEK2) kernels, Transparent HugePages are enabled by default at runtime. However, Transparent HugePages might cause delays in memory allocation because memory is allocated dynamically. Hence, Oracle recommends that you disable Transparent HugePages on all Oracle Database servers to avoid performance issues.
Although Transparent HugePages are similar to HugePages, they are set up dynamically at runtime by the khugepaged thread in the kernel while standard HugePages are preallocated at startup. Oracle recommends that you use standard HugePages for enhanced performance.
To check if Transparent HugePages are enabled run one of the following commands as the root user:
Red Hat Enterprise Linux kernels:
# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
Other kernels:
# cat /sys/kernel/mm/transparent_hugepage/enabled
The following is a sample output that shows Transparent HugePages are being used as the [always] flag is enabled.
[always] never
说明:
If Transparent HugePages are removed from the kernel then the /sys/kernel/mm/transparent_hugepage or /sys/kernel/mm/redhat_transparent_hugepage files do not exist.
To disable Transparent HugePages perform the following steps:
1. Add the following entry to the kernel boot line in the /etc/grub.conf file:
transparent_hugepage=never
For example:
title Oracle Linux Server (2.6.32-300.25.1.el6uek.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-300.25.1.el6uek.x86_64 ro root=LABEL=/ transparent_hugepage=never initrd /initramfs-2.6.32-300.25.1.el6uek.x86_64.img
2. Restart the system to make the changes permanent.
Checking the Network Setup
This section describes how to install Oracle Database on computers that do not meet the typical scenario.
Installing on Multihomed Computers
You can install Oracle Database on a multihomed computer. A multihomed computer is associated with multiple IP addresses. This is typically achieved by having multiple network cards on the computer. Each IP address is associated with a host name. In addition, you can set up aliases for the host name. By default, Oracle Universal Installer uses the ORACLE_HOSTNAME environment variable setting to find the host name. If ORACLE_HOSTNAME is not set and you are installing on a computer that has multiple network cards, then Oracle Universal Installer determines the host name from the /etc/hosts file.
Creating Required Operating System Groups and Users
A custom configuration is a configuration with groups and users that divide access privileges granted by membership in separate operating system groups and users.
The Oracle Database, and the Oracle Grid Infrastructure for a standalone server installation owner users must be members of the Oracle Inventory group (oinstall).
Creating Custom Configuration Groups and Users for Job Roles
This section provides an overview of how to create users and groups to divide access privileges by job roles.
Understanding Restrictions for Oracle Installations with Job Role Separation
Oracle recommends that you create one software owner to own each Oracle software installation (typically, oracle, for the database software and grid for the Oracle Restart owner user).
To create separate Oracle software owners, to create separate users, and separate operating system privileges groups for different Oracle software installations, each of these users must have the Oracle central inventory group (oraInventory group) as their primary group. Members of this group have write privileges to the Oracle central inventory (oraInventory) directory, and are also granted permissions for various Oracle Restart resources and directories in the Oracle Restart home to which DBAs need write access, and other necessary privileges.
简单说明:每个 Oracle 软件安装所有者都必须使 Oracle 清单组作为其主组。
The database software owner (typically, oracle) must also have the OSDBA group of the Oracle Grid Infrastructure home so that database instances can log on to Oracle ASM, and (if you create it) the OSOPER group as secondary groups.
简单说明:数据库软件所有者也需要 Oracle GI home 的 OSDBA 组,这样数据库实例就可以登陆到 Oracle ASM。
Each Oracle software owner must be a member of the same central inventory group. Oracle recommends that you do not have more than one central inventory for Oracle installations. If an Oracle software owner has a different central inventory group, then you may corrupt the central inventory.
For Oracle Grid Infrastructure for a standalone server, the grid user (grid) must be in the OSDBA group of every database home.
简单说明:对于独立服务器,Oracle GI 所有者必须是其上运行的每个数据库 home 的 OSDBA 组的成员。
注:这与集群服务器不同。
Database Groups for Job Role Installations
如果安装 Oracle 数据库,创建下面的操作系统组:
The OSDBA group (typically, dba)
This group identifies operating system user accounts that have database administrative privileges (the SYSDBA privilege).
The OSOPER group for Oracle Database (typically, oper)
This group cannot directly connect as SYSOPER, unless explicitly granted. However, they have the privileges granted by the SYSOPER privilege.
Oracle Grid Infrastructure Groups for Job Role Installations
如果安装 Oracle GI,创建下面的操作系统组:
The OSDBA group for Oracle ASM (typically, asmdba)
The OSDBA group for Oracle ASM can be the same group used as the OSDBA group for the database, or you can create a separate OSDBA group for Oracle ASM (typically, asmdba) to provide administrative access to Oracle ASM instances.
The Oracle Grid Infrastructure software owner (typically, grid) must be a member of the OSDBA group. Membership in the OSDBA group enables access to the files managed by Oracle ASM. If you have a separate OSDBA group for Oracle ASM, then the Oracle Restart software owner must be a member of the OSDBA group for each database and the OSDBA group for Oracle ASM.
The OSASM group for Oracle ASM (typically, asmadmin)
SYSASM privileges for Oracle ASM files provide administrator privileges for storage file.SYSASM privileges provide no access privileges on an RDBMS instance.
The OSOPER group for Oracle ASM (typically, asmoper)
If you want to have an OSOPER group for Oracle ASM, then the Oracle Grid Infrastructure owner must be a member of this group.
Creating Database Operating System Groups and Users with Job Role Separation
下面部分描述如何创建需要的操作系统用户和组:
注意:Oracle recommends that you do not use the UID and GID defaults.
Creating the Oracle Inventory Group
When you install Oracle software on the system for the first time, Oracle Universal Installer creates the oraInst.loc file.
Determining if the Oracle Inventory Group Exists
If you have an existing Oracle Inventory, then ensure that you use the same Oracle Inventory for all Oracle software installations, and ensure that all Oracle software users you intend to use for installation have permissions to write to this directory.
To determine if the Oracle Inventory group exist, enter the following command:
# grep oinstall /etc/group
To determine if the oraInst.loc file exists, enter the following command:
# more /etc/oraInst.loc
Creating the Oracle Inventory Group
# /usr/sbin/groupadd -g 501 oinstall
Creating the OSDBA Group for Database Installations
# /usr/sbin/groupadd -g 502 dba
Creating an OSOPER Group for Database Installations
# /usr/sbin/groupadd -g 503 oper
Creating the OSASM Group for Oracle Automatic Storage Management
# /usr/sbin/groupadd -g 504 asmadmin
Creating the OSDBA Group for Oracle Automatic Storage Management
# /usr/sbin/groupadd -g 506 asmdba
Creating the OSOPER Group for Oracle Automatic Storage Management
# /usr/sbin/groupadd -g 505 asmoper
Creating the Oracle Software Owner User
Determining if an Oracle Software Owner User Exists
# id oracle # id grid
Creating an Oracle Software Owner User
# /usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba,oper oracle # passwd oracle
Modifying an Existing Oracle Software Owner User
# /usr/sbin/usermod -g oinstall -G dba,asmdba[,oper] oracle
注:如果需要安装 Oracle GI,还需要创建 grid 用户。
# useradd -u 504 -g oinstall -G asmadmin,asmdba,asmoper,dba grid # passwd grid
Checking Resource Limits for the Oracle Software Installation Users
For each installation software owner, check the resource limits for installation, using the following recommended ranges:
To check resource limits:
1. Log in as an installation owner.
2. Check the soft and hard limits for the file descriptor setting. Ensure that the result is in the recommended range, for example:
[root@linuxcast ~]# ulimit -Sn 1024 [root@linuxcast ~]# ulimit -Hn 4096
3. Check the soft and hard limits for the number of processes available to a user. Ensure that the result is in the recommended range, for example:
[root@linuxcast ~]# ulimit -Su 63702 [root@linuxcast ~]# ulimit -Hu 63702
4. Check the soft limit for the stack setting. Ensure that the result is in the recommended range, for example:
[root@linuxcast ~]# ulimit -Ss 8192 [root@linuxcast ~]# ulimit -Hs unlimited
5. Repeat this procedure for each Oracle software installation owner.
If necessary, update the resource limits in the /etc/security/limits.conf configuration file for the installation owner. However, note that the configuration file may be distribution specific.
注意:If the grid or oracle users are logged in, then changes in the limits.conf file do not take effect until you log these users out and log them back in. You must do this before you use these accounts for installation.
注:这里文件描述符设置、和 stack 设置不满足推荐的范围,通过修改 /etc/security/limits.conf 文件:
vim /etc/security/limits.conf oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 63702 oracle hard nproc 63702 oracle soft stack 10240 oracle hard stack 32768 grid soft nofile 1024 grid hard nofile 65536 grid soft nproc 63702 grid hard nproc 63702 grid soft stack 10240 grid hard stack 32768
注意:
If the grid or oracle users are logged in, then changes in the limits.conf file do not take effect until you log these users out and log them back in. You must do this before you use these accounts for installation.
Configuring Kernel Parameters for Linux
If you cannot use the fixup script, then verify that the kernel parameters shown in the following table are set to values greater than or equal to the minimum value shown.
重要:
The kernel parameter and shell limit values shown in the following section are minimum values only. For production database systems, Oracle recommends that you tune these values to optimize the performance of the system. See the operating system documentation for more information about tuning kernel parameters.
Displaying and Changing Kernel Parameter Values
Enter the commands shown in the following table to display the current values of the kernel parameters. Note these values and identify any values that you must change:
If the value of any kernel parameter is different from the minimum value, then perform the following:
1. Using any text editor, create or edit the /etc/sysctl.conf file, and add or edit lines similar to the following:
fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 4294967295 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
注意:
Include lines only for the kernel parameter values to change. For the semaphore parameters (kernel.sem), you must specify all four values. If any of the current values are larger than the minimum value, then specify the larger value.
By specifying the values in the /etc/sysctl.conf file, they persist when you restart the system.
2. Enter the following command to change the current values of the kernel parameters:
# /sbin/sysctl -p
例:
查看当前kernel 参数值:
[root@linuxcast ~]# sysctl -a | grep sem kernel.sem = 250 32000 32 128 [root@linuxcast ~]# sysctl -a | grep shm kernel.shm_rmid_forced = 0 kernel.shmall = 4294967296 kernel.shmmax = 68719476736 kernel.shmmni = 4096 vm.hugetlb_shm_group = 0 [root@linuxcast ~]# sysctl -a | grep file-max fs.file-max = 810419 [root@linuxcast ~]# sysctl -a | grep ip_local_port_range net.ipv4.ip_local_port_range = 32768 61000 [root@linuxcast ~]# sysctl -a | grep rmem_default net.core.rmem_default = 212992 [root@linuxcast ~]# sysctl -a | grep rmem_max net.core.rmem_max = 212992 [root@linuxcast ~]# sysctl -a | grep wmem_default net.core.wmem_default = 212992 [root@linuxcast ~]# sysctl -a | grep wmem_max net.core.wmem_max = 212992
修改不满足最小值要求的参数:
vim /etc/sysctl.conf
kernel.shmmax = 5368709120
kernel.shmall = 1310720
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
kernel.shmmni = 4096
fs.aio-max-nr = 1048576
fs.file-max = 6815744
sysctl -p
Identifying Required Software Directories
You must identify or create the following directories for the Oracle software:
Oracle Base Directory
The Oracle base directory is a top-level directory for Oracle software installations. The Optimal Flexible Architecture (OFA) guidelines recommend that you use a path similar to the following for the Oracle base directory:
/mount_point/app/software_owner
You must specify the Oracle base directory that contains all Oracle products.
You can use the same Oracle base directory for multiple installations or you can create separate Oracle base directories for different installations. If different operating system users install Oracle software on the same system, then each user must create a separate Oracle base directory.
Oracle Inventory Directory
The Oracle Inventory directory (oraInventory) stores an inventory of all software installed on the system. It is required and shared by all Oracle software installations on a single system.
If you have set ORACLE_BASE for the oracle user during installation, then Oracle Universal Installer creates the Oracle Inventory directory in the path ORACLE_BASE/../oraInventory.
If you have neither created an OFA-compliant path nor set ORACLE_BASE, then the Oracle Inventory directory is placed in the home directory of the user that is performing the installation.
Oracle Universal Installer creates the directory that you specify and sets the correct owner, group, and permissions for it. You do not have to create it.
注意:
All Oracle software installations rely on the Oracle Inventory directory. Ensure that you back it up regularly.
Oracle Home Directory
The Oracle home directory is the directory where you install the software for a particular Oracle product. You must install different Oracle products or different releases of the same Oracle product in separate Oracle home directories.
In accordance with the OFA guidelines, Oracle strongly recommends that the Oracle home directory you specify is a subdirectory of the Oracle base directory for the user account performing the installation.
oracle_base/product/11.2.0/dbhome_1 oracle_base/product/11.2.0/grid
Oracle Universal Installer creates the directory path that you specify under the Oracle base directory. It also sets the correct owner, group, and permissions on it. You do not have to create this directory.
简单说明:只有 Oracle Base Directory 在安装 Oracle 软件时需要创建。
Identifying or Creating an Oracle Base Directory
Identifying an existing Oracle home directory
Enter the following command to display the contents of the oratab file:
# more /etc/oratab
The directory paths specified on each line identify Oracle home directories. Directory paths that end with the user name of the Oracle software owner to use are valid choices for an Oracle base directory.
Identifying an existing Oracle base directory
After you locate the Oracle home directory, run a similar command to confirm the location of Oracle base:
cat /u01/app/oraInventory/ContentsXML/inventory.xml
Before deciding to use an existing Oracle base directory for this installation, ensure that it meets the following conditions:
It is not on the same file system as the operating system.
It has sufficient free disk space, as follows:
To determine the free disk space on the file system where the Oracle base directory is located, enter the following command:
# df -h oracle_base_path
Creating an Oracle Base Directory
Before you create an Oracle base directory, you must identify an appropriate file system with sufficient free disk space.
To identify an appropriate file system:
1. To determine the free disk space on each mounted file system, use the following command:
# df -h
2. From the display, identify a file system that has the appropriate amount of free space.
The file system that you identify can be a local file system, a cluster file system, or an NFS file system on a certified NAS device.
3. Note the name of the mount point directory for the file system that you identified.
To create the Oracle base directory and specify the correct owner, group, and permissions for it:
1. Enter commands similar to the following to create the recommended subdirectories in the mount point directory that you identified and set the appropriate owner, group, and permissions on them:
# mkdir -p /mount_point/app/oracle_sw_owner # chown -R oracle:oinstall /mount_point/app/oracle_sw_owner # chmod -R 775 /mount_point/app/oracle_sw_owner
For example:
# mkdir -p /u01/app/oracle # chown -R oracle:oinstall /u01/app/oracle # chmod -R 775 /u01/app/oracle
2. When you configure the oracle user’s environment, set the ORACLE_BASE environment variable to specify the Oracle base directory that you created.
Choosing a Storage Option for Oracle Database and Recovery Files
注意:
Database files and recovery files are supported on file systems and Oracle ASM.
Creating Directories for Oracle Database or Recovery Files
This section contains the following topics:
Guidelines for Placing Oracle Database Files on a File System(P94)
Enter commands similar to the following to create the recommended subdirectories in each of the mount point directories and set the appropriate owner, group, and permissions on them:
Database file directory:
# mkdir /mount_point/oradata # chown oracle:oinstall /mount_point/oradata # chmod 775 /mount_point/oradata
Recovery file directory (fast recovery area):
# mkdir /mount_point/fast_recovery_area # chown oracle:oinstall /mount_point/fast_recovery_area # chmod 775 /mount_point/fast_recovery_area
Oracle recommends that you keep the fast recovery area on a separate physical disk than that of the database file directory.
补充说明:如果使用本地文件系统存储数据库文件,建议 Database File Directory 和 FRA 挂载点目录的文件系统使用逻辑卷,这在以后的空间管理上会方便很多。
下面给出有关逻辑卷的内容:
假设这里有块磁盘/dev/sdc,用它来作为数据库文件的文件系统。
1. 创建PV
pvcreate /dev/sdc
2. 创建VG
vgcreate vg_oradata /dev/sdc
3. 创建LV
lvcreate -L 2G -n lv_oradata /dev/sdc
4. 创建文件系统
mkfs.ext4 /dev/vg_oradata/lv_oradata
5. 挂载文件系统
mount /dev/vg_oradata/lv_oradata /u02/oradata
6. 配置 /etc/fstab 文件,使其在系统重启时自动挂载
/dev/vg_oradata/lv_oradata /u02/oradata ext4 defaults 0 0
此后,假如目前的2G磁盘空间已用完,可以通过从现有的 VG free 空间中扩展 LV
lvextend -l +767 /dev/vg_oradata/lv_oradata
resize2fs /dev/vg_oradata/lv_oradata
如果LV空间已用完,而且VG中也没有free空间,可以通过在线增加磁盘的方式,以增加LV空间
假设给该服务器增加了一块新的硬盘 /dev/sdd
1. pvcreate /dev/sdd
2. vgextend vg_oradata /dev/sdd
3.lvextend -L +5G /dev/vg_oradata/lv_oradata
4. resize2fs /dev/vg_oradata/lv_oradata
Configuring Storage for Oracle Database Files Using Block Devices
This section describes how to configure Oracle Database files on block devices. Use the following procedure to create block device partitions:
1. Use fdisk to create disk partitions on block devices for database files.
2. Create or modify the rules file in /etc/udev/rules.d to change the permissions of the data files from the default root ownership.
Ensure that the file you create is appropriate for your distribution.
Example 2–2 Example of a Rules File with User grid
/etc/udev/rules.d/99-oracle.rules # # ASM disks KERNEL=="sdb[6-9]", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sdb10", OWNER="grid", GROUP="asmadmin", MODE="0660"
Configuring Disk Devices for Oracle Database
Example of Configuring Block Device Storage for Oracle Database
The following procedure creates partitions for Oracle Database files on block devices:
1. Log in as root
2. Enter the fdisk command to format a specific storage disk. For example, /sbin/fdisk /dev/sdb
3. Create a partition. For example, create a 280 MB partition for data files.
4. Use the command similar to the following to update the kernel partition table for the shared storage device: /sbin/partprobe diskpath
Stopping Existing Oracle Processes(P97)
注:
If you are installing additional Oracle Database 11g products in an existing Oracle home, then stop all processes, including the listener and database, running in the Oracle home. You must complete this task to enable Oracle Universal Installer to relink certain executables and libraries.
If you plan to use Oracle Restart, then you must install Oracle Grid Infrastructure before you install and create the database. When you perform a database installation, the database must use the same listener created during the Oracle Grid Infrastructure installation.
The default listener and any additional listeners must run from the Oracle Grid Infrastructure home.
Configuring Oracle Software Owner Environment
Set the default file mode creation mask (umask) to 022 in the shell startup file.
Set the DISPLAY environment variable.(P99)
If the /tmp directory has less than 1 GB of free disk space(P100)
If you have had an existing installation on your system, and you are using the same user account to install this installation(P101)
To verify that the environment has been set correctly, enter the following commands:
$ umask $ env | more
到这里,完成了安装非asm管理存储的单实例数据库的配置。
内容基本上是对 Database Installation Guide 的剪贴,如果需要使用 asm 管理存储,可以阅读该文档的第 3 章节。