11g oracle database installation with oracle grid infrastructure on linux(文件)

lovehewenyu發表於2013-05-13

11g oracle database installation with oracle grid infrastructure on linux

 

一、預裝oracle database 準備

 

安裝11g oracle database所需的linux軟體包

binutils-2.17.50.0.6

compat-libstdc++-33-3.2.3

elfutils-libelf-0.125

elfutils-libelf-devel-0.125

gcc-4.1.2

gcc-c++-4.1.2

glibc-2.5-24

glibc-common-2.5

glibc-devel-2.5

glibc-headers-2.5

ksh-20060214

libaio-0.3.106

libaio-devel-0.3.106

libgcc-4.1.2

libstdc++-4.1.2

libstdc++-devel 4.1.2

make-3.81

sysstat-7.0.2

官檔地址:

http://docs.oracle.com/cd/E11882_01/install.112/e24321/pre_install.htm#i1011296

 

安裝命令執行

yum install binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibcglibc-common glibc-devel glibc-headers ksh-20060214 libaio libaio-devel libgcc libstdc++- libstdc++-devel make-3.81 sysstat unixODBC unixODBC-devel

(unixODBCunixODBC-develODBC的支援包;ODBC更多解釋:http://zh.wikipedia.org/zh-cn/ODBC)

 

安裝cvuqdiskCluster Verification Utility find shared disks

[root@doudou-32bit tmp]# cd /opt/grid/rpm/

[root@doudou-32bit rpm]# export CVUQDISK_GRP=oinstall

[root@doudou-32bit rpm]# rpm -iv cvuqdisk-1.0.7-1.rpm

 

建立oracle產品組,root使用者

vi /etc/oraInst.loc

inventory_loc=/u01/app/oraInventory

inst_group=oinstall

 

DNS解析,直接配置hosts檔案

vi /etc/hosts

192.168.1.217 doudou    doudou

 

磁碟要求,請看附表

 

記憶體和SWAP要求

--oracle database--

Minimum: 1 GB of RAM

Recommended: 2 GB of RAM or more

SWAP建議

RAM

Swap Space

Between 1 GB and 2 GB

1.5 times the size of the RAM

Between 2 GB and 16 GB

Equal to the size of the RAM

More than 16 GB

16 GB

--Oracle grid infrastructure--

RAM>=1.5G  oracle grid

RAM>=2.5G  oracle grid + oracle database

RAM>=4G   oracle grid + oracle rac

SWAP建議

Available RAM

Swap Space Required

Between 2.5 GB and 32 GB

Equal to the size of RAM

More than 32 GB

32 GB of RAM

 

檢視當前swap

grep SwapTotal /proc/meminfo

注:線上增加swap,請看附表增加swap

檢視當前shmfs

df -h /dev/shm

注:oracle 11g AMM 使用記憶體需要通過更多的共享記憶體

(如需增加/dev/shm請看附表增加/dev/shm

 

建立組

/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 -u 501 -g oinstall -G dba,oper,asmdba oracle

/usr/sbin/useradd -u 8001 -g oinstall -G asmadmin,asmdba,asmoper,dba grid

修改密碼

passwd oracle

passwd grid

注:具體組和使用者含義請看附表Overview of Groups and Users

使用者環境變數

--oracle---

vi .bash_profile

export ORACLE_SID=doudou

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

export TMP=/tmp

export TMPDIR=/u01/tmp

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:

umask 022

--grid--

vi .bash_profile

export ORACLE_SID=+ASM

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=$ORACLE_BASE/11.2.0/dbhome_1

export TMP=/tmp

export TMPDIR=/u01/tmp

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:

umask 022

注:tmp空間不足時,新增TMPDIR;可以看附表增大tmp

建立目錄

--oracle database--

mkdir -p /u01/app/oracle

mkdir -p /u01/app/oraInventory

chown -R oracle:oinstall /u01/app/oracle

chown oracle:oinstall /u01/app/oraInventory

--oracle grid infrastructure--

mkdir -p /u01/app/grid

mkdir -p /u01/app/11.2.0/grid

chown -R grid:oinstall /u01/app/grid

chmod -R 775 /u01


注:具體目錄含義請看附表Overview of directories

 

安裝使用者資源限制

vi /etc/security/limits.conf

oracle              soft    nproc   2047

oracle              hard    nproc   16384

oracle              soft    nofile  1024

oracle              hard    nofile  65536

oracle              soft    stack   10240

grid              soft    nproc   2047

grid              hard    nproc   16384

grid              soft    nofile  1024

grid              hard    nofile  65536

grid              soft    stack   10240

 

對預設的shell啟動檔案進行更改,以便oracle安裝所有者的 ulimit設定

[root@doudou-32bit ~]# vi /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

 

更改核心引數值

vi /etc/sysctl.conf

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 524288

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 = 1048576

執行sysctl -p 立即生效

注: shmall and shmmax解釋請看附表 shmall and shmmax

 

二、ASM DISKopenfiler模擬儲存伺服器)

1、 使用udev製作ASM DISK

2、 使用asmlib製作 ASM DISK

 

製作partitions

fdisk -l --(檢視識別的硬碟)

具體制作partition具體步驟如下:

fdisk /dev/sda

n

p

1

回車

回車

w

partprobe /dev/sda1

其他分割槽省略

 

1、 使用udev製作ASM DISK

製作完分割槽後,使用udev固化iscsi磁碟裝置名稱

檢視儲存磁碟scsi_idscsi_id具有唯一性)

[root@localhost rules.d]# scsi_id -g -u -s /block/sdb

14f504e46494c4500764a6b65714e2d416b5a432d314d6753

[root@localhost rules.d]# scsi_id -g -u -s /block/sdc

14f504e46494c45004532476568362d566f35702d35303470

建立新的 vi /etc/udev/rules.d/99-oracle-asmdevices.rules

[root@localhost rules.d]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="14f504e46494c4500764a6b65714e2d416b5a432d314d6753", NAME="asm_data-1", WNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="14f504e46494c45004532476568362d566f35702d35303470", NAME="asm_data-2", WNER="grid", GROUP="asmadmin", MODE="0660"

[root@doudou ~]# start_udev start

啟動 udev[確定]

[root@localhost rules.d]# ls -l /dev/asm*

brw-rw---- 1 grid asmadmin 8, 16 05-03 17:58 /dev/asm_data-1

brw-rw---- 1 grid asmadmin 8, 32 05-03 17:58 /dev/asm_data-2

OK到此我們使用udev製作的ASM DISK完成

注:個人推薦使用udev製作ASM DISK

至於什麼不使用asmlib?可以看看maclean liu的見解

http://www.askmaclean.com/archives/why-asmlib-and-why-not.html

 

2、使用asmlib製作 ASM DISK

2-1.檢視作業系統版本

[root@doudou-32bit ~]# uname -rm

2.6.18-348.3.1.el5 i686

2-2.下載相關的asmlib

http://www.oracle.com/technetwork/topics/linux/asmlib/index-101839.html

oracleasm-2.6.18-348.3.1.el5-2.0.5-1.el5.i686.rpm

oracleasm-2.6.18-348.3.1.el5debug-2.0.5-1.el5.i686.rpm

oracleasm-2.6.18-348.3.1.el5PAE-2.0.5-1.el5.i686.rpm

oracleasm-2.6.18-348.3.1.el5xen-2.0.5-1.el5.i686.rpm

oracleasmlib-2.0.4-1.el5.i386.rpm

oracleasm-support-2.1.8-1.el5.i386.rpm

安裝包過程省略

2-3.配置oracleasm

[root@doudou-32bit ~]# /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) [y]: 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  ]

2-4.使用oracleasm建立ASM DISK

[root@doudou-32bit ~]#  /etc/init.d/oracleasm createdisk DISK1 /dev/sda1

其餘省略

[root@doudou-32bit ~]#  /etc/init.d/oracleasm  listdisks

DISK1

DISK2

DISK3

DISK4

DISK5

DISK6

DISK7

DISK8

OK到此使用asmlib製作ASM DISK完成

 

安裝oracle grid infrastructure

[root@doudou-32bit ~]# su grid

[grid@doudou-32bit ~]$ export DISPLAY=192.168.1.25:0.0

[grid@doudou-32bit grid]$ ./runInstaller

圖形安裝過程省略

需要注意的是,oracle asm 提供了3種冗餘

External redundancy --1ASM DISK即可(磁碟有raid支援情況下)每個磁碟無大小要求

Normal redundancy   --2ASM DISK必須(沒有raid建議使用)EACH ASM DISK SIZE 1:1

High redundancy     --3ASM DISK必須(沒有raid建議使用) EACH ASM DISK SIZE 1:1:1

[grid@doudou-32bit grid]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 18 14:26:05 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Automatic Storage Management option

SQL> select name,state,type,total_mb,free_mb,usable_file_mb from v$asm_diskgroup;

NAME       STATE       TYPE     TOTAL_MB    FREE_MB USABLE_FILE_MB

---------- ----------- ------ ---------- ---------- --------------

DATA       MOUNTED     NORMAL      30708      30529          15234  --為可用空間

REDO       MOUNTED     EXTERN        511        459            459

注:USABLE_FILE_MB ASM DISK 磁碟組真實可用空間

 

安裝oracle database

[root@doudou-32bit ~]# su - oracle

[oracle@doudou-32bit ~]$ export DISPLAY=192.168.1.25:0.0

[oracle@doudou-32bit database]$ ./runInstaller

圖形安裝過程省略

需要注意的是:database 字符集的選擇

 

附表

11g Oracle Database installation with Oracle grid infrastructure

 

磁碟要求

oracle database磁碟最小需求

The following tables describe the disk space requirements for software files and data files for each installation type on Linux x86:

Installation Type

Requirement for Software Files (GB)

Enterprise Edition

3.95

Standard Edition

3.88

Installation Type

Disk Space for Data Files (GB)

Enterprise Edition

1.7

Standard Edition

1.5

官檔地址:

http://docs.oracle.com/cd/E11882_01/install.112/e24321/pre_install.htm#autoId12

oracle grid infrastructure磁碟最小要求

At least 5.5 GB of disk space.

At least 1 GB of space in the /tmp directory.

 

Overview of Groups and Users

功能

作業系統組名

備註

Oracle Inventory Group

oinstall

 

OSDBA Group for Database Installations

dba

 

OSOPER Group for Database Installations

oper

 

OSASM Group for Oracle Automatic Storage Management

asmadmin

連線Oracle ASM 例項

OSDBA Group for Oracle Automatic Storage Management

asmdba

必須組

OSOPER Group for Oracle Automatic Storage Management

asmoper

可選組

***********************************************

************          

*******************                   

功能

作業系統使用者

備註

Oracle Software Owner User

oracle

 

Oracle grid infrastructure Software Owner User

grid

 

官檔地址:

http://docs.oracle.com/cd/E11882_01/install.112/e24321/pre_install.htm#BABHHEJD

下面是oracle技術文件中的解釋更為詳細精準

Description

OS Group Name

OS Users Assigned to this Group

Oracle Privilege

Oracle Group Name

Oracle Inventory and Software Owner

oinstall

grid, oracle

 

 

Oracle Automatic Storage Management Group

asmadmin

grid

SYSASM

OSASM

ASM Database Administrator Group

asmdba

grid, oracle

SYSDBA for ASM

OSDBA for ASM

ASM Operator Group

asmoper

grid

SYSOPER for ASM

OSOPER for ASM

Database Administrator

dba

oracle

SYSDBA

OSDBA

Database Operator

oper

oracle

SYSOPER

OSOPER

 

 

Overview of directories

目錄名

模版

建立的目錄

Oracle base directory

/mount_point/app/software_owner

/u01/app/oracle

Oracle inventory directory

ORACLE_BASE/oraInventory

/u01/app/oracle/oraInventory

Oracle home directory

ORACLE_BASE/product/11.2.0/dbhome_1

/u01/app/oracle/product/11.2.0/dbhome_1

*************************

***********************************

****************

Oracle Grid Infrastructure base directory

/mount_point/app/software_owner

/u01/app/grid

Oracle Grid Infrastructure inventory directory

ORACLE_BASE/oraInventory

/u01/app/grid/oraInventory

Oracle Grid Infrastructure home directory

/u01/app/11.2.0/grid

/u01/app/11.2.0/grid

官檔地址:

http://docs.oracle.com/cd/E11882_01/install.112/e24321/pre_install.htm#autoId52

 

增加/dev/shm

共享記憶體的標準:The size of the shared memory must be at least the greater of the MEMORY_MAX_TARGET and MEMORY_TARGET parameters for each Oracle instance on the computer.

[root@doudou-32bit ~]# df -h /dev/shm

檔案系統              容量  已用 可用 已用% 掛載點

tmpfs                 990M  154M  836M  16% /dev/shm

如果/dev/shm太小,我們可以新增/dev/shm

暫時新增/dev/shm方法:mount -t tmpfs shmfs -o size=2g /dev/shm

永久新增/dev/shm方法:vi /etc/fstab 

尾部新增一行 shmfs /dev/shm tmpfs size=2g 0

我使用的永久新增方法,可以不重啟機器直接mount a 立即生效/etc/fstab的內容

[root@doudou-32bit grid]# mount a

增大/dev/shm的結果展示

[root@doudou-32bit ~]# df -h /dev/shm

檔案系統              容量  已用 可用 已用% 掛載點

shmfs                 2.0G     0  2.0G   0% /dev/shm

官檔地址:

http://docs.oracle.com/cd/E11882_01/install.112/e24321/pre_install.htm#autoId10

 

shmall and shmmax

shmallphysical memory/PAGESIZE

shmmaxRecommended: More than half the physical memory

這個shmmax引數是限制shared memory segments (mos 567506.1),可不要認為這個引數是限制SGAmemory_max_target

官檔地址:

http://docs.oracle.com/cd/E11882_01/install.112/e24321/pre_install.htm#autoId50

 

增大tmp

mkdir -p /u01/tmp

chmod -R a+wr /u01/tmp

使用者環境變數

export TMPDIR=/u01/tmp

 

線上增加swap

1、建立交換分割槽目錄

mkdir -p /opt/image

2、建立swap所需檔案(以2G為例)

dd if=/dev/zero f=/opt/image/swap bs=1024 count=2048000

3、建立交換空間,使用命令nkswap

nkswap /opt/image/swap

4、啟動新增交換空間,使用命令swapon

swapon /opt/image/swap

5、檢視是否新增成功

free -m

6、修改/etc/fstab檔案,設定永久型swap即開機自動掛載

vi /etc/fstab

尾部新增

/opt/image/swap     swap      swap defaults 0 0

7、不重啟,直接掛載驗證/etc/fstab修改結果

mount -a

free -m

 

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

相關文章