使用ORACLE ASMFD配置ORACLE儲存標準化
說明
從 12.1.0.2 開始, Oracle 引入了 ASMFD(ASM Filter Driver) , ASMFD 支援 Linux x86_64 和 Oracle Solaris 平臺。安裝完 Grid Infrastructure 後,你可以決定是否配置它。如果之前使用了 ASMLIB 或者 UDEV ,遷移到 ASMFD 之後,需要解除安裝 ASMLIB 或禁用 udev 的規則。透過 Filter driver 可以過濾無效的請求,避免因為非 oracle 的 I/O 請求造成意外的覆寫,進而保證了系統的安全和穩定。
測試環境描述
作業系統版本: Red Hat Enterprise Linux Server release 7.5 (Maipo)
資料庫版本: 19.3.0.0.0
資料庫架構: RAC
ASM 磁碟繫結方式: UDEV
原 UDEV 繫結磁碟資訊:
select name,path,state from v$asm_disk;
NAME PATH STATE
------------------------------------------------------------------------
DATA2_0000 /dev/asmdisk1 NORMAL
DATA_0001 /dev/asmdisk3 NORMAL
DATA_0000 /dev/asmdisk4 NORMAL
DATA2_0001 /dev/asmdisk2 NORMAL
DATA_0002 /dev/asmdisk5 NORMAL
sdb sdc sdd 為測試新增的磁碟:
Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 sectors
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Disk /dev/sdf: 85.9 GB, 85899345920 bytes, 167772160 sectors
Disk /dev/sdh: 21.5 GB, 21474836480 bytes, 41943040 sectors
Disk /dev/sdd: 10.7 GB, 10737418240 bytes, 20971520 sectors
Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Disk /dev/sdg: 21.5 GB, 21474836480 bytes, 41943040 sectors
Disk /dev/sde: 85.9 GB, 85899345920 bytes, 167772160 sectors
Disk /dev/sdi: 21.5 GB, 21474836480 bytes, 41943040 sectors
ASMFD
檢視ASMFD是否安裝
[root@rac1 ~]# su – grid
[grid@rac1 ~]$ asmcmd afd_state
ASMCMD-9530: The AFD state is 'NOT INSTALLED'
安裝ASMFD
一二節點均需安裝
1 使用 root 使用者關閉 CRS : crsctl stop crs
2 使用 root 使用者安裝 ASMFD :
[root@rac1 ~]# export ORACLE_BASE=/oracle/gridbase
[root@rac1 ~]# export ORACLE_HOME=/oracle/grid/crs_1
[root@rac1 ~]# /oracle/grid/crs_1/bin/asmcmd afd_configure
AFD-627: AFD distribution files found.
AFD-634: Removing previous AFD installation.
AFD-635: Previous AFD components successfully removed.
AFD-9294: updating file /etc/sysconfig/oracledrivers.conf
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.
檢查ASMFD的狀態
[root@rac1 ~]# /oracle/grid/crs_1/bin/asmcmd afd_state
ASMCMD-9526: The AFD state is 'LOADED' and filtering is 'ENABLED' on host 'rac1'
[grid@rac1 ~]$ crsctl status res -t -init
ora.driver.afd
1 ONLINE ONLINE rac1 STABLE
afd_label 標識磁碟
檢視afd_diskstring
[root@rac1 dev]# more /etc/oracleafd.conf
afd_diskstring='/dev/asm*'
使用udev繫結磁碟
vi 99-oracle-asmdevices.rules
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="0QEMU_QEMU_HARDDISK_drive-scsi8", RUN+="/bin/sh -c 'mknod /dev/asmfd1 b $major $minor; chown grid:oinstall /dev/asmfd1; chmod 0660 /dev/asmfd1'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="0QEMU_QEMU_HARDDISK_drive-scsi7", RUN+="/bin/sh -c 'mknod /dev/asmfd2 b $major $minor; chown grid:oinstall /dev/asmfd2; chmod 0660 /dev/asmfd2'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="0QEMU_QEMU_HARDDISK_drive-scsi6", RUN+="/bin/sh -c 'mknod /dev/asmfd3 b $major $minor; chown grid:oinstall /dev/asmfd3; chmod 0660 /dev/asmfd3'"
重啟udev
/sbin/udevadm trigger --type=devices --action=change
使用afd_label標識磁碟
[grid@rac1 ~]$ asmcmd afd_label ASMFD1 /dev/asmfd1
[grid@rac1 ~]$ asmcmd afd_label ASMFD2 /dev/asmfd2
[grid@rac1 ~]$ asmcmd afd_label ASMFD3 /dev/asmfd3
[grid@rac1 ~]$ asmcmd afd_lsdsk
------------------------------------------------------------------------
Label Filtering Path
=========================================================================
ASMFD1 ENABLED /dev/asmfd1
ASMFD2 ENABLED /dev/asmfd2
ASMFD3 ENABLED /dev/asmfd3
/etc/udev/rules.d/53-afd.rules
[root@rac1 rules.d]# more 53-afd.rules
#
# AFD devices
KERNEL=="oracleafd/.*", OWNER="grid", GROUP="asmadmin", MODE="0770"
KERNEL=="oracleafd/*", OWNER="grid", GROUP="asmadmin", MODE="0770"
KERNEL=="oracleafd/disks/*", OWNER="grid", GROUP="asmadmin", MODE="0660"
若標識錯誤,使用afd_unlabel 移除標識的磁碟
[grid@rac1 ~]$ asmcmd afd_unlabel ASMFD1
[grid@rac1 ~]$ asmcmd afd_unlabel ASMFD2
[grid@rac1 ~]$ asmcmd afd_unlabel ASMFD3
在另外的節點中,不再需要作 label ,而是直接 scan 即可。
[grid@rac1 ~]$ asmcmd afd_scan
[grid@rac1 ~]$ asmcmd afd_lsdsk
ASM 磁碟組
圖形化介面方式
修改 asm_diskstring
命令列方式
[grid@rac1 ~]$ sqlplus / as sysasm
show parameter string
NAME TYPE VALUE
------------------------------------ --------------------------
asm_diskstring string /dev/asm*, AFD:*
select name,path,state from v$asm_disk;
NAME PATH STATE
------------ ------------------ --------
/dev/asmfd2 NORMAL
AFD:ASMFD1 NORMAL
AFD:ASMFD2 NORMAL
/dev/asmfd1 NORMAL
/dev/asmfd3 NORMAL
AFD:ASMFD3 NORMAL
DATA2_0000 /dev/asmdisk1 NORMAL
DATA_0001 /dev/asmdisk3 NORMAL
DATA_0000 /dev/asmdisk4 NORMAL
DATA2_0001 /dev/asmdisk2 NORMAL
DATA_0002 /dev/asmdisk5 NORMAL
11 rows selected.
CREATE DISKGROUP DATA3 EXTERNAL REDUNDANCY DISK 'AFD:ASMFD1';
alter diskgroup DATA3 add disk 'AFD:ASMFD2';
alter diskgroup DATA3 add disk 'AFD:ASMFD3';
select name,path,state from v$asm_disk;
NAME PATH STATE
------------- ------------------ --------
/dev/asmfd2 NORMAL
/dev/asmfd1 NORMAL
/dev/asmfd3 NORMAL
DATA2_0000 /dev/asmdisk1 NORMAL
DATA_0001 /dev/asmdisk3 NORMAL
DATA_0000 /dev/asmdisk4 NORMAL
DATA2_0001 /dev/asmdisk2 NORMAL
DATA_0002 /dev/asmdisk5 NORMAL
ASMFD1 AFD:ASMFD1 NORMAL
ASMFD2 AFD:ASMFD2 NORMAL
ASMFD3 AFD:ASMFD3 NORMAL
Filter 功能
檢視 filter 功能是否啟用
[grid@rac1 ~]$ asmcmd afd_lsdsk
--------------------------------------------------------------------
Label Filtering Path
===================================================================
ASMFD1 ENABLED /dev/asmfd1
ASMFD2 ENABLED /dev/asmfd2
ASMFD3 ENABLED /dev/asmfd3
在啟用 Filter 功能下, dd 磁碟測試
[root@rac1 dev]# dd if=/dev/zero of=/dev/asmfd1
dd: writing to ‘/dev/asmfd1’: No space left on device
20971521+0 records in
20971520+0 records out
10737418240 bytes (11 GB) copied, 931.568 s, 11.5 MB/s
透過 strings 檢視 /dev/sdb ,可以發現,裡面的內容並沒有被清空
[root@rac1 dev]# strings /dev/asmfd1
ORCLDISKASMFD1
ASMFD1
DATA3
ASMFD1
ORCLDISKASMFD1
ASMFD1
DATA3
ASMFD1
……
解除安裝、掛載磁碟組測試
SQL> select NAME,STATE from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
DATA2 MOUNTED
DATA MOUNTED
DATA3 MOUNTED
SQL> alter diskgroup DATA3 dismount;
Diskgroup altered.
SQL> alter diskgroup DATA3 mount;
Diskgroup altered.
/var/log/messages 裡顯示的錯誤資訊
Mar 4 14:31:43 rac1 kernel: buffer_io_error: 17144 callbacks suppressed
Mar 4 14:31:43 rac1 kernel: Buffer I/O error on dev sdb, logical block 2560823, lost async page write
Mar 4 14:31:43 rac1 kernel: Buffer I/O error on dev sdb, logical block 2560824, lost async page write
Mar 4 14:31:43 rac1 kernel: Buffer I/O error on dev sdb, logical block 2560825, lost async page write
參考文件:
Grid Infrastructure Installation and Upgrade Guide for Linux
Automatic Storage Management Administrator's Guide
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23732248/viewspace-2887286/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【ASK_ORACLE】Oracle RAC配置ASM Filter Driver(ASMFD)(一)ASMFD簡介OracleASMFilter
- 【BUILD_ORACLE】Oracle RAC配置ASM Filter Driver(ASMFD)(二)詳細配置步驟UIOracleASMFilter
- 【BUILD_ORACLE】Oracle 19c RAC搭建(三)使用UDEV配置共享儲存UIOracledev
- Oracle儲存過程Oracle儲存過程
- Oracle 12C使用規範標準Oracle
- Oracle 資料庫安全許可權配置標準Oracle資料庫
- Oracle儲存過程-1Oracle儲存過程
- Oracle 共享儲存掛載Oracle
- oracle的儲存過程Oracle儲存過程
- Oracle儲存過程中定義多個遊標Oracle儲存過程
- 原創:oracle 儲存過程Oracle儲存過程
- 《儲存產業標準化白皮書(2022)》釋出產業
- [20190930]oracle number型別儲存轉化指令碼.txtOracle型別指令碼
- [20191003]oracle number型別儲存轉化指令碼.txtOracle型別指令碼
- [20191013]oracle number型別儲存轉化指令碼.txtOracle型別指令碼
- 基於oracle linux的 DBI/DBD 標準化安裝OracleLinux
- Sqlsugar呼叫Oracle的儲存過程SqlSugarOracle儲存過程
- LightDB/PostgreSQL 相容Oracle儲存過程SQLOracle儲存過程
- oracle儲存過程書寫格式Oracle儲存過程
- Oracle 12c新特性--ASMFD(ASM Filter Driver)特性OracleASMFilter
- ORACLE RAC的全自動 打補丁標準化文件Oracle
- Oracle優化案例-儲存過程的優化思路(二十三)Oracle優化儲存過程
- Oracle儲存過程乾貨(一):儲存過程基礎Oracle儲存過程
- Oracle 儲存過程分頁 + Sqlsugar呼叫Oracle儲存過程SqlSugar
- oracle儲存過程和觸發器Oracle儲存過程觸發器
- Oracle 標準大頁和透明大頁Oracle
- .NET Core中使用Dapper操作Oracle儲存過程最佳實踐APPOracle儲存過程
- Oracle OCP(42):ASM 儲存結構簡介OracleASM
- ibatis呼叫oracle儲存過程(極簡版)BATOracle儲存過程
- oracle RAC 更換儲存遷移資料Oracle
- 【NUMBER】Oracle資料庫最佳化之理解NUMBER儲存機制Oracle資料庫
- oracle使用儲存過程將表資料以excel格式匯出Oracle儲存過程Excel
- 使用JavaScript和Python實現Oracle資料庫的儲存過程?JavaScriptPythonOracle資料庫儲存過程
- 基於Linux的oracle 12cR2 RAC 標準化安裝(一)LinuxOracle
- 基於Linux的oracle 12cR2 RAC 標準化安裝(二)LinuxOracle
- 基於Linux的oracle 12cR2 RAC 標準化安裝(三)LinuxOracle
- 基於Linux的oracle 12cR2 RAC 標準化安裝(四)LinuxOracle
- 雲端儲存安全標準和最佳實踐