温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Oracle RAC之:ASM概念及基本操作维护

发布时间:2020-08-14 06:45:40 来源:ITPUB博客 阅读:266 作者:不一样的天空w 栏目:关系型数据库
Oracle RAC系列之:ASM基本操作维护

ASM(自动存储管理)是一个专门为Oracle数据库服务的数据文件存储机制,通过ASM管理数据文件,DBA不用再担心I/O性能问题,也不需要知道文件的名称,同时ASM也提供了文件系统到卷管理器的集成,下面依次介绍。
一、 ASM的特点
(1)自动调整I/O负载
ASM可以在所有可用的磁盘中自动调整I/O负载,不但避免了人工调整I/O的难度,而且也优化了性能,同时,利用ASM可以在线增加数据库的大小,而无需关闭数据库。

(2)条带化存储
ASM将文件分为多个分配单元(Allocation Units, AU)进行存储,并在所有磁盘间平均分配每个文件的AU。

(3)在线自动负载均衡
当共享存储设备有变化时,ASM中的数据会自动均匀分配到现有存储设备中。同时,还可以调节数据的负载均衡速度。

(4)自动管理数据库文件
在ASM存储管理中,Oracle数据文件是ASM自动管理的。ASM创建的任何文件一旦不再需要,就会被自动删除。但是,ASM不管理二进制文件、跟踪文件、预警日志和口令文件。

(5)数据冗余
ASM通过磁盘组镜像可以实现数据冗余,不需要第三方工具。

(6)支持各种Oracle数据文件
ASM存储支持Oracle数据文件、日志文件、控制文件、归档日志、RMAN备份集等。

二、ASM的体系结构与后台进程
图1显示了ASM的物理构成。
  Oracle RAC之:ASM概念及基本操作维护dNsXL+0e9ff2I3+1DrX5+5+69fKGouF02xRmXDQBcsCyHwqM448ovgBf1oY1HcSzA2baoj24Mitfq5y6XC6PMtqWzq7u8f6SsOQbFf9/8487de+wXGnDxj8RManZOWXMMis88S3GVSIETULxkH4PiXPVR4BA+lLYHBoeUNcegOMqFbU55/6izq1tZcwyKm8Mj6uv/wDlAcWdxfHLKfg6aAcX5cXu88uuDw2rr/Y9PTpPpTCP03WxuzTq7EFvWNzYbW2lsurS125SmJykf3/lA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u+UGzsFeI3sWTobiBvadqd2C/OjwPFgeZAcaA5UBxoDhQHmqO/4pgKq835tLfv7bmtrDkGxaem44wTqgN28oWiOTyisjnViqdm554mZtgvNODi5eLKo8dPlDXHoDimpW1zJsKTKn3jmZlW8cSNwDnU6ucdHbdULp3AozjS8bZF8YSGFpfilaMvnV3dmH+5Dent6/+4vaeyRbaFUDDobEPUh4CLUfFa/fxvd/+OZ0DtQ3n/aGBwSP2q4ZyLEn6uWr19/Rh4tgO1+vnA4JDiFIVgXlqWCogfStvsnwH4eVD8/n3zD5bW+RcIrxx9MX8dQYFFV968e88Vvwl+xa2zi1r9fGo63tnVvZxdRZlFG3Kv3/b29Y+OjavPv2UcoThR3j+aCE+6XK7RsfHl7Gq+UEQCc7P4uL2XLxRzr9/ef/DQ5XLdf/CQMXgLHKQ4Uaufv3n3fiI8aQ6PDAwOGfi6OV+9ff3m8Aj9Jqlzln53nOIAXC9QHGgOFAeaA8WB5kBxoDlQHGgOFAeaA8WB5vxH8aeJGVoUAQDNeP7i1chvvxkjv/0GgK7885//NP6NL3xp/fX/2/xgV8ufZfwAAAAASUVORK5CYII=">
         从图1可以看出,第一部分是顶层的ASM磁盘组,ASM实例和数据库实例可以直接访问这些磁盘组;第二部分是ASM文件,每个ASM文件只能包含在一个磁盘组中,不过,一个磁盘组中可以包含属于多个数据库的多个ASM文件,并且单个数据库可以使用来自多个磁盘组的存储空间;第三部分是ASM磁盘,多个ASM磁盘组成了ASM磁盘组,但每个ASM磁盘只能属于一个磁盘组;第四部分是AU(分配单元),AU是ASM磁盘组分配的最小连续磁盘空间,ASM磁盘按照AU进行分区,每个AU的大小默认为1MB;这个结构的底层是Oracle数据块,由于AU是ASM分配的最小连续磁盘空间,因此,ASM是不允许跨分配单元拆分一个Oracle数据块的。
          要使用ASM,需要在启动数据库实例之前,先启动一个名为“+ASM”的实例,ASM实例不会装载数据库,启动它的目的是为了管理磁盘组和保护其中的数据。同时,ASM实例还可以向数据库实例传递有关文件布局的信息。通过这种方式,数据库实例就可以直接访问磁盘组中存储的文件。图2显示了ASM的一般体系结构。
 Oracle RAC之:ASM概念及基本操作维护cDnlpFPbfPo0SO4042JiWFWNXK5/OjRo6wj4TBSM5OQQn0C/+23rPX09BgMhn379qnVaghvTEzM0aNHmQXQ2qWa1zZOVRdpxmZlZT22Ql5enpwBRVH79++3eAz8zfyjq6uLpumamhr475kzZ2pqahQKxYYNG86cOZOYmHjmzBmapru6usrLy/Py8pYtWwbf3bBhg0KhOMOgpqZm//79eXl5cDYOCgoKIFDcL3iRnlKOU8nNYB1w7949uVyel5cH17xhwwb4Y9myZfv371coFPBfmqYfP34MJQr+OHPmDITXaDSSSIAT0jSdl5dHAl5eXl5TU5OXl7d///579+5xhx2aU9wveNXV1UH8bN26lftsjx8/rqmpgVBDipD9YF9WWtA0DWEh+zds2JCYmEjTNMQMHFNTU3PmzBmIB6PRuH///mXLltXU1MAxeXl5GzZskMvliYmJ8PUNz5DL5Rs2bIDYZrF161bmna/E1UU6zY4cOcIKCGQeiBwS0q6uLrlcvmzZMsgkBFLFkz0KhaK8vBzKGjNRjEZjV1cXZEuS35j5FuKWGdtkZ78lDuB5ywg9pePGjbN2HsfGQE1NzbJly86cOXPv3r39+/fv379/w4YNRqMRyiAEzc4YuH37dr+3jHxqm8fP6kxS6IDExES5XM6qdeHyli1blpiYCHtqamqgoEEl85hHWYM/FAoF1MnMsCsUCvgvx9Wyahunqqu2ttZaESLQNM2MNWbUEM6cOWOurmXLlpHK+vEzdcHBoK4NGzZAcYIaGepx5g9B3JEsBfFr/ussGhoaIFDcq2PAklRjx461dp79+/czMxBYyjwTk3qZqAuKGanBmdcMtT/8CyUKjmeVSTgnyVLMQsUddng4JJPJOAJOZtA4fvw499ngIqFsQKCYFwklSqFQkJ1QS+bl5RHJkdsXUlQgLKDnxMTEZcuWwfFdXV3kW1C3kj9InHMkfU1NDQQKplORuLrIDBoXL15kBYTksf379zPDC/EDRmce/PjxY8gkj59VXo8ZZY1kHpqmoc6C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0CzaZDM1NTUVFBQMHv27Dt37ogdIL48fvwYchJ5v53MQstfXZDoNE1XVlaKHaABUFNTYzHRXVFdjY2Ner3e39+/oaFB7HgdAKWlpeHh5b29vZAEA5pNg6irqanp7bffjo2NdaG7xjt37syePfv48eOk3A1UXU1NTYcOHaJp2rVqm9WrV69bt46EWlrqampqOnv2bHh5eFRUVG9v7/+TPO+8886kSZNu375NZtb64osvbFPX+fPn9+zZM2LEiJqaGrGD1T8XL14cN25cUVERc1Yx29TV1NR06tQpmqbfeOMN6Sf6d999t3bt2ldeecVioruoupqamj788MOxY8euXbv2u+++EzuO+6G3t/eNN95YunRpb28vSQIyjeRA1XX+/PmkpKQJEyY0NDSIHbL+qampGTduHGsuUxvURWqb0tJSscPUPx0dHdOnT2dN2L127Vppqev8+fPNzc2bN28eMWLExx9//P9JlcuXL9M0bb5sxKVLl2xW1/nz5z/77DOoxL/99luxg2iVLVu2TJo0yXwBBZvVBYkOE6CdO3dO7PBZ5fLly+PGjeNIdNdVFyRBfHz89OnTL1++LHZMW+XcuXMjR47cs2cPKwnI2h82qKu5uflPf/rTxIkTt2zZInb4rPL999+vXLnylVde6erqYoXdNnVBbRMeHi7x2qaoqGjcuHGnTp1ihVqi6rpw4QLMjrVmzZq7d++KHXv/wvfff79jx45Jkybp9XrzNdDa29vtUReEHSrx48ePix1WNkajcfbs2UlJSV9//bV52JcsWWKPui5cuFBRUTF27FgJJvq3336r0WjGjRtncYlCkuiurq4LFy689957o0aN0mg0UqvO7t69u2bNmkmTJl27do1j7UHb1NXc3NzQ0PDGG2/QNP3ZZ5+JHVY2x48fHzduXH5+vsV1F2F5WxvURWqbF1988b333hM7lGygtlm+fLnF2uadd96RqLouXLjQ0tKSnJz861//+o033rhx48ZTsenr69uxY4ePj8/KlStv3Lhx3xKff/65/epqaWk5duzYjBkzJkyYcPToUbHD/fTp06eNjY2RkZFjx46tqKiwGPD79+8vXrzYTnW1tLSQRAeBiR3up319fRqNxsfH5+2337537x53oruBulpaWs6dO7dixYpf//rXGo2mr69P7BR4CtLy8fH54x//aC3vVVVV2akuCHtZWVlgYOD06dNPnz4tdrifPn369MMPP5wwYcLcuXPPnz9vLex2qqulpeXkyZMKhQIEJnaInz59+rS1tbXf2ubtt9+WtLouXrzY1NSUlZX1wgsvgMD+Kgb379+H+mvlypWdnZ191iEzsdqprosXLxqNxqNHj7766quQpUQJ+F//+te6uroZM2YEBgYeOnSII+B9fX2OUhckekpKikQS/e233+7u7uaT6O6hLkgCg8Hw1ltvvfDCC2vWrOnp6RElCXp6ekBamzdv7unp4UiCjz76yCHqgnK3f//+wMDAGTNm1NXViRLwv/71rzqdbsKECXPmzDEYDNzlzn51Qairq6sjIiJefPHFsrIysULd1tY2f/78sWPH9lvbuIC6jEZja2trW1tbdnb2Cy+8MGHChIKCgs7Ozr8Jz4MHD8rKyubPn+/l5ZWWlnb9+vVv+4Ms/ewQdUHYa2pq5s2b98tf/jIuLk6n0/35z392QtibmpqSkpJGjx4dEhLy0Ucf9Rvwb7/91oHqgoA3NzdDotM0XVBQcOPGDScE/N69e3v37p0/f/7QoUMHmujupC5IgrNnz6alpf3yl78MCwvbu3fvvXv3nJAEN27cKCgomDFjhpeX1+bNm+/evdtvEjhWXa2tra2trSUlJZMmTXrxxReTkpIMBoMTAv63v/1Np9OtWrXKy8trzpw5dXV1fMpdSEiIQ9TFrG2ee+65uLi48vJy59Q2bW1t69atGz169NixY99//30+oU5LS3MZdX3++eft7e1/+tOfoqOjf/vb344ePTopKamtrc3h8UhKztChQ+ENuDt37vTyw2g0OlxdEPbTp09v2rRp5syZzz333Pz588vKyh58eODYgP/5z3/W6XRxcXFeXl6BgYGbNm1qbGzkGfDe3t6oqCjHqosk+uHDh7Ojo1944YXRo0evW7dOiETv7OwsKCigadrLy+uNN944ePAg/4CTRHc/dZEkKCoqev31159//vkJEyZs3br1ypUrDk8CWJFuwoQJPj4+b731lk6n458EZC4uB6rr888///zzz2tra99+++1JkyYJV5vDLfLixYtlMtmcOXO2bdvW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qqqEEOsqhBD94j0QIdjWRItQ92Cr0hWLxSA9ApMA5aOUQmGEXy6IpXbGWKFQyOVykE7xZXcsXzBRMKwJIV3GBNcT4XSU5gAIIsGyQLrYarSHaoTSBSoFSoNV90wmAzKGywU11UgIFjUFDJg/A2utvGAodItHSFeDgBgNBygvMAgfr+EG5FL8fhjZEA9iyIZn8/l8vCiCveHKKFyUiCeklPKLo0TBsAaEdBkQLJUDsDJWv8wd1y6hdMGcNAaLfMEQLQ5K8fyiJwwQ8eu8rcF/8fhQKASSxiouGArd0iCkqxHoK9QwvhljqqqCcoCeabIutmqBOOhRutCEYMTHYjGYPwOTQ/XC+gOcUC91AOyHKopmp6YtUM2HhVvJZFI85syEdBkSLLYjED7CR7yeQbUcpQuORANcS7pgkQXYGj9DxlaNC0+Ic1q8NeVyOSiTVFIwhBQNZVg86cyEdDWGWCymsSLGGAx9qEtAZYOfN9Y8d8Vvg1pAigbWiCs4oHbBr9NdV7qwdgGRoKZg6PP5NHYCC64Qfbu2IUK6DAisWuL34BQvxIhQQsRUJhQKYaEvFovxGRIOcmV1AT3U+qBuD3UR/ZMnZaQLLFdRlFAoBFamWc3BXzY8/cIjVhgyIV2tS6FQAMuE6SswgFAoBOIHKzWk9eDDPY0mCTupHCFd2wRKKb4+A5f1QtKGz02ua3T8CUHz9IhixroI6dqaiJJCIxHSJWBrvztUsBkI6RIINoqQLoGgwQjpEgg2ipAugaDBCOkSCDaKkC6BoME0SLqePHnyP4Fgi/LkyZMGGFFV/Pvvv82+KwLBJvLPP//8H3BV4xRgXNdJAAAAAElFTkSuQmCC">
 
         从图2可以看出,ASM实例与数据库实例进行通信的桥梁是ASMB进程,此进程运行在每个数据库实例上,是两个实例间信息交换的通道。ASMB进程先利用磁盘组名称通过CSS获得管理该磁盘组的ASM实例连接串,然后建立一个到ASM的持久连接,这样两个实例之间就可以通过这条连接定期交换信息,同时这也是一种心跳监控机制。
         另外,在ASM实例中还存在另外一个新的进程,即RBAL,此进程负责规划和协调磁盘组的重新平衡活动。除此之外,ASM实例还有一些与数据库实例中的进程相同的后台进程,例如LGWR、SMON、PMON、DBWR 、CKPT等。
如果一个数据库实例使用ASM作为存储,那么它将多出两个后台进程,即RBAL和ASMB。RBAL 负责打开磁盘组中所有磁盘和数据,而ASMB负责和ASM实例进程通信。

三、管理ASM实例
 在使用ASM作为数据存储时,ASM实例管理显得非常重要,Oracle提供了丰富的管理功能,对ASM实例进行管理需要具备SYSDBA权限,在Oracle 11g中可以使用一个新角色 ,即SYSASM,此角色只用于管理ASM实例。

1.创建ASM实例
创建ASM实例有两种方法,第一种是利用dbca创建,这种方法只需运行Database Configuration Assistant(DBCA),然后根据提示即可创建一个ASM实例,此种方式在前面已有讲述,这里不再多说。第二种方法是用命令行方式创建ASM实例,下面进行简单介绍。

(1)创建ASM磁盘
可以使用RAID划分的LUN、分区和裸设备等来创建ASM磁盘,但是在使用LUN、分区或裸设备时,要注意将属主和属组改为Oracle用户及其对应的组,这个在前面节已经讲述过,另外一种简单的方法就是使用Oracle提供的ASMLib来完成ASM磁盘的创建,下面将讲述这种方法。

在创建ASM实例之前,首先应该确保节点上已经安装了ASMlib包,同时确认ASMLib是否已经自动加载:
[root@node1 ~]# lsmod | grep oracleasm
oracleasm              46356  1

然后,通过ASMlib提供的oracleasm将已经划分好的磁盘分区转化为ASM磁盘,例如:
[root@node1 ~]#/etc/init.d/oracleasm createdisk ASMDISK1 /dev/sdc5
Marking disk "/dev/sdc5" as an ASM disk [  OK  ]
[root@node1 ~]#/etc/init.d/oracleasm createdisk ASMDISK2 /dev/sdc6
Marking disk "/dev/sdc6" as an ASM disk [  OK  ]
[root@node1 ~]#/etc/init.d/oracleasm createdisk ASMDISK3 /dev/sdc7
Marking disk "/dev/sdc7" as an ASM disk [  OK  ]
[root@node1 ~]#/etc/init.d/oracleasm createdisk ASMDISK4 /dev/sdc8
Marking disk "/dev/sdc8" as an ASM disk [  OK  ]
[root@node1 ~]#/etc/init.d/oracleasm createdisk ASMdisk5 /dev/sdc9
Marking disk "/dev/sdc9" as an ASM disk [  OK  ]

创建完ASM磁盘后,可以查看系统的/dev/oracleasm/disks/目录下是否已经生成磁盘设备,可以采用的命令如如下:
[root@node1 ~]# ll /dev/oracleasm/disks/ASMDISK*
brw-rw---- 1 oracle oinstall 8, 21 Sep 10 23:40 /dev/oracleasm/disks/ASMDISK1
brw-rw---- 1 oracle oinstall 8, 22 Sep 10 23:40 /dev/oracleasm/disks/ASMDISK2
brw-rw---- 1 oracle oinstall 8, 23 Sep 10 23:36 /dev/oracleasm/disks/ASMDISK3
brw-rw---- 1 oracle oinstall 8, 24 Sep 10 23:40 /dev/oracleasm/disks/ASMDISK4
brw-rw---- 1 oracle oinstall 8, 25 Sep 10 23:40 /dev/oracleasm/disks/ASMDISK5

也可以通过如下方式查看:
[root@node1 ~]#service oracleasm listdisks
ASMDISK1
ASMDISK2
ASMDISK3
ASMDISK4
ASMDISK5

如果要删除 ASM磁盘可通过以下命令:
[root@node1 ~]#./etc/init.d/oracleasm deletedisk ASMDISK5
Removing ASM disk "ASMdisk5" [  OK  ]

在RAC环境中,要注意另外一个节点是否能够发现对应的ASM磁盘,执行如下命令,让另外一个节点来获取这种变化。
[root@node2 ~]#/etc/init.d/oracleasm scandisks
到此位置,ASM磁盘已经创建完毕了。

(2)初始化参数
启动ASM实例只需要如下几个参数即可,利用这些参数可以实现ASM实例的内存的自动分配和自动管理。
下面介绍ASM实例初始化参数:
instance_type=asm
cluster_database=true
DB_UNIQUE_NAME=+ASM
ASM_POWER_LIMIT=1
large_pool_size=60M
asm_diskgroups='FLASH_DISK','ARCH_DISK','DATA_DISK'
asm_diskstring='/dev/oracleasm/disks/*'
每个参数的含义如下:
? instance_type,指定实例的类型,对于ASM实例,应设置为ASM
? cluster_database,指定是否是数据库集群,true表示是ASM集群
? DB_UNIQUE_NAME,指定ASM实例的名称,默认是+ASM
? ASM_POWER_LIMIT,该参数用来控制ASM中数据的负载均衡速度
? large_pool_size,设置大池的大小,由于ASM文件的分配单元映射是从large_pool分配的,因此large_pool_size至少要8MB,                                   建议越大越好
? asm_diskgroups,指定实例启动时可用的ASM磁盘组,ASM实例将在启动时自动挂载这些磁盘组
? asm_diskstring,用于限制ASM实例可用于创建磁盘组的磁盘设备。如果该值为NULL,则ASM实例可见的所有磁盘都可以成为创建磁盘组的可选磁盘

(3)创建密码文件
[oracle@node1 ~]$su - oracle
[oracle@node1 ~]$ cd $ORACLE_HOME/dbs
[oracle@node1 ~]$ orapwd file=orapw+ASM password=oracle

(4)创建目录结构
[oracle@node 1~]$su – oracle
[oracle@node1 ~]$cd $ORACLE_HOME/dbs
[oracle@node1 ~]$mkdir –p $ORALCE_BASE/admin/+ASM/udump
[oracle@node1 ~]$ mkdir –p $ORALCE_BASE/admin/+ASM/bdump
[oracle@node1 ~]$mkdir –p $ORALCE_BASE/admin/+ASM/adump
[oracle@node1~]$ mkdir –p $ORALCE_BASE/admin/+ASM/cdump

2.启动ASM实例
 无论在RAC环境中还是单实例环境,ASM实例都需要用到CSS进程,在RAC环境中,启动CRS后CSS已经运行,而在单实例环境下,需要以root用户运行脚本,初始化CSS服务,否则,在启动ASM实例时会报如下错误:
ORA-29701: unable to connect to Cluster Manager
执行初始化脚本的过程如下:
[root@node1 ~]#$ORACLE_HOME/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
Cleaning up Network socket directories
Setting up Network socket directories
 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.
 Cluster Synchronization Services is active on these nodes.
        node1
Cluster Synchronization Services is active on all the nodes.
Oracle CSS service is installed and running under init(1M)

然后启动ASM实例:
[oracle@node1 ~]$export ORACLE_SID=+ASM
[oracle@node1 ~]$sqlplus / as sysdba
SQL> startup
ASM instance started
Total System Global Area    134217728 bytes
Fixed Size                   1218124 bytes
Variable Size               107833780 bytes
ASM Cache                   25165824 bytes
ORA-15110: no diskgroups mounted
因为首次启动ASM实例并没有创建ASM磁盘组,所以显示 15110错误是正常的。
 
3.管理ASM磁盘组
 ASM磁盘组是作为逻辑单元进行统一管理的一组磁盘,在ASM实例中,可以创建和添加新的磁盘组,可以修改现有的磁盘组,在其中添加一个磁盘或者删除一个磁盘,也可以删除现有的磁盘组。

(1)添加磁盘组
SQL> create diskgroup FLASH_DISK external redundancy disk '/dev/oracleasm/disks/ASMDISK1' name flashdisk;
Diskgroup created.
SQL> create diskgroup ARCH_DISK external redundancy disk '/dev/oracleasm/disks/ASMDISK2' name archdisk1;
Diskgroup created.
SQL> create diskgroup DATA_DISK normal redundancy disk '/dev/oracleasm/disks/ASMDISK4' name datadisk1, '/dev/oracleasm/disks/ASMDISK5' name datadisk2;
Diskgroup created.

(2)查看磁盘组状态
SQL> select name,state from v$asm_diskgroup;
NAME                           STATE
-------------------       --------------
FLASH_DISK                   MOUNTED
ARCH_DISK                   MOUNTED
DATA_DISK               MOUNTED

(3)卸载FLASH_DISK磁盘组
SQL> alter diskgroup FLASH_DISK dismount;
Diskgroup altered.
SQL> select name,state from v$asm_diskgroup;
NAME               STATE
---------------------------  -----------
FLASH_DISK         DISMOUNTED
ARCH_DISK          MOUNTED
DATA_DISK          MOUNTED

(4)挂载FLASH_DISK磁盘组
SQL> alter diskgroup  FLASH_DISK mount;
Diskgroup altered.
SQL> select name,state from v$asm_diskgroup;
NAME                STATE
------------------------------  -----------
FLASH_DISK      MOUNTED
ARCH_DISK        MOUNTED
DATA_DISK     MOUNTED

(5)查看磁盘名与裸设备对应关系
SQL>  select name,path from v$asm_disk_stat;
NAME                             PATH
-------------------         --------------------------------------
 DATADISK3                     /dev/oracleasm/disks/ASMDISK3
DATADISK2                      /dev/oracleasm/disks/ASMDISK5
DATADISK1                      /dev/oracleasm/disks/ASMDISK4
ARCHDISK1                      /dev/oracleasm/disks/ASMDISK2
FLASHDISK                      /dev/oracleasm/disks/ASMDISK1

(6)查看每个磁盘组的可用大小
SQL> select name,allocation_unit_size,total_mb from v$asm_diskgroup;
NAME      ALLOCATION_UNIT_SIZE      TOTAL_MB
------------------ --------------------------------    ----------
FLASH_DISK  1048576          3815
ARCH_DISK  1048576          3815
DATA_DISK   1048576           954

(7)向磁盘组中增加一个磁盘
SQL> ALTER DISKGROUP ARCH_DISK ADD DISK '/dev/oracleasm/disks/ASMDISK3' name ARCHDISK2;

Diskgroup altered.

查看每个磁盘组的可用大小
SQL> select name,allocation_unit_size,total_mb from v$asm_diskgroup;
NAME       ALLOCATION_UNIT_SIZE   TOTAL_MB
------------------- -------------------------------   ----------
FLASH_DISK  1048576         3815
ARCH_DISK  1048576         4292
DATA_DISK  1048576          954

SQL> select name,path from v$asm_disk_stat;
NAME                            PATH
-------------------       ----------------------------------------
DATADISK3                      /dev/oracleasm/disks/ASMDISK5
DATADISK1                       /dev/oracleasm/disks/ASMDISK4
ARCHDISK2                       /dev/oracleasm/disks/ASMDISK3
ARCHDISK1                       /dev/oracleasm/disks/ASMDISK2
FLASHDISK                       /dev/oracleasm/disks/ASMDISK1
可以看出,磁盘组ARCH_DISK的大小发生变化了,表明添加磁盘成功

(8)从磁盘组中删除一个磁盘:
SQL> ALTER DISKGROUP ARCH_DISK DROP DISK ARCHDISK2;
Diskgroup altered.

(9)删除一个磁盘组:
SQL> drop diskgroup  FLASH_DISK;
Diskgroup dropped.
当有数据库使用ASM的磁盘组时,是无法卸载和删除这个磁盘组的。ASM实例如果宕掉,那么使用ASM的数据库实例也会宕掉。在RAC环境中,在删除一个磁盘组之前,其他节点的ASM实例必须要将这个要删除的磁盘组卸载。

4.关闭ASM实例
关闭ASM实例的命令和关闭数据库实例的命令相同,但只有在没有任何数据库实例连接到该ASM实例的情况下,才能正常关闭ASM实例,如果至少有一个数据库实例与之连接,会提示以下错误:
ORA-15097: cannot SHUTDOWN ASM instance with connected RDBMS instance
此时,如果对该ASM实例强制执行SHUTDOWN ABORT命令,那么ASM实例将被关闭,任何与之连接的数据库实例最终也将自动关闭,同时报以下错误:
ORA-15064: communication failure with ASM instance
ASM实例被强制关闭后,在下次启动时,会要求进行恢复。

5.  ASMCMD命令
Oracle在10g版本中提供了ASMCMD命令,通过这个命令可以管理存储在ASM磁盘中的数据。下面简单介绍ASMCMD命令的使用方法。
在使用ASMCMD命令时必须启动ASM实例,然后指定ORACLE_HOME和ORACLE_SID,例如:
[oracle@node-rac1 ~]$ export ORACLE_SID=+ASM1
[oracle@node-rac1 ~]$ asmcmd
ASMCMD>
还可以使用“asmcmd -p”,加上“-p”参数可以显示当前路径。
下面是ASMCMD提供的一些可用命令,其中oracle 11g新增的命令有cp、md_backup、md_restore。
ASMCMD> ?
        commands:
        --------
        help
        cd
        cp
        du
        find
        ls
        lsct
        lsdg
        mkalias
        mkdir
        pwd
        rm
        rmalias
        md_backup
        md_restore
        lsdsk
        remap

(1)切换目录
ASMCMD> cd +DATA_DISK/RACDB

(2)列出目录信息
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileracdb.ora

(3)查看磁盘空间信息
执行ASMCMD的 “du DATAFILE”命令查看磁盘空间信息,如图3所示
 

(4)显示ASM和数据库实例连接情况
执行ASMCMD的“lsct”命令显示ASM和数据库实例连接情况,如图4所示
 

(5)创建一个目录
ASMCMD> mkdir test
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileracdb.ora
test/

(6)复制磁盘文件
将ASM磁盘文件spfileracdb.ora复制到test目录下:
ASMCMD> cp spfileracdb.ora test
source +DATA_DISK/RACDB/spfileracdb.ora
target +DATA_DISK/RACDB/test/spfileracdb.ora
copying file(s)...
file, +DATA_DISK/racdb/test/spfileracdb.ora, copy committed.
ASMCMD> cd test
ASMCMD> ls
spfileracdb.ora

将ASM磁盘文件UNDOTBS1.258.728340289文件复制到操作系统某目录下:
ASMCMD> cp UNDOTBS1.258.728340289 UNDOTBS1.dbf           
source +DATA_DISK/RACDB/DATAFILE/UNDOTBS1.258.728340289
target UNDOTBS1.dbf
copying file(s)...
copying file(s)...
copying file(s)...
copying file(s)...
copying file(s)...
copying file(s)...
file, /u01/oracle/product/11.0.6/rac_db/dbs/UNDOTBS1.dbf, copy committed.

(7)备份ASM的metadata
ASMCMD> md_backup  /u01/oracle/datadisk.bak -G data_disk
Disk group to be backed up: DATA_DISK
这样就把ASM的metadata备份到了文件系统上,通过查看datadisk.bak文件可以得知metadata的组织信息。

(8)为ASM磁盘文件设置别名
执行如图5所示的命令为ASM磁盘文件设置别名。


(9)在磁盘组查找文件
ASMCMD> find +DATA_DISK  sys*
+DATA_DISK/RACDB/DATAFILE/SYSAUX.257.728340287
+DATA_DISK/RACDB/DATAFILE/SYSAUX.dbf
+DATA_DISK/RACDB/DATAFILE/SYSTEM.256.728340285
+DATA_DISK/RACDB/DATAFILE/SYSTEM.dbf

(10)在磁盘组删除文件
ASMCMD> rm -rf test
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI