Chinaunix首页 | 论坛 | 博客
  • 博客访问: 511775
  • 博文数量: 65
  • 博客积分: 2925
  • 博客等级: 上尉
  • 技术积分: 1306
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-01 10:56
个人简介

2013

文章分类

全部博文(65)

分类: Oracle

2011-07-11 10:12:19

1.   准备操作系统环境

1.1.     安装操作系统,suse9 sp4

SUSE LINUX Enterprise Server 9 (x86_64)

VERSION = 9

PATCHLEVEL = 4

uname -a

Linux rac1 2.6.5-7.308-default #1 Mon Dec 10 11:36:40 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux

 

1.2.     创建共享盘

 

C:\Program Files\VMware\VMware Server>vmware-vdiskmanager.exe -c -s 20000MB -a l

silogic -t 0 "F:\Virtual Machines\10gsharedisk\sharedisk10.vmdk"

Creating disk 'F:\Virtual Machines\10gsharedisk\sharedisk10.vmdk'

Virtual disk creation successful.

 

将共享盘加入操作系统


 

在虚拟机配置中加入:

scsi2:0.shared = "TRUE"

disk.locking="FALSE"

scsi2:0.sharedBus = "Virtual"

 

1.3.     LVM操作

 

1.3.1.   创建pv

rac101:~ # pvcreate /dev/sdb

  Physical volume "/dev/sdb" successfully created

rac101:~ # pvdisplay

  --- NEW Physical volume ---

  PV Name               /dev/sdb

  VG Name

  PV Size               19.53 GB

  Allocatable           NO

  PE Size (KByte)       0

  Total PE              0

  Free PE               0

  Allocated PE          0

  PV UUID               6fbekf-U5RY-ybXJ-XOn5-VyR2-C71d-8H3xBo

 

rac101:~ # pvscan

  PV /dev/sdb         lvm2 [19.53 GB]

  Total: 1 [19.53 GB] / in use: 0 [0   ] / in no VG: 1 [19.53 GB]

 

1.3.2.   创建vg

rac101:~ # vgcreate wjlvg /dev/sdb

  Volume group "wjlvg" successfully created

rac101:~ # vgdisplay

  --- Volume group ---

  VG Name               wjlvg

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  1

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                0

  Open LV               0

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               19.53 GB

  PE Size               4.00 MB

  Total PE              4999

  Alloc PE / Size       0 / 0

  Free  PE / Size       4999 / 19.53 GB

  VG UUID               JO5yOw-STvy-UNn1-l3MY-UfVm-2cNf-PmvvpB

 

 

vgdisplay -v wjlvg

 

 

1.3.3.   创建lv

lvcreate -L 300M  -n wjllv300m001 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m002 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m003 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m004 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m005 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m006 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m007 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m008 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m009 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m010 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m011 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m012 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m013 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m014 /dev/wjlvg

lvcreate -L 300M  -n wjllv300m015 /dev/wjlvg      

 

lvcreate -L 500M  -n wjllv500m001 /dev/wjlvg

lvcreate -L 500M  -n wjllv500m002 /dev/wjlvg

lvcreate -L 500M  -n wjllv500m003 /dev/wjlvg

lvcreate -L 500M  -n wjllv500m004 /dev/wjlvg

lvcreate -L 500M  -n wjllv500m005 /dev/wjlvg

lvcreate -L 500M  -n wjllv500m006 /dev/wjlvg

lvcreate -L 500M  -n wjllv500m007 /dev/wjlvg

lvcreate -L 500M  -n wjllv500m008 /dev/wjlvg

 

lvcreate -L 5GB  -n wjllv5g001 /dev/wjlvg

lvcreate -L 5GB  -n wjllv5g002 /dev/wjlvg

 

 

 

1.3.4.   raw

*********

step 1

raw /dev/raw/raw301 /dev/wjlvg/wjllv300m001

raw /dev/raw/raw302 /dev/wjlvg/wjllv300m002

raw /dev/raw/raw303 /dev/wjlvg/wjllv300m003

raw /dev/raw/raw304 /dev/wjlvg/wjllv300m004

raw /dev/raw/raw305 /dev/wjlvg/wjllv300m005

raw /dev/raw/raw306 /dev/wjlvg/wjllv300m006

raw /dev/raw/raw307 /dev/wjlvg/wjllv300m007

raw /dev/raw/raw308 /dev/wjlvg/wjllv300m008

raw /dev/raw/raw309 /dev/wjlvg/wjllv300m009

raw /dev/raw/raw310 /dev/wjlvg/wjllv300m010

raw /dev/raw/raw311 /dev/wjlvg/wjllv300m011

raw /dev/raw/raw312 /dev/wjlvg/wjllv300m012

raw /dev/raw/raw313 /dev/wjlvg/wjllv300m013

raw /dev/raw/raw314 /dev/wjlvg/wjllv300m014

raw /dev/raw/raw315 /dev/wjlvg/wjllv300m015

 

raw /dev/raw/raw501 /dev/wjlvg/wjllv500m001

raw /dev/raw/raw502 /dev/wjlvg/wjllv500m002

raw /dev/raw/raw503 /dev/wjlvg/wjllv500m003

raw /dev/raw/raw504 /dev/wjlvg/wjllv500m004

raw /dev/raw/raw505 /dev/wjlvg/wjllv500m005

raw /dev/raw/raw506 /dev/wjlvg/wjllv500m006

raw /dev/raw/raw507 /dev/wjlvg/wjllv500m007

raw /dev/raw/raw508 /dev/wjlvg/wjllv500m008

 

raw /dev/raw/raw601 /dev/wjlvg/wjllv5g001

raw /dev/raw/raw602 /dev/wjlvg/wjllv5g002

 

 

step2

/bin/chmod 600 /dev/raw/raw301

/bin/chmod 600 /dev/raw/raw302

/bin/chmod 600 /dev/raw/raw303

/bin/chmod 600 /dev/raw/raw304

/bin/chmod 600 /dev/raw/raw305

/bin/chmod 600 /dev/raw/raw306

/bin/chmod 600 /dev/raw/raw307

/bin/chmod 600 /dev/raw/raw308

/bin/chmod 600 /dev/raw/raw309

/bin/chmod 600 /dev/raw/raw310

/bin/chmod 600 /dev/raw/raw311

/bin/chmod 600 /dev/raw/raw312

/bin/chmod 600 /dev/raw/raw313

/bin/chmod 600 /dev/raw/raw314

/bin/chmod 600 /dev/raw/raw315

 

/bin/chmod 600 /dev/raw/raw501

/bin/chmod 600 /dev/raw/raw502

/bin/chmod 600 /dev/raw/raw503

/bin/chmod 600 /dev/raw/raw504

/bin/chmod 600 /dev/raw/raw505

/bin/chmod 600 /dev/raw/raw506

/bin/chmod 600 /dev/raw/raw507

/bin/chmod 600 /dev/raw/raw508

 

/bin/chmod 600 /dev/raw/raw601

/bin/chmod 600 /dev/raw/raw602

 

 

 

step3

/bin/chown oracle:oinstall /dev/raw/raw301

/bin/chown oracle:oinstall /dev/raw/raw302

/bin/chown oracle:oinstall /dev/raw/raw303

/bin/chown oracle:oinstall /dev/raw/raw304

/bin/chown oracle:oinstall /dev/raw/raw305

/bin/chown oracle:oinstall /dev/raw/raw306

/bin/chown oracle:oinstall /dev/raw/raw307

/bin/chown oracle:oinstall /dev/raw/raw308

/bin/chown oracle:oinstall /dev/raw/raw309

/bin/chown oracle:oinstall /dev/raw/raw310

/bin/chown oracle:oinstall /dev/raw/raw311

/bin/chown oracle:oinstall /dev/raw/raw312

/bin/chown oracle:oinstall /dev/raw/raw313

/bin/chown oracle:oinstall /dev/raw/raw314

/bin/chown oracle:oinstall /dev/raw/raw315

 

/bin/chown oracle:oinstall /dev/raw/raw501

/bin/chown oracle:oinstall /dev/raw/raw502

/bin/chown oracle:oinstall /dev/raw/raw503

/bin/chown oracle:oinstall /dev/raw/raw504

/bin/chown oracle:oinstall /dev/raw/raw505

/bin/chown oracle:oinstall /dev/raw/raw506

/bin/chown oracle:oinstall /dev/raw/raw507

/bin/chown oracle:oinstall /dev/raw/raw508

 

/bin/chown oracle:oinstall /dev/raw/raw601

/bin/chown oracle:oinstall /dev/raw/raw602

 

 

附:

lvchange -ay /dev/wjlvg/wjllv300m001

lvchange -an /dev/wjlvg/wjllv300m001

查看裸设备:

raw -a

 

1.4.     创建组oinstall,dba 用户 oracle

groupadd oinstall

groupadd dba

mkdir /u01

useradd -d /u01/oracle -g oinstall -G dba oracle

passwd oracle

mkdir /u01/oracle

chown -R oracle:oinstall /u01/oracle

 

1.5.     创建oracle用户的初始化参数

vi /home/oracle/.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

export LD_ASSUME_KERNEL=2.4.19

export ORACLE_BASE=/u01/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10g/db

export ORACLE_SID=wjldb

export ORACLE_TERM=xterm

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

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

export TNS_ADMIN=$ORACLE_HOME/network/admin

export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data

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 THREADS_FLAG=native

export TEMP=/tmp

export TMPDIR=/tmp

 

unset USERNAME

 

1.6.     配置ssh等效

 

clusterware rac database 安装过程中,OUI 必须能够以oracle的身份自动将软件复制到所有rac节点。这里通过配置sshoracle用户拥有不输入密码即可访问各节点。

建立用户等效性,需要在两个节点上以oracle用户身份生成用户:

oracle@rac101:~> mkdir .ssh

oracle@rac101:~> ls

oracle@rac101:~> chmod 700 .ssh

oracle@rac101:~> ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/u01/oracle/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /u01/oracle/.ssh/id_rsa.

Your public key has been saved in /u01/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

61:84:7f:df:db:ec:7d:e7:bb:ce:a4:20:92:92:a8:cc oracle@rac101

oracle@rac101:~> ssh-keygen -t dsa

Generating public/private dsa key pair.

Enter file in which to save the key (/u01/oracle/.ssh/id_dsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /u01/oracle/.ssh/id_dsa.

Your public key has been saved in /u01/oracle/.ssh/id_dsa.pub.

The key fingerprint is:

cd:1b:07:4c:cb:62:7e:92:7f:57:a7:01:9e:a2:54:07 oracle@rac101

oracle@rac101:~>

 

 

oracle@rac102:~> mkdir .ssh

oracle@rac102:~> chmod 700 .ssh

oracle@rac102:~> ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/u01/oracle/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /u01/oracle/.ssh/id_rsa.

Your public key has been saved in /u01/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

93:35:25:2a:70:63:eb:7a:85:88:58:4f:96:81:6e:fc oracle@rac102

oracle@rac102:~> ssh-keygen -t dsa

Generating public/private dsa key pair.

Enter file in which to save the key (/u01/oracle/.ssh/id_dsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /u01/oracle/.ssh/id_dsa.

Your public key has been saved in /u01/oracle/.ssh/id_dsa.pub.

The key fingerprint is:

e3:90:ae:fa:b4:50:69:1e:f3:7e:06:e5:21:9b:d5:a8 oracle@rac102

 

1.7.        开启rcp服务(跟ssh配置等效二选一)

1.7.1.       在两台主机上分别修改/etc/xinetd.d目录下的如下文件:rsh,rexec,rlogin

注释掉该语句:disable  = yes,如果三个文件中无此语句,安全起见最好手动加上disable  =  no,因为我们不知道操作系统默认给disable赋了什么样的值。

1.7.2.       执行以下语句

echo "rsh" >> /etc/securetty

echo "rexec" >> /etc/securetty

echo "rlogin" >> /etc/securetty

1.7.3.       修改root用户和oracle用户根目录下的.rhosts文件,没有请手动创建

.rhosts中的内容如下:

Root用户下:

主机名1      root

主机名2      root

Oracle用户下(没有需在根目录下创建):

主机名1     oracle

主机名1     oracle

1.7.4.       重新启动网络服务

/etc/init.d/xinetd restart

1.7.5.       验证rcp服务

 

1.8.     配置ASM

oracle@rac101:~/.ssh> cat id_rsa.pub >> authorized_keys

oracle@rac101:~/.ssh> cat id_dsa.pub >> authorized_keys

 

oracle@rac101:~> ssh rac102 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

oracle@rac101:~> ssh rac102 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

oracle@rac101:~> scp ~/.ssh/authorized_keys rac102:~/.ssh/authorized_keys

 

rac101:~/asmlib # rpm -ivh oracleasm-support-2.1.3-1.SLE9.x86_64.rpm

Preparing...                ########################################### [100%]

   1:oracleasm-support      ########################################### [100%]

 

 

rac101:~/asmlib # rpm -ivh oracleasm-2.6.5-7.308-default-2.0.3-1.x86_64.rpm

Preparing...                ########################################### [100%]

   1:oracleasm-2.6.5-7.308-d########################################### [100%]

rac101:~/asmlib #

rac101:~/asmlib #

rac101:~/asmlib #

rac101:~/asmlib # rpm -ivh oracleasmlib-2.0.4-1.sle9.x86_64.rpm

Preparing...                ########################################### [100%]

   1:oracleasmlib           ########################################### [100%]

rac101:~/asmlib #

 

 

rac101:~/asmlib # /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 [oracle]:

Default group to own the driver interface [dba]:

Start Oracle ASM library driver on boot (y/n) [y]:

Scan for Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: done

Initializing the Oracle ASMLib driver:                                                                                   done

Scanning the system for Oracle ASMLib disks:                                                                             done

rac101:~/asmlib #

 

 

rac102:~/asmlib # /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 []: oracle

Default group to own the driver interface []: dba

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:                               done

Scanning the system for Oracle ASMLib disks:                         done

 

 

 

rac101上:

 

rac101:~/asmlib # /etc/init.d/oracleasm createdisk VOL1 /dev/wjlvg/wjllv5g001

Marking disk "VOL1" as an ASM disk:                                  done

rac101:~/asmlib # /etc/init.d/oracleasm createdisk VOL1 /dev/wjlvg/wjllv5g002

Marking disk "VOL1" as an ASM disk:                                  failed

rac101:~/asmlib # /etc/init.d/oracleasm createdisk VOL2 /dev/wjlvg/wjllv5g002

Marking disk "VOL2" as an ASM disk:                                  done

rac101:~/asmlib # /etc/init.d/oracleasm scandisks

Scanning the system for Oracle ASMLib disks:                         done

rac101:~/asmlib #

rac101:~/asmlib # /etc/init.d/oracleasm listdisks

VOL1

VOL2

 

 

rac102

rac102:~/asmlib # /etc/init.d/oracleasm scandisks

Scanning the system for Oracle ASMLib disks:                         done

rac102:~/asmlib # /etc/init.d/oracleasm listdisks

VOL1

VOL2

 

 

1.9.     配置network

rac101

10.230.17.240

192.168.1.100

 

rac102

10.230.17.241

192.168.1.101

 

rac101/rac102

/etc/hosts

192.168.1.100   priv-rac101

192.168.1.101   priv-rac102

10.230.17.241   rac102

10.230.17.230   vip-rac101

10.230.17.231   vip-rac102

10.230.17.240   rac101

 

阅读(2747) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~