oracle 移出一个字符,12c新特性ASMFD

从12.1.0.2开始,Oracle 引入了ASMFD(ASM Filter Driver),ASMFD只适应于Linux平台。安装完Grid Infrastructure后,你可以决定是否配置她。如果之前使用了ASMLIB(可以简单的理解为对设备做标签来标识磁盘)或者udev(可以动态管理设备),迁移到ASMFD之后,需要卸载ASMLIB或禁用udev的规则。通过Filter driver可以过滤无效的请求,避免因为非oracle的I/O请求造成意外的覆写,进而保证了系统的安全和稳定。

官方文档中关于ASMFD的描述

This feature is available on Linux systems starting with Oracle Database 12c Release 1 (12.1.0.2).

Oracle ASM Filter Driver (Oracle ASMFD) is a kernel module that resides in the I/O path of the Oracle ASM disks.Oracle ASM uses the filter driver to validate write I/O requests to Oracle ASM disks. After installation of Oracle Grid Infrastructure, you can optionally configure Oracle ASMFD for your system. If ASMLIB is configured for an existing Oracle ASM installation, then you must explicitly migrate the existing ASMLIB configuration to Oracle ASMFD.

The Oracle ASMFD simplifies the configuration and management of disk devices by eliminating the need to rebind disk devices used with Oracle ASM each time the system is restarted.

The Oracle ASM Filter Driver rejects any I/O requests that are invalid. This action eliminates accidental overwrites of Oracle ASM disks that would cause corruption in the disks and files within the disk group. For example, the Oracle ASM Filter Driver filters out all non-Oracle I/Os which could cause accidental overwrites.

ASMFD会拒绝所有的无效的I/O请求。这种行为可以避免因为意外的覆写造成ASM Disk的损坏或磁盘组中文件的损坏。比如她会过滤出所有可能造成覆写的non-oracle的I/O请求。

本文以Oracle Restart(测试版本12.1.0.2.0)环境测试为例来说明如何安装配置ASMFD。首先安装GI(Install Softeware Only),然后配置ASMFD,配置Label ASMFD Disks,创建ASM实例,创建ASM磁盘组(ASMFD),创建spfile并迁移至ASM磁盘组。最后在启用和关闭Filter功能情况下分别测试。

详情参考:http://docs.oracle.com/database/121/OSTMG/GUID-06B3337C-07A3-4B3F-B6CD-04F2916C11F6.htm

配置Oracle Restart(SIHA)

[root@db1 ~]# /orgrid/oracle/product/121/root.sh

Performing root user operation.

The following environment variables are set as:

ORACLE_OWNER= orgrid

ORACLE_HOME=  /orgrid/oracle/product/121

Enter the full pathname of the local bin directory: [/usr/local/bin]:

The contents of "dbhome" have not changed. No need to overwrite.

The contents of "oraenv" have not changed. No need to overwrite.

The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:

/orgrid/oracle/product/121/perl/bin/perl -I/orgrid/oracle/product/121/perl/lib -I/orgrid/oracle/product/121/crs/install /orgrid/oracle/product/121/crs/install/roothas.pl  执行这个脚本配置HAS,可以不必在GUI下运行

To configure Grid Infrastructure for a Cluster execute the following command as orgrid user:

/orgrid/oracle/product/121/crs/config/config.sh

安装GI,选择只安装软件,如果要配置RAC,需要运行config.sh脚本(必须在GUI模式下运行),会让你输入cluster信息,scan信息,感兴趣的可以尝试下。

This command launches the Grid Infrastructure Configuration Wizard. The wizard also supports silent operation, and the parameters can be passed through the response file that is available in the installation media.

[root@db1 ~]#

[root@db1 ~]# /orgrid/oracle/product/121/perl/bin/perl -I/orgrid/oracle/product/121/perl/lib -I/orgrid/oracle/product/121/crs/install /orgrid/oracle/product/121/crs/install/roothas.pl

Using configuration parameter file: /orgrid/oracle/product/121/crs/install/crsconfig_params

LOCAL ADD MODE

Creating OCR keys for user 'orgrid', privgrp 'asmadmin'..

Operation successful.

LOCAL ONLY MODE

Successfully accumulated necessary OCR keys.

Creating OCR keys for user 'root', privgrp 'root'..

Operation successful.

CRS-4664: Node db1 successfully pinned.

2016/05/16 22:10:54 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.conf'

db1     2016/05/16 22:11:11     /orgrid/oracle/product/121/cdata/db1/backup_20160516_221111.olr     0

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'db1'

CRS-2673: Attempting to stop 'ora.evmd' on 'db1'

CRS-2677: Stop of 'ora.evmd' on 'db1' succeeded

CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'db1' has completed

CRS-4133: Oracle High Availability Services has been stopped.

CRS-4123: Oracle High Availability Services has been started.

2016/05/16 22:12:19 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

用udev绑定,加载并查看

[root@db1 ~]# cd /etc/udev/rules.d/

[root@db1 rules.d]# cat 99-oracle-asmdevices.rules

KERNEL=="sdb1",NAME="asmdisk1",OWNER="orgrid",GROUP="asmadmin",MODE="0660"

KERNEL=="sdb2",NAME="asmdisk2",OWNER="orgrid",GROUP="asmadmin",MODE="0660"

KERNEL=="sdb3",NAME="asmdisk3",OWNER="orgrid",GROUP="asmadmin",MODE="0660"

KERNEL=="sdb4",NAME="asmdisk4",OWNER="orgrid",GROUP="asmadmin",MODE="0660"

KERNEL=="sdc1",NAME="asmdisk5",OWNER="orgrid",GROUP="asmadmin",MODE="0660"

KERNEL=="sdc2",NAME="asmdisk6",OWNER="orgrid",GROUP="asmadmin",MODE="0660"

KERNEL=="sdc3",NAME="asmdisk7",OWNER="orgrid",GROUP="asmadmin",MODE="0660"

KERNEL=="sdc4",NAME="asmdisk8",OWNER="orgrid",GROUP="asmadmin",MODE="0660" [root@db1 rules.d]# [root@db1 rules.d]# udevadm control --reload-rules

[root@db1 rules.d]# udevadm trigger

[root@db1 rules.d]# ls -l /dev/asmdisk*

brw-rw---- 1 orgrid asmadmin 8, 17 May 16 23:03 /dev/asmdisk1

brw-rw---- 1 orgrid asmadmin 8, 18 May 16 23:03 /dev/asmdisk2

brw-rw---- 1 orgrid asmadmin 8, 19 May 16 23:03 /dev/asmdisk3

brw-rw---- 1 orgrid asmadmin 8, 20 May 16 23:03 /dev/asmdisk4

brw-rw---- 1 orgrid asmadmin 8, 33 May 16 23:03 /dev/asmdisk5

brw-rw---- 1 orgrid asmadmin 8, 34 May 16 23:03 /dev/asmdisk6

brw-rw---- 1 orgrid asmadmin 8, 35 May 16 23:03 /dev/asmdisk7

brw-rw---- 1 orgrid asmadmin 8, 36 May 16 23:03 /dev/asmdisk8

[root@db1 rules.d]#

查看ASMFD是否安装

[root@db1 ~]# export ORACLE_HOME=/orgrid/oracle/product/121

[root@db1 ~]# export ORACLE_SID=+ASM

[root@db1 ~]# export PATH=$ORACLE_HOME/bin:$PATH

[root@db1 ~]# $ORACLE_HOME/bin/asmcmd afd_state

Connected to an idle instance.

ASMCMD-9526: The AFD state is 'NOT INSTALLED' and filtering is 'DEFAULT' on host 'db1'

[root@db1 ~]#

安装ASMFD(必须先关掉CRS(RAC)/HAS(SIHA)服务)

[root@db1 ~]# $ORACLE_HOME/bin/asmcmd afd_configure

Connected to an idle instance.

ASMCMD-9523: command cannot be used when Oracle Clusterware stack is up

[root@db1 ~]# crsctl stop has

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'db1'

CRS-2673: Attempting to stop 'ora.evmd' on 'db1'

CRS-2677: Stop of 'ora.evmd' on 'db1' succeeded

CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'db1' has completed

CRS-4133: Oracle High Availability Services has been stopped.

[root@db1 ~]# $ORACLE_HOME/bin/asmcmd afd_configure

Connected to an idle instance.

AFD-627: AFD distribution files found.

AFD-636: Installing requested AFD software.

AFD-637: Loading installed AFD drivers.

AFD-9321: Creating udev for AFD.

AFD-9323: Creating module dependencies - this may take some time.

AFD-9154: Loading 'oracleafd.ko' driver.

AFD-649: Verifying AFD devices.

AFD-9156: Detecting control device '/dev/oracleafd/admin'.

AFD-638: AFD installation correctness verified.

Modifying resource dependencies - this may take some time.

[root@db1 ~]#

查看ASMFD详情

[orgrid@db1 ~]$ $ORACLE_HOME/bin/asmcmd afd_state

Connected to an idle instance.

ASMCMD-9526: The AFD state is 'LOADED' and filtering is 'DEFAULT' on host 'db1'

[root@db1 ~]# /orgrid/oracle/product/121/bin/crsctl start has

CRS-4123: Oracle High Availability Services has been started.

[root@db1 ~]#

[orgrid@db1 ~]$

[orgrid@db1 bin]$ pwd

/orgrid/oracle/product/121/bin

[orgrid@db1 bin]$ ls -ltr afd*

-rwxr-x--- 1 orgrid asmadmin 1000 May 23 2014 afdroot

-rwxr-xr-x 1 orgrid asmadmin 72836515 Jul 1 2014 afdboot

-rwxr-xr-x 1 orgrid asmadmin 184403 Jul 1 2014 afdtool.bin

-rwxr-x--- 1 orgrid asmadmin 766 May 16 23:29 afdload

-rwxr-x--- 1 orgrid asmadmin 1254 May 16 23:29 afddriverstate

-rwxr-xr-x 1 orgrid asmadmin 2829 May 16 23:29 afdtool

[root@db1 ~]# crsctl stat res -t

--------------------------------------------------------------------------------

Name Target State Server State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.ons

OFFLINE OFFLINE db1 STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

1 OFFLINE OFFLINE STABLE

ora.diskmon

1 OFFLINE OFFLINE STABLE

ora.driver.afd

1 ONLINE ONLINE db1 STABLE

ora.evmd

1 ONLINE ONLINE db1 STABLE

--------------------------------------------------------------------------------

[root@db1 ~]#

安装成功后,你看到afd的一些文件,还能看到资源ora.driver.afd

用afd_label标识磁盘

[orgrid@db1 bin]$ $ORACLE_HOME/bin/asmcmd afd_label ASMDISK1 /dev/asmdisk1

Connected to an idle instance.

[orgrid@db1 bin]$ $ORACLE_HOME/bin/asmcmd afd_lsdsk

Connected to an idle instance.

--------------------------------------------------------------------------------

Label Filtering Path

================================================================================

ASMDISK1 ENABLED /dev/asmdisk1

[orgrid@db1 bin]$ $ORACLE_HOME/bin/asmcmd afd_label ASMDISK2 /dev/asmdisk2

Connected to an idle instance.

[orgrid@db1 bin]$ $ORACLE_HOME/bin/asmcmd afd_lsdsk

Connected to an idle instance.

--------------------------------------------------------------------------------

Label Filtering Path

================================================================================

ASMDISK1 ENABLED /dev/asmdisk1

ASMDISK2 ENABLED /dev/asmdisk2

[orgrid@db1 bin]$ asmcmd

Connected to an idle instance.

ASMCMD> afd_label ASMDISK3 /dev/asmdisk3

ASMCMD> afd_lsdsk

--------------------------------------------------------------------------------

Label Filtering Path

================================================================================

ASMDISK1 ENABLED /dev/asmdisk1

ASMDISK2 ENABLED /dev/asmdisk2

ASMDISK3 ENABLED /dev/asmdisk3

ASMCMD>

[root@db1 rules.d]# ls -ltr|tail -5

-rw-r--r--. 1 root root 789 Mar 10 05:18 70-persistent-cd.rules

-rw-r--r--. 1 root root 341 Mar 10 05:25 99-vmware-scsi-udev.rules

-rw-r--r-- 1 root root 190 May 16 22:11 55-usm.rules

-rw-r--r-- 1 root root 600 May 16 23:03 99-oracle-asmdevices.rules

-rw-r--r-- 1 root root 230 May 17 00:31 53-afd.rules

[root@db1 rules.d]#

[orgrid@db1 rules.d]$ pwd

/etc/udev/rules.d

[root@db1 rules.d]# cat 53-afd.rules

#

# AFD devices

KERNEL=="oracleafd/.*", OWNER="orgrid", GROUP="asmadmin", MODE="0770"

KERNEL=="oracleafd/*", OWNER="orgrid", GROUP="asmadmin", MODE="0770"

KERNEL=="oracleafd/disks/*", OWNER="orgrid", GROUP="asmadmin", MODE="0660"

[root@db1 rules.d]# cat 55-usm.rules

#

# ADVM devices

KERNEL=="asm/*", GROUP="asmadmin", MODE="0770"

KERNEL=="asm/.*", GROUP="asmadmin", MODE="0770"

#

# ACFS devices

KERNEL=="ofsctl", GROUP="asmadmin", MODE="0664"

[root@db1 rules.d]#

安装后会看到udev rules下面多了一些文件,实际上ASMFD仍使用了udev

创建ASM实例(也可以通过asmca去创建)

[orgrid@db1 dbs]$ srvctl add asm

[orgrid@db1 dbs]$ ps -ef|grep pmon

orgrid 42414 36911 0 14:26 pts/2 00:00:00 grep pmon

[orgrid@db1 dbs]$ crsctl stat res -t

--------------------------------------------------------------------------------

Name Target State Server State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.asm

OFFLINE OFFLINE db1 STABLE

ora.ons

OFFLINE OFFLINE db1 STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

1 OFFLINE OFFLINE STABLE

ora.diskmon

1 OFFLINE OFFLINE STABLE

ora.driver.afd

1 ONLINE ONLINE db1 STABLE

ora.evmd

1 ONLINE ONLINE db1 STABLE

--------------------------------------------------------------------------------

[orgrid@db1 dbs]$

[orgrid@db1 ~]$ cat $ORACLE_HOME/dbs/init*.ora

*.asm_power_limit=1

*.diagnostic_dest='/orgrid/grid_base'

*.instance_type='asm'

*.large_pool_size=12M

*.memory_target=1024M

*.remote_login_passwordfile='EXCLUSIVE'

[orgrid@db1 ~]$

[orgrid@db1 ~]$ ps -ef|grep pmon

orgrid 42724 42694 0 14:30 pts/2 00:00:00 grep pmon

[orgrid@db1 ~]$ srvctl start asm

[orgrid@db1 ~]$ ps -ef|grep pmon

orgrid 42807 1 0 14:30 ? 00:00:00 asm_pmon_+ASM

orgrid 42888 42694 0 14:31 pts/2 00:00:00 grep pmon

[orgrid@db1 ~]$ crsctl stat res -t

--------------------------------------------------------------------------------

Name Target State Server State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.asm

ONLINE ONLINE db1 Started,STABLE

ora.ons

OFFLINE OFFLINE db1 STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.cssd

1 ONLINE ONLINE db1 STABLE

ora.diskmon

1 OFFLINE OFFLINE STABLE

ora.driver.afd

1 ONLINE ONLINE db1 STABLE

ora.evmd

1 ONLINE ONLINE db1 STABLE

--------------------------------------------------------------------------------

[orgrid@db1 ~]$

通过asmca创建DiskGroup

[orgrid@db1 ~]$ asmca -silent  -sysAsmPassword oracle -asmsnmpPassword oracle -createDiskGroup -diskString 'AFD:*' -diskGroupName DATA_AFD -disk 'AFD:ASMDISK1' -disk 'AFD:ASMDISK2' -redundancy Normal -au_size 4  -compatible.asm 12.1 -compatible.rdbms 12.1

Disk Group DATA_AFD created successfully.

[orgrid@db1 ~]$

创建spfile并迁移到磁盘组

[orgrid@db1 ~]$ asmcmd spget

[orgrid@db1 ~]$

[orgrid@db1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue May 17 15:09:26 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Automatic Storage Management option

SQL> show parameter spf

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

spfile string

SQL> create spfile='+DATA_AFD' from pfile;

File created.

SQL> show parameter spf

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

spfile string

SQL> exit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Automatic Storage Management option

[orgrid@db1 ~]$ asmcmd spget

+DATA_AFD/ASM/ASMPARAMETERFILE/registry.253.912092995

[orgrid@db1 ~]$

备份并移除udev rule文件99-oracle-asmdevices.rules

重命名99-oracle-asmdevices.rules为99-oracle-asmdevices.rules.bak。如果不move 99-oracle-asmdevices.rules文件,下次重启之后,之前ASMFD标识过的磁盘,看不到。

[orgrid@db1 ~]$ asmcmd afd_lsdsk

There are no labelled devices.

[root@db1 ~]# ls -l /dev/oracleafd/disks

total 0

[root@db1 ~]# ls -l /dev/oracleafd/

admin disks/

设置磁盘Discovery String字符串

ASMCMD> afd_dsget

AFD discovery string:

ASMCMD> afd_dsset '/dev/sd*' --设置ASMFD discovery string为原来物理磁盘的信息

ASMCMD> afd_dsget

AFD discovery string: '/dev/sd*'

ASMCMD>

[orgrid@db1 ~]$ asmcmd afd_dsget

AFD discovery string: '/dev/sd*'

[orgrid@db1 ~]$ asmcmd dsget --设置ASM磁盘组iscovery string为AFD:*

parameter:AFD:*

profile:AFD:*

[orgrid@db1 ~]$

重启服务器并验证

[root@db1 ~]# ls -l /dev/oracleafd/disks/

total 12

-rw-r--r-- 1 root root 10 May 17 00:15 ASMDISK1

-rw-r--r-- 1 root root 10 May 17 00:15 ASMDISK2

-rw-r--r-- 1 root root 10 May 17 00:15 ASMDISK3

[root@db1 ~]#

ASMCMD> lsdsk --candidate

Path

AFD:ASMDISK2

AFD:ASMDISK3

ASMCMD> afd_lsdsk

--------------------------------------------------------------------------------

Label Filtering Path

================================================================================

ASMDISK1 DISABLED /dev/sdb1

ASMDISK2 DISABLED /dev/sdb2

ASMDISK3 DISABLED /dev/sdb3

ASMCMD>

[orgrid@db1 ~]$ ls -l /dev/disk/by-label/

total 0

lrwxrwxrwx 1 root root 10 May 17 00:30 ASMDISK1 -> ../../sdb1

lrwxrwxrwx 1 root root 10 May 17 00:30 ASMDISK2 -> ../../sdb2

lrwxrwxrwx 1 root root 10 May 17 00:31 ASMDISK3 -> ../../sdb3

[orgrid@db1 ~]$

重启后会发现,ASMFD用的磁盘的属性变成了root权限

启用Filter功能

ASMCMD> help afd_filter

afd_filter

Sets the AFD filtering mode on a given disk path.

If the command is executed without specifying a disk path then

filtering is set at node level.

ASMCMD>

ASMCMD> afd_filter -e /dev/sdb2

ASMCMD> afd_lsdsk

--------------------------------------------------------------------------------

Label Filtering Path

================================================================================

ASMDISK1 DISABLED /dev/sdb1

ASMDISK2 DISABLED /dev/sdb2

ASMDISK3 DISABLED /dev/sdb3

ASMCMD> afd_filter -e

ASMCMD> afd_lsdsk

--------------------------------------------------------------------------------

Label Filtering Path

================================================================================

ASMDISK1 ENABLED /dev/sdb1

ASMDISK2 ENABLED /dev/sdb2

ASMDISK3 ENABLED /dev/sdb3

ASMCMD>

创建新磁盘组DATA_PGOLD

SQL> create diskgroup DATA_PGOLD external redundancy disk 'AFD:ASMDISK3';

Diskgroup created.

SQL>

[orgrid@db1 ~]$ kfed read AFD:ASMDISK3

kfbh.endian: 1 ; 0x000: 0x01

kfbh.hard: 130 ; 0x001: 0x82

kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD

kfbh.datfmt: 1 ; 0x003: 0x01

kfbh.block.blk: 0 ; 0x004: blk=0

kfbh.block.obj: 2147483648 ; 0x008: disk=0

kfbh.check: 771071217 ; 0x00c: 0x2df59cf1

kfbh.fcn.base: 0 ; 0x010: 0x00000000

kfbh.fcn.wrap: 0 ; 0x014: 0x00000000

kfbh.spare1: 0 ; 0x018: 0x00000000

kfbh.spare2: 0 ; 0x01c: 0x00000000

kfdhdb.driver.provstr: ORCLDISKASMDISK3 ; 0x000: length=16

kfdhdb.driver.reserved[0]: 1145918273 ; 0x008: 0x444d5341

kfdhdb.driver.reserved[1]: 843797321 ; 0x00c: 0x324b5349

kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000

kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000

kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000

kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000

kfdhdb.compat: 168820736 ; 0x020: 0x0a100000

kfdhdb.dsknum: 0 ; 0x024: 0x0000

kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL

kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER

kfdhdb.dskname: ASMDISK3 ; 0x028: length=8

kfdhdb.grpname: DATA_PGOLD ; 0x048: length=10

kfdhdb.fgname: ASMDISK2 ; 0x068: length=8

kfdhdb.capname: ; 0x088: length=0

kfdhdb.crestmp.hi: 33035808 ; 0x0a8: HOUR=0x0 DAYS=0x11 MNTH=0x5 YEAR=0x7e0

kfdhdb.crestmp.lo: 3231790080 ; 0x0ac: USEC=0x0 MSEC=0x4d SECS=0xa MINS=0x30

kfdhdb.mntstmp.hi: 33035808 ; 0x0b0: HOUR=0x0 DAYS=0x11 MNTH=0x5 YEAR=0x7e0

kfdhdb.mntstmp.lo: 3239631872 ; 0x0b4: USEC=0x0 MSEC=0x237 SECS=0x11 MINS=0x30

kfdhdb.secsize: 512 ; 0x0b8: 0x0200

kfdhdb.blksize: 4096 ; 0x0ba: 0x1000

kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000

kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80

kfdhdb.dsksize: 2055 ; 0x0c4: 0x00000807

kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002

kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001

kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002

kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002

kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000

kfdhdb.redomirrors[1]: 0 ; 0x0da: 0x0000

kfdhdb.redomirrors[2]: 0 ; 0x0dc: 0x0000

kfdhdb.redomirrors[3]: 0 ; 0x0de: 0x0000

kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000

kfdhdb.grpstmp.hi: 33035808 ; 0x0e4: HOUR=0x0 DAYS=0x11 MNTH=0x5 YEAR=0x7e0

kfdhdb.grpstmp.lo: 3231717376 ; 0x0e8: USEC=0x0 MSEC=0x6 SECS=0xa MINS=0x30

在启用Filter功能下,用dd做测试

[root@db1 log]# dd if=/dev/zero of=/dev/sdb3

dd: writing to `/dev/sdb3': No space left on device

4209031+0 records in

4209030+0 records out

2155023360 bytes (2.2 GB) copied, 235.599 s, 9.1 MB/s

[root@db1 log]#

[root@db1 ~]# strings -a /dev/sdb3

ORCLDISKASMDISK3

ASMDISK3

DATA_PGOLD

ASMDISK3

0

...省去了一部分

ORCLDISKASMDISK3

ASMDISK3

DATA_PGOLD

ASMDISK3

[root@db1 ~]#

[root@db1 ~]#

通过strings查看/dev/sdb3,可以发现,里面的内容并没有被清空

卸载、挂载磁盘组正常

[orgrid@db1 ~]$ asmcmd

ASMCMD> lsdg

State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name

MOUNTED EXTERN N 512 4096 1048576 4110 4058 0 4058 0 N DATA_ADF/

MOUNTED EXTERN N 512 4096 1048576 2055 1993 0 1993 0 N DATA_PGOLD/

ASMCMD> umount data_pgold

ASMCMD> lsdg

State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name

MOUNTED EXTERN N 512 4096 1048576 4110 4058 0 4058 0 N DATA_ADF/

ASMCMD> mount data_pgold

ASMCMD> lsdg

State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name

MOUNTED EXTERN N 512 4096 1048576 4110 4058 0 4058 0 N DATA_ADF/

MOUNTED EXTERN N 512 4096 1048576 2055 1993 0 1993 0 N DATA_PGOLD/

ASMCMD>

/var/log/messages里显示的错误信息

[root@db1 log]# tail -3 messages

May 17 01:10:34 db1 kernel: F 4297082.224/160516171034 flush-8:16[9173] afd_mkrequest_fn: write IO on ASM managed device (major=8/minor=18) not supported i=2 start=8418038 seccnt=2 pstart=4209030 pend=8418060

May 17 01:10:34 db1 kernel: F 4297082.224/160516171034 flush-8:16[9173] afd_mkrequest_fn: write IO on ASM managed device (major=8/minor=18) not supported i=2 start=8418040 seccnt=2 pstart=4209030 pend=8418060

May 17 01:10:34 db1 kernel: F 4297082.224/160516171034 flush-8:16[9173] afd_mkrequest_fn: write IO on ASM managed device (major=8/minor=18) not supported i=2 s

[root@db1 log]#

在关闭Filter功能情况下做测试

ASMCMD> afd_filter -d

ASMCMD> afd_lsdsk

--------------------------------------------------------------------------------

Label Filtering Path

================================================================================

ASMDISK1 DISABLED /dev/sdb1

ASMDISK2 DISABLED /dev/sdb2

ASMDISK3 DISABLED /dev/sdb3

ASMCMD> exit

[orgrid@db1 ~]$

备份磁盘的前1024字节并清除,普通用户没权限读

[orgrid@db1 ~]$ dd if=/dev/sdb3 of=block1 bs=1024 count=1

dd: opening `/dev/sdb3': Permission denied

[orgrid@db1 ~]$ exit

logout

[root@db1 ~]# dd if=/dev/sdb3 of=block1 bs=1024 count=1

1+0 records in

1+0 records out

1024 bytes (1.0 kB) copied, 0.00236493 s, 433 kB/s

[root@db1 ~]# dd if=/dev/zero of=/dev/sdb3 bs=1024 count=1

1+0 records in

1+0 records out

1024 bytes (1.0 kB) copied, 0.000458225 s, 2.2 MB/s

[root@db1 ~]# su - orgrid

卸载、挂载磁盘组DATA_PGOLD

[orgrid@db1 ~]$ asmcmd

ASMCMD> lsdg

State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name

MOUNTED  EXTERN  N         512   4096  1048576      4110     4058                0            4058              0             N  DATA_ADF/

MOUNTED  EXTERN  N         512   4096  1048576      2055     1993                0            1993              0             N  DATA_PGOLD/

ASMCMD> umount data_pgold

ASMCMD> mount data_pgold

ORA-15032: not all alterations performed

ORA-15017: diskgroup "DATA_PGOLD" cannot be mounted

ORA-15040: diskgroup is incomplete (DBD ERROR: OCIStmtExecute)

ASMCMD>

可以看出,关闭了Filter功能之后,就会失去保护功能

通过kfed修复

[root@db1 ~]# /orgrid/oracle/product/121/bin/kfed repair /dev/sdb3

[root@db1 ~]# su - orgrid

[orgrid@db1 ~]$ asmcmd

ASMCMD> lsdg

State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name

MOUNTED  EXTERN  N         512   4096  1048576      4110     4058                0            4058              0             N  DATA_ADF/

ASMCMD> mount data_pgold

ASMCMD> lsdg

State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name

MOUNTED  EXTERN  N         512   4096  1048576      4110     4058                0            4058              0             N  DATA_ADF/

MOUNTED  EXTERN  N         512   4096  1048576      2055     1993                0            1993              0             N  DATA_PGOLD/

ASMCMD>

通过之前dd备份的块做修复

[root@db1 ~]# dd if=block1 of=/dev/sdb2 bs=1024 count=1 conv=notrunc

1+0 records in

1+0 records out

1024 bytes (1.0 kB) copied, 0.000467297 s, 2.2 MB/s

[root@db1 ~]# su - orgrid

[orgrid@db1 ~]$ asmcmd

ASMCMD> mount data_pgold

ASMCMD> lsdg

State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name

MOUNTED  EXTERN

N         512   4096  1048576      4110     4058

0            4058              0             N  DATA_ADF/

MOUNTED

EXTERN  N         512   4096  1048576      2055     1993

0            1993              0             N  DATA_PGOLD/

ASMCMD> exit

[orgrid@db1 ~]$

增加AFD DISK,一般用户没权限添加,必须用root用户

ASMCMD> help afd_label

afd_label

To set the given label to the specified disk

ASMCMD>

[orgrid@db1 ~]$ $ORACLE_HOME/bin/asmcmd afd_label ASMDISK4 /dev/sdb4

ORA-15227: could not perform label set/clear operation

ORA-15031: disk specification '/dev/sdb4' matches no disks (DBD ERROR: OCIStmtExecute)

ASMCMD-9513: ASM disk label set operation failed.

[root@db1 ~]# /orgrid/oracle/product/121/bin/asmcmd afd_label ASMDISK4 /dev/sdb4

Connected to an idle instance.

[root@db1 ~]#

常见问题和解答

问:运行afd_configure时遇到ASMCMD-9524: AFD configuration failed 'ERROR: OHASD start failed'

答:安装是如果遇到这个错误,需要安装p19035573_121020_Generic.zip,这个patch实际上是一个asmcmdsys.pm文件

问:什么时候用afd_label --migrate

答:如果是从现有DiskGroup迁移到ASMFD,需要加参数--migrate,否则不需要

Reference

Configure ASMFD

http://docs.oracle.com/database/121/OSTMG/GUID-2F5E344F-AFC2-4768-8C00-6F3C56302123.htm#OSTMG95729

http://docs.oracle.com/database/121/OSTMG/GUID-BB2B3A64-4B83-4A6D-816C-6472FAF9B27A.htm#OSTMG95909Configure in Restart

http://docs.oracle.com/database/121/OSTMG/GUID-06B3337C-07A3-4B3F-B6CD-04F2916C11F6.htm

http://www.ibm.com/developerworks/cn/linux/l-cn-udev/

https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值