簡單配置ASM

dbhelper發表於2014-11-27

環境描述

系統:Red Hat Enterprise Linux Server release 5.4 (Tikanga)
資料庫版本:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0

新增磁碟

    新增三塊硬碟,用來做ASM磁碟組:

 

三塊磁碟最好一樣大, 不一樣大在做冗餘時容易導致熱點競爭,增大磁碟的I/O,影響效能。

重啟一下系統,格式磁碟

 

啟動系統後fdisk -l檢視載入的磁碟,fdisk /dev/sdbsdb進行格式化

[root@localhost ~]# fdisk /dev/sdb

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.

The number of cylinders for this disk is set to 1044.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

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-1044, default 1): 

Using default value 1

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

Using default value 1044

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost ~]# fdisk /dev/sdc

[root@localhost ~]# fdisk /dev/sdd

[root@localhost ~]# fdisk -l         

 看到如下資訊 sdbsbcsdd三塊磁碟將用來做ASM磁碟組

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1        1044     8385898+  83  Linux

 

Disk /dev/sdc: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1        1044     8385898+  83  Linux

 

Disk /dev/sdd: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1               1        1044     8385898+  83  Linux

安裝配置ASM

上傳asm包,查詢對應版本,安裝asm

[root@localhost asm]# ls

oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm

oracleasm-2.6.9-67.EL-2.0.3-1.i686.rpm

oracleasm-2.6.9-67.ELhugemem-2.0.3-1.i686.rpm

oracleasm-2.6.9-67.ELsmp-2.0.3-1.i686.rpm

oracleasm-2.6.9-67.ELxenU-2.0.3-1.i686.rpm

oracleasmlib-2.0.4-1.el4.i386.rpm

oracleasm-support-2.1.4-1.el4.i386.rpm

[root@localhost asm]# uname -a

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

[root@localhost asm]# rpm -ivh oracleasm-support-2.1.4-1.el4.i386.rpm 

warning: oracleasm-support-2.1.4-1.el4.i386.rpm: Header V3 DSA signature: NOKEY, key ID b38a8516

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

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

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

warning: 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@localhost asm]# rpm -ivh oracleasmlib-2.0.4-1.el4.i386.rpm 

warning: oracleasmlib-2.0.4-1.el4.i386.rpm: Header V3 DSA signature: NOKEY, key ID b38a8516

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

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

 

[root@localhost asm]# /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 []: oinstall

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  ]

 

建立asmdisk

[root@localhost asm]# /etc/init.d/oracleasm createdisk asm_1 /dev/sdb1

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

[root@localhost asm]# /etc/init.d/oracleasm createdisk asm_2 /dev/sdc1

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

[root@localhost asm]# /etc/init.d/oracleasm createdisk asm_3 /dev/sdd1

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

 

[root@localhost asm]# /etc/init.d/oracleasm scandisks

Scanning the system for Oracle ASMLib disks:               [  OK  ]

[root@localhost asm]# /etc/init.d/oracleasm listdisks

ASM_1

ASM_2

ASM_3

 

DBCA建立asm

asm一來css服務,建立前先啟動css

 

[root@localhost ~]# /u01/app/oracle/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)

 

 

Create new disk

 

此時會發現剛建立的ASM磁碟組free僅為所有磁碟的一般,預設的一般磁碟用來做冗餘

 

 

接下來就是按照常規的dbca建立資料庫,但是選擇asm做儲存

 

其他步驟根據自己需求選擇即可,此處不贅述

 

安裝完成設定ASM例項,即可管理ASM

[oracle@localhost ~]$ export ORACLE_SID=+ASM

[oracle@localhost ~]$ sqlplus / as sysdba

SQL> select status from v$instance;

 

STATUS

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

STARTED

 

SQL> col name for a11

SQL> col failgroup for a11

SQL> select state,total_mb,free_mb,name,failgroup from v$asm_disk;

 

STATE      TOTAL_MB    FREE_MB NAME        FAILGROUP

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

NORMAL         8189       7374 ASM_GROUP1  ASM_GROUP1

NORMAL         8189       7379 ASM_GROUP2  ASM_GROUP2

NORMAL         8189       7382 ASM_GROUP3  ASM_GROUP3

 

SQL> select group_number,name,state,type,total_mb,free_mb,unbalanced from v$asm_diskgroup;

 

GROUP_NUMBER NAME        STATE       TYPE     TOTAL_MB    FREE_MB U

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

           1 DATA        MOUNTED     NORMAL      24567      22135 N

 
設定資料庫例項即可登入資料庫

[oracle@localhost ~]$ export ORACLE_SID=orclasm

[oracle@localhost ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jul 30 17:02:29 2014

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, OLAP and Data Mining options

 

SQL> select status from v$instance;

 

STATUS

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

OPEN

 

SQL> col TABLESPACE_NAME for a15

SQL> col FILE_NAME for a47

SQL> select tablespace_name,file_name from dba_data_files;

TABLESPACE_NAME FILE_NAME

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

USERS           +DATA/orcl_asm/datafile/users.259.854297377

SYSAUX          +DATA/orcl_asm/datafile/sysaux.257.854297377

UNDOTBS1        +DATA/orcl_asm/datafile/undotbs1.258.854297377

SYSTEM          +DATA/orcl_asm/datafile/system.256.854297375

 

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29320885/viewspace-1242628/,如需轉載,請註明出處,否則將追究法律責任。

相關文章