环境描述
数据库版本:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
添加磁盘
添加三块硬盘,用来做ASM磁盘组:
三块磁盘最好一样大, 不一样大在做冗余时容易导致热点竞争,增大磁盘的I/O,影响性能。
重启一下系统,格式磁盘
启动系统后fdisk -l查看加载的磁盘,fdisk /dev/sdb对sdb进行格式化
[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
看到如下信息 sdb、sbc、sdd三块磁盘将用来做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/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29320885/viewspace-1242628/