一步一步搭建11gR2 rac+dg之DG 機器配置(七)

cxs86621發表於2015-05-05
  1. DG 機器配置

 

本文文件結構:

這一步的DG機器配置就相當於安裝單例項的DB+ASM 一樣,這裡我把之前的文件內容直接複製過來了,也不做過多的解釋了

 

  1. 安裝之前的配置工作

 

  1. 檢查硬體

在正式安裝開始前,請先檢查你的軟硬體條件是否滿足安裝需要。

硬體上可以使用命令檢視記憶體情況和 CPU 特性:

#more /proc/meminfo

#more /proc/cpuinfo

其中記憶體的要求是不低於 1G

下面的不是必須的,可選使用

#df –k /dev/shm 檢查共享記憶體

#df –k /tmp 檢查臨時磁碟空間

#more /proc/version 檢查作業系統版本

#uname –r 檢查核心版本

 

記憶體

# grep MemTotal /proc/meminfo

交換空間

# grep SwapTotal /proc/meminfo

磁碟空間

# df -ah

# free

#free -m

 

  1. 安裝軟體包檢查

 

可以統一檢查:

rpm -q binutils \

compat-libstdc++-33 \

elfutils-libelf \

gcc \

gcc-c++ \

glibc \

glibc-common \

glibc-devel \

glibc-headers \

ksh \

libaio \

libaio-devel \

libgomp \

libgcc \

libstdc++ \

libstdc++-devel \

make \

sysstat \

unixODBC \

unixODBC-devel \

numactl-devel

 

我們可以看到沒有安裝過的包會已is not installed 出現:

[root@rhel6_lhr ~]# rpm -q binutils \

> compat-libstdc++-33 \

> elfutils-libelf \

> gcc \

> gcc-c++ \

> glibc \

> glibc-common \

> glibc-devel \

> glibc-headers \

> ksh \

> libaio \

> libaio-devel \

> libgomp \

> libgcc \

> libstdc++ \

> libstdc++-devel \

> make \

> sysstat \

> unixODBC \

> unixODBC-devel \

> numactl-devel

binutils-2.20.51.0.2-5.36.el6.x86_64

compat-libstdc++-33-3.2.3-69.el6.x86_64

compat-libstdc++-33-3.2.3-69.el6.i686

elfutils-libelf-0.152-1.el6.x86_64

gcc-4.4.7-4.el6.x86_64

gcc-c++-4.4.7-4.el6.x86_64

glibc-2.12-1.132.el6.x86_64

glibc-common-2.12-1.132.el6.x86_64

glibc-devel-2.12-1.132.el6.x86_64

glibc-headers-2.12-1.132.el6.x86_64

package ksh is not installed

libaio-0.3.107-10.el6.x86_64

libaio-devel-0.3.107-10.el6.x86_64

libaio-devel-0.3.107-10.el6.i686

libgomp-4.4.7-4.el6.x86_64

libgcc-4.4.7-4.el6.x86_64

libstdc++-4.4.7-4.el6.x86_64

libstdc++-devel-4.4.7-4.el6.x86_64

libstdc++-devel-4.4.7-4.el6.i686

make-3.81-20.el6.x86_64

sysstat-9.0.4-22.el6.x86_64

unixODBC-2.2.14-12.el6_3.x86_64

unixODBC-2.2.14-12.el6_3.i686

unixODBC-devel-2.2.14-12.el6_3.i686

unixODBC-devel-2.2.14-12.el6_3.x86_64

package numactl-devel is not installed

[root@rhel6_lhr ~]#

   

如果部分包不存在

可以批次更新安裝,但如果依賴關係缺失,可能需要多執行兩遍

或者手工調整

 

 

  1. 修改主機名

永久生效:

[root@zijuan /]# vim /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=yes

HOSTNAME=dg

 

注意:修改主機名後,需要重啟系統後生效,或者切換個使用者然後切換回來就OK

 

 

檢視/etc/hosts檔案中必須包含a fully qualified name for the server

 [root@localhost lhr]# cat /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.59.140 dg

[root@localhost lhr]# hostname dg

[root@localhost lhr]# hostname

dg

 

  1. 磁碟準備

 

這裡為了節省空間,我們採用dd命令來faking 5塊裸裝置磁碟

 

1塊硬碟安裝作業系統

234塊用於實現ASM 儲存資料

5塊硬碟用於儲存FRA

 

 

------------------------ 直接貼指令碼,root使用者下執行

mkdir /asmdisk

dd if=/dev/zero of=/asmdisk/disk1 bs=1024k count=2000

dd if=/dev/zero of=/asmdisk/disk2 bs=1024k count=2000

dd if=/dev/zero of=/asmdisk/disk3 bs=1024k count=2000

dd if=/dev/zero of=/asmdisk/disk4 bs=1024k count=2000

dd if=/dev/zero of=/asmdisk/disk5 bs=1024k count=2000

 

/sbin/losetup /dev/loop1 /asmdisk/disk1

/sbin/losetup /dev/loop2 /asmdisk/disk2

/sbin/losetup /dev/loop3 /asmdisk/disk3

/sbin/losetup /dev/loop4 /asmdisk/disk4

/sbin/losetup /dev/loop5 /asmdisk/disk5

 

raw /dev/raw/raw1 /dev/loop1

raw /dev/raw/raw2 /dev/loop2

raw /dev/raw/raw3 /dev/loop3

raw /dev/raw/raw4 /dev/loop4

raw /dev/raw/raw5 /dev/loop5

 

chmod 660 /dev/raw/raw1

chmod 660 /dev/raw/raw2

chmod 660 /dev/raw/raw3

chmod 660 /dev/raw/raw4

chmod 660 /dev/raw/raw5

chown oracle:dba /dev/raw/raw1

chown oracle:dba /dev/raw/raw2

chown oracle:dba /dev/raw/raw3

chown oracle:dba /dev/raw/raw4

chown oracle:dba /dev/raw/raw5

 

------ 將以下內容新增到檔案/etc/rc.local檔案中

------Add the following entries to the file "/etc/rc.local"

/sbin/losetup /dev/loop1 /asmdisk/disk1

/sbin/losetup /dev/loop2 /asmdisk/disk2

/sbin/losetup /dev/loop3 /asmdisk/disk3

/sbin/losetup /dev/loop4 /asmdisk/disk4

/sbin/losetup /dev/loop5 /asmdisk/disk5

 

raw /dev/raw/raw1 /dev/loop1

raw /dev/raw/raw2 /dev/loop2

raw /dev/raw/raw3 /dev/loop3

raw /dev/raw/raw4 /dev/loop4

raw /dev/raw/raw5 /dev/loop5

 

chmod 660 /dev/raw/raw1

chmod 660 /dev/raw/raw2

chmod 660 /dev/raw/raw3

chmod 660 /dev/raw/raw4

chmod 660 /dev/raw/raw5

chown oracle:dba /dev/raw/raw1

chown oracle:dba /dev/raw/raw2

chown oracle:dba /dev/raw/raw3

chown oracle:dba /dev/raw/raw4

chown oracle:dba /dev/raw/raw5

 

 

 

如果需要刪除的話,刪除命令:

losetup –d /dev/loop1

losetup –d /dev/loop1

......

 

 

 

檢視結果:

 

[root@dg ~]# ll /dev/raw/raw*

crw-rw---- 1 oracle dba 162, 1 Oct 9 16:35 /dev/raw/raw1

crw-rw---- 1 oracle dba 162, 2 Oct 9 16:35 /dev/raw/raw2

crw-rw---- 1 oracle dba 162, 3 Oct 9 16:35 /dev/raw/raw3

crw-rw---- 1 oracle dba 162, 4 Oct 9 16:35 /dev/raw/raw4

crw-rw---- 1 oracle dba 162, 5 Oct 9 16:35 /dev/raw/raw5

crw-rw---- 1 root disk 162, 0 Oct 5 15:42 /dev/raw/rawctl

[root@dg ~]#

 

 

 

更多請參考:

 

 

  1. 配置目錄、使用者等

 

  1. 配置使用者及使用者組

利用 /usr/sbin/groupadd 命令

 

------這裡Oracle使用者可能已經安裝過的,沒有影響:

程式碼:

groupadd oinstall

groupadd dba

groupadd oper

groupadd asmadmin

groupadd asmoper

groupadd asmdba

 

--新增使用者到組

useradd -g oinstall -G dba,asmdba,oper,asmadmin oracle

useradd -g oinstall -G asmadmin,asmdba,asmoper,dba grid

 

--修改密碼

passwd oracle

passwd grid

 

echo oracle | passwd --stdin lhr

echo grid | passwd --stdin lhr

 

---檢視屬主

[root@rhel_linux_asm ~]# id oracle

uid=501(oracle) gid=502(dba) groups=502(dba),501(oinstall),504(asmadmin),506(asmdba)

[root@rhel_linux_asm ~]# id grid

uid=502(grid) gid=501(oinstall) groups=501(oinstall),502(dba),504(asmadmin),505(asmoper),506(asmdba)

[root@rhel_linux_asm ~]#

  1. 建立目錄並且配置 grid 和 oracle 使用者的配置檔案

程式碼:

--root使用者下:

mkdir -p /u01/app/oracle

mkdir -p /u01/app/grid

mkdir -p /u01/app/11.2.0/grid

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

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

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

chmod -R 775 /u01

 

mkdir -p /u01/app/oraInventory

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

chmod -R 775 /u01/app/oraInventory

 

 

--------Oracle User----切換到Oracle使用者下------

[root@rhel_linux_asm ~]# su - oracle

[grid@rhel_linux_asm ~]$ vi ~/.bash_profile

export ORACLE_SID=phydb

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"

export TMP=/tmp

export TMPDIR=$TMP

export PATH=$PATH:$ORACLE_HOME/bin

 

 

export GLOBAL_DB_UNIQUE_NAME=phydb

export ORACLE_HOSTNAME=192.168.59.140

export ORACLE_UNQNAME=phydb

 

 

 

export ORACLE_ALERT=$ORACLE_BASE/diag/rdbms/$ORACLE_UNQNAME/$ORACLE_SID/trace

alias sqlplus='rlwrap sqlplus'

alias rman='rlwrap rman'

alias asmcmd='rlwrap asmcmd'

alias alert_log='tail -200f $ORACLE_ALERT/alert_$ORACLE_SID.log'

alias alert_listener='tail -200f $ORACLE_BASE/diag/tnslsnr/rhel6/listener/trace/listener.log'

 

 

--------Grid User-----切換到grid使用者下-----

 

cd /home/grid

vim .bash_profile

export ORACLE_SID=+ASM

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/11.2.0/grid

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"

export PATH=$ORACLE_HOME/bin:$PATH

 

alias sqlplus='rlwrap sqlplus'

alias asmcmd='rlwrap asmcmd'

alias alert_log='tail -200f $ORACLE_BASE/diag/asm/+asm/$ORACLE_SID/trace/alert_$ORACLE_SID.log'

 

修改完成後執行 source .bash_profile 讓設定生效

  1. 系統核心引數修改

    1. 編輯 /etc/security/limits.conf 檔案,在檔案尾部新增如下內容:

[root@localhost ~]# tail -8 /etc/security/limits.conf

# add by lhr for oracle and grid on 2014-05-02

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 1024

grid hard nofile 65536

  1. 編輯 /etc/pam.d/login 檔案,在檔案尾部新增如下內容:

[root@localhost ~]# tail -1 /etc/pam.d/login

session required pam_limis.so

[root@localhost ~]#

  1. 編輯 /etc/profile 檔案,設定 shell 限制,在檔案尾部新增如下內容:

[root@localhost ~]# tail -9 /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

 

  1. /etc/sysctl.conf

Configuring Kernel Parameters for Linux

 

vim /etc/sysctl.conf

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 4294967295

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

 

生效

# /sbin/sysctl -p

 

 

  1. 備庫安裝grid軟體

安裝GridInfrastructure:

 

 

  1. 建立ASM磁碟組

 

 

 

  1. 執行root指令碼

 

 

[root@dg 11.2.0]# /u01/app/oraInventory/orainstRoot.sh

Changing permissions of /u01/app/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

 

Changing groupname of /u01/app/oraInventory to oinstall.

The execution of the script is complete.

 

[root@dg 11.2.0]# /u01/app/11.2.0/grid/root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

ORACLE_OWNER= grid

ORACLE_HOME= /u01/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

The contents of "dbhome" have not changed. No need to overwrite.

The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

[n]:

The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

[n]:

 

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params

Creating trace directory

LOCAL ADD MODE

Creating OCR keys for user 'grid', privgrp 'oinstall'..

Operation successful.

LOCAL ONLY MODE

Successfully accumulated necessary OCR keys.

Creating OCR keys for user 'root', privgrp 'root'..

Operation successful.

CRS-4664: Node dg successfully pinned.

Adding Clusterware entries to upstart

 

dg 2014/10/02 22:59:43 /u01/app/11.2.0/grid/cdata/dg/backup_20141002_225943.olr

Successfully configured Oracle Grid Infrastructure for a Standalone Server

[root@dg 11.2.0]#

 

 

  1. 安裝oracle軟體

①以oracle使用者登入圖形介面,執行/home/oracle/database/runInsta

 

 

 

 

 

 

[root@dg ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

ORACLE_OWNER= oracle

ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

The contents of "dbhome" have not changed. No need to overwrite.

The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

[n]:

The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

[n]:

 

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

[root@dg ~]#

 

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

相關文章