oracle11g rac 配置

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;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章