使用裸设备配置Oracle ASM实例一例

1.查看当前磁盘

[[email protected] u01]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        4698    37736653+  83  Linux
/dev/sda2            4699        5220     4192965   82  Linux swap / Solaris

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/sde: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

从上面的输出可以看出我们有四快盘且都没有分区:
/dev/sdb
/dev/sdc
/dev/sdd
/dev/sde

2.对磁盘进行分区

[[email protected] u01]# 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-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261

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

Calling ioctl() to re-read partition table.
Syncing disks.

对其他磁盘执行同样的分区操作!

[[email protected] u01]# ll /dev/sd*
brw-r----- 1 root disk 8,  0 Jan 30 09:10 /dev/sda
brw-r----- 1 root disk 8,  1 Jan 30 09:10 /dev/sda1
brw-r----- 1 root disk 8,  2 Jan 30 09:10 /dev/sda2
brw-r----- 1 root disk 8, 16 Jan 30 13:30 /dev/sdb
brw-r----- 1 root disk 8, 17 Jan 30 13:30 /dev/sdb1
brw-r----- 1 root disk 8, 32 Jan 30 13:37 /dev/sdc
brw-r----- 1 root disk 8, 33 Jan 30 13:37 /dev/sdc1
brw-r----- 1 root disk 8, 48 Jan 30 13:38 /dev/sdd
brw-r----- 1 root disk 8, 49 Jan 30 13:38 /dev/sdd1
brw-r----- 1 root disk 8, 64 Jan 30 13:39 /dev/sde
brw-r----- 1 root disk 8, 65 Jan 30 13:39 /dev/sde1

3.绑定裸设备

[[email protected] u01]# vi /etc/sysconfig/rawdevices
[[email protected] u01]# cat /etc/sysconfig/rawdevices
# raw device bindings
# format:  <rawdev> <major> <minor>
#          <rawdev> <blockdev>
# example: /dev/raw/raw1 /dev/sda1
#          /dev/raw/raw2 8 5
/dev/raw/raw1  /dev/sdb1
/dev/raw/raw2  /dev/sdc1
/dev/raw/raw3  /dev/sdd1
/dev/raw/raw4  /dev/sde1
[[email protected] u01]# 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
[[email protected] u01]# raw -qa
/dev/raw/raw1:  bound to major 8, minor 17
/dev/raw/raw2:  bound to major 8, minor 33
/dev/raw/raw3:  bound to major 8, minor 49
/dev/raw/raw4:  bound to major 8, minor 65

3.更改裸设备的权限

[[email protected] u01]# cd /dev/raw
[[email protected] raw]# ll
total 0
crw------- 1 root root 162, 1 Jan 30 13:42 raw1
crw------- 1 root root 162, 2 Jan 30 13:42 raw2
crw------- 1 root root 162, 3 Jan 30 13:42 raw3
crw------- 1 root root 162, 4 Jan 30 13:42 raw4
[[email protected] raw]# chown oracle:dba raw*
[[email protected] raw]# ll
total 0
crw------- 1 oracle dba 162, 1 Jan 30 13:42 raw1
crw------- 1 oracle dba 162, 2 Jan 30 13:42 raw2
crw------- 1 oracle dba 162, 3 Jan 30 13:42 raw3
crw------- 1 oracle dba 162, 4 Jan 30 13:42 raw4

为方便我们把"chown oracle:dba raw*"写入/etc/rc.local

[[email protected] raw]# cat /etc/rc.local |grep chown
chown oracle:dba /dev/raw/raw[1-4]
[[email protected] raw]# 

4.安装配置ASM驱动

[[email protected] u01]# uname -ra
Linux std 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[[email protected] u01]# ll oracleasm*
-rw-r--r-- 1 root root 130018 Jul 24  2013 oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm
-rw-r--r-- 1 root root 130966 Jul 24  2013 oracleasm-2.6.18-194.el5debug-2.0.5-1.el5.i686.rpm
-rw-r--r-- 1 root root   2844 Jul 24  2013 oracleasm-2.6.18-194.el5-debuginfo-2.0.5-1.el5.i686.rpm
-rw-r--r-- 1 root root 130595 Jul 24  2013 oracleasm-2.6.18-194.el5PAE-2.0.5-1.el5.i686.rpm
-rw-r--r-- 1 root root 128392 Jul 24  2013 oracleasm-2.6.18-194.el5xen-2.0.5-1.el5.i686.rpm
-rw-r--r-- 1 root root  13929 Jul 24  2013 oracleasmlib-2.0.4-1.el5.i386.rpm
-rw-r--r-- 1 root root  85303 Jul 24  2013 oracleasm-support-2.1.8-1.el5.i386.rpm

[[email protected] u01]# rpm -ivh oracleasm*    --这些包之前我们以安装过
warning: oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
        package oracleasm-support-2.1.8-1.el5.i386 is already installed
        package oracleasm-2.6.18-194.el5xen-2.0.5-1.el5.i686 is already installed
        package oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686 is already installed
        package oracleasm-2.6.18-194.el5debug-2.0.5-1.el5.i686 is already installed
        package oracleasm-2.6.18-194.el5-debuginfo-2.0.5-1.el5.i686 is already installed
        package oracleasm-2.6.18-194.el5PAE-2.0.5-1.el5.i686 is already installed
        package oracleasmlib-2.0.4-1.el5.i386 is already installed

配置验证ASM驱动:

[[email protected] u01]# /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
Default group to own the driver interface [ ]:oinstall
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:                    [ OK ]
Scanning the system for Oracle ASMLib disks:              [ OK ]

[[email protected] u01]# lsmod |grep asm
oracleasm              46356  1 

5.初始化ASM参数

[[email protected] u01]# su - oracle
[[email protected] ~]$ cd $ORACLE_HOME/dbs
[[email protected] dbs]$ mkdir -p $ORACLE_BASE/admin/+ASM/{b,c,u}dump
[[email protected] dbs]$ touch init+ASM.ora
[[email protected] dbs]$ vi init+ASM.ora
[[email protected] dbs]$ cat init+ASM.ora
*.asm_diskstring=‘/dev/raw/raw*‘
*.instance_type=‘asm‘
*.large_pool_size=24M
*.remote_login_passwordfile=‘SHARED‘
*.background_dump_dest=‘/u02/app/admin/+ASM/bdump‘
*.core_dump_dest=‘/u02/app/admin/+ASM/cdump‘
*.user_dump_dest=‘/u02/app/admin/+ASM/bdump‘
[[email protected] dbs]$ 

6.为ASM实例创建密码文件

[[email protected] dbs]$ orapwd file=orapw+ASM password=oracle1
[[email protected] dbs]$ 

7.以root身份启动CSS进程

[[email protected] ~]# /u02/app/product/10.2.0/db_1/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.
localhost
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

验证CSS进程是否启动;

[[email protected] dbs]$ crsctl check css
CSS appears healthy
[[email protected] dbs]$ crsctl check crs
CSS appears healthy
Cannot communicate with CRS
Cannot communicate with EVM 

8.启动ASM实例

[[email protected] dbs]$ export ORACLE_SID=+ASM
[[email protected] dbs]$ sqlplus ‘/as sysdba‘

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Jan 30 14:34:00 2015

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area   96468992 bytes
Fixed Size                  1265984 bytes
Variable Size              70037184 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted

可以看到我们的ASM实例已经正常启动,最后报出ORA-15110错误说明没有挂载任何磁盘组,
因为此时我们还没有创建任何磁盘组,所以忽略这个错误。

9.创建spfile

使用spfile以后,在节下来的我们创建磁盘组时,ASM_DISKGROUPS这个参数会被自动更新。
而如果使用pfile,这个参数值不会自动更新。

SQL> create spfile from pfile;

File created.

SQL> shutdown abort
ASM instance shutdown
SQL> startup
ASM instance started

Total System Global Area   96468992 bytes
Fixed Size                  1265984 bytes
Variable Size              70037184 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted

SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u02/app/product/10.2.0/db_1/d
                                                 bs/spfile+ASM.ora

10.查看磁盘及创建磁盘组

--查看磁盘asm_diskstring参数指定的磁盘

SQL> select path from v$asm_disk;

PATH
--------------------------------------------------------------------------------
/dev/raw/raw4
/dev/raw/raw3
/dev/raw/raw2
/dev/raw/raw1

--创建磁盘组

CREATE DISKGROUP diskgroup_name
[ { HIGH | NORMAL | EXTERNAL } REDUNDANCY ]
[ FAILGROUP failgroup_name ]
DISK [ NAME disk_name ] [ SIZE size_clause ] [ FORCE | NOFORCE ] ...;

注意:冗余度有三个选择:HIGH(高度冗余&gt;三路)、NORMAL(标准冗余--双路)和EXTERNAL(外部存储冗余)

SQL> create diskgroup DATA external redundancy
  2  disk ‘/dev/raw/raw1‘,‘/dev/raw/raw2‘;

Diskgroup created.

SQL> create diskgroup FLA external redundancy
  2  disk ‘/dev/raw/raw3‘,‘/dev/raw/raw4‘;

Diskgroup created.

SQL> select GROUP_NUMBER,NAME,TOTAL_MB,FREE_MB from v$asm_diskgroup;

GROUP_NUMBER NAME                             TOTAL_MB    FREE_MB
------------ ------------------------------ ---------- ----------
           1 DATA                                 4094       4042
           2 FLA                                  4094       4042

11.把ASM实例注册到监听中

创建好ASM实例后,一般会系统会把ASM实例自动注册到监听中,如果没有自动注册,可以手动注册。

[[email protected] bdump]$ export ORACLE_SID=+ASM
[[email protected] bdump]$ sqlplus ‘/as sysdba‘

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Jan 30 15:21:00 2015

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter system register;

System altered.
[[email protected] ~]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 30-JAN-2015 15:19:33

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date                30-JAN-2015 15:19:15
Uptime                    0 days 0 hr. 0 min. 18 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u02/app/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=std)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully

12.远程访问ASM实例

要想从远程访问ASM实例,TNS配置需加上UR属性

asm=
 (DESCRIPTION=
  (ADDRESS= (PROTOCOL=tcp)(HOST=192.168.1.172)(PORT=1521))
  (CONNECT_DATA=
     (SERVICE_NAME=+ASM)
     (UR=A)))
C:\Users\Administrator>sqlplus sys/[email protected] as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期五 1月 30 15:27:08 2015

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select group_number,name from v$asm_diskgroup;

GROUP_NUMBER NAME
------------ ------------------------------------------------------------
           1 DATA
           2 FLA

时间: 2024-08-05 23:41:18

使用裸设备配置Oracle ASM实例一例的相关文章

【翻译自mos文章】设置了RemoveIPC=yes 的RHEL7.2上 会crash掉Oracle asm 实例和Oracle database实例

设置了RemoveIPC=yes 的RHEL7.2  会crash掉Oracle asm 实例和Oracle database实例,该问题也会在使用Shared Memory Segment (SHM) or Semaphores (SEM)的应用程序中发生. 来源于: ALERT: Setting RemoveIPC=yes on Redhat 7.2 Crashes ASM and Database Instances as Well as Any Application That Uses

RemoveIPC=yes 的RHEL7.2 会crash掉Oracle asm 实例和Oracle database实例

一个在centos7.2上的11204库的实例crash了,检查alert发现如下: Wed Sep 21 00:00:11 2016 Errors in file /apps/oracle/diag/rdbms/xberp/xberp/trace/xberp_ckpt_17537.trc: ORA-27157: OS post/wait facility removed ORA-27300: OS system dependent operation:semop failed with sta

[转]Oracle DB 管理ASM实例

? 描述使用ASM 的好处 ? 管理ASM 实例 ? 创建和删除ASM 磁盘组 ? 扩展ASM 磁盘组 ? 通过使用各种实用程序检索ASM 元数据 Automatic Storage Management Automatic Storage Management (ASM) 将文件系统与卷管理器纵向集成在一起,这是一项专门为Oracle DB 文件建立的技术.使用ASM 可管理单个对称多处理(SMP) 计算机,或通过管理集群的多个节点来支持Oracle Real Application Clus

连接 Oracle 11G R2 ASM实例

连接 Oracle 11G R2 ASM实例 开始连接ASM时候,效仿10G的方法却怎么都连接不到ASM 连接的都是idle实例 [[email protected] ~]# su - oracle [[email protected] ~]$ export ORACLE_SID=+ASM2 [[email protected] ~]$ sqlplus   / as  sysdba SQL*Plus: Release 11.2.0.3.0 Production on Wed May 16 18:

oracle数据库启动报错,不能启动ASM实例

数据库rac启动时报错,日志如下,后来使用 Sat Jun  7 06:02:11 2014 GATHER_STATS_JOB encountered errors.  Check the trace file. Sat Jun  7 06:02:11 2014 Errors in file /oracle/product/admin/dqb/bdump/dqb2_j001_13352.trc: ORA-08103: object no longer exists Sat Jun  7 06:0

Oracle单实例+ASM启动与关闭

转自:chenoracle  :  http://blog.itpub.net/29785807/viewspace-1744718/ 启动关闭注意事项 1 ASM实例的启动和数据库实例的启动有严格的先后关系,ASM启动一定早于数据库实例,关闭一定晚于ASM实例,因为它是数据库数据文件存储位置: 2 需要优先启动CSS,HAS服务. 启动: 一 启动时应该先启动ASM,在启动数据库 如果顺序反了会报错 例如: 1 关闭ASM [[email protected] ~]$ sqlplus Ente

oracle asm管理

1.asm优点 概念: auto storage manage db+instance<=====> raw裸设备 性能比较:raw > asm > filesystem 管理方便性 filesystem > asm > raw 逻辑结构 数据库<--表空间(tablespace)<---段(segment)<----区(extend)<---数据块(block) 物理结构:SAN存储 NFS存储 数据文件() ASM结构:: ASM磁盘组<

Oracle ASM 详解

ASM:Automatic Storage Management, 是Oracle 主推的一种面向Oracle的存储解决方案, ASM 和 RDBMS 非常相似,ASM 也是由实例和文件组成, 也可以通过sqlplus 工具来维护. ASM 实例的创建和删除也可以用DBCA 这个命令来操作.在dbca 的第一个界面选择配置自动存储管理就可以了. ASM 实例需要CSS 进程, 如果是非RAC 环境, 在启动ASM 实例之前会提示用脚本 $ORACLE_HOME/bin/localconfig a

oracle ASM 如何添加新磁盘到磁盘

适用平台: AIX hp linux  win Solaris 适用版本:所有数据库10.1.0.2 to12.1.0.1 适用于 rac和 standalone 以RAC 环境为例: 假设 oracle 为oracle rdbms 属组:grid 为 gi 属组: For ASMLIB users: RAC 环境 gi owner 执行以下命令 1.# /etc/init.d/oracleasm  scandisks  #( root用户执行) $> id $> /etc/init.d/or