oracle asm+node 安装

oracle 10g 和 oracle 11g asm +oracle单实例安装有很多不同,在这里主要整理oracle 11g+ ASM 。( asm + oracle 10g 见下章笔记整理
grid安装与配置-.pdf

 二种方法

   方法一: ORACLE 11G +ASM 安装:(单实例) 
                    创建两个用户,oracle,grid  (单实例此方法不推荐)


1, oracle 11G 涉及连个user  : grid  oracle  ---分别都需要创建用户组,权限,环境变量配置,类似rac 安装。

2,ip 只需配置主机

根据oracle官档安装相关的rpm包体(每个rac/node都需要)

yum install -y binutils* compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

#rpm -qa |grep libgcc


创建用户名及相关配置(grid,oracle),root下操作:

A,创建grid相关用户组

#groupadd -g 1000 oinstall

#groupadd -g 1200 asmadmin

#groupadd -g 1201 asmdba

#groupadd -g 1202 asmoper

#useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper grid

#id grid

 uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper)

#su - grid

$vim .bash_profile

B,创建oracle相关用户组

#groupadd -g 1300 dba

#groupadd -g 1301 oper

#useradd -m -u 1101 -g oinstall -G dba,oper,asmdba,asmadmin oracle     ---在这里必须把oracle也加入asmadmin组,和rac有些不同。

#id oracle 

 uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1201(asmdba),1300(dba),1301(oper)

#su - oracle

#vim .bash_profile


编辑grid,oracle的环境参数    ----另一个节点也需要

vim  /home/grid/.bash_profile

# for oracle11g grid

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/11.2/grid

export ORACLE_SID=+ASM1

export PATH=$PATH:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export PATH=$PATH:$HOME/bin

export LANG=C

vim  /home/oracle/.bash_profile

##for oracle11g

export ORACLE_SID=rac1

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2/dbhome_1

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

export LANG=C

#export ORACLE_HOSTNAME=localhost

umask 022

$ . .bash_profile

$ echo $ORACLE_SID

$ echo $ORACLE_HOME

#id nobody


创建rac相关关目录

#mkdir -p  /u01/app/grid

#mkdir -p  /u01/app/grid/11.2/grid    ---home目录

#chown -R grid:oinstall /u01

#mkdir -p /u01/app/oracle

#mkdir -p $ORACLE_BASE/product/11.2/dbhome_1

#chown oracle:oinstall /u01/app/oracle

#chmod -R 755 /u01


linux系统参数配置:

# vim /etc/security/limits.conf

# for oracle11g_db

oracle           soft    nproc   2047

oracle           hard    nproc   16384

oracle           soft    nofile  1024

oracle           hard    nofile  65536

# for ora11g_grid

grid              soft    nproc   2047

grid              hard    nproc   16384

grid              soft    nofile  1024

grid              hard    nofile  65536


修改login文件:

#vim /etc/pam.d/login

session required pam_limits.so


修改profile文件:

#vim /etc/profile

cat >>/etc/profile <<EOF

if [ $USER = "oracle" ]; then

        if [ $SHELL = "/bin/ksh" ]; then

              ulimit -p 16384

              ulimit -n 65536

        else

              ulimit -u 16384 -n 65536

        fi

umask 022

fi

EOF


修改sysctl.conf文件:

#vim /etc/syscrl.conf

cat >> /etc/sysctl.conf <<EOF

#

## for oracle11g r2  install

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 536870912

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

 

#sysctl -p   ---执行及时生效




存储配置:两总方式:

A,裸设备 绑定,通过undev  


系统操作:root 下

uname -a 查看系统版本号(我这里是linux系统),这里以第二种方式笔记整理,第一种,见oracle_rac 实施总结。

oraclelib 存储插件,可在官网下载(地址:http://www.oracle.com/technetwork/topics/linux/asmlib/index-101839.html)。


安装包: rpm -ivh xxxxx

 

格式磁盘:

  #fdisk -l

  #fdisk /dev/sd*   ----详见linux系统磁盘管理,创建磁盘。(不需要mkfs 格式化为系统级文件)

  --在这里,不需要通过udev绑定,直接通过oracleasm 创建(如果走裸设备的话,就需要undev 绑定)


   

#/etc/init.d/oracleasm ---直接回车,会出现帮组, 



创建盘,通过oracleasm: 


先把asm 指定用户和组:


         

创建ASM盘



查看创建的ASM盘



提示:如果这里创建错误,可通过 /etc/init.d /oracleasm deletedisk  盘符名  /dev/sd* 



受权限对ASM盘:


#chown  -R grid:oinstall /dev/sd* 

#chmod -R 775 /dev/sd*        

---否然,看不见盘,在安装grid时




1安装grid:


解压软件  unzip xxx -d /home/oracle  ---解压路劲可自定义

执行

 grid 用户下 ,cd  解压路径,运行 ./ runInstaller   ---可以不需要检测


执行runInstaller后,进入安装界面:

Installationoption:

---选择installand configure Grid Infrastructure for a  standalone server,点击next

--- 选择磁盘,作为仲裁磁盘 grid

---选择默认的用户组 OSDBA(asmdba组) OSOPER(asmoper组) OSASM(asmadmin组)

-- 继续下面的安装,约。。。

--安装完成,检测进程crs

---#/u01/app/11.2/grid/bin/

   ./crsctl status resource -t  或者  ./crsctl  -s -t -v 




2安装oracle soft 软件  ----(约)文件系统差不多


3安装asm规划磁盘:

  在grid 下 asmca  创建:


4netmgr 常见监听


5dbca 建库





  方法二:  ORACLE 11G +ASM 安装:(单实例)  涉及用户oracle


2 Package Requirements
yum   install   -y  binutils-* compat-libstdc++-*  elfutils-libelf-*  gcc-*  glibc-* kernel-headers-2.6.18  ksh-20060214  libaio-*   libgcc libgomp libstdc++*  make  sysstat unixODBC-*


3  Create the Oracle Groups and User Account 

/usr/sbin/groupadd  -g 800 oinstall
/usr/sbin/groupadd -g  801 dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
id oracle

4 Create Directories 
--与第8步里的oracle用户的环境变量里的ORACLE_HOME一致
mkdir -p /u01/app/oracle/product/11.2.0/db_1
mkdir -pv /u01/app/11.2/grid     ----grid 的主目录,因只有oracle用户,其home 为/home/oracle
                                             ----(同时需要把/u01/app/11.2/grid安装主目录放到oracle 环境变量下)
chown -R oracle.oinstall /u01
chown - R oracle.oinstall /u01/app
chmod -R 775 /u01/app

5 Configuring the Linux Kernel Parameters 
cat >> /etc/sysctl.conf <<EOF
#
## for oracle11g r2  install
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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

/sbin/sysctl -p

6 Setting Shell Limits for the oracle User
Oracle recommends setting limits on the number of processes and open files each Linux account may use. To make these changes, cut and paste the following commands as root: 
6.1

cat >> /etc/security/limits.conf <<EOF
# for oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF

6.2
cat >> /etc/pam.d/login <<EOF
# for oracle
session required /lib/security/pam_limits.so
EOF

7

#Change the default profile for bash and ksh as well as the default login script for cshell.
cat >>/etc/profile <<EOF
if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
fi
EOF


8  
cat >> /home/oracle/.bash_profile <<EOF
# User specific environment and startup programs
export ORACLE_SID=lmocm1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2/lmocm_1
export PATH= $ORACLE_HOME/bin:/u01/app/11.2/grid/bin:$PATH:$HOME/bin
export DISPLSY=192.168.97.127:0.0
#export SQL_PATH='/home/oracle'
#export LD_LIBRARY_PATH=$ORACLE_HOME/lib
#alias  sqlplus='rlwrap sqlplus'
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
#alias  rman='rlwrap rman'
#alias  dgmgrl='rlwrap dgmgrl'
#alias  tailoraalert="$ORACLE_BASE/admin/$ORACLE_SID/bdump/alert_$ORACLE_SID.log"
EOF

                   

9 unzip   grid software  -d  /home/oracle



[root@lmocm1 ~]# usermod -d /u01 oracle     --- 重定义oracle home  ,另一个目录也属于oracle,环境变量不同

[root@lmocm1 ~]# cp -p /home/oracle/.bash      

      -----原因:因为只有一个用户,所以重新定义环境变量。如果不定义也可,每次就需要export ORACLE_SID 和 ORACLE_HOME,这样麻烦,直接重定义路径为oracle第二个环境变量。

.bash_history  .bash_logout   .bash_profile  .bashrc        

[root@lmocm1 ~]# cp -p /home/oracle/.bash* /u01/


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

[oracle@lmocm1 ~]$ pwd

/u01

[oracle@lmocm1 ~]$ cat .bash_profile 

# .bash_profile


# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi


# User specific environment and startup programs


PATH=$PATH:$HOME/bin


export PATH

# User specific environment and startup programs

export ORACLE_SID=lmocm1  ---改为+ASM

export ORACLE_BASE=/u01/app/oracle   --这里不变,是因为安装的时候,指定base 目录就为此  --多用户就不同了

export ORACLE_HOME=$ORACLE_BASE/product/11.2/lmocm_1  ---改为grid安装的目录/u01/app/11.2/grid

export PATH=$ORACLE_HOME/bin:/u01/app/11.2/grid/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin

export SQL_PATH='/home/oracle'

export LD_LIBRARY_PATH=/lib

export DISPLAY=192.168.97.127:0.0

#alias  sqlplus='rlwrap sqlplus'

#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"

#alias  rman='rlwrap rman'

#alias  dgmgrl='rlwrap dgmgrl'

#alias  tailoraalert="/admin//bdump/alert_.log"

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


10   规划磁盘  

# fdisk  -l

#  fdisk /dev/sd*


11  根据 OS的版本号,安装oraclelib 插件,

官网下载(地址:

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


12  oracleasm 指定


[root@lmocm1 ~]# /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 <ENTER> without typing an

answer will keep that current value.  Ctrl-C will abort.


Default user to own the driver interface [oracle]: oracle

Default group to own the driver interface [dba]: dba

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  ]


[root@lmocm1 ~]# /etc/init.d/oracleasm listdisks

ARCHIVE

DBFILE1

DBFILE2

FLASH

GRID

GRID1  




13 配置 时间同步  ---ntpd



14  $ cd 到grid 解压的路径下,运行   ./runInstaller 


14-1  




---root下运行脚本后,在/u01/app/11.2/grid/root.sh 之后需要执行显示的结果脚本:


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

[root@lmocm1 ~]# /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@lmocm1 ~]# /u01/app/11.2/grid/root.sh

Performing root user operation for Oracle 11g 


The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /u01/app/11.2/grid


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

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...



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.


To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:

/u01/app/11.2/grid/perl/bin/perl -I/u01/app/11.2/grid/perl/lib -I/u01/app/11.2/grid/crs/install /u01/app/11.2/grid/crs/install/roothas.pl



To configure Grid Infrastructure for a Cluster execute the following command:

/u01/app/11.2/grid/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.




[root@lmocm1 ~]# /u01/app/11.2/grid/crs/config/config.sh


ERROR: You must not be logged in as root to run this tool.

       Log in as Oracle user and rerun this tool.

[root@lmocm1 ~]# /u01/app/11.2/grid/perl/bin/perl -I/u01/app/11.2/grid/perl/lib -I/u01/app/11.2/grid/crs/install /u01/app/11.2/grid/crs/install/roothas.pl

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

Creating trace directory

User ignored Prerequisites during installation

LOCAL ADD MODE 

Creating OCR keys for user 'oracle', 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 lmocm1 successfully pinned.

Adding Clusterware entries to inittab


lmocm1     2013/04/27 15:09:48     /u01/app/11.2/grid/cdata/lmocm1/backup_20130427_150948.olr

Successfully configured Oracle Grid Infrastructure for a Standalone Server

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



15  运行ASM 之前,需要先配置监听 netca  netmgr 



16 检测grid  是否成功  

$ cd /u01/app/11.2/grid/bin

  $crs_ctl -t 或者   crsctl  status resource -t  


16-1  asmca   创建asm 磁盘

-----完成后

17 安装 db soft软件


18 dbca 


grid  asm 教程:$ cd /u01/app/11.2/grid/bin

                           $crs_ctl -t 或者   crsctl  status resource -t   







ASM 其他操作


 --关于ASM动态视图:v$asm_diskgroup磁盘组信息、v$asm_disk信息资料、v$asm_disk_stat与v$asm_disk类似

v$asm_file显示ASM文件、 v$asm_operation:显示ASM重新负载平衡操作过程。

--进入图形界面配置asm磁盘管理: asmca
--进入底层系统查看asm 元数据文件: asmcmd  (前提需要配置,不论是rac+ASM 还是node+ASM)
--这里演示,为上第二种方法(oracle下安装ASM+NODE,其他也一样)
--设定SID值: $ export ORACLE_SID=+ASM
              $ export ORACLE_HOME=/u01/app/11.2/grid
              $ conn / as sysasm     ----之后就可继续其他的操作,在之前,都需要现在系统级别下创建组
--进去后,可以通过命令添加,修改ASM磁盘组信息。10g,11g, 针对绝对路径问题: 如果通过裸设备可以查看:
eg:
SQL> select name, path, mode_status, state from v$asm_disk;  --path 路径为 ORCL:ARCHIVE  通过oraclelib 插件安装

          NAME       PATH    MODE_ST STATE
------------------------------ -------------------- ------- --------
ARCHIVE_0000       ORCL:ARCHIVE    ONLINE  NORMAL
DBFILE_0000       ORCL:DBFILE1    ONLINE  NORMAL
DBFILE_0001       ORCL:DBFILE2    ONLINE  NORMAL             ----11g显示路劲为这样。

[root@dominic1 ~]# /etc/init.d/oracleasm querydisk /dev/sd*              
Device "/dev/sda" is not marked as an ASM disk
Device "/dev/sda1" is marked an ASM disk with the label "VOTE1_DG"
Device "/dev/sdb" is not marked as an ASM disk
Device "/dev/sdb1" is marked an ASM disk with the label "VOTE2_DG"
Device "/dev/sdc" is not marked as an ASM disk
Device "/dev/sdc1" is marked an ASM disk with the label "VOTE3_DG"
Device "/dev/sdd" is not marked as an ASM disk
Device "/dev/sdd1" is marked an ASM disk with the label "DB_DG"
Device "/dev/sde" is not marked as an ASM disk
Device "/dev/sde1" is marked an ASM disk with the label "LOG_DG"
      
SQL> select name, path, mode_status, state from v$asm_disk;   --path 路径为  /dev/raw/raw3   裸设备 


NAME                           PATH                           MODE_ST STATE
------------------------------ ------------------------------ ------- --------
                                                          
ASM_DISKGROUP_0002             /dev/raw/raw3                  ONLINE  NORMAL
ASM_DISKGROUP_0001             /dev/raw/raw2                  ONLINE  NORMAL
ASM_DISKGROUP_0000             /dev/raw/raw1                  ONLINE  NORMAL        --10g 显示路劲为这样。


---创建磁盘,首先需要现在系统级别下创建磁盘组

SQL> create diskgroup LMOCM normal redundancy failgroup f1 disk 'ORCL:TEST1'  failgroup f2 disk 'ORCL:TEST';


Diskgroup created.


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


NAME     STATE TYPE  TOTAL_MB    FREE_MB

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

DB_FILE      MOUNTED EXTERN      2047320421

ARCHIVE      MOUNTED EXTERN      10236 8208

DBFILE     MOUNTED NORMAL      2047220366

FLASH     MOUNTED EXTERN      10236 9828

OCRVDISK     MOUNTED NORMAL       4094 3974

LMOCM     MOUNTED NORMAL      1022810126




----如果没有走10g 的裸设备,需要查看绝对路径:系统级别下: # /etc/init.d/oracleasm querydisk /dev/sd*  

 eg:

[root@lmocm1 ~]# /etc/init.d/oracleasm querydisk /dev/sd*

Device "/dev/sda" is not marked as an ASM disk

Device "/dev/sda1" is not marked as an ASM disk

Device "/dev/sda2" is not marked as an ASM disk

Device "/dev/sda3" is not marked as an ASM disk

Device "/dev/sdb" is not marked as an ASM disk

Device "/dev/sdb1" is marked an ASM disk with the label "GRID"

Device "/dev/sdc" is not marked as an ASM disk

Device "/dev/sdc1" is marked an ASM disk with the label "GRID1"

Device "/dev/sdd" is not marked as an ASM disk

Device "/dev/sdd1" is marked an ASM disk with the label "FLASH"

Device "/dev/sde" is not marked as an ASM disk

Device "/dev/sde1" is marked an ASM disk with the label "ARCHIVE"

Device "/dev/sdf" is not marked as an ASM disk

Device "/dev/sdf1" is marked an ASM disk with the label "DBFILE1"

Device "/dev/sdg" is not marked as an ASM disk

Device "/dev/sdg1" is marked an ASM disk with the label "DBFILE2"

Device "/dev/sdh" is not marked as an ASM disk

Device "/dev/sdh1" is marked an ASM disk with the label "DBFILE3"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值