oracle11Gr2安裝ASM,使用裸裝置

edwardking888發表於2010-04-20

今天在在辦公室的實驗計算機上安裝了oracle11GR2

軟體環境是:CENTOS5.4    +    oracle11Gr2

記憶體2GB

硬碟160GB

一、安裝所需系統與軟體簡介

作業系統:RHEL 5.4 x86_64   rhel-server-5.4-x86_64-dvd.iso

ASM software:

oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm                                               oracleasm-support-2.1.3-1.el5.x86_64.rpm
oracleasmlib-2.0.4-1.el5.x86_64.rpm

11gR2 GRID: p10098816_112020_Linux-x86-64_1of7.zip

11gR2 Database: p10098816_112020_Linux-x86-64_1of7.zip                p10098816_112020_Linux-x86-64_2of7.zip

二、檢查必要的軟體是否已被安裝

grid軟體和database軟體安裝要求是一樣的

binutils-2.17.50.0.6
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-common-2.5
ksh-20060214
libstdc++-devel 4.1.2
make-3.81
sysstat-7.0.2
pdksh

libaio-devel

三、網路環境的配置


1. /etc/hosts

[root@asm11g ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.75.38            asm11g.zhyhl.com asm11g


 

四、建立組、使用者和目錄

/usr/sbin/groupadd -g 1000 oinstall
/usr/sbin/groupadd -g 1100 asmadmin
/usr/sbin/groupadd -g 1200 dba
/usr/sbin/groupadd -g 1300 asmdba
/usr/sbin/groupadd -g 1301 asmoper

/usr/sbin/useradd -u 1100 -g oinstall -G dba,asmadmin,asmdba,asmoper grid
/usr/sbin/useradd -u 1101 -g oinstall -G dba,asmadmin,asmdba oracle


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

設定grid和oracle使用者密碼:

/usr/bin/passwd   grid
/usr/bin/passwd   oracle

注意及參考事項:

注意:如果grid中不包含dba組,則dbca的時候會停止報錯,且使用srvctl時也會報如下錯誤
(此時資料庫已經可以建立完畢,可以通過sqlplus 來啟動)。

五、配置系統

1. 配置並修改核心引數

vi /etc/sysctl.conf

net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1

 

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 4097152
kernel.shmmax = 8294967295
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


vm.min_free_kbytes = 409600
vm.swappiness = 20
vm.dirty_ratio = 20
vm.vfs_cache_pressure=200

2. 為oracle使用者設定shell限制

(1) /etc/pam.d/login

 
session    required     pam_limits.so
 

(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/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
 

(4) /etc/csh.login

 
if ( $USER == "oracle" || $USER == "grid" ) then
        limit maxproc 16384
        limit descriptors 65536
    umask 022
endif
 

六、使用者環境變數


1. grid    /home/grid/.bash_profile
-----------------------------------

export ORACLE_BASE=/u01/app/grid
export ORACLE_SID=+ASM

export ORACLE_HOME=/u01/app/grid/product/11.2.0/grid
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64
export ORACLE_TERM=xterm
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export TNS_ADMIN=$ORACLE_HOME/network/admin

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;
# export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
# export NLS_LANG="Simplified Chinese_China.ZHS16CGB231280"
# export NLS_LANG="Simplified Chinese_China.UTF8"

2. oracle  /home/oracle/.bash_profile
-------------------------------------

export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64
export ORACLE_HOSTNAME=asm11g
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;
# export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
# export NLS_LANG="Simplified Chinese_China.ZHS16CGB231280"
# export NLS_LANG="Simplified Chinese_China.UTF8"

 

七、配置ASM

1. 準備ASM磁碟

ASM磁碟準備了2塊.

2. disk partition alignment

省略。。。。。。。。。

3. 安裝和配置ASM

首先使用uname -rm
確定LINUX核心版本,然後去oracle網站:RHEL5下的ASMLib2.0下載地址:
http://www.oracle.com/technology/global/cn/tech/linux/asmlib/index.html

下載ASMLIB包。

然後安裝:

rpm   -Uvh  oracleasm-support-2.1.3-1.el5.x86_64.rpm  oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm  oracleasmlib-2.0.4-1.el5.x86_64.rpm

注意:

1.具體的包名和你的作業系統有關。

2.如果是oracle linux(最新版本的oracle linux可能還不帶有,只能使用裸裝置了,或等待一段時間) 只要安裝下面的包,就自動包含ASMLIB包了:

yum install kernel-uek kernel-uek-devel kernel-uek-headers kernel-uek-firmware


最好設定好oracle的安裝環境變數

 

 

二。配置ASMLIB

啟動oracle asmlib:

 #/etc/init.d/oracleasm start

 

啟用asmlib:

#/etc/init.d/oracleasm enable
Writing Oracle ASM library driver configuration:   [ OK ]
Loading module "oracleasm":                        [ OK ]
Mounting ASMlib driver filesystem:                 [ OK ]
Scanning system for ASM disk

[root@asm11g ~]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: grid           Default group to own the driver interface []: asmadmin      Start Oracle ASM library driver on boot (y/n) [n]: y        Scan for Oracle ASM disks on boot (y/n) [y]: y              Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [  OK  ]
Scanning the system for Oracle ASMLib disks: [  OK  ]

#/etc/init.d/oracleasm createdisk VOL_C /dev/sdc1

當向RAC設定中新增磁碟時,需要通知其它節點該磁碟的存在:

在一個節點上執行建立ASM磁碟,然後在其它節點上執行:

# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks: [ OK ]
 

檢視狀態:
[root@asm11g ~]# /etc/init.d/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes

 /etc/init.d/oracleasm createdisk VOL_A /dev/sdb1
 /etc/init.d/oracleasm createdisk VOL_B /dev/sdb2

如果建立磁碟失敗,可以檢視:

cat  /var/log/oracleasm
 獲取操作日誌.

八、安裝GRID

1. 以grid身份登入系統,在解開的grid軟體目錄中,執行./runInstaller

2. 選擇:Install and Configure Grid Infrastructure for a Standalone Server

3。檢驗安裝與配置

[grid@asm11g grid]$ srvctl status asm
ASM is running on asm11g
[grid@asm11g grid]$
[grid@asm11g grid]$ srvctl  status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): asm11g
[grid@asm11g grid]$


[grid@asm11g grid]$ ps -ef |grep +ASM
grid     11032     1  0 20:58 ?        00:00:00 asm_pmon_+ASM
grid     11034     1  0 20:58 ?        00:00:00 asm_vktm_+ASM
grid     11038     1  0 20:58 ?        00:00:00 asm_gen0_+ASM
grid     11040     1  0 20:58 ?        00:00:00 asm_diag_+ASM
grid     11042     1  0 20:58 ?        00:00:00 asm_psp0_+ASM
grid     11044     1  0 20:58 ?        00:00:00 asm_dia0_+ASM
grid     11046     1  0 20:58 ?        00:00:00 asm_mman_+ASM
grid     11048     1  0 20:58 ?        00:00:00 asm_dbw0_+ASM
grid     11050     1  0 20:58 ?        00:00:00 asm_lgwr_+ASM
grid     11052     1  0 20:58 ?        00:00:00 asm_ckpt_+ASM
grid     11054     1  0 20:58 ?        00:00:00 asm_smon_+ASM
grid     11056     1  0 20:58 ?        00:00:00 asm_rbal_+ASM
grid     11058     1  0 20:58 ?        00:00:00 asm_gmon_+ASM
grid     11060     1  0 20:58 ?        00:00:00 asm_mmon_+ASM
grid     11062     1  0 20:58 ?        00:00:00 asm_mmnl_+ASM
grid     11228  5501  0 21:02 pts/0    00:00:00 grep +ASM
[grid@asm11g grid]$


[grid@asm11g grid]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    asm11g      
ora.FRA.dg     ora....up.type ONLINE    ONLINE    asm11g      
ora....ER.lsnr ora....er.type ONLINE    ONLINE    asm11g      
ora.asm        ora.asm.type   ONLINE    ONLINE    asm11g      
ora.cssd       ora.cssd.type  ONLINE    ONLINE    asm11g      
ora.diskmon    ora....on.type ONLINE    ONLINE    asm11g      
 
4.asmca建立磁碟組


使用VOL5和VOL6建立閃回區所用的磁碟組:FRA
[grid@asm11g ~]$ which asmca
/u01/app/grid/product/11.2.0/grid/bin/asmca


檢視ASM磁碟組的資訊:

[grid@asm11g grid]$ sqlplus "/as sysasm"


col disk format a15
col disk_group format a15

select a.name disk, b.name disk_group
from v$asm_disk a, v$asm_diskgroup b
where a.group_number = b.group_number;

DISK            DISK_GROUP
--------------- ---------------
VOL1            DATA
VOL2            DATA


6 rows selected.

 

九、安裝資料庫

1. 安裝資料庫軟體

   以oracle使用者登入系統,在解開的oracle軟體目錄中,執行./runInstaller

2. 建立資料庫dbca

   選擇ASM作為儲存,輸入ASMSNMP的密碼,資料庫存放區選擇+DATA, FRA區選擇+FRA。

3. 資料庫的啟動與關閉

[oracle@asm11g ~]$ srvctl status database -d orcl
Database is running.
[oracle@asm11g ~]$

[oracle@asm11g ~]$ srvctl stop database -d orcl
[oracle@asm11g ~]$ srvctl start database -d orcl

 

查詢RPM包使用rpm -qal | grep oracleasm

 

解除安裝RPM包使用 rpm -e

 

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8183550/viewspace-660269/,如需轉載,請註明出處,否則將追究法律責任。

相關文章