rhel 6.4 + udev + 11.2.0.3 + asm 单点安装


第一块磁盘的大小为50G,安装RHEL6.4 及 gi standalone,oracle software。
第二块磁盘的大小为40G,使用udev配置成asm的磁盘。


安装OS结束后,执行下面的步骤

cd /mnt
mkdir cdrom
mount /dev/cdrom /mnt/cdrom


chkconfig cups off
chkconfig sendmail off
chkconfig isdn off
chkconfig smartd off
chkconfig iptables off

reboot

创建第二块盘
cd D:\Program Files\VMware\VMware Server

vmware-vdiskmanager.exe -c -s 40000Mb -a lsilogic -t 2 H:/VM_ware/asm_data1.vmdk

下面类容添加到 dbasm 的 Red Hat Linux.vmx中

scsi1.present = "TRUE" 
scsi1.virtualDev = "lsilogic" 
scsi1.sharedBus = "virtual" 

scsi1:1.present = "TRUE" 
scsi1:1.mode = "independent-persistent" 
scsi1:1.filename = "H:/VM_ware/asm_data1.vmdk" 
scsi1:1.deviceType = "plainDisk" 

disk.locking = "false" 
diskLib.dataCacheMaxSize = "0" 
diskLib.dataCacheMaxReadAheadSize = "0" 
diskLib.DataCacheMinReadAheadSize = "0" 
diskLib.dataCachePageSize = "4096" 
diskLib.maxUnsyncedWrites = "0"

需要添加内容结束


修改OS的信息

vi /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=dbasm

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:59:4B:00
ONBOOT=yes
IPADDR=10.1.1.35
NETMASK=255.255.255.0
GATEWAY=10.1.1.1


vi /etc/hosts
10.1.1.35 asmnode


--重启网络服务,使修改生效
service network restart


建立oracle,grid用户
11gr2建议将oracle用户的权限分离,当然不分离也是可以的,不过分离是应该的,
把数据库用户和存储用户区别开,就好比 data tablespace 和index tablespace 一样让人概念清晰,管理方便
估计会在12c中强制分离

创建 相应 的组
 groupadd -g 501 oinstall
 groupadd -g 502 dba
 groupadd -g 503 oper

 groupadd -g 504 asmadmin
 groupadd -g 505 asmdba
 groupadd -g 506 asmoper
 
创建oracle用户及grid用户,这里可以看出grid的权限是比oracle大的
 useradd -u 1100 -g oinstall -G asmdba,dba,oper oracle
 useradd -u 1110 -g oinstall -G asmadmin,asmdba,asmoper,dba,oper grid

修改用户的密码
 passwd oracle
 passwd grid


如果有错可以用usermod 命令修改
usermod -G osasm,osdba,osoper,dba,oper oracle


创建目录
mkdir -p /u01/app/oracle/product/11.2.0/db_1
mkdir -p /u01/app/grid/product/11.2.0/grid_1
mkdir -p /u01/app/gridbase

chown -R oracle:oinstall /u01/app
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/gridbase
chmod -R 775 /u01

修改一些系统配置
vi /etc/security/limits.conf
#ORACLE SETTING
grid                 soft    nproc   655350
grid                 hard    nproc   655350
grid                 soft    nofile  655350
grid                 hard    nofile  655350

oracle               soft    nproc   655350
oracle               hard    nproc   655350
oracle               soft    nofile  655350
oracle               hard    nofile  655350


vi /etc/pam.d/login
#ORACLE SETTING
session    required    /lib64/security/pam_limits.so
session    required    pam_limits.so


vi /etc/sysctl.conf
#ORACLE SETTING
#kernel.shmall = 2097152
#kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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

立即生效
sysctl -p

禁止selinux
vi /etc/selinux/config
SELINUX=disabled


关掉防火墙
service iptables status
service iptables stop
chkconfig iptables off


--应该是不需要的,单机需要时间同步?在11gr2 RAC中建议使用CTSS
gird时间同步所需要的设置,Network Time Protocol Setting

/sbin/service ntpd stop
chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.bak 或者 rm /etc/ntp.conf

fdisk 处理裸设备,切记不要格式化为文件系统 

特别注意:如果是虚拟机,就要在虚拟机的配置文件里设置 disk.EnableUUID = "TRUE",否则 scsci_id 获取不到磁盘的字符串
/dev/sdb1
/dev/sdb2
/dev/sdb3

/sbin/partprobe /dev/sdb1
/sbin/partprobe /dev/sdb2
/sbin/partprobe /dev/sdb3

配置udev设备
touch /etc/udev/rules.d/99-oracle-asmdevices.rules

#添加记录到/etc/scsi_id.config,如果没有该文件,则手动创建
echo "options=--whitelisted --replace-whitespace"  >> /etc/scsi_id.config

for i in b1 b2 b3
do
echo "KERNEL==\"sd$i\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$parent\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd${i:0:1}`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""      
done;

输出结果添加到 /etc/udev/rules.d/99-oracle-asmdevices.rules

# /sbin/udevadm control --reload-rules
# start_udev

# ls -lrt /dev/asm*


oracle 用户的.bash_profile 文件
vi /home/oracle/.bash_profile

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=dbasm
#export TNS_ADMIN=$ORACLE_HOME/network/admin
#export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp


用户的.bash_profile 文件 ORACLE_HOSTNAME请自行设置
vi /home/grid/.bash_profile
export ORACLE_BASE=/u01/app/gridbase
export ORACLE_HOME=/u01/app/grid/product/11.2.0/grid_1
export ORACLE_SID=+ASM

export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp

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


yum 配置

vi /etc/yum.conf
追加如下内容
[base]
name=base pyb yum test
baseurl=file:///mnt/cdrom
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

[updates-released]
name= updates-released pyb yum test
baseurl=file:///mnt/cdrom
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

修改其中的 gpgcheck参数,改为gpgcheck=0 
修改其中的 enabled参数,改为enabled=1 


先安装 gi software ,可以仅安装软件,或者安装软件时同时配置( standalone)。建议后面一种方式。
再安装 oracle software,之后再dbca建库

安装 grid software,这里是仅安装软件,中间会检查系统参数和OS的依赖包,用yum install 安装就可以了
最后运行弹出窗口的脚本
/u01/app/oraInventory/orainstRoot.sh
/u01/app/grid/product/11.2.0/grid_1/root.sh


配置监听
[grid@asmnode software]$ netca 

运行asmca
[grid@asmnode software]$ asmca

如果只安装软件,在运行asmca 时会报错,需要 以root运行 grid 用户的这个文件 
# perl /u01/app/grid/product/11.2.0/grid_1/crs/install/roothas.pl 
可以会出错,提示要先卸载
# perl /u01/app/grid/product/11.2.0/grid_1/crs/install/roothas.pl -verbose -deconfig -force


重新运行root.sh
# /u01/app/grid/product/11.2.0/grid_1/root.sh
# perl /u01/app/grid/product/11.2.0/grid_1/crs/install/roothas.pl

下面为相关的日志输出,供学习研究用
# perl /u01/app/grid/product/11.2.0/grid_1/crs/install/roothas.pl
Using configuration parameter file: /u01/app/grid/product/11.2.0/grid_1/crs/install/crsconfig_params
User ignored Prerequisites during installation
CRS is already configured on this node for crshome=/u01/app/grid/product/11.2.0/grid_1
Cannot configure two CRS instances on the same cluster.
Please deconfigure before proceeding with the configuration of new home. 


# perl /u01/app/grid/product/11.2.0/grid_1/crs/install/roothas.pl -verbose -deconfig -force
Using configuration parameter file: /u01/app/grid/product/11.2.0/grid_1/crs/install/crsconfig_params
PRKO-2573 : ONS daemon is already stopped.
CRS-2500: Cannot stop resource 'ora.cssd' as it is not running
CRS-4000: Command Stop failed, or completed with errors.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'asmnodedup'
CRS-2673: Attempting to stop 'ora.evmd' on 'asmnodedup'
CRS-2677: Stop of 'ora.evmd' on 'asmnodedup' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'asmnodedup' has completed
CRS-4133: Oracle High Availability Services has been stopped.

Successfully deconfigured Oracle Restart stack


# /u01/app/grid/product/11.2.0/grid_1/root.sh
Performing root user operation for Oracle 11g 

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/grid/product/11.2.0/grid_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 contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

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.

To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:
/u01/app/grid/product/11.2.0/grid_1/perl/bin/perl -I/u01/app/grid/product/11.2.0/grid_1/perl/lib -I/u01/app/grid/product/11.2.0/grid_1/crs/install /u01/app/grid/product/11.2.0/grid_1/crs/install/roothas.pl

To configure Grid Infrastructure for a Cluster execute the following command:
/u01/app/grid/product/11.2.0/grid_1/crs/config/config.sh
This command launches the Grid Infrastructure Configuration Wizard. The wizard also supports silent operation, and the parameters can be passed through the response file that is available in the installation media.



# perl /u01/app/grid/product/11.2.0/grid_1/crs/install/roothas.pl
Using configuration parameter file: /u01/app/grid/product/11.2.0/grid_1/crs/install/crsconfig_params
User ignored Prerequisites during installation
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 asmnodedup successfully pinned.
Adding Clusterware entries to upstart

asmnode     2016/04/26 08:56:20     /u01/app/grid/product/11.2.0/grid_1/cdata/asmnodedup/backup_20160426_085620.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server


grid 用户下,注意用sysasm登录(11g新加的角色)
$ sqlplus /nolog
SQL> conn / as sysasm
Connected.
SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
------------
如果在11g grid 下启动asm实例会报 ORA-29701 错误
$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.3.0 Production onTue Apr 26 15:44:30 2016
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
ORA-29701: unable to connect to Cluster Synchronization Service

那是因为css没有起来,可以手动起来,或者稍等一下,因为重启后会随着系统启动,存在延迟

注意用户.bash_profile 的 ORACLE_SID 和dbca 的实例名的大小写

--检查css
crsctl check css  
ps -ef|grep -i cssd

--检查has
crsctl check has  
ps -ef|grep -i d.bin

手动启动css
crsctl start resource ora.cssd  

手动启动全部资源
crsctl start resource -all

# ./crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host        
----------------------------------------------------------------------
ora.DG_DATA.dg ora....up.type 0/5    0/     ONLINE    ONLINE    asmnode     
ora.asm        ora.asm.type   0/5    0/     ONLINE    ONLINE    asmnode     
ora.cssd       ora.cssd.type  0/5    0/5    ONLINE    ONLINE    asmnode     
ora.dbasm.db   ora....se.type 0/2    0/1    ONLINE    ONLINE    asmnode     
ora.diskmon    ora....on.type 0/10   0/5    OFFLINE   OFFLINE               
ora.evmd       ora.evm.type   0/10   0/5    ONLINE    ONLINE    asmnode     
ora.ons        ora.ons.type   0/3    0/     OFFLINE   OFFLINE   

# ./crsctl status resource -t -init
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DG_DATA.dg
               ONLINE  ONLINE       asmnode                                      
ora.asm
               ONLINE  ONLINE       asmnode                  Started             
ora.ons
               OFFLINE OFFLINE      asmnode                                      
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       asmnode                                      
ora.dbasm.db
      1        ONLINE  ONLINE       asmnode                  Open                
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       asmnode   

1)默认情况下HAS(High Availability Service)是自动启动的.通过如下命令可以取消和启用自动启动
        crsctl disable has        
        crsctl enable has      
2)HAS手动启动和停止        
        crsctl start has        
        crsctl stop has      
3)查看HAS的状态        
        crsctl check has      
4)如果想让ora.css和ora.diskmon服务随着HAS的启动而自动启动,
  那么你可以这两个服务的AUTO_START属性        
  crsctl modify resource "ora.cssd" -attr "AUTO_START=1"       
  or         
  crsctl modify resource "ora.diskmon" -attr "AUTO_START=1"   
  
5)如果想取消ora.css和ora.diskmon的Auto start         
  crsctl modify resource "ora.cssd" -attr "AUTO_START=never"  
  or  
  crsctl modify resource "ora.diskmon" -attr "AUTO_START=never"

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


安装oracle software,仅安装数据库软件
下一步,一直下一步 注意选择 only database software
/u01/app/oracle/product/11.2.0/db_1/root.sh 

分别运行后 数据库软件就算安装完毕了

开始创建数据库,运行dbca
$ dbca

注意存储时选择ASM,

DG_DATA01

注意选择数据库的编码,要和OS的 NLS_LANG 变量一致

再后面是创建数据库了,没什么好说的了









 
posted @ 2016-04-26 16:06  peiybpeiyb  阅读(296)  评论(0编辑  收藏  举报