Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching, Zero-Downtime Upgrade, GoldenGate

Oracle Exadata ,Oracle ODA, Oracle ZDLRA


当前位置: 首页 » 技术文章 » AODU

aodu(At Oracle Database Utility)之asmdisk

oracle自从10g退出ASM之后,现在生产环境中使用ASM的场景越来越多。有时可能会发生对磁盘的误操作,导致ASM磁盘的损坏,这对数据库来说是致命的。如果有工具能查看磁盘是否是ASM使用的磁盘,这样会更方便,更安全。

如果一块磁盘用作ASM,那么Oracle就会在磁盘的头部表示出来,字符是ORCLDISK,包括Windows和所用Unix平台。可以通过od -N 128 -c <设备全路径>查看,这个命令是通用的,适用所用unix平台,当然aodu也可以实现。


注意:创建ASM磁盘后,想在使用,必须删除(通过asmca或命令行),或者通过dd清除设备头部即可。

dd if=/dev/zero of=/dev/hdiskpower10 bs=1024 count=10



通过aodu查看
[root@ohs1 linux]# ./aodu

At Oracle Database Utility,Release 1.1.0 on Tue Jun 14 11:35:09 2016
Copyright (c) 2014, 2015, Robin.Han.  All rights reserved.
http://ohsdba.cn
WeChat:ohsdba
Cell:186-9589-1286
E-Mail:375349564@qq.com

AODU>

AODU> asmdisk /dev/sdb1
The disk /dev/sdb1 still used by ASM.
AODU> asmdisk /dev/sdb2
The disk /dev/sdb2 still used by ASM.
AODU> asmdisk /dev/sdb11
The disk /dev/sdb11 still used by ASM.
AODU> asmdisk /dev/sdb12
The disk /dev/sdb12 has been used by ASM.
AODU> asmdisk /dev/sdb13
The disk /dev/sdb13 has not been used by ASM.
AODU>  asmdisk /dev/sdb14
The disk /dev/sdb14 has been used by ASM.
AODU> asmdisk /dev/sdb15
The disk /dev/sdb15 still used by ASM.
AODU> asmdisk /dev/sdb16
/dev/sdb16: Bad file descriptor
AODU>

AIX是可以使用lquerypv查看,非常方便
$ lquerypv -h /dev/hdiskpower1


00000000   00000000 00000000 00000000 00000000  |................|
00000010   00000000 00000000 00000000 00000000  |................|
00000020   00000000 00000000 00000000 00000000  |................|
00000030   00000000 00000000 00000000 00000000  |................|
00000040   00000000 00000000 00000000 00000000  |................|
00000050   00000000 00000000 00000000 00000000  |................|
00000060   00000000 00000000 00000000 00000000  |................|
00000070   00000000 00000000 00000000 00000000  |................|
00000080   00000000 00000000 00000000 00000000  |................|
00000090   00000000 00000000 00000000 00000000  |................|
000000A0   00000000 00000000 00000000 00000000  |................|
000000B0   00000000 00000000 00000000 00000000  |................|
000000C0   00000000 00000000 00000000 00000000  |................|
000000D0   00000000 00000000 00000000 00000000  |................|
000000E0   00000000 00000000 00000000 00000000  |................|
000000F0   00000000 00000000 00000000 00000000  |................|
$
用作ASM后,可以看到
#lquerypv -h /dev/hdiskpower0
00000000   00820101 00000000 80000000 9FD017BD  |................|
00000010   00000000 00000000 00000000 00000000  |................|
00000020   4F52434C 4449534B 00000000 00000000  |ORCLDISK........|
00000030   00000000 00000000 00000000 00000000  |................|
00000040   0B200000 00000203 53595354 454D4447  |. ......SYSTEMDG|
00000050   5F303030 30000000 00000000 00000000  |_0000...........|
00000060   00000000 00000000 53595354 454D4447  |........SYSTEMDG|
00000070   00000000 00000000 00000000 00000000  |................|
00000080   00000000 00000000 53595354 454D4447  |........SYSTEMDG|
00000090   5F303030 30000000 00000000 00000000  |_0000...........|
000000A0   00000000 00000000 00000000 00000000  |................|
000000B0   00000000 00000000 00000000 00000000  |................|
000000C0   00000000 00000000 01F81331 E1851000  |...........1....|
000000D0   01F81332 005A5C00 02001000 00100000  |...2.Z\.........|
000000E0   0001BC80 00001000 00000002 00000001  |................|
000000F0   00000002 00000002 00000000 00000000  |................|
#

Linux上没有这个好用的工具,可以通过od查看
[root@ohs1 /]# od --read-bytes=128 --format=c /dev/sdb1
0000000 001 202 001 001  \0  \0  \0  \0  \0  \0  \0 200 310   ;   U   [
0000020  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000040   O   R   C   L   D   I   S   K   A   S   M   D   I   S   K   1
0000060  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000100  \0  \0      \v  \0  \0 002 003   S   Y   S   T   E   M   D   G
0000120   _   0   0   0   0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000140  \0  \0  \0  \0  \0  \0  \0  \0   S   Y   S   T   E   M   D   G
0000160  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000200

[root@ohs1 ~]# dd if=/dev/sdb1 bs=128 count=1|od -c
1+0 records in
1+0 records out
128 bytes (128 B) copied, 2.9095e-05 seconds, 4.4 MB/s
0000000 001 202 001 001  \0  \0  \0  \0  \0  \0  \0 200 310   ;   U   [
0000020  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000040   O   R   C   L   D   I   S   K   A   S   M   D   I   S   K   1
0000060  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000100  \0  \0      \v  \0  \0 002 003   S   Y   S   T   E   M   D   G
0000120   _   0   0   0   0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000140  \0  \0  \0  \0  \0  \0  \0  \0   S   Y   S   T   E   M   D   G
0000160  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000200

[root@ohs1 ~]#
[root@ohs1 /]# od -N 128 -t c /dev/sdb1
0000000 001 202 001 001  \0  \0  \0  \0  \0  \0  \0 200 310   ;   U   [
0000020  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000040   O   R   C   L   D   I   S   K   A   S   M   D   I   S   K   1
0000060  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000100  \0  \0      \v  \0  \0 002 003   S   Y   S   T   E   M   D   G
0000120   _   0   0   0   0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000140  \0  \0  \0  \0  \0  \0  \0  \0   S   Y   S   T   E   M   D   G
0000160  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000200
[root@ohs1 /]#


关键词:aodu 

相关文章

aodu(At Oracle Database Utility)之optim
aodu(At Oracle Database Utility)之asm(二)
aodu(At Oracle Database Utility)之asm(一)
aodu(At Oracle Database Utility)之rac(二)
aodu(At Oracle Database Utility)之rac(一)
aodu(At Oracle Database Utility)之ora600
aodu(At Oracle Database Utility)之asmdisk
aodu(At Oracle Database Utility)之unwrap
aodu(At Oracle Database Utility)之rdba
aodu(At Oracle Database Utility)之drux
aodu(At Oracle Database Utility)之time
aodu(At Oracle Database Utility)之odlog
Top