ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 安装ASM数据库 裸设备方式

安装ASM数据库 裸设备方式

原创 Linux操作系统 作者:hjianping 时间:2011-05-05 23:03:09 0 删除 编辑

一、配置ORACLE环境参数

1、配置网络
vi /etc/hosts
127.0.0.1               redhat localhost.localdomain localhost
变成
127.0.0.1               localhost.localdomain  localhost (huang)
192.168.1.120           huang

2、创建ORACLE用户及目录
==================================================
groupadd oinstall
groupadd dba

mkdir -p /u01/oracle

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

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

4、设置环境变量(oracle用户)
vi .bash_profile
===============================================================================
ORACLE_SID=ora10
ORACLE_BASE=/u01
ORACLE_HOME=/u01/oracle
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

export ORACLE_SID ORACLE_BASE ORACLE_HOME PATH LD_ASSUME_KERNEL LD_LIBRARY_PATH
================================================================================
检验环境变量设置是否成功,ORACLE用户登陆
env | grep ORA

5、配置内核参数(root用户)
vi /etc/sysctl.conf
===========================================
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
===========================================
/sbin/sysctl -p (要执行)

6、To increase the shell limits(root用户):

Add the following lines to the vi /etc/security/limits.conf file:
============================================
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
============================================

Add or edit the following line in the vi /etc/pam.d/login file, if it does not already exist(root用户):
===================================================
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so
===================================================

For the Bourne, Bash, or Korn shell,add the following lines to the vi /etc/profile file (or the file on SUSE systems)/etc/profile.local(root用户):
===================================================
if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
fi
===================================================


二、添加磁盘,以root用户身份
# fdisk /dev/sdb
=================================================
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512):
Using default value 512

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
=================================================
# fdisk /dev/sdc
# fdisk /dev/sdd
# fdisk /dev/sde


三、为ASM磁盘映射原始设备,以root用户身份

1、编辑rawdevices的配置文件
# vi /etc/sysconfig/rawdevices
===============================
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
/dev/raw/raw4 /dev/sde1
===============================

2、配置系统启动时,自动启动rawdevices服务
# chkconfig rawdevices on

3、重启rawdevices服务
# /sbin/service rawdevices restart
=================================================
Assigning devices:
           /dev/raw/raw1  -->   /dev/sdb1
/dev/raw/raw1:  bound to major 8, minor 17
           /dev/raw/raw2  -->   /dev/sdc1
/dev/raw/raw2:  bound to major 8, minor 33
           /dev/raw/raw3  -->   /dev/sdd1
/dev/raw/raw3:  bound to major 8, minor 49
           /dev/raw/raw4  -->   /dev/sde1
/dev/raw/raw4:  bound to major 8, minor 65
done
=================================================

4、确认rawdevices服务成功启动
# service rawdevices status

5、更改裸设备的属主
# chown oracle:dba /dev/raw/raw*
# chmod 660 /dev/raw/raw*
# ls -l /dev/raw/raw*
===========================================================
crw-rw----  1 oracle dba 162, 4 May 27 14:56 /dev/raw/raw4
crw-rw----  1 oracle dba 162, 3 May 27 14:56 /dev/raw/raw3
crw-rw----  1 oracle dba 162, 2 May 27 14:56 /dev/raw/raw2
crw-rw----  1 oracle dba 162, 1 May 27 14:56 /dev/raw/raw1
===========================================================

6、编辑UDEN权限配置文件
# vi /etc/udev/permissions.d/50-udev.permissions
=================================================
# raw devices
ram*:root:disk:0660
#raw/*:root:disk:0660
raw/*:oracle:dba:0660
=================================================

7、重启rawdevices服务
# /sbin/service rawdevices restart


四、安装Oracle数据库和实例
1、安装Oracle数据库(以Oracle用户身份安装,先不安装实例)
解压ZIP文件
unzip *.zip

安装
./runInstaller
选择高级安装,添加中文支持。

以root用户身份运行
./u01/oraInventory/orainstRoot.sh
./u01/oracle/root.sh
(回车取默认)

2、安装ASM
a、以root用户身份运行
# /u01/oracle/bin/localconfig add
==============================================================
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized
Adding to inittab
Startup will be queued to init within 90 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        redhat
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
==============================================================

b、以Oracle用户身份安装ASM
$ dbca
选择Configure Automatic Storage Management

3、以Oracle用户身份安装实例
$ dbca
选择Create a Database

$ netca


启动ASM(开机后要等待一会)
$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
SQL> startup

启动实例
$ export ORACLE_SID=ora10
$ sqlplus / as sysdba
SQL> startup


五、ASM相关故障处理

1、ORA-29701: unable to connect to Cluster Manager
# ps -axu |grep cssd
# /etc/init.d/init.cssd stop
# /etc/init.d/init.cssd start


2、没有挂载ASM磁盘
SQL> startup;
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+date1/ora10/spfileora10.ora'
ORA-17503: ksfdopn:2 Failed to open file +date1/ora10/spfileora10.ora
ORA-15077: could not locate ASM instance serving a required diskgroup
可以看出diskgroup没有mount,所以先把diskgroup mount

$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
SQL> shutdown immediate;
ORA-15100: invalid or missing diskgroup name
ASM instance shutdown

SQL> startup;
ASM instance started
Total System Global Area   92274688 bytes
Fixed Size                  1217884 bytes
Variable Size              65890980 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted

SQL> select name,state from v$asm_diskgroup;

SQL> alter diskgroup DATE1 mount;

SQL> alter diskgroup DATA2 mount;

SQL> exit

$ export ORACLE_SID=ora10
$ sqlplus / as sysdba
SQL> startup

 

六、测试ASM数据库
1、添加磁盘
alter diskgroup dg1 add
failgroup fg1 disk '/dev/raw/raw7'
failgroup fg2 disk '/dev/raw/raw8';

alter diskgroup dg2 add disk '/dev/raw/raw9';

select group_number,operation,state,est_work,sofar,est_minutes from v$asm_operation;
(no rows selected 即自动数据平衡完成)

select name,allocation_unit_size,total_mb from v$asm_diskgroup;

2、删除磁盘
alter diskgroup dgroup1 drop disk '/dev/raw/raw9';

select group_number,operation,state,est_work,sofar,est_minutes from v$asm_operation;
(no rows selected 即自动数据平衡完成)

select name,allocation_unit_size,total_mb from v$asm_diskgroup;
alter diskgroup dgroup1 rebalance;
select label,failgroup,state from v$asm_disk;

3、相关视图
V$asm_operation

V$asm_diskgroup

V$asm_disk

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17012874/viewspace-694568/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 裸设备安装Oracle
下一篇: 复制数据库 手工
请登录后发表评论 登录
全部评论

注册时间:2011-04-24

  • 博文量
    80
  • 访问量
    73179