Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1159019
  • 博文数量: 253
  • 博客积分: 5892
  • 博客等级: 大校
  • 技术积分: 1942
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-24 14:20
文章分类

全部博文(253)

文章存档

2012年(98)

2011年(155)

分类: Oracle

2012-01-19 01:00:20

题记:关于和ASM的配置应该算是老生常谈了,由于11gR2的安装配置方法和之前版本的有很大的区别,所以我特地抽了时间做了这个,也顺便将整个安装过程分享出来给大家,希望能给各位提供帮助,请多多指教!

1. 准备工作

(1) 操作系统版本

[root@AS5 ~]# uname -a

Linux AS5 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:54 EDT 2009 i686 i686 i386 GNU/Linux

(2) Yum仓库创建

[root@AS5 ~]# mount -o remount /dev/hdc /mnt

[root@AS5 ~]# cat /etc/yum.repos.d/rhel-debuginfo.repo

[rhel-debuginfo]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=file:///mnt/Server

enabled=1

gpgcheck=0

[root@AS5 ~]# yum clean all

Loaded plugins: rhnplugin, security

Cleaning up Everything

[root@AS5 ~]# yum grouplist

(3) 硬盘、内存等信息

[root@AS5 ~]# df -H

Filesystem Size Used Avail Use% Mounted on

/dev/sda3 17G 2.7G 14G 17% /

/dev/sda1 104M 12M 87M 12% /boot

tmpfs 1.1G 0 1.1G 0% /dev/shm

/dev/hdc 3.1G 3.1G 0 100% /mnt

[root@AS5 ~]# free -m

total used free shared buffers cached

Mem: 1010 239 771 0 15 184

-/+ buffers/cache: 39 971

Swap: 2000 0 2000

(4) 网络配置

[root@AS5 ~]# ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:0C:29:C7:70:76

inet addr:172.24.0.200 Bcast:172.24.0.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fec7:7076/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:1343052 errors:31 dropped:31 overruns:0 frame.:0

TX packets:113486 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:2019886062 (1.8 GiB) TX bytes:11644712 (11.1 MiB)

Interrupt:75 Base address:0x2000

[root@AS5 ~]# hostname

AS5

[root@AS5 ~]# cat /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=AS5

GATEWAY=172.24.0.1

[root@AS5 ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost AS5

::1 localhost6.localdomain6 localhost6

172.24.0.200 AS5

(5) 安装必要的包

oracle要求的必要软件包如下:

binutils-2.17.50.0.6

compat-libstdc++-33-3.2.3

elfutils-libelf-0.125

elfutils-libelf-devel-0.125

elfutils-libelf-devel-static-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

kernel-headers-2.6.18

ksh-20060214

libaio-0.3.106

libaio-devel-0.3.106

libgcc-4.1.2

libgomp-4.1.2

libstdc++-4.1.2

libstdc++-devel-4.1.2

make-3.81

sysstat-7.0.2

unixODBC-2.2.11

unixODBC-devel-2.2.11

安装方法:(安装时我添加了这两个包:libXp pdksh

[root@AS5 ~]# yum –y install binutils compat-* elfutils-libelf* gcc gcc-c++ glibc* kernel-headers ksh libaio* libgcc libgomp libstdc++* make sysstat unixODBC* libXp pdksh

(6) 建立用户及组

[root@AS5 ~]# groupadd oinstall

[root@AS5 ~]# groupadd dba

[root@AS5 ~]# groupadd asmadmin

[root@AS5 ~]# groupadd asmdba

[root@AS5 ~]# useradd -g oinstall -G asmdba,asmadmin,dba grid

[root@AS5 ~]# useradd -g oinstall -G dba,asmdba oracle

[root@AS5 ~]# passwd grid

[root@AS5 ~]# passwd oracle

[root@AS5 ~]# id grid

uid=500(grid) gid=500(oinstall) groups=500(oinstall),501(dba),502(asmadmin),503(asmdba)

[root@AS5 ~]# id oracle

uid=501(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),503(asmdba)

(7) 配置内核参数及其他配置选项

/etc/sysctl.conf配置文件中添加如下:

#===================oracle11gr2=====================

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

然后执行:

[root@AS5 ~]# sysctl -p

再在/etc/security/limits.conf置文件中添加:

#====================oracle11gr2======================

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

/etc/pam.d/login配置文件中添加:

#=================oracle11gr2=====================

session required pam_limits.so

/etc/profile配置文件中添加:

#===================oracle11gr2=====================

if [ $USER = "oracle" ] || [ $USER = "grid" ]; then

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

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

(8) 建立相应目录

[root@AS5 ~]# mkdir -p /u01/app/oracle

[root@AS5 ~]# chown -R oracle:oinstall /u01

[root@AS5 ~]# chmod -R 775 /u01

(9) 配置gridoracle用户的环境变量

~grid/.bash_profile配置文件中添加:

#========================oracle11gr2—grid ============================

umask 022

TMP=/tmp

TMPDIR=/tmp

PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

ORACLE_BASE=/u02/app/grid

ORACLE_HOME=$ORACLE_BASE/11.2.0

ORACLE_SID=+ASM

PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH TMP TMPDIR

#stty erase ^h

~oracle/.bash_profile配置文件中添加:

#======================oracle11gr2=========================

umask 022

TMP=/tmp

TMPDIR=/tmp

PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

ORACLE_SID=ora10

LD_LIBRARY_PATH=$ORACLE_HOME/jdk/jre/lib/i386:$ORACLE_HOME/jdk/jre/lib/i386/server:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH

PATH=$ORACLE_HOME/bin:$PATH

NLS_LANG=American_America.ZHS16GBK

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH NLS_LANG TMP TMPDIR

stty erase ^h

至此,整个环境搭建完毕。如果可以,建议重启系统。

2.安装ASM存储(grid

说明:如果文件直接存储在文件系统中,这一步可以略过。

(1) 系统现在有空闲的分区

[root@AS5 install]# fdisk -l /dev/sdb

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 2610 20964793+ 5 Extended

/dev/sdb5 1 366 2939832 83 Linux

/dev/sdb6 367 732 2939863+ 83 Linux

/dev/sdb7 733 1098 2939863+ 83 Linux

/dev/sdb8 1099 1342 1959898+ 83 Linux

[root@AS5 u02]# chown grid:asmadmin /dev/sdb?

[root@AS5 u02]# ls -l /dev/sdb?

brw-r----- 1 grid asmadmin 8, 17 Jul 15 18:25 /dev/sdb1

brw-r----- 1 grid asmadmin 8, 21 Jul 15 18:24 /dev/sdb5

brw-r----- 1 grid asmadmin 8, 22 Jul 15 18:25 /dev/sdb6

brw-r----- 1 grid asmadmin 8, 23 Jul 15 18:24 /dev/sdb7

brw-r----- 1 grid asmadmin 8, 24 Jul 15 18:25 /dev/sdb8

(2) 安装AMBlib

[root@AS5 u02]# rpm -ivh oracleasm-support-2.1.3-1.el5.i386.rpm

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

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

[root@AS5 u02]# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm

warning: ora005_oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159

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

1:oracleasm-2.6.18-164.el########################################### [100%]

[root@AS5 u02]# rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpm

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

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

(3) 配置ASM

[root@AS5 u02]# /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) [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: [ OK ]

Scanning the system for Oracle ASMLib disks: [ OK ]

[root@AS5 u02]# /usr/sbin/oracleasm init

(4) 创建ASM磁盘

[root@AS5 u02]# service oracleasm createdisk VOL01 /dev/sdb5

Marking disk "VOL01" as an ASM disk: [ OK ]

[root@AS5 u02]# service oracleasm createdisk VOL02 /dev/sdb6

Marking disk "VOL02" as an ASM disk: [ OK ]

[root@AS5 u02]# service oracleasm createdisk VOL03 /dev/sdb7

Marking disk "VOL03" as an ASM disk: [ OK ]

[root@AS5 u02]# service oracleasm createdisk VOL04 /dev/sdb8

Marking disk "VOL04" as an ASM disk: [ OK ]

[root@AS5 u02]# oracleasm scandisks

Reloading disk partitions: done

Cleaning any stale ASM disks...

Scanning system for ASM disks...

[root@AS5 u02]# oracleasm listdisks

VOL01

VOL02

VOL03

VOL04

(5) 关闭时间服务

[root@AS5 u02]# service ntpd stop

Shutting down ntpd: [FAILED]

[root@AS5 u02]# chkconfig ntpd off

[root@AS5 u02]# mv /etc/ntp.conf /etc/ntp.conf_bak

 
说明:本想将过程中的所有截图一同发布,可惜的是这里的日志中不好粘贴图片,所以安装过程中的截图将以打包的形式发布,请各位谅解!链接地址:http://space.itpub.net/25881373/viewspace-702460

(6) 安装grid

注意:这一步中,必须是以grid用户登录操作,而不能从其他用户su命令切换到grid上。

[grid@AS5 u02]$ unzip linux_11gR2_grid.zip

[grid@AS5 u02]$ cd grid/

[grid@AS5 grid]$ export DISPLAY=172.24.0.1:0.0

[grid@AS5 grid]$ ./runInstaller

图1至图10 (打包在grid_setup.rar中)

http://space.itpub.net/25881373/viewspace-702460

[root@AS5 u02]# /u02/app/oraInventory/orainstRoot.sh

Changing permissions of /u02/app/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

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

The execution of the script. is complete.

[root@AS5 u02]# /u02/app/grid/11.2.0/root.sh

Running root.sh script...

The following environment variables are set as:

ORACLE_OWNER= grid

ORACLE_HOME= /u02/app/grid/11.2.0

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.sh script.

Now product-specific root actions will be performed.

2011-07-15 11:56:31: Checking for super user privileges

2011-07-15 11:56:32: User has super user privileges

2011-07-15 11:56:32: Parsing the host name

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

Creating trace directory

LOCAL ADD MODE

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

Operation successful.

CRS-4664: Node as5 successfully pinned.

Adding daemon to inittab

CRS-4123: Oracle High Availability Services has been started.

ohasd is starting

as5 2011/07/15 11:57:46 /u02/app/grid/11.2.0/cdata/as5/backup_20110715_115746.olr

Successfully configured Oracle Grid Infrastructure for a Standalone

Updating inventory properties for clusterware

Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB. Actual 2000 MB Passed

The inventory pointer is located at /etc/oraInst.loc

The inventory is located at /u02/app/oraInventory

'UpdateNodeList' was successful.

至此,grid安装完毕。

[root@AS5 install]# ps -ef | grep ASM

grid 30172 1 0 15:23 ? 00:00:00 asm_pmon_+ASM

grid 30174 1 0 15:23 ? 00:00:00 asm_vktm_+ASM

grid 30178 1 0 15:23 ? 00:00:00 asm_gen0_+ASM

grid 30180 1 0 15:23 ? 00:00:00 asm_diag_+ASM

grid 30182 1 0 15:23 ? 00:00:00 asm_psp0_+ASM

grid 30184 1 0 15:23 ? 00:00:00 asm_dia0_+ASM

grid 30186 1 0 15:23 ? 00:00:00 asm_mman_+ASM

grid 30188 1 0 15:23 ? 00:00:00 asm_dbw0_+ASM

grid 30190 1 0 15:23 ? 00:00:00 asm_lgwr_+ASM

grid 30192 1 0 15:23 ? 00:00:00 asm_ckpt_+ASM

grid 30194 1 0 15:23 ? 00:00:00 asm_smon_+ASM

grid 30196 1 0 15:23 ? 00:00:00 asm_rbal_+ASM

grid 30198 1 0 15:23 ? 00:00:00 asm_gmon_+ASM

grid 30200 1 0 15:23 ? 00:00:00 asm_mmon_+ASM

grid 30202 1 0 15:23 ? 00:00:00 asm_mmnl_+ASM

创建完成ASM实例后,需要用grid用户进行:

[grid@AS5 utl]$ crsctl modify resource "ora.cssd" -attr "AUTO_START=1"

[grid@AS5 utl]$ crsctl modify resource "ora.diskmon" -attr "AUTO_START=1"

(7) 创建ASM磁盘组

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

NAME STATE TYPE TOTAL_MB USABLE_FILE_MB

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

DATA01MOUNTED NORMAL 8610 4185

SQL> select name,header_status,mount_status,state,path from v$asm_disk;

NAME HEADER_STATU MOUNT_S STATE PATH

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

PROVISIONED CLOSED NORMAL ORCL:VOL04

VOL01 MEMBER CACHED NORMAL ORCL:VOL01

VOL02 MEMBER CACHED NORMAL ORCL:VOL02

VOL03 MEMBER CACHED NORMAL ORCL:VOL03

SQL> create diskgroup flash_recover_area external redundancy disk 'ORCL:VOL04';

Diskgroup created.

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

NAME STATE TYPE TOTAL_MB USABLE_FILE_MB

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

DATA01 MOUNTED NORMAL 8610 4185

FLASH_RECOVER_AREA MOUNTED EXTERN 1913 1863

3.安装oracle软件

1)将oracle数据库软件上传到主机上,然后用oracle身份解压:

[oracle@AS5 u01]$ ll

total 3188280

drwxrwxr-x 3 oracle oinstall 4096 Jul 14 18:30 app

-rwxrwxr-x 1 oracle oinstall 1285396902 Jul 14 18:49 linux_11gR2_database_1of2.zip

-rwxrwxr-x 1 oracle oinstall 995359177 Jul 14 18:46 linux_11gR2_database_2of2.zip

[oracle@AS5 u01]$ unzip linux_11gR2_database_1of2.zip

[oracle@AS5 u01]$ rm linux_11gR2_database_1of2.zip

[oracle@AS5 u01]$ unzip linux_11gR2_database_2of2.zip

[oracle@AS5 u01]$ rm linux_11gR2_database_2of2.zip

[oracle@AS5 u01]$ chmod -R 775 database/

2)安装oracle

注意:这一步中,必须是以oracle用户登录操作,而不能从其他用户su命令切换到oracle上。

[oracle@AS5 u01]$ cd database/

[oracle@AS5 database]$ pwd

/u01/database

[oracle@AS5 database]$ ll

total 40

drwxrwxr-x 12 oracle oinstall 4096 Aug 17 2009 doc

drwxrwxr-x 4 oracle oinstall 4096 Aug 14 2009 install

drwxrwxr-x 2 oracle oinstall 4096 Aug 14 2009 response

drwxrwxr-x 2 oracle oinstall 4096 Aug 14 2009 rpm

-rwxrwxr-x 1 oracle oinstall 4352 Aug 14 2009 runInstaller

drwxrwxr-x 2 oracle oinstall 4096 Aug 14 2009 sshsetup

drwxrwxr-x 14 oracle oinstall 4096 Aug 14 2009 stage

-rwxrwxr-x 1 oracle oinstall 5400 Aug 18 2009 welcome.html

[oracle@AS5 database]$ export DISPLAY=172.24.0.1:0.0

[oracle@AS5 database]$ ./runInstaller

安装过程截图11至图20(打包在oracle_setup.rar中)

http://space.itpub.net/25881373/viewspace-702460

[root@AS5 install]# /u01/app/oracle/product/11.2.0/db_1/root.sh

Running Oracle 11g root.sh script...

The following environment variables are set as:

ORACLE_OWNER= oracle

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

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

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

[n]: y

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

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

[n]: y

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

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

[n]: y

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

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.sh script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

至此,oracle数据库软件已经安装完毕。

4.建库

[oracle@AS5 database]$ echo $ORACLE_SID

ora10

[oracle@AS5 database]$ export DISPLAY=172.24.0.1:0.0

[oracle@AS5 database]$ dbca

图21至图32(打包在dbca.rar中)

http://space.itpub.net/25881373/viewspace-702460

完成上面的操作,数据库即创建完成。

SQL> select file_name from dba_data_files;

FILE_NAME

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

+DATA01/ora10/datafile/users.259.756577629

+DATA01/ora10/datafile/undotbs1.258.756577629

+DATA01/ora10/datafile/sysaux.257.756577629

+DATA01/ora10/datafile/system.256.756577627

+DATA01/ora10/datafile/example.265.756577983

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