Oracle RAC 11g 集群

2.3 搭建数据库服务器

2.3.3 挂载iscsi服务

1.启动iscsi服务

[root@node1 ~]# /etc/init.d/iscsi status
iscsid (pid  2915) is running...
[root@node1 ~]# /etc/init.d/iscsi
iscsi   iscsid  
[root@node1 ~]# /etc/init.d/iscsid status
iscsid (pid  2915) is running...

2.探测存储服务器的iscsi磁盘

[root@node1 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.2.1:3260

3.挂载存储服务器的iscsi磁盘到本地

[root@node1 ~]# iscsiadm -m node -T iqn.openfiler.ractest.ocrvdisk1  -p 192.168.2.1:3260 -l

也可以直接执行以下命令,自动将所有有权使用的共享存储挂载到本地硬盘:

[root@node1 ~]# iscsiadm -m node -p 192.168.2.1:3260 -l

4.查看iscsi磁盘信息

[root@node1 ~]# iscsiadm -m node session

[root@node1 ~]# fdisk -l

5.卸载iscsi磁盘

[root@node1 ~]# iscsiadm -m node -U all

 

2.3.4 配置udev固定iscsi磁盘设备名称

 

在两个 Oracle RAC 节点上创建以下规则文件 /etc/udev/rules.d/55-openiscsi.rules

 ..............................................
# /etc/udev/rules.d/55-openiscsi.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM="/etc/udev/scripts/iscsidev.sh %b",SYMLINK+="iscsi/%c/part%n"
..............................................

现在,我们需要创建在接收该事件时将调用的 UNIX SHELL 脚本。我们首先在两个 Oracle RAC 节点上创建一个单独的目录,用于存储 udev 脚本:

[root@node1 ~]# mkdir -p /etc/udev/scripts                       

接下来,在两个 Oracle RAC 节点上创建 UNIX shell 脚本 /etc/udev/scripts/iscsidev.sh

 ..............................................
#!/bin/sh
# FILE: /etc/udev/scripts/iscsidev.sh

BUS=${1}
HOST=${BUS%%:*}
[ -e /sys/class/iscsi_host ] || exit 1
file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/
targetname"
target_name=$(cat ${file})
# This is not an open-scsi drive
if [ -z "${target_name}" ]; then
exit 1
fi

# Check if QNAP drive
check_qnap_target_name=${target_name%%:*}
if [ $check_qnap_target_name = "iqn.2004-04.com.qnap" ]; then
target_name=`echo "${target_name%.*}"`
fi

echo "${target_name##*.}"
..............................................

创建 UNIX SHELL 脚本后,将其更改为可执行文件:

[root@node1 ~]# chmod 755 /etc/udev/scripts/iscsidev.sh                       

既然已经配置了 udev,下面将在两个 Oracle RAC 节点上重新启动 iSCSI 服务:

[root@node1 ~]# service iscsi stop
Logging out of session [sid: 6, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]
Logging out of session [sid: 7, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]
Logging out of session [sid: 8, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]
Logout of [sid: 6, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]: successful
Logout of [sid: 7, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]: successful
Logout of [sid: 8, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]: successful
Stopping iSCSI daemon: [ OK ]

[root@node1 ~]# service iscsi start
iscsid dead but pid file exists
Turning off network shutdown. Starting iSCSI daemon: [ OK ]
[ OK ]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]
Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]: successful
Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]: successful
Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]: successful [ OK ]

下面,我们来看一下我们的辛勤工作是否得到了回报:

[root@node1 ~]# ls -l /dev/iscsi/*
/dev/iscsi/crs1:
total 0
lrwxrwxrwx 1 root root 9 Nov 3 18:13 part -> http://www.cnblogs.com/sdc

/dev/iscsi/data1:
total 0
lrwxrwxrwx 1 root root 9 Nov 3 18:13 part -> http://www.cnblogs.com/sde

/dev/iscsi/fra1:
total 0
lrwxrwxrwx 1 root root 9 Nov 3 18:13 part -> http://www.cnblogs.com/sdd

 

2.3.5 配置服务器的图形化环境

1 .安装软件包

[root@node1 ~]# yum install vnc-server

2.启动vnc服务

[root@node1 ~]# vncserver :1


You will require a password to access your desktops.


Password:
Verify:
xauth:  creating new authority file /root/.Xauthority


New 'node1:1 (root)' desktop is node1:1


Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/node1:1.log

3 修改vnc桌面配置

第一次启动后编辑 ~/.vnc/xstartup

注释最后一行:

#twm&

加入新行

gnome-session &

保存退出

这里将默认的twm桌面改成了gnome-session,为了能够正常显示gnome桌面,确保以下的软件包已经安装在操作系统中:

gnome-session

gnome-themes

gnome-terminal

dbus-x11

xclock

4.重启vnc服务

[root@node1 ~]# vncserver -kill :1
Killing Xvnc process ID 4518
[root@node1 ~]# vncserver :1  

New 'node1:1 (root)' desktop is node1:1


Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/node1:1.log

 

2.4 RAC运行环境安装前的检查

2.5 配置数据库服务器

2.5.1安装软件包

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n'  \
binutils \
compat-libstdc++-33 \
compat-db \
compat-libf2c-34 \
compat-libgcc-296 \
control-center \
elfutils-libelf \
elfutils-libelf-devel \
elfutils-libelf-devel-static \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
libstdc++ \
libstdc++-devel \
libXp \
libgomp \
libXmu \
libgcc \
libaio \
libaio-devel \
make \
sysstat \
glibc-headers \
kernel-headers \
openmotif22 \
unixODBC \
unixODBC-devel

安装没有的软件包

yum install -y compat-db compat-libf2c-34 compat-libgcc-296gcc gcc-c++ libstdc++-devel libXp libaio-devel sysstat openmotif22 unixODBC unixODBC-devel

2.5.2 修改系统参数

1.内核参数

[root@node1 ~]# cat /etc/sysctl.conf 
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.


# Controls IP packet forwarding
net.ipv4.ip_forward = 0


# Controls source route verification
net.ipv4.conf.default.rp_filter = 1


# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0


# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0


# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1


# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1


# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536


# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536


# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736


# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

# 添加以下参数
fs.aio‐max‐nr = 1048576 
fs.file‐max = 6815744 
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 

[root@node1 ~]# sysctl -p

 

2.资源限制参数

/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

3.登录参数

/etc/pam.d/login,加入以下内容

session    required     /lib64/security/pam_limits.so

/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

2.5.3 配置域名解析服务

1.安装

[root@node1 chroot]# yum install bind bind-chroot caching-nameserver

2.配置文件

[root@node1 etc]# cd /var/named/chroot/etc

[root@node1 etc]# cp -p named.rfc1912.zones named.conf

在named.conf,加入以下内容

options {
directory     "/var/named";
};

zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "1.168.192.db";
        allow-update { none; };
};


zone "example.com" IN {
        type master;
        file "example.com.db";
        allow-update { none; };
};

 

[root@node1 etc]# cd /var/named/chroot/var/named/

[root@node1 named]# cp -p localhost.zone example.com.db
[root@node1 named]# cp -p named.local 1.168.192.db

[root@node1 named]# cat example.com.db 
$TTL    86400
@               IN SOA  node1.       root.node1. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum


                IN NS   node1.


rhel-cluster-scan.grid  IN      1H      A               192.168.1.63
                        IN      1H      A               192.168.1.64
                        IN      1H      A               192.168.1.65

[root@node1 named]# cat 1.168.192.db 
$TTL    86400
@       IN      SOA     node1. root.node1.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      node1.
63       IN      PTR     rhel-cluster-scan.grid.example.com.
64       IN      PTR     rhel-cluster-scan.grid.example.com.
65       IN      PTR     rhel-cluster-scan.grid.example.com.

[root@node1 named]# service named restart

3.客户端配置(node1,node2)

[root@node1 named]# cat /etc/resolv.conf 
nameserver 192.168.1.61

4.客户端验证

[root@node1 ~]# nslookup rhel-cluster-scan.grid.example.com
Server:         192.168.1.61
Address:        192.168.1.61#53


Name:   rhel-cluster-scan.grid.example.com
Address: 192.168.1.65
Name:   rhel-cluster-scan.grid.example.com
Address: 192.168.1.63
Name:   rhel-cluster-scan.grid.example.com
Address: 192.168.1.64

2.5.4配置hosts文件

在每个节点的/etc/hosts,加入

#Public Network (eth0)
192.168.1.61    rhel1
192.168.1.62    rhel2
#Private Interconnect (eth2)
192.168.3.61    rhel1-priv
192.168.3.62    rhel2-priv
#Public Virtual IP (VIP) addresses (eth0:1)
192.168.1.68    rhel1-vip
192.168.1.69    rhel2-vip
#Private Storage Network for openfiler (eth1)
192.168.2.1     openfiler

2.5.5创建组,用户和目录

1.创建用户和组

[root@rhel1 ~]# groupadd -g 1000 oinstall
[root@rhel1 ~]# groupadd -g 1100 asmadmin
[root@rhel1 ~]# groupadd -g 1200 dba
[root@rhel1 ~]# groupadd -g 1201 oper
[root@rhel1 ~]# groupadd -g 1300 asmdba
[root@rhel1 ~]# groupadd -g 1301 asmoper
[root@rhel1 ~]# useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper grid
[root@rhel1 ~]# useradd -u 1101 -g oinstall -G dba,oper,asmdba oracle
[root@rhel1 ~]# passwd grid

[root@rhel1 ~]# passwd oracle

确认 nobody 用户存在

[root@rhel2 ~]# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)

2.创建目录

[root@rhel1 ~]# mkdir -p /u01/app/11.2.0/grid
[root@rhel1 ~]# chown -R grid:oinstall /u01
[root@rhel1 ~]# mkdir -p /u01/app/oracle
[root@rhel1 ~]# chown oracle:oinstall /u01/app/oracle
[root@rhel1 ~]# chmod -R 775 /u01

2.5.6设置环境变量

 

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

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

  • rhel1ORACLE_SID=+ASM1
  • rhel2ORACLE_SID=+ASM2
[root@rhel1 ~]# su - grid

 

[grid@rhel1 ~]$ cat .bash_profile
# ---------------------------------------------------
# .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="YYYY-MM-DD 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

PATH=${PATH}:${ORACLE_HOME}/oracm/bin:${ORACLE_HOME}/OPatch

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 节点并创建以下登录脚本 (.bash_profile):

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

  • rhel1ORACLE_SID=racdb1
  • rhel2ORACLE_SID=racdb2

 

[oracle@rhel1 ~]$ cat .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="YYYY-MM-DD 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
PATH=${PATH}:${ORACLE_HOME}/oracm/bin:${ORACLE_HOME}/OPatch
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

2.5.7 配置SSH用户等效性

1.在rhel1节点创建私钥和公钥

[grid@rhel1 ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/grid/.ssh/id_dsa):
Created directory '/home/grid/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/grid/.ssh/id_dsa.
Your public key has been saved in /home/grid/.ssh/id_dsa.pub.
The key fingerprint is:
02:ee:bf:58:91:a1:2f:28:1d:63:cc:29:37:4c:92:4e grid@rhel1

2.在rhel2节点创建私钥和公钥

[grid@rhel2 ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/grid/.ssh/id_dsa):
Created directory '/home/grid/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/grid/.ssh/id_dsa.
Your public key has been saved in /home/grid/.ssh/id_dsa.pub.
The key fingerprint is:
1a:69:c3:2d:ef:89:d9:31:98:99:3f:06:37:ab:b1:99 grid@rhel2

3.将rhel1,rhel2节点的公钥内容拷贝到rhel1节点的authorized_keys文件中

[grid@rhel1 ~]$ cat ~/.ssh/id_dsa.pub >>  ~/.ssh/authorized_keys

[grid@rhel1 ~]$ ssh rhel2 cat ~/.ssh/id_dsa.pub >>  ~/.ssh/authorized_keys

4.将rhel1,rhel2节点的公钥内容拷贝到rhel2节点的authorized_keys文件中

[grid@rhel2 ~]$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
[grid@rhel2 ~]$ ssh rhel1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

注意 chmod 644 ~/.ssh/authorized_keys

5.验证用户等效性

[grid@rhel1 ~]$ ssh rhel2 date

[grid@rhel2 ~]$ ssh rhel1 date

6.对oracle用户配置并验证等效性

2.5.8 配置时间同步服务

1.可以采用NTP时间 同步服务

2.这里使用 oracle 11g 中自带的CTSS时间同步服务。在安装Grid Infrastructure过程中,如果发现节点没有NTP服务,就会自动安装CTSS。

(1)停止NTP服务

[root@rhel1 ~]# /etc/init.d/ntpd stop
Shutting down ntpd: [FAILED]
[root@rhel1 ~]# chkconfig ntpd off

(2)删除或者重命名NTP配置文件

[root@rhel1 ~]# mv /etc/ntp.conf /etc/ntp.conf.bak

posted @ 2013-05-08 17:42  cav5lier  阅读(427)  评论(0编辑  收藏  举报