成都创新互联网站制作重庆分公司

oracle11grac配置

openfile:
192.168.10.40
DNS+NTP:
192.168.10.41


1.rpm安装系统包:
rpm -Uvh binutils-*
rpm -ivh compat-libcap1-1.10-1.x86_64.rpm
rpm -Uvh compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
rpm -Uvh elfutils-libelf-0.*
rpm -Uvh elfutils-libelf-devel-*
rpm -Uvh gcc-4.*
rpm -Uvh gcc-c++-4.*
rpm -Uvh glibc-2.*
rpm -Uvh glibc-common-2.*
rpm -Uvh glibc-devel-2.*
rpm -Uvh glibc-headers-2.*
rpm -Uvh ksh-2*
rpm -Uvh libaio-0.*
rpm -Uvh libaio-devel-0.*
rpm -Uvh libgcc-4.*
rpm -Uvh libstdc++-4.*
rpm -Uvh libstdc++-devel-4.*
rpm -Uvh make-3.*
rpm -Uvh sysstat-7.*
rpm -Uvh unixODBC-2.*
rpm -Uvh unixODBC-devel-2.*


2.创建用户和组:
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 505 asmoper
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/useradd -g oinstall -G dba,asmdba,oper -u 500 oracle
/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba -u 501 grid

3.创建目录:

mkdir -p /u01/app/
chmod -R 775 /u01/app/

mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory

mkdir -p /u01/app/grid
mkdir /u01/app/11.2.0/grid -p
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/cfgtoollogs
chown -R grid:oinstall /u01/app/11.2.0
chown -R grid:oinstall /u01/app/grid
chown -R oracle:oinstall /u01/app/oracle/
chmod -R 775 /u01/app/oracle/
chmod -R 775 /u01/app/grid

4.修改hosts文件

127.0.0.1              localhost.lbdb.com       localhost
192.168.40.11          node1.lbdb.com           node1
192.168.40.12          node2.lbdb.com           node2
10.10.10.11            node1-priv.lbdb.com      node1-priv
10.10.10.12            node2-priv.lbdb.com      node2-priv
192.168.40.13          node1-vip.lbdb.com       node1-vip
192.168.40.14          node2-vip.lbdb.com       node2-vip


192.168.40.15         node-scan.lbdb.com       node-scan
192.168.40.16         node-scan.lbdb.com       node-scan
192.168.40.17         node-scan.lbdb.com       node-scan

5.修改参数
cat >> /etc/security/limits.conf << EOF
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

cat >> /etc/pam.d/login << EOF
session required /lib/security/pam_limits.so
EOF

cat >> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 8388608
kernel.shmmax = 536870912
kernel.shmmax = 1073741824
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
EOF



6.修改用户环境变量:
su - grid

export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid/product/11.2/grid
export PATH=$PATH:/u01/app/grid/product/11.2/grid/bin
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
#根据具体环境设置
#export ORACLE_SID=+ASM1
#export ORACLE_SID=+ASM2

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





su - oracle

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2/db
export PATH=$PATH:/u01/app/oracle/product/11.2/db/bin
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
#根据具体环境设置
#export ORACLE_SID=bridge1
#export ORACLE_SID=bridge2
export ORACLE_UNQNAME=bridge 安装数据库时候 开启em功能  需要设置
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


7.停止ntp并删除ntp配置文件和服务(注意两个节点都要操作)
/etc/init.d/ntpd stop
 mv /etc/ntp.conf /etc/ntp.conf-bak


8.挂载磁盘并分区
本文使用iscsic
rpm -ivh iscsi-initiator-utils-6.2.0.871-0.16.el5.x86_64.rpm
/etc/init.d/iscsi restart
/etc/init.d/iscsid restart
chkconfig iscsi on
chkconfig iscsid on
发现:
iscsiadm -m discovery -t sendtargets -p 192.168.10.40
手动挂起:
iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.28fcc085aa01 -p 192.168.10.40 -l

9.使用udev管理磁盘设备
#安装oracleasm
拍虚拟机快照
 fdisk格式化磁盘
两个节点执行:
vi /etc/udev/rules.d/60-raw.rules
添加如下内容:
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="raw1", OWNER="grid",GROUP="asmadmin",MODE="660"
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="raw2", OWNER="grid",GROUP="asmadmin",MODE="660"
ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="raw3", OWNER="grid",GROUP="asmadmin",MODE="660"
重启udev:
start_udev


#oracleasm configure -i
#oracleasm init
#一个节点执行:
#oracleasm createdisk ocr_vote /dev/sdd1

10.安装grid
上传grid文件到node1的grid用户目录下并解压
执行./runInstaller 安装


11.用oracle用户登录,安装oracle数据库软件,oracle

12.创建ASM 磁盘组
以grid用户登录系统,使用asmca命令创建磁盘组


13.以oracle用户执行dbca创建数据库。
注意:
内存选择70%时候报错:
如下解决:
vi /etc/fstab
tmpfs                   /dev/shm                tmpfs   defaults,size=1250M        0 0
mount -o remount /dev/shm
两个节点都要执行。

配置DNS服务器
首先确认主机名称:
编辑hosts文件
vi /etc/hosts                                      
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1                    localhost.zhou.com     localhost
192.168.10.87           www.zhou.com           www

一、安装 DNS Server         
rpm -ivh bind-9.3.6-4.P1.el5_4.2.x86_64.rpm
rpm -ivh bind-chroot-9.3.6-4.P1.el5_4.2.x86_64.rpm                     
rpm -ivh caching-nameserver-9.3.6-4.P1.el5_4.2.x86_64.rpm
  二、配置 DNS Server
 
 (1)、创建主配置文件 named.conf
  cd /var/named/chroot/etc
  cp -p named.caching-nameserver.conf named.conf
  vi named.conf   ###修改named.conf文件,将源文件中的所有localhost以及127.0.0.1修改成any,注意any;前后保留空格还有最后
  include "/etc/named.zones";名字  
  修改后如下:
                                                                          
[root@www etc]# cat named.conf                                               
//                                                                           
// named.caching-nameserver.conf                                             
//                                                                           
// Provided by Red Hat caching-nameserver package to configure the           
// ISC BIND named(8) DNS server as a caching only nameserver                 
// (as a localhost DNS resolver only).                                       
//                                                                           
// See /usr/share/doc/bind*/sample/ for example named configuration files.   
//                                                                           
// DO NOT EDIT THIS FILE - use system-config-bind or an editor               
// to create named.conf - edits to this file will be lost on                 
// caching-nameserver package upgrade.                                       
//                                                                           
options {                                                                    
    listen-on port 53 { any; };                                                
    listen-on-v6 port 53 { ::1; };                                             
    directory     "/var/named";                                                  
    dump-file     "/var/named/data/cache_dump.db";                             
        statistics-file "/var/named/data/named_stats.txt";                 
        memstatistics-file "/var/named/data/named_mem_stats.txt";          
                                                                           
    // Those options should be used carefully because they disable port      
    // randomization                                                         
    // query-source    port 53;                                                 
    // query-source-v6 port 53;                                              
                                                                           
    allow-query     { any; };                                                
    allow-query-cache { any; };                                              
};                                                                         
logging {                                                                  
        channel default_debug {                                            
                file "data/named.run";                                     
                severity dynamic;                                          
        };                                                                 
};                                                                         
view localhost_resolver {                                                  
    match-clients        { any; };                                             
    match-destinations { any; };                                             
    recursion yes;                                                           
    include "/etc/named.zones";    ###此处需要修改,修改的名字为以下的    cp -p named.rfc1912.zones named.zones                                         
};                                                                         



(2)cp -p named.rfc1912.zones named.zones
 
  #以下两个zone为新增的,包含正向和反向zone
  vi named.zones修改后的结果如下:  
   
[root@www etc]# cat named.zones                                                   
// named.rfc1912.zones:                                                           
//                                                                                
// Provided by Red Hat caching-nameserver package                                 
//                                                                                
// ISC BIND named zone configuration for zones recommended by                     
// RFC 1912 section 4.1 : localhost TLDs and address zones                        
//                                                                                
// See /usr/share/doc/bind*/sample/ for example named configuration files.        
//                                                                                
#zone "." IN {
#       type hint;
#       file "named.ca";
#};
zone "." IN {
        type hint;
        file "/dev/null";
};

                                                                                  
zone "localdomain" IN {                                                           
    type master;                                                                    
    file "localdomain.zone";                                                        
    allow-update { none; };                                                         
};                                                                                
                                                                                  
zone "localhost" IN {                                                             
    type master;                                                                    
    file "localhost.zone";                                                          
    allow-update { none; };                                                         
};                                                                                
                                                                                  
zone "0.0.127.in-addr.arpa" IN {                                                  
    type master;                                                                    
    file "named.local";                                                             
    allow-update { none; };                                                         
};                                                                                
                                                                                  
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;                                                              
    file "named.ip6.local";                                                         
    allow-update { none; };                                                         
};                                                                                
                                                                                  
zone "255.in-addr.arpa" IN {                                                      
    type master;                                                                    
    file "named.broadcast";                                                         
    allow-update { none; };                                                         
};                                                                                
                                                                                  
zone "0.in-addr.arpa" IN {                                                        
    type master;                                                                    
    file "named.zero";                                                              
    allow-update { none; };                                                         
};                                                                                
zone "bridge.org" IN {                                                            
        type master;                                                              
        file "www.bridge.zero";       ###注意和主机名称对应                                            
        allow-update { none; };                                                   
};                                                                                
zone "88.168.192.in-addr.arpa" IN {                                               
        type master;                                                              
        file "88.168.192.local";                                                  
        allow-update { none; };                                                   
};                                                                                


(3)#配置正向和反向搜索数据库解析文件
      [root@node1 etc]# pwd  
      /var/named/chroot/etc  
      [root@node1 etc]# cd  ../var/named/    
      
      #同样使用cp -p 方式复制文件到新的正向和反向文件
      [root@www named]# cp -p named.zero  www.bridge.zero  名字与上面的新增解析文件名字一样
      [root@www named]# cp -p named.local 88.168.192.local   名字与上面的新增解析文件名字一样
 
      #下面是修改之后的正向搜索文件,也可以将host文件的其他ip对照编辑到正向搜索文件以实现解析  
      #如下面的例子将vip的参照关系也添加到解析文件  
      

[root@www named]# cat www.bridge.zero
$TTL    86400
@               IN SOA  www.bridge.org.      root.bridge.org. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
    IN    NS    www.bridge.org.
node-scan      IN   A   192.168.88.100
node-scan      IN   A   192.168.88.101
node-scan      IN   A   192.168.88.102
node1          IN   A   192.168.88.81
node2          IN   A   192.168.88.82
node1-vip      IN   A   192.168.88.91
node2-vip      IN   A   192.168.88.92



                                 
 #下面是修改之后的反向搜索文件   
 
 [root@www named]# cat 88.168.192.local
$TTL    86400
@       IN      SOA     www.bridge.org. root.bridge.org.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      www.bridge.org.
1       IN      PTR     www.bridge.org.
100     IN      PTR     node-scan.
101     IN      PTR     node-scan.
102     IN      PTR     node-scan.
81      IN      PTR     node1.
82      IN      PTR     node2.
91      IN      PTR     node1-vip.
92      IN      PTR     node2-vip.

   
dns配置注意:
修改权限:
cd /var/run
chmod 777 named

查看报错信息:
named -d 3 -f -g
tail -f /var/log/messages
建立soft link:
ln -s /var/named/chroot/etc/named.conf /etc/named.conf
ln -s /var/named/chroot/etc/named.zones /etc/named.zones

重启那么多服务
(4)为客户端添加dns解析:

编辑 /etc/resolv.conf 文件,
编辑后内容如下:
[root@node1 ~]# cat /etc/resolv.conf
search bridge.org       
nameserver 192.168.88.11
 
 修改 vi /etc/nsswitch.conf文件:
[root@node1 ~]# cat /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Legal entries are:
#
#    nisplus or nis+        Use NIS+ (NIS version 3)
#    nis or yp        Use NIS (NIS version 2), also called YP
#    dns            Use DNS (Domain Name Service)
#    files            Use the local files
#    db            Use the local database (.db) files
#    compat            Use NIS on compat mode
#    hesiod            Use Hesiod for user lookups
#    [NOTFOUND=return]    Stop searching if not found so far
#

# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:     db files nisplus nis

passwd:     files
shadow:     files
group:      files

#hosts:     db files nisplus nis dns
hosts:      dns files   #######更改此处的解析顺序

# Example - obey only what nisplus tells us...
#services:   nisplus [NOTFOUND=return] files
#networks:   nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:     nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files     

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files

netgroup:   nisplus

publickey:  nisplus

automount:  files nisplus
aliases:    files nisplus






 



RAC简单维护:
srvctl:
1.启动一个与数据库相关的所有实例:
srvctl start database -d bridge

2.关闭一个与数据库相关的所有实例:
srvctl stop database -d bridge

3.查看数据库的当前状态:
srvctl status database -d bridge

4.启动其中单一的实例:
srvctl start instance -d bridge -i bridge1
srvctl start instance -d bridge -n node1

5.表空间维护:
oracle 11G R2 RAC ASM 创建表空间:
CREATE TABLESPACE TBS_IMOOLLY DATAFILE '+DATA' SIZE 128M AUTOEXTEND ON NEXT 128M MAXSIZE 8192M;

删除表空间:
DROP TABLESPACE tablespacename INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;

oracle 11G R2 RAC ASM 创建临时表空间:
CREATE TEMPORARY TABLESPACE TBS_IMOOLLY_TEMP TEMPFILE '+DATA' SIZE 128M AUTOEXTEND ON NEXT 128M MAXSIZE 8192M;

创新互联公司专业为企业提供柞水网站建设、柞水做网站、柞水网站设计、柞水网站制作等企业网站建设、网页设计与制作、柞水企业网站模板建站服务,10年柞水做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。


本文名称:oracle11grac配置
路径分享:http://cxhlcq.com/article/jpsedd.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部