AIX (NORAC)下面 ASM的安装及条带化和镜像的实现

简介: 原创 转载请注明: 前期要建立用户和组,查看补丁是否都打了1、建立多个LV 用来准备做RAW。通过SMIT就可以轻松的完成。没有安装文件系统的LV就是RAW我这里建立了5个RAW AMS1 AMS2 ASM3 ASM4 ASM5(妈妈的前面ping错了^_^)...

原创 转载请注明:

前期要建立用户和组,查看补丁是否都打了
1、建立多个LV 用来准备做RAW。通过SMIT就可以轻松的完成。没有安装文件系统的LV就是RAW
我这里建立了5个RAW AMS1 AMS2 ASM3 ASM4 ASM5(妈妈的前面ping错了^_^)
2、需要对RAW 设备进行权限改变如下:
crw-rw----   1 oracle   dba          10, 12 Apr 19 14:47 rams1
crw-rw----   1 oracle   dba          10, 13 Apr 19 14:47 rams2
crw-rw----   1 oracle   dba          10, 14 Apr 19 14:47 rasm3
crw-rw----   1 oracle   dba          10, 15 Apr 19 14:47 rasm4
crw-rw----   1 oracle   dba          10, 16 Apr 19 14:47 rasm5

3、建立ASM参数文件
我这里参数如下:
*.asm_diskgroups='test1','test2'   自动挂载的磁盘组
*.asm_diskstring='/dev/rams1', '/dev/rams2'  裸设备
*.background_dump_dest='/oracle/+ASM/bdump'  BDUMP位置
*.core_dump_dest='/oracle/+ASM/cdump'  CDUMP位置
*.instance_type='asm'  这里必须的
*.large_pool_size=12M  LATGER POOL大小至少8M
*.remote_login_passwordfile='SHARED' 数据库可以使用密码文件来进行验证
*.user_dump_dest='/oracle/+ASM/udump' UDUMP位置
*.ASM_POWER_LIMIT=1 表示添加和删除磁盘的时候,磁盘自动对数据在新旧磁盘间重新分配的级别,1表示最慢最小性能影响,11表示最快最大性能影响,0表示不做再平衡.默认为1
4、建立ASM密码文件
orapwd file='**' password=** entries=10
5、启动CSS
CSS其实是RAC中的集群同步服务,但是ASM 也需要CSS。
$ORACLE_HOME/bin/localconfig add
可能会报错
ibmtest2@/u01/oracle/product/db10gr2/bin# ./localconfig add
exec(): 0509-036 Cannot load program crsctl.bin because of the following errors:
        0509-130 Symbol resolution failed for crsctl.bin because:
        0509-136   Symbol _Getctype__FPCc (number 101) is not exported from
                   dependent module /usr/lib/libC.a[ansi_64.o].
        0509-136   Symbol _Getnumpunct__FPCc (number 105) is not exported from
                   dependent module /usr/lib/libC.a[ansi_64.o].
        0509-192 Examine .loader section symbols with the
                 'dump -Tv' command.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'system'..
Operation successful.
Configuration for local CSS has been initialized

需要下载
xlc.rte.70.aix.tar
xlc.rte.aix50.sep2005.ptf.tar
解压后通过SMIT来安装

6、EXPORT ORACLE_SID=+ASM
  启动AMS INSTANCE
这个时候会提示没有磁盘组
这里我们要建立磁盘组了
CREATE DISKGROUP TEST1 EXTERNAL REDUNDANCY DISK '/dev/rams1';
CREATE DISKGROUP TEST2 EXTERNAL REDUNDANCY DISK '/dev/rams2';
这里可以是外部冗余EXTERNAL,普通冗余normal,高冗余high,外部冗余至少1个失效组就可以了,普通就是至少2个失效组做镜像,high就是至少3个失效组做镜像,需要注意的是这里的镜像是对数据库对象做镜像就是分区(extend)
创建一个高失效磁盘组如下:
SQL> create diskgroup test3 high redundancy
  2  failgroup fg1 disk '/dev/rasm3' name db3
  3  failgroup fg2 disk '/dev/rasm4' name db4
  4  failgroup fg3 disk '/dev/rasm5' name db5;

Diskgroup created.

7、查看LSNRCTL看看监听中是否有ASM的信息
没有话要手动注册
ALTER SYSTEM REGISTER;
8、查看磁盘组信息
SQL> select group_number,disk_number,name,failgroup,create_date,path from v$asm_disk;

GROUP_NUMBER DISK_NUMBER NAME                           FAILGROUP                      CREATE_DA PATH
------------ ----------- ------------------------------ ------------------------------ --------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
           1           0 TEST1_0000                     TEST1_0000                     14-APR-11 /dev/rams1
           2           0 TEST2_0000                     TEST2_0000                     14-APR-11 /dev/rams2
           3           0 DB3                            FG1                            19-APR-11 /dev/rasm3
           3           1 DB4                            FG2                            19-APR-11 /dev/rasm4
           3           2 DB5                            FG3                            19-APR-11 /dev/rasm5

 

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

NAME                           GROUP_NUMBER STATE       TYPE     TOTAL_MB    FREE_MB
------------------------------ ------------ ----------- ------ ---------- ----------
TEST1                                     1 MOUNTED     EXTERN        640        583
TEST2                                     2 MOUNTED     EXTERN       2560       1528
TEST3                                     3 MOUNTED     HIGH          480        327

这里可以看到冗余方式,其实使用了RAID可以不用ASM的冗余方式

SQL> select * from v$asm_alias order by name;

NAME                                             GROUP_NUMBER FILE_NUMBER FILE_INCARNATION ALIAS_INDEX ALIAS_INCARNATION PARENT_INDEX REFERENCE_INDEX A S
------------------------------------------------ ------------ ----------- ---------------- ----------- ----------------- ------------ --------------- - -
CONTROLFILE                                                 2  4294967295       4294967295          58                 1     33554485        33554591 Y Y
Current.260.748785235                                       2         260        748785235         159                 1     33554591        50331647 N Y
Current.261.748785237                                       2         261        748785237         160                 1     33554591        50331647 N Y
Current.262.748785237                                       2         262        748785237         161                 1     33554591        50331647 N Y
DATAFILE                                                    1  4294967295       4294967295          53                 1     16777269        16777322 Y Y
DATAFILE                                                    2  4294967295       4294967295          53                 1     33554485        33554538 Y Y
ONLINELOG                                                   2  4294967295       4294967295          62                 1     33554485        33554644 Y Y
PARAMETERFILE                                               2  4294967295       4294967295          68                 1     33554485        33554750 Y Y
PPZHU                                                       1  4294967295       4294967295           0                 1     16777216        16777269 Y Y
SYSAUX.257.748785097                                        2         257        748785097         107                 1     33554538        50331647 N Y
SYSTEM.256.748785097                                        2         256        748785097         106                 1     33554538        50331647 N Y

NAME                                             GROUP_NUMBER FILE_NUMBER FILE_INCARNATION ALIAS_INDEX ALIAS_INCARNATION PARENT_INDEX REFERENCE_INDEX A S
------------------------------------------------ ------------ ----------- ---------------- ----------- ----------------- ------------ --------------- - -
TEMP.266.748785289                                          2         266        748785289         265                 1     33554697        50331647 N Y
TEMPFILE                                                    2  4294967295       4294967295          66                 1     33554485        33554697 Y Y
TEST                                                        2  4294967295       4294967295           0                 1     33554432        33554485 Y Y
TEST.268.748788181                                          2         268        748788181         110                 1     33554538        50331647 N Y
UNDOTBS1.258.748785099                                      2         258        748785099         108                 1     33554538        50331647 N Y
USERS.256.748789567                                         1         256        748789567         106                 1     16777322        33554431 N Y
USERS.259.748785099                                         2         259        748785099         109                 1     33554538        50331647 N Y
control01.ctl                                               2         260        748785235          59                 1     33554485        50331647 N N
control02.ctl                                               2         261        748785237          60                 1     33554485        50331647 N N
control03.ctl                                               2         262        748785237          61                 1     33554485        50331647 N N
group_1.263.748785265                                       2         263        748785265         212                 1     33554644        50331647 N Y

NAME                                             GROUP_NUMBER FILE_NUMBER FILE_INCARNATION ALIAS_INDEX ALIAS_INCARNATION PARENT_INDEX REFERENCE_INDEX A S
------------------------------------------------ ------------ ----------- ---------------- ----------- ----------------- ------------ --------------- - -
group_2.264.748785267                                       2         264        748785267         213                 1     33554644        50331647 N Y
group_3.265.748785271                                       2         265        748785271         214                 1     33554644        50331647 N Y
redo01.log                                                  2         263        748785265          63                 1     33554485        50331647 N N
redo02.log                                                  2         264        748785267          64                 1     33554485        50331647 N N
redo03.log                                                  2         265        748785271          65                 1     33554485        50331647 N N
spfile.267.748785363                                        2         267        748785363         318                 1     33554750        50331647 N Y
spfiletest.ora                                              2         267        748785363          69                 1     33554485        50331647 N N
sysaux01.dbf                                                2         257        748785097          55                 1     33554485        50331647 N N
system01.dbf                                                2         256        748785097          54                 1     33554485        50331647 N N
temp01.dbf                                                  2         266        748785289          67                 1     33554485        50331647 N N
test01.dbf                                                  2         268        748788181           1                 1     33554432        50331647 N N

NAME                                             GROUP_NUMBER FILE_NUMBER FILE_INCARNATION ALIAS_INDEX ALIAS_INCARNATION PARENT_INDEX REFERENCE_INDEX A S
------------------------------------------------ ------------ ----------- ---------------- ----------- ----------------- ------------ --------------- - -
undotbs01.dbf                                               2         258        748785099          56                 1     33554485        50331647 N N
user01.dbf                                                  1         256        748789567           1                 1     16777216        33554431 N N
users01.dbf                                                 2         259        748785099          57                 1     33554485        50331647 N N

36 rows selected.

9、最后就是在建立库的使用来使用磁盘组了。我这里已经通过DBCA方式建立了一个。也可以通过RMAN 的CONVERT方式来转换现有文件系统的数据文件到ASM里面

如下:

1、shutdown database

2、startup mount

3、rman target  /

4、convert datafile ‘/oradata/test01.dbf' format '+test1/test01.dbf'

5、alter databae rename file  ‘/oradata/test01.dbf'  to  '+test1/test01.dbf'

6、alter database open;

10、最后说明一下ASM的条带化,ASM条带化分为粗和细,粗条带1M为单位,细128k。除了CONTROLFILE,LOGFILE,flashlog是使用细条带化其他都是粗条带,这样做是为了提高性能,如果DATAFILE本生一般很大,如果查看一个大的表,使用细条带那磁盘磁头的岂不是要在不同的物理盘上不停的跳动?性能不好。
 
11、
oracle是不管你创建多少个failure group的,你如果没有显式指定,oracle就帮你给每个asm disk都创建一个failure group,在这些group之上,你如果指定是external redundancy,那么oracle就只在随机(所谓随机还是有自己的算法)选择1个failure group中存储一份数据;如果是normal,那么oracle会随机选择2个failure group各存储一份数据;如果是high,那么就是存3份。


之前我建立一个CREATE DISKGROUP TEST3 high redundancy
DISK '/dev/rasm3','/dev/rasm4','/dev/rasm5';

一看TOTAL_MB 480 我的每块盘是160M 如果是常规的镜像这里使用应该是160
然后建立了一个
ATE DISKGROUP TEST3 EXTERNAL REDUNDANCY DISK '/dev/rasm3','/dev/rasm4','/dev/rasm5';
一看TOTAL_MB 还是480
原来这里大小是总的磁盘大小,只是在进行存储数据的时候HIGH冗余会镜像3份。比如存储1M的数据 HIGH需要3M。
这里如果要看这个DISKGROUP实际可用的空间可以查看v$asm_diskgroup的USABLE_FILE_MB字段。
相关文章
|
文字识别 Oracle 关系型数据库
11.2.0.4单实例ASM安装报错ohasd failed to line 73
11.2.0.4单实例ASM安装报错ohasd failed to line 73
179 0
|
弹性计算 Kubernetes 网络协议
非容器应用与K8s工作负载的服务网格化实践-1 ASM-VM-PROXY的安装
ASM-VM-PROXY是连接ASM和VM的工具,运行在VM节点中,负责与ASM通信获取xDS信息、劫持非容器应用流量并执行网格化操作(比如上报链路追踪数据、请求安全认证等)。为了支持跨操作系统,以docker image的方式分发。 为了演示跨操作系统的能力,本文使用三种最常见的Linux分发版本创建ECS实例。
2925 0
非容器应用与K8s工作负载的服务网格化实践-1 ASM-VM-PROXY的安装
|
存储 Oracle 关系型数据库
|
存储 关系型数据库 数据库