oracle rac搭建iscsi,Build Your Own Oracle RAC 11g Cluster Oracle Enterprise Linux and iSCSI, Page 2 | ...

在集群的两个 Oracle RAC 节点上针对 grid 和 oracle 用户执行以下用户、组和目录配置并设置 shell 限制的任务。

本节介绍如何使用 任务角色划分 配置来创建操作系统用户和组以安装所有 Oracle 软件。本节所使用的命令应在两个 Oracle RAC 节点上以 root 用户身份执行,从而创建组、用户和目录。请注意,组 ID 和用户 ID 在集群的两个 Oracle RAC 节点上应保持一致。检查以确保每个集群成员节点上都存在您要使用的组 ID 和用户 ID,确认每个网格基础架构的集群安装所有者的主组拥有相同的名称和组 ID,具体在本指南中为 oinstall (GID 1000)。

Oracle 的任务角色划分权限配置是这样一种配置,将对 Oracle Grid Infrastructure 安装的管理访问权限赋予给一些操作系统组和用户,从而将这类权限从涉及其他 Oracle 安装(例如,Oracle Database 软件)的其他管理用户和组中划分出来。管理访问权限由各个操作系统组授予,而安装权限由每个 Oracle 安装的各个安装所有者授予。

我们会为每个 Oracle 软件产品创建一个操作系统用户作为该产品的所有者 —“grid”作为 Oracle Grid Infrastructure 的所有者,“oracle”作为 Oracle RAC 软件的所有者。在本文中,grid 的用户是我们创建作为 Oracle Grid Infrastructure 二进制文件所有者的用户。该用户将是 Oracle Clusterware 和 Oracle 自动存储管理二进制文件的所有者。而 oracle 的用户是我们创建作为 Oracle 数据库二进制文件 (Oracle RAC) 所有者的用户。这两个 Oracle 软件所有者必须以 Oracle Inventory 组 (oinstall) 作为其主组,这样每个 Oracle 软件安装所有者都有权写入中央清单 (oraInventory),以便正确设置 OCR 和 Oracle Clusterware 资源的权限。Oracle RAC 软件所有者还必须以 OSDBA 组和可选的 OSOPER 组作为其辅助组。

此类配置是可选的,但是对于需要通过划分各个管理用户的负责区域来限制用户对 Oracle 软件的访问的组织来说,Oracle 强烈建议采用这样的配置。例如,一个小型组织可能只分配操作系统用户权限,这样就可以只使用一个管理用户和一个组,该用户和组通过操作系统认证之后会具有存储层和数据库层上的所有系统权限。就此类配置来说,您可以指定 oracle 用户为所有 Oracle 软件(Grid Infrastructure 和 Oracle Database 软件)的唯一安装所有者,并指定 oinstall 为唯一组,授予其成员 Oracle Clusterware、自动存储管理及服务器上所有 Oracle 数据库的所有系统权限,及其作为安装所有者的所有权限。然而,其他组织有一些专门的系统角色来负责 Oracle 软件的安装,如系统管理员、网络管理员或存储管理员。这些不同的管理员用户可对系统进行配置以便为集群安装的 Oracle Grid Infrastructure 作准备,并完成所有需要操作系统 root 权限的配置任务。在成功完成 Grid Infrastructure 的安装与配置后,系统管理员应只需提供配置信息并授予数据库管理员在 Oracle RAC 安装期间以 root 用户身份运行脚本的权限。

我们将创建以下 O/S 组:

描述

OS 组名

分配给该组的 OS 用户

Oracle 权限

Oracle 组名

Oracle 清单和软件所有者

oinstall

grid、oracle

Oracle 自动存储管理组

asmadmin

grid

SYSASM

OSASM

ASM 数据库管理员组

asmdba

grid、oracle

ASM 的 SYSDBA

OSDBA for ASM

ASM 操作员组

asmoper

grid

ASM 的 SYSOPER

OSOPER for ASM

数据库管理员

dba

oracle

SYSDBA

OSDBA

数据库操作员

oper

oracle

SYSOPER

OSOPER

Oracle 清单组(一般为 oinstall)

OINSTALL 组的成员被视为 Oracle 软件的“所有者”,拥有对 Oracle 中央清单 (oraInventory) 的写入权限。在一个 Linux 系统上首次安装 Oracle 软件时,OUI 会创建 /etc/oraInst.loc 文件。该文件指定 Oracle 清单组的名称(默认为 oinstall)以及 Oracle 中央清单目录的路径。

如果不存在 oraInventory 组,默认情况下,安装程序会将集群的网格基础架构的安装所有者的主组列为 oraInventory 组。确保所有计划的 Oracle 软件安装所有者都使用此组作为主组。就本指南来说,必须将 grid 和 oracle 安装所有者配置为以 oinstall 作为其主组。

Oracle 自动存储管理组(一般为 asmadmin)

此组为必需组。如果想让 Oracle ASM 管理员和 Oracle Database 管理员分属不同的管理权限组,可单独创建此组。在 Oracle 文档中,OSASM 组是其成员被授予权限的操作系统组,在代码示例中,专门创建了一个组来授予此权限,此组名为 asmadmin。

OSASM 组的成员可通过操作系统身份验证使用 SQL 以 SYSASM 身份连接到一个 Oracle ASM 实例。SYSASM 权限是在 Oracle ASM 11g 第 1 版 (11.1) 中引入的,现在,在 Oracle ASM 11g 第 2 版 (11.2) 中,该权限已从 SYSDBA 权限中完全分离出来。SYSASM 权限不再提供对 RDBMS 实例的访问权限。用 SYSASM 权限代替 SYSDBA 权限来提供存储层的系统权限,这使得 ASM 管理和数据库管理之间有了清晰的责任划分,有助于防止使用相同存储的不同数据库无意间覆盖其他数据库的文件。SYSASM 权限允许执行挂载和卸载磁盘组及其他存储管理任务。

ASM 数据库管理员组(OSDBA for ASM,一般为 asmdba)

ASM 数据库管理员组(OSDBA for ASM)的成员是 SYSASM 权限的一个子集,拥有对 Oracle ASM 管理的文件的读写权限。Grid Infrastructure 安装所有者 (grid) 和所有 Oracle Database 软件所有者 (oracle) 必须是该组的成员,而所有有权访问 Oracle ASM 管理的文件并且具有数据库的 OSDBA 成员关系的用户必须是 ASM 的 OSDBA 组的成员。

ASM 操作员组(OSOPER for ASM,一般为 asmoper)

该组为可选组。如果需要单独一组具有有限的 Oracle ASM 实例管理权限(ASM 的 SYSOPER 权限,包括启动和停止 Oracle ASM 实例的权限)的操作系统用户,则创建该组。默认情况下,OSASM 组的成员将拥有 ASM 的 SYSOPER 权限所授予的所有权限。

要使用 ASM 操作员组创建 ASM 管理员组(该组拥有的权限比默认的 asmadmin 组要少),安装 Grid Infrastructure 软件时必须选择 Advanced 安装类型。这种情况下,OUI 会提示您指定该组的名称。在本指南中,该组为 asmoper。

如果要拥有一个 OSOPER for ASM 组,则集群的 Grid Infrastructure 软件所有者 (grid) 必须为此组的一个成员。

数据库管理员(OSDBA,一般为 dba)

OSDBA 组的成员可通过操作系统身份验证使用 SQL 以 SYSDBA 身份连接到一个 Oracle 实例。该组的成员可执行关键的数据库管理任务,如创建数据库、启动和关闭实例。该组的默认名称为 dba。SYSDBA 系统权限甚至在数据库未打开时也允许访问数据库实例。对此权限的控制完全超出了数据库本身的范围。

不要混淆 SYSDBA 系统权限与数据库角色 DBA。DBA 角色不包括 SYSDBA 或 SYSOPER 系统权限。

数据库操作员组(OSOPER,一般为 oper)

OSOPER 组的成员可通过操作系统身份验证使用 SQL 以 SYSOPER 身份连接到一个 Oracle 实例。这个可选组的成员拥有一组有限的数据库管理权限,如管理和运行备份。该组的默认名称为 oper。SYSOPER 系统权限甚至在数据库未打开时也允许访问数据库实例。对此权限的控制完全超出了数据库本身的范围。要使用该组,选择 Advanced 安装类型来安装 Oracle 数据库软件。

为 Grid Infrastructure 创建组和用户

在本节中,我们首先在两个 Oracle RAC 节点上为 Grid Infrastructure 创建推荐的操作系统组和用户:

[root@racnode1 ~]# groupadd -g 1000 oinstall

[root@racnode1 ~]# groupadd -g 1200 asmadmin

[root@racnode1 ~]# groupadd -g 1201 asmdba

[root@racnode1 ~]# groupadd -g 1202 asmoper

[root@racnode1 ~]# useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d

/home/grid -s /bin/bash -c "Grid Infrastructure Owner" grid

[root@racnode1 ~]# id grid uid=1100(grid) gid=1000(oinstall)

groups=1000(oinstall), 1200(asmadmin), 1201(asmdba),1202(asmoper)

设置 grid 帐户的口令:

[root@racnode1 ~]# passwd grid

Changing password for user grid.

New UNIX password:xxxxxxxxxxx

Retype new UNIX password:xxxxxxxxxxx

passwd: all authentication tokens updated successfully.

为 grid 用户帐户创建登录脚本

以 grid 用户帐户分别登录到两个 Oracle RAC 节点并创建以下登录脚本 (.bash_profile):

注:在为每个 Oracle RAC 节点设置 Oracle 环境变量时,确保为每个 RAC 节点指定唯一的 Oracle SID。对于此示例,我使用:

racnode1:ORACLE_SID=+ASM1

racnode2:ORACLE_SID=+ASM2

[root@racnode1 ~]# su - grid

# ---------------------------------------------------

# .bash_profile

# ---------------------------------------------------

# OS User: grid

# Application: Oracle Grid Infrastructure

# Version: Oracle 11g release 2

# ---------------------------------------------------

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

alias ls="ls -FA"

# ---------------------------------------------------

# ORACLE_SID

# ---------------------------------------------------

# Specifies the Oracle system identifier (SID)

# for the Automatic Storage Management (ASM)instance

# running on this node.

# Each RAC node must have a unique ORACLE_SID.

# (i.e. +ASM1, +ASM2,...)

# ---------------------------------------------------

ORACLE_SID=+ASM1; export ORACLE_SID

# ---------------------------------------------------

# JAVA_HOME

# ---------------------------------------------------

# Specifies the directory of the Java SDK and Runtime

# Environment.

# ---------------------------------------------------

JAVA_HOME=/usr/local/java; export JAVA_HOME

# ---------------------------------------------------

# ORACLE_BASE

# ---------------------------------------------------

# Specifies the base of the Oracle directory structure

# for Optimal Flexible Architecture (OFA) compliant

# installations. The Oracle base directory for the

# grid installation owner is the location where

# diagnostic and administrative logs, and other logs

# associated with Oracle ASM and Oracle Clusterware

# are stored.

# ---------------------------------------------------

ORACLE_BASE=/u01/app/grid; export ORACLE_BASE

# ---------------------------------------------------

# ORACLE_HOME

# ---------------------------------------------------

# Specifies the directory containing the Oracle

# Grid Infrastructure software. For grid

# infrastructure for a cluster installations, the Grid

# home must not be placed under one of the Oracle base

# directories, or under Oracle home directories of

# Oracle Database installation owners, or in the home

# directory of an installation owner. During

# installation, ownership of the path to the Grid

# home is changed to root. This change causes

# permission errors for other installations.

# ---------------------------------------------------

ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME

# ---------------------------------------------------

# ORACLE_PATH

# ---------------------------------------------------

# Specifies the search path for files used by Oracle

# applications such as SQL*Plus. If the full path to

# the file is not specified, or if the file is not

# in the current directory, the Oracle application

# uses ORACLE_PATH to locate the file.

# This variable is used by SQL*Plus, Forms and Menu.

# ---------------------------------------------------

ORACLE_PATH=/u01/app/oracle/common/oracle/sql; export ORACLE_PATH

# ---------------------------------------------------

# SQLPATH

# ---------------------------------------------------

# Specifies the directory or list of directories that

# SQL*Plus searches for a login.sql file.

# ---------------------------------------------------

# SQLPATH=/u01/app/common/oracle/sql; export SQLPATH

# ---------------------------------------------------

# ORACLE_TERM

# ---------------------------------------------------

# Defines a terminal definition. If not set, it

# defaults to the value of your TERM environment

# variable. Used by all character mode products.

# ---------------------------------------------------

ORACLE_TERM=xterm; export ORACLE_TERM

# ---------------------------------------------------

# NLS_DATE_FORMAT

# ---------------------------------------------------

# Specifies the default date format to use with the

# TO_CHAR and TO_DATE functions. The default value of

# this parameter is determined by NLS_TERRITORY. The

# value of this parameter can be any valid date

# format mask, and the value must be surrounded by

# double quotation marks. For example:

# # NLS_DATE_FORMAT = "MM/DD/YYYY"

# # ---------------------------------------------------

NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT

# ---------------------------------------------------

# TNS_ADMIN

# ---------------------------------------------------

# Specifies the directory containing the Oracle Net

# Services configuration files like listener.ora,

# tnsnames.ora, and sqlnet.ora.

# ---------------------------------------------------

TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN

# ---------------------------------------------------

# ORA_NLS11

# ---------------------------------------------------

# Specifies the directory where the language,

# territory, character set, and linguistic definition

# files are stored.

# ---------------------------------------------------

ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11

# ---------------------------------------------------

# PATH

# ---------------------------------------------------

# Used by the shell to locate executable programs;

# must include the $ORACLE_HOME/bin directory.

# ---------------------------------------------------

PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin

PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

PATH=${PATH}:/u01/app/common/oracle/bin

export PATH

# ---------------------------------------------------

# LD_LIBRARY_PATH

# ---------------------------------------------------

# Specifies the list of directories that the shared

# library loader searches to locate shared object

# libraries at runtime.

# ---------------------------------------------------

LD_LIBRARY_PATH=$ORACLE_HOME/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

export LD_LIBRARY_PATH

# ---------------------------------------------------

# CLASSPATH

# ---------------------------------------------------

# Specifies the directory or list of directories that

# contain compiled Java classes.

# ---------------------------------------------------

CLASSPATH=$ORACLE_HOME/JRE

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export CLASSPATH

# ---------------------------------------------------

# THREADS_FLAG

# ---------------------------------------------------

# All the tools in the JDK use green threads as a

# default. To specify that native threads should be

# used, set the THREADS_FLAG environment variable to

# "native". You can revert to the use of green

# threads by setting THREADS_FLAG to the value

# "green".

# ---------------------------------------------------

THREADS_FLAG=native; export THREADS_FLAG

# ---------------------------------------------------

# TEMP, TMP, and TMPDIR

# ---------------------------------------------------

# Specify the default directories for temporary

# files; if set, tools that create temporary files

# create them in one of these directories.

# ---------------------------------------------------

export TEMP=/tmp

export TMPDIR=/tmp

# ---------------------------------------------------

# UMASK

# ---------------------------------------------------

# Set the default file mode creation mask

# (umask) to 022 to ensure that the user performing

# the Oracle software installation creates files

# with 644 permissions.

# ---------------------------------------------------

umask 022

为 Oracle 数据库软件创建组和用户

接下来,我们在两个 Oracle RAC 节点上为 Oracle 数据库软件创建推荐的操作系统组和用户:

[root@racnode1 ~]# groupadd -g 1300 dba

[root@racnode1 ~]# groupadd -g 1301 oper

[root@racnode1 ~]# useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d

/home/oracle -s /bin/bash -c "Oracle Software Owner" oracle

[root@racnode1 ~]# id oracle

uid=1101(oracle)

gid=1000(oinstall)

groups=1000(oinstall),1201(asmdba),1300(dba),1301(oper)

设置 oracle 帐户的口令:

[root@racnode1 ~]# passwd oracle

Changing password for user oracle.

New UNIX password:

xxxxxxxxxxx

Retype new UNIX password:

xxxxxxxxxxx

passwd: all authentication tokens updated successfully.

为 oracle 用户帐户创建登录脚本

以 oracle 用户帐户分别登录到两个 Oracle RAC 节点并创建以下登录脚本 (.bash_profile):

注:在为每个 Oracle RAC 节点设置 Oracle 环境变量时,确保为每个 RAC 节点指定唯一的 Oracle SID。对于此示例,我使用:

racnode1:ORACLE_SID=racdb1

racnode2:ORACLE_SID=racdb2

[root@racnode1 ~]# su - oracle

# ---------------------------------------------------

# .bash_profile

# ---------------------------------------------------

# OS User: oracle

# Application: Oracle Database Software Owner

# Version: Oracle 11g release 2

# ---------------------------------------------------

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

alias ls="ls -FA"

# ---------------------------------------------------

# ORACLE_SID

# ---------------------------------------------------

# Specifies the Oracle system identifier (SID) for

# the Oracle instance running on this node.

# Each RAC node must have a unique ORACLE_SID.

# (i.e. racdb1, racdb2,...)

# ---------------------------------------------------

ORACLE_SID=racdb1; export ORACLE_SID

# ---------------------------------------------------

# ORACLE_UNQNAME

# ---------------------------------------------------

# In previous releases of Oracle Database, you were

# required to set environment variables for

# ORACLE_HOME and ORACLE_SID to start, stop, and

# check the status of Enterprise Manager. With

# Oracle Database 11g release 2 (11.2) and later, you

# need to set the environment variables ORACLE_HOME

# and ORACLE_UNQNAME to use Enterprise Manager.

# Set ORACLE_UNQNAME equal to the database unique

# name.

# ---------------------------------------------------

ORACLE_UNQNAME=racdb; export ORACLE_UNQNAME

# ---------------------------------------------------

# JAVA_HOME

# ---------------------------------------------------

# Specifies the directory of the Java SDK and Runtime

# Environment.

# ---------------------------------------------------

JAVA_HOME=/usr/local/java; export JAVA_HOME

# ---------------------------------------------------

# ORACLE_BASE

# ---------------------------------------------------

# Specifies the base of the Oracle directory structure

# for Optimal Flexible Architecture (OFA) compliant

# database software installations.

# ---------------------------------------------------

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

# ---------------------------------------------------

# ORACLE_HOME

# ---------------------------------------------------

# Specifies the directory containing the Oracle

# Database software.

# ---------------------------------------------------

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME

# ---------------------------------------------------

# ORACLE_PATH

# ---------------------------------------------------

# Specifies the search path for files used by Oracle

# applications such as SQL*Plus. If the full path to

# the file is not specified, or if the file is not

# in the current directory, the Oracle application

# uses ORACLE_PATH to locate the file.

# This variable is used by SQL*Plus, Forms and Menu.

# ---------------------------------------------------

ORACLE_PATH=/u01/app/common/oracle/sql; export ORACLE_PATH

# ---------------------------------------------------

# SQLPATH

# ---------------------------------------------------

# Specifies the directory or list of directories that

# SQL*Plus searches for a login.sql file.

# ---------------------------------------------------

# SQLPATH=/u01/app/common/oracle/sql; export SQLPATH

# ---------------------------------------------------

# ORACLE_TERM

# ---------------------------------------------------

# Defines a terminal definition. If not set, it

# defaults to the value of your TERM environment

# variable. Used by all character mode products.

# ---------------------------------------------------

ORACLE_TERM=xterm; export ORACLE_TERM

# ---------------------------------------------------

# NLS_DATE_FORMAT

# ---------------------------------------------------

# Specifies the default date format to use with the

# TO_CHAR and TO_DATE functions. The default value of

# this parameter is determined by NLS_TERRITORY. The

# value of this parameter can be any valid date

# format mask, and the value must be surrounded by

# double quotation marks. For example:

# # NLS_DATE_FORMAT = "MM/DD/YYYY"

# # ---------------------------------------------------

NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT

# ---------------------------------------------------

# TNS_ADMIN

# ---------------------------------------------------

# Specifies the directory containing the Oracle Net

# Services configuration files like listener.ora,

# tnsnames.ora, and sqlnet.ora.

# ---------------------------------------------------

TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN

# ---------------------------------------------------

# ORA_NLS11

# ---------------------------------------------------

# Specifies the directory where the language,

# territory, character set, and linguistic definition

# files are stored.

# ---------------------------------------------------

ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11

# ---------------------------------------------------

# PATH

# ---------------------------------------------------

# Used by the shell to locate executable programs;

# must include the $ORACLE_HOME/bin directory.

# ---------------------------------------------------

PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin

PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

PATH=${PATH}:/u01/app/common/oracle/bin

export PATH

# ---------------------------------------------------

# LD_LIBRARY_PATH

# ---------------------------------------------------

# Specifies the list of directories that the shared

# library loader searches to locate shared object

# libraries at runtime.

# ---------------------------------------------------

LD_LIBRARY_PATH=$ORACLE_HOME/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

export LD_LIBRARY_PATH

# ---------------------------------------------------

# CLASSPATH

# ---------------------------------------------------

# Specifies the directory or list of directories that

# contain compiled Java classes.

# ---------------------------------------------------

CLASSPATH=$ORACLE_HOME/JRE

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export CLASSPATH

# ---------------------------------------------------

# THREADS_FLAG

# ---------------------------------------------------

# All the tools in the JDK use green threads as a

# default. To specify that native threads should be

# used, set the THREADS_FLAG environment variable to

# "native". You can revert to the use of green

# threads by setting THREADS_FLAG to the value

# "green".

# ---------------------------------------------------

THREADS_FLAG=native; export THREADS_FLAG

# ---------------------------------------------------

# TEMP, TMP, and TMPDIR

# ---------------------------------------------------

# Specify the default directories for temporary

# files; if set, tools that create temporary files

# create them in one of these directories.

# ---------------------------------------------------

export TEMP=/tmp

export TMPDIR=/tmp

# ---------------------------------------------------

# UMASK

# ---------------------------------------------------

# Set the default file mode creation mask

# (umask) to 022 to ensure that the user performing

# the Oracle software installation creates files

# with 644 permissions.

# ---------------------------------------------------

umask 022

验证用户 nobody 存在

安装软件之前,执行以下过程,以验证在两个 Oracle RAC 节点上存在用户 nobody:

要确定该用户是否存在,输入以下命令:

#id nobody

uid=99(nobody) gid=99(nobody) groups=99(nobody)

如果该命令显示了 nobody 用户的信息,则无需创建该用户。

如果用户 nobody 不存在,则输入以下命令进行创建:

# /usr/sbin/useradd nobody

在集群中的所有其他 Oracle RAC 节点上重复此过程。

创建 Oracle 基目录路径

最后一步是配置 Oracle 基路径,要遵循最佳灵活体系结构 (OFA) 的结构及正确的权限。需要以 root 用户身份在集群的两个 Oracle RAC 节点上完成此任务。

本指南假设在根文件系统中创建 /u01 目录。请注意,这样做是为了简便起见,不建议将其作为通用做法。通常会将 /u01 目录作为配置了硬件或软件镜像功能的单独文件系统供应。

[root@racnode1 ~]# mkdir -p /u01/app/grid

[root@racnode1 ~]# mkdir -p /u01/app/11.2.0/grid

[root@racnode1 ~]# chown -R grid:oinstall /u01

[root@racnode1 ~]# mkdir -p /u01/app/oracle

[root@racnode1 ~]# chown oracle:oinstall /u01/app/oracle

[root@racnode1 ~]# chmod -R 775 /u01

本节结束时,两个 Oracle RAC 节点应具有以下配置:

Oracle 中央清单组,即 oraInventory 组 (oinstall),其成员以中央清单组作为主组,拥有对 oraInventory 目录的写入权限。

单独的 OSASM 组 (asmadmin),其成员拥有 SYSASM 权限,可以管理 Oracle Clusterware 和 Oracle ASM。

单独的 ASM OSDBA 组 (asmdba),其成员包括 grid 和 oracle,拥有对 Oracle ASM 的访问权限。

单独的 ASM OSOPER 组 (asmoper),其成员包括 grid,拥有有限的 Oracle ASM 管理员权限(包括启动和停止 Oracle ASM 实例的权限)。

集群的 Oracle 网格安装所有者 (grid),该用户以 oraInventory 组作为其主组,以 OSASM (asmadmin)、OSDBA for ASM (asmdba) 和 OSOPER for ASM (asmoper) 组作为其辅助组。

单独的 OSDBA 组 (dba),其成员拥有 SYSDBA 权限,可以管理 Oracle 数据库。

单独的 OSOPER 组 (oper),其成员包括 oracle,拥有有限的 Oracle 数据库管理员权限。

Oracle 数据库软件所有者 (oracle),该用户以 oraInventory 组作为其主组,以 OSDBA (dba)、OSOPER (oper) 和 OSDBA for ASM 组 (asmdba) 作为其辅助组。

符合 OFA 的挂载点 /u01,在安装之前,其所有者为 grid:oinstall。

网格的 Oracle 基目录 /u01/app/grid,其所有者为 grid:oinstall,权限设置为 775,在安装过程中其权限设置更改为 755。网格安装所有者的 Oracle 基目录是存放 Oracle ASM 诊断和管理日志文件的位置。

网格主目录 /u01/app/11.2.0/grid,其所有者为 grid:oinstall,权限设置为 775 (drwxdrwxr-x)。这些权限为安装所需,在安装过程中会更改为 root:oinstall 和 755 权限设置 (drwxr-xr-x)。

在安装过程中,OUI 在路径 /u01/app/oraInventory 下创建 Oracle 清单目录。此路径的所有者一直为 grid:oinstall,使其他 Oracle 软件所有者可以写入中央清单。

Oracle 基目录 /u01/app/oracle,其所有者为 oracle:oinstall,权限设置为 775。

为 Oracle 软件安装用户设置资源限制

要改善 Linux 系统上的软件性能,必须对 Oracle 软件所有者用户(grid、oracle)增加以下资源限制:

Shell 限制

limits.conf 中的条目

硬限制

打开文件描述符的最大数

nofile

65536

可用于单个用户的最大进程数

nproc

16384

进程堆栈段的最大大小

stack

10240

要进行这些更改,以 root 用户身份运行以下命令:

在每个 Oracle RAC 节点上,在 /etc/security/limits.conf 文件中添加以下几行代码(下面的示例显示软件帐户所有者 oracle 和 grid):

[root@racnode1 ~]# cat >> /etc/security/limits.conf <

grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 1024

grid hard nofile 65536

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

EOF

在每个 Oracle RAC 节点上,在 /etc/pam.d/login 文件中添加或编辑下面一行内容(如果不存在此行):

[root@racnode1 ~]# cat >> /etc/pam.d/login <

session required pam_limits.so

EOF

根据您的 shell 环境,对默认的 shell 启动文件进行以下更改,以便更改所有 Oracle 安装所有者的 ulimit 设置(注意这里的示例显示 oracle 和 grid 用户):

对于 Bourne、Bash 或 Korn shell,通过运行以下命令将以下行添加到 /etc/profile 文件:

[root@racnode1 ~]# cat >> /etc/profile <

if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then

if [ \$SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

umask 022

fi

EOF

对于 C shell(csh 或 tcsh),通过运行以下命令将以下行添加到 /etc/csh.login 文件

[root@racnode1 ~]# cat >> /etc/csh.login <

if ( \$USER == "oracle" || \$USER == "grid" ) then

limit maxproc 16384

limit descriptors 65536

endif

EOF

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值