ITPub博客

首页 > 数据库 > Oracle > oracle 手动创建ASM

oracle 手动创建ASM

原创 Oracle 作者:邱东阳 时间:2014-03-20 14:55:08 0 删除 编辑

手动创建ASM磁盘组

根据自己的需求为OS 添加磁盘

 

官方说明安装ASM 需要三个包:

 

  oracleasm-support-version.arch.rpm

  oracleasmlib-version.arch.rpm

  oracleasm-kernel-version.arch.rpm

 

 

安装ASM必要的包

 

[root@fengzi init.d]# cd /rhel5/Server/  (我的本地源)

[root@fengzi Server]# ls oracleasm*

oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm

oracleasm-2.6.18-274.el5debug-2.0.5-1.el5.x86_64.rpm

oracleasm-2.6.18-274.el5xen-2.0.5-1.el5.x86_64.rpm

oracleasm-support-2.1.7-1.el5.x86_64.rpm

 

[root@fengziServer]#rpm -Uvh oracleasm-support-2.1.7-1.el5.x86_64.rpm

warning: oracleasm-support-2.1.7-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159

Preparing...                                                            (10########################################### [100%]

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

[root@fengzi Server]# rpm -Uvh oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm

warning: oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159

Preparing...                                                            (10########################################### [100%]

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

 

 

缺少oracleasmlib包(到网上下载)

使用SHH 工具上传包

 

[root@fengzi oracle]# cd /root

[root@fengzi ~]# ls

anaconda-ks.cfg  install.log.syslog

Desktop         

oracleasmlib-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm(可能版本不是一致)

install.log

[root@fengzi ~]# rpm -Uvh oracleasmlib-2.6.18-194.32.1.el5-2.0.5-1.el5.x86_64.rpm

warning: oracleasmlib-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159

Preparing...                                                            (10########################################### [100%]

   1:oracleasmlib-2.6.18-194.3.e15                                           ( 1########################################### [100%]

 

 

配置 ASMLib

使用 ASMLib 之前,必须运行配置脚本以准备驱动程序。以 root 用户身份运行以下命令,并响应如下示例中所显示的提示

 

 

[root@fengzi ~]# /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: [  OK  ]

Scanning the system for Oracle ASMLib disks: [  OK  ]

[root@fengzi ~]#

 

 

启用 ASMLib 驱动程序

 

[root@fengzi ~]# /etc/init.d/oracleasm enable

Writing Oracle ASM library driver configuration: done

Initializing the Oracle ASMLib driver: [  OK  ]

Scanning the system for Oracle ASMLib disks: [  OK  ]

[root@fengzi ~]#

 

ASM 配置磁盘

查看当前磁盘

 

[root@fengzi u01]# fdisk -l

 

Disk /dev/sda: 20.5 GB, 20574109696 bytes

255 heads, 63 sectors/track, 2501 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1         130     1044193+  83  Linux

/dev/sda2             131        2371    18000832+  83  Linux

/dev/sda3            2372        2501     1044225   82  Linux swap / Solaris

 

Disk /dev/sdb: 21.5 GB, 21581791232 bytes

255 heads, 63 sectors/track, 2623 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1        2623    21069216   83  Linux

 

Disk /dev/sdc: 4294 MB, 4294967296 bytes

255 heads, 63 sectors/track, 522 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sdc doesn't contain a valid partition table

 

Disk /dev/sdd: 4294 MB, 4294967296 bytes

255 heads, 63 sectors/track, 522 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sdd doesn't contain a valid partition table

 

Disk /dev/sde: 4294 MB, 4294967296 bytes

255 heads, 63 sectors/track, 522 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sde doesn't contain a valid partition table

 

Disk /dev/sdf: 4294 MB, 4294967296 bytes

255 heads, 63 sectors/track, 522 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sdf doesn't contain a valid partition table

[root@fengzi u01]#

 

 

给磁盘分区

 

几个盘都分区

[root@fengzi u01]# fdisk /dev/sdc

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

 

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-522, default 1): Enter

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-522, default 522): Enter

Using default value 522

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table.

The new table will be used at the next reboot.

Syncing disks.

[root@fengzi u01]#

 使用相同步骤将需要添加到磁盘组的磁盘都分区

我的为/dev/sdc  /dev/sdd  /dev/sde   /dev/sdf

 

 

配置磁盘

 

[root@fengzi u01]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdc1

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

[root@fengzi u01]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdd1

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

[root@fengzi u01]# /etc/init.d/oracleasm createdisk VOL3 /dev/sde1

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

[root@fengzi u01]# /etc/init.d/oracleasm createdisk VOL4 /dev/sdf1

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

[root@fengzi u01]#

 

列出标记为由 ASMLib 使用的所有磁盘

[root@fengzi u01]# /etc/init.d/oracleasm listdisks

VOL1

VOL2

VOL3

VOL4

[root@fengzi u01]#

 

 

配置oracle集群同步服务(css

 

用于同步ASM实例与RDBMS实例,使用root帐户进行配置,配置程序位于$ORACLE_HOME/bin

$su

[root@fengzi u01]# $ORACLE_HOME/bin/localconfig all

/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.

        hxl

CSS is active on all nodes.

Oracle CSS service is installed and running under init(1M)

 

 

手动创建ASM目录

使用oracle用户

 

mkdir -p $ORACLE_BASE/admin/+ASM/bdump

mkdir -p $ORACLE_BASE/admin/+ASM/cdump

mkdir -p $ORACLE_BASE/admin/+ASM/hdump

mkdir -p $ORACLE_BASE/admin/+ASM/pfile

mkdir -p $ORACLE_BASE/admin/+ASM/udump

 

 

创建磁盘组参数文件

 

[oracle@fengzi bin]#vi $ORACLE_BASE/admin/+ASM/pfile/init.ora

*.asm_diskgroups='DATA'

+ASM.asm_diskgroups='DATA'                              #Manual Mount

*.background_dump_dest='/u01/app/oracle/admin/+ASM/bdump'

*.cluster_database=true

*.core_dump_dest='/u01/app/oracle/admin/+ASM/cdump'

 

*.instance_type='asm'

*.large_pool_size=12M

*.remote_login_passwordfile='exclusive'

*.user_dump_dest='/u01/app/oracle/admin/+ASM/udump'

 

 

 

创建磁盘组

 

[oracle@fengzi bin]# export ORACLE_SID=+ASM

[oracle@fengzi bin]#sqlplus  / as  sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 21 19:10:51 2010

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL>

 

 

外部冗余方式

SQL> create  diskgroup DATA external redundancy disk '/dev/oracleasm/VOL1';

 

Diskgroupcreated.

 

SQL> alter diskgroup DATA add disk '/dev/oracleasm/VOL2';

 

Diskgroupaltered.

SQL> alter diskgroup DATA add disk '/dev/oracleasm/VOL3';

 

Diskgroupaltered.

SQL> alter diskgroup DATA add disk '/dev/oracleasm/VOL4';

 

Diskgroupaltered.

普通冗余方式

SQL> create diskgroup DATA normal redundancy

  2  failgroup DATA1 disk '/dev/oracleasm/VOL1' name DATA1

  3  failgroup DATA2 disk '/dev/oracleasm/VOL2' name DATA2;

 

SQL> alter diskgroup DATA add disk '/dev/oracleasm/VOL1' name

VOL1,'/dev/oracleasm/VOL3' name VOL3,'/dev/oracleasm/VOL4' name VOL4

 

  创建spfile

SQL>create spfile from pfile;

File created.

 

 手动指定磁盘组的名

 

SQL> alter system set asm_diskgroups=DATA scope=both;

 

System altered.

 

SQL> show parameter asm;

 

NAME                                TYPE        VALUE

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

asm_diskgroups                      string      DATA

asm_diskstring                      string

asm_power_limit                     integer     1

 

 

重启ASM

 

SQL>shutdown immediate 

ASMinstance shutdown

SQL>startup

ASMinstance started

 

TotalSystem Global Area   92274688 bytes

FixedSize                  1217884 bytes

VariableSize              65890980 bytes

ASMCache                  25165824 bytes

ASMdiskgroups mounted

SQL>select name,state from v$asm_diskgroup;

 

NAME                           STATE

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

DATA                    MOUNTED

 

 

 

创建完成,下面就可以构建一个使用ASM进行磁盘存储的数据库。

 

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

请登录后发表评论 登录
全部评论

注册时间:2014-03-11

  • 博文量
    38
  • 访问量
    173586