Oracle DataBase单实例使用ASM案例(4)--AIX系统Oracle 10g应用
系统环境:
操作系统: AIX5300-08
Oracle 软件: Oracle 10gR2
对于AIX系统,在Oracle 10g下使用ASM非常方便,在安装Oracle 数据库软件后,不需要安装任何其他软件,就可以使用ASM存储数据。
1、建立ASM Instance
[oracle@aix211 dbs]$cat init+ASM.ora
instance_type='asm'
asm_diskstring='/dev/rlv*'
large_pool_size=12m
asm_diskgroups='DG1','RCY1'
background_dump_dest=/u01/app/oracle/admin/+ASM/bdump
core_dump_dest=/u01/app/oracle/admin/+ASM/cdump
user_dump_dest=/u01/app/oracle/admin/+ASM/udump
2、建立Instance运行相关目录
[oracle@aix211 dbs]$mkdir -p /u01/app/oracle/admin/+ASM/bdump
[oracle@aix211 dbs]$mkdir -p /u01/app/oracle/admin/+ASM/cdump
[oracle@aix211 dbs]$mkdir -p /u01/app/oracle/admin/+ASM/udump
3、启动CSS进程
CSS进程用于ASM Instance和 RDBMS之间通讯
[oracle@aix211 bin]$./localconfig add
You must be logged in as root to run ./localconfig.
Log in as root and restart ./localconfig execution.
[oracle@aix211 bin]$su -
root's Password:
[u@h W]$bash
[root@aix211 /]#cd /u01/app/oracle/product/10.2.0/db_1/bin
[root@aix211 bin]#./localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'system'..
Operation successful.
Configuration for local CSS has been initialized
Adding to inittab
Startup will be queued to init within 30 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.
aix211
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
4、启动ASM Instance
[oracle@aix211 ~]$export ORACLE_SID=+ASM
[oracle@aix211 ~]$sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 27 16:22:40 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ASM instance started
Total System Global Area 130023424 bytes
Fixed Size 2019136 bytes
Variable Size 102838464 bytes
ASM Cache 25165824 bytes
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string
db_unique_name string +ASM
global_names boolean FALSE
instance_name string +ASM
lock_name_space string
log_file_name_convert string
service_names string +ASM
SQL>
5、通过LV建立ASM磁盘
[root@aix211 /]#lsvg asmvg
VOLUME GROUP: asmvg VG IDENTIFIER: 00040f8a00004c00000001463c91f6ec
VG STATE: active PP SIZE: 64 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 480 (30720 megabytes)
MAX LVs: 256 FREE PPs: 480 (30720 megabytes)
LVs: 0 USED PPs: 0 (0 megabytes)
OPEN LVs: 0 QUORUM: 2 (Enabled)
TOTAL PVs: 1 VG DESCRIPTORS: 2
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 1 AUTO ON: yes
MAX PPs per VG: 32512
MAX PPs per PV: 1016 MAX PVs: 32
LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no
HOT SPARE: no BB POLICY: relocatable
1)建立逻辑卷
[root@aix211 /]#mklv -y lv_asm1 asmvg 64
lv_asm1
[root@aix211 /]#mklv -y lv_asm2 asmvg 64
lv_asm2
[root@aix211 /]#mklv -y lv_asm3 asmvg 64
lv_asm3
[root@aix211 /]#mklv -y lv_asm4 asmvg 64
lv_asm4
[root@aix211 /]#lsvg -l asmvg
asmvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
lv_asm1 jfs 64 64 1 closed/syncd N/A
lv_asm2 jfs 64 64 1 closed/syncd N/A
lv_asm3 jfs 64 64 1 closed/syncd N/A
lv_asm4 jfs 64 64 1 closed/syncd N/A
[root@aix211 /]#
2)设置逻辑卷属性
[root@aix211 /]#chown oracle:dba /dev/*lv_asm*
[root@aix211 /]#ls -l /dev/|grep asm
crw-rw---- 1 root system 88, 0 May 27 16:25 asmvg
brw-rw---- 1 oracle dba 88, 1 May 27 16:28 lv_asm1
brw-rw---- 1 oracle dba 88, 2 May 27 16:29 lv_asm2
brw-rw---- 1 oracle dba 88, 3 May 27 16:29 lv_asm3
brw-rw---- 1 oracle dba 88, 4 May 27 16:29 lv_asm4
crw-rw---- 1 oracle dba 88, 1 May 27 16:28 rlv_asm1
crw-rw---- 1 oracle dba 88, 2 May 27 16:29 rlv_asm2
crw-rw---- 1 oracle dba 88, 3 May 27 16:29 rlv_asm3
crw-rw---- 1 oracle dba 88, 4 May 27 16:29 rlv_asm4
3)查看ASM磁盘信息
[oracle@aix211 ~]$kfod
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME
================================================================================
+ASM /u01/app/oracle/product/10.2.0/db_1
[oracle@aix211 ~]$kfod status=TRUE asm_diskstring='/dev/rlv*' disk=all
--------------------------------------------------------------------------------
Disk Size Header Path
================================================================================
1: 4096 Mb FOREIGN /dev/rlv_asm1 //这个裸设备信息和其他lv不一致
2: 4096 Mb CANDIDATE /dev/rlv_asm2
3: 4096 Mb CANDIDATE /dev/rlv_asm3
4: 4096 Mb CANDIDATE /dev/rlv_asm4
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME
================================================================================
+ASM /u01/app/oracle/product/10.2.0/db_1
6、建立ASM磁盘组
[oracle@aix211 ~]$export ORACLE_SID=+ASM
[oracle@aix211 ~]$sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 27 16:36:03 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> create diskgroup dg1
2 normal redundancy
3 failgroup fg1 disk '/dev/rlv_asm1'
4 failgroup fg2 disk '/dev/rlv_asm2';
create diskgroup dg1
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15201: disk /dev/rlv_asm1 contains a valid RDBMS file
报错信息:rlv_asm1被数据库实例占用
清除ASM磁盘头部信息:
[oracle@aix211 ~]$dd if=/dev/zero of=/dev/rlv_asm1 bs=8192 count=2560
2560+0 records in
2560+0 records out
[oracle@aix211 ~]$kfod status=TRUE asm_diskstring='/dev/rlv*' disk=all
--------------------------------------------------------------------------------
Disk Size Header Path
================================================================================
1: 4096 Mb CANDIDATE /dev/rlv_asm1 //此时,rlv_asm1和其他lv保持一致
2: 4096 Mb CANDIDATE /dev/rlv_asm2
3: 4096 Mb CANDIDATE /dev/rlv_asm3
4: 4096 Mb CANDIDATE /dev/rlv_asm4
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME
================================================================================
+ASM /u01/app/oracle/product/10.2.0/db_1
再建立磁盘组:
[oracle@aix211 ~]$sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 27 16:44:16 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> create diskgroup dg1
2 normal redundancy
3 failgroup fg1 disk '/dev/rlv_asm1'
4 failgroup fg2 disk '/dev/rlv_asm2';
Diskgroup created.
SQL> create diskgroup rcy1
2 normal redundancy
3 failgroup fg1 disk '/dev/rlv_asm3'
4 failgroup fg2 disk '/dev/rlv_asm4';
Diskgroup created.
7、查看磁盘组信息
SQL> select name,state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
DG1 MOUNTED
RCY1 MOUNTED
SQL> select name,path,state from v$asm_disk
NAME PATH STATE
------------------------------ -------------------------------------------------- --------
DG1_0000 /dev/rlv_asm1 NORMAL
DG1_0001 /dev/rlv_asm2 NORMAL
RCY1_0000 /dev/rlv_asm3 NORMAL
RCY1_0001 /dev/rlv_asm4 NORMAL
@至此,在AIX系统通过Oracle 10g建立ASM存储系统成功,可以通过ASM 磁盘组进行DataBase的存储,发挥ASM存储系统的有时,提高Oracle数据库I/O的性能。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。