溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Oracle Study之--ASM文件系統(tǒng)ACFS管理

發(fā)布時(shí)間:2020-08-03 21:58:28 來(lái)源:網(wǎng)絡(luò) 閱讀:3179 作者:客居天涯 欄目:關(guān)系型數(shù)據(jù)庫(kù)

Oracle Study之--ASM文件系統(tǒng)ACFS管理

系統(tǒng)環(huán)境:

      操作系統(tǒng): RedHat EL5.5

      Cluster:   Oracle Grid 11.2.0.1.0

      Oracle:     Oracle 11g  11.2.0.1.0

在Oracle Database 11gR2中,以ASM技術(shù)為基礎(chǔ),Oracle推出了強(qiáng)勁的ACFS文件系統(tǒng),進(jìn)一步推進(jìn)了自動(dòng)存儲(chǔ)管理技術(shù)。

在Oracle 11gR2中,ASM技術(shù)仍舊著眼于支持?jǐn)?shù)據(jù)庫(kù)運(yùn)行和備份的核心文件等,包括數(shù)據(jù)文件、控制文件、歸檔日志、spfile、RMAN備份文件、Change Tracking文件、數(shù)據(jù)泵Dump文件以及OCR文件等;而ACFS和Oracle ADVM(ASM Dynamic Volume Manager)則進(jìn)一步延展了ASM的支持范圍,可以存儲(chǔ)Oracle軟件、告警日志、跟蹤文件、BFILEs大對(duì)象,還有影像、圖片以及其他應(yīng)用的普通文件。

在ASMCA中,可以通過(guò)ASM集群文件系統(tǒng)(ASM Cluster File Systems)選項(xiàng)頁(yè)來(lái)查看ACFS相關(guān)設(shè)置,"ASM集群文件系統(tǒng)(ACFS)可用于存儲(chǔ)文件,如可執(zhí)行文件、Oracle診斷文件、應(yīng)用程序配置文件等。要使用ACFS,必須先創(chuàng)建ASM卷"。

ASM卷的創(chuàng)建方式有兩種,一種是ASMCA工具,一種是通過(guò)命令行;

一、ASMCA創(chuàng)建acfs

1、首先創(chuàng)建asm diskgroup(asm diskgroup如果使用asmca創(chuàng)建,默認(rèn)compatible為“11.2”,如果使用sqlplus命令,默認(rèn)compatible為“11.1”,要更新到“11.2”)

SQL> create diskgroup dg2
  2  external redundancy
  3  disk 'ORCL:ASM_EXT1' attribute 'compatible.asm'='11.2';
Diskgroup created.
SQL> create diskgroup dg3
  2  external redundancy
  3  disk 'ORCL:ASM_EXT2';
Diskgroup created.
SQL> alter diskgroup dg3 set attribute 'compatible.asm'='11.2';     //更新compatible到“11.2”
Diskgroup altered.

查看磁盤組信息:

SQL> select name,state,COMPATIBILITY from v$asm_diskgroup
NAME                           STATE       COMPATIBILITY
------------------------------ ----------- ------------------------------------------------------------
DG1                            MOUNTED     11.2.0.0.0
OCR_VOTE                       MOUNTED     11.2.0.0.0
RCY1                           MOUNTED     11.2.0.0.0
DG2                            MOUNTED     11.2.0.0.0
DG3                            MOUNTED     11.2.0.0.0

2、通過(guò)asmca創(chuàng)建acfs

1、查看asm istance狀態(tài)

Oracle Study之--ASM文件系統(tǒng)ACFS管理

2、查看asm下的asm diskgroup狀態(tài)

Oracle Study之--ASM文件系統(tǒng)ACFS管理

3、選擇可用的asm diskgroup 建立asm volume

Oracle Study之--ASM文件系統(tǒng)ACFS管理

4、查看以建立的asm volume

Oracle Study之--ASM文件系統(tǒng)ACFS管理

2、建立acfs文件系統(tǒng),并選擇默認(rèn)掛載點(diǎn)

Oracle Study之--ASM文件系統(tǒng)ACFS管理

ACFS創(chuàng)建完成,在系統(tǒng)下查看:

Oracle Study之--ASM文件系統(tǒng)ACFS管理

因?yàn)锳CFS文件系統(tǒng)為共享的,所有會(huì)自動(dòng)在所有RAC node被mount。

在文件系統(tǒng)下存儲(chǔ)文件測(cè)試:
[grid@zcx2 ~]$ echo "hello,world" >/u01/app/oracle/acfsmounts/dg2_asm_vol1/1.txt
[grid@zcx2 ~]$ ls -l /u01/app/oracle/acfsmounts/dg2_asm_vol1
total 68
-rw-r--r-- 1 grid oinstall    12 Sep 30 15:07 1.txt
drwx------ 2 root root     65536 Sep 30 15:04 lost+found


二、通過(guò)acfsutil命令創(chuàng)建acfs


1、創(chuàng)建掛載點(diǎn)

[root@zcx2 ~]# mkdir /u02
[root@zcx2 ~]# su - grid

2、通過(guò)asmca創(chuàng)建asm volume
[grid@zcx2 ~]$ asmcmd
ASMCMD> volcreate -G dg3 -s 1g asm_vol2


ASMCMD> volinfo -G dg3 asm_vol2
Diskgroup Name: DG3
         Volume Name: ASM_VOL2
         Volume Device: /dev/asm/asm_vol2-129
         State: ENABLED
         Size (MB): 1024
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: 
         Mountpath: 

3、查看asm卷屬性
[root@node3 ~]# ls -l /dev/asm/asm_vol2-129 
brwxrwx--- 1 root asmadmin 252, 66049 Sep 30 15:10 /dev/asm/asm_vol2-129


 SQL> select GROUP_NUMBER ,VOLUME_NAME  ,state from v$asm_volume;

GROUP_NUMBER VOLUME_NAME                    STATE
------------ ------------------------------ --------
           4 ASM_VOL1                       ENABLED
           5 ASM_VOL2                       ENABLED
  

4、格式化asm volume建立acfs         
 [root@zcx2 ~]# mkfs.acfs /dev/asm/asm_vol2-129 
mkfs.acfs: version                   = 11.2.0.1.0.0
mkfs.acfs: on-disk version           = 39.0
mkfs.acfs: volume                    = /dev/asm/asm_vol2-129
mkfs.acfs: volume size               = 1073741824
mkfs.acfs: Format complete.

5、注冊(cè)acfs

[root@zcx2 ~]#acfsutil registry -a /dev/asm/asm_vol2-129 


6、建立acfs的掛載
[root@zcx2 ~]# mount -t acfs /dev/asm/asm_vol2-129  /u02      

7、查看掛載信息

[root@zcx2 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/asm/asm_vol1-211
                      2.0G  173M  1.9G   9% /u01/app/oracle/acfsmounts/dg2_asm_vol1
/dev/asm/asm_vol2-129
                      1.0G   39M  986M   4% /u02


通過(guò)asmca查看acfs:

Oracle Study之--ASM文件系統(tǒng)ACFS管理


8、測(cè)試acfs應(yīng)用                                          
[root@node3 ~]# su - grid
[grid@node3 ~]$ cd /u02
[grid@node3 u02]$ touch g.txt
touch: cannot touch `g.txt': Permission denied
[grid@node3 u02]$ su -
Password: 
su: incorrect password
[grid@node3 u02]$ su -
Password: 
[root@node3 ~]# ls -ld /u02
drwxr-xr-x 4 root root 4096 Sep 30 15:20 /u02
[root@node3 ~]# chown oracle:oinstall /u02
[root@node3 ~]# ls -ld /u02
drwxr-xr-x 4 oracle oinstall 4096 Sep 30 15:20 /u02
[root@node3 ~]# chmod 775 /u02
[root@node3 ~]# su - grid
[grid@node3 ~]$ cd /u02
[grid@node3 u02]$ touch g.txt
[grid@node3 u02]$ su - oracle
Password: 
[oracle@node3 ~]$ touch /u02/o.txt
[oracle@node3 ~]$ ls -l /u02
total 64
-rw-r--r-- 1 grid   oinstall     0 Sep 30 15:21 g.txt
drwx------ 2 root   root     65536 Sep 30 15:20 lost+found
-rw-r--r-- 1 oracle oinstall     0 Sep 30 15:21 o.txt

三、刪除ACFS系統(tǒng)

                
可以使用acfsutil工具刪除acfs:

[root@zcx2 ~]# acfsutil

Usage: acfsutil [-h] command ...   # (Version 11.2.0.1.0.0)

             -h - help
 Command Subcmd Arguments
-------- ------ ----------------------------------------------------------------
    help                                 - display this message
 version                                 - display ACFS version information
    info fs                              - Display all ACFS file systems
    info fs     [<path> ...]             - Display specific ACFS file sys
    info fs     -o <item> <path>         - Display specific file sys item:
    info fs     -o                           freespace,    totalspace,
    info fs     -o                           mountpoints,  volumes,
    info fs     -o                           available,    ismountpoint,
    info fs     -o                           isavailable,  iscorrupt,
    info fs     -o                           isadvm,       diskgroup,
    info fs     -o                           redundancy,   resizeincrement,
    info fs     -o                           stripewidth,  stripecolumns,
    info fs     -o                           primaryvolume
    info file   <path> [<path> ...]      - Display specific file info
    info id     <file-identifier> <mountpoint> - 
    info id           Display the pathname associated with the given  
    info id           ACFS file identifier and mountpoint.
    rmfs        <device>                 - Remove unmounted ACFS file sys
    size        [-|+]nnn[K|M|G|T|P] [-d <device>] <path> - Resize file system
registry        [-l]                     - Display registry contents
registry        -l <mountpoint>          - Display a specific mount point
registry        -l <device>              - Display a specific device
registry        -m <device>              - Display a specific mount point associated with a device
registry        -a [-f] [-o <opts>] [-n <nodes>] <device> <mountpoint> - Add a mount point
registry        -d [<mountpoint> | <device>] - Delete a mount point or a device
    tune        AcfsMaxOpenFiles         - Maximum number of open files
    tune                                   (Windows only)
    snap create <snap_name> <mountpoint> - create a file system snapshot
    snap delete <snap_name> <mountpoint> - delete a file system snapshot
 
 1、卸載文件系統(tǒng)
 [root@node3 ~]# umount /u02
[root@node3 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/asm/asm_vol1-211
                      2.0G  173M  1.9G   9% /u01/app/oracle/acfsmounts/dg2_asm_vol1


2、撤銷對(duì)acfs系統(tǒng)的注冊(cè)
 [root@node3 ~]# acfsutil registry -d /u02


3、刪除acfs系統(tǒng)
[root@node3 ~]# acfsutil rmfs /dev/asm/asm_vol2-129 
 

4、查看asm volume信息 
   ASMCMD> volinfo -G dg3  asm_vol2
Diskgroup Name: DG3
         Volume Name: ASM_VOL2
         Volume Device: /dev/asm/asm_vol2-129
         State: ENABLED
         Size (MB): 1024
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: 
         Mountpath: 
 

5、禁用asm volume       
 ASMCMD> voldisable -G dg3 asm_vol2
ASMCMD> volinfo -G dg3  asm_vol2
Diskgroup Name: DG3
         Volume Name: ASM_VOL2
         Volume Device: /dev/asm/asm_vol2-129
         State: DISABLED
         Size (MB): 1024
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: 
         Mountpath: 

6、刪除asm volume
ASMCMD> voldelete -G dg3 asm_vol2
ASMCMD> volinfo -G dg3  asm_vol2
volume asm_vol2 not found in diskgroup dg3


用ASCMCA查看:

Oracle Study之--ASM文件系統(tǒng)ACFS管理


----至此,ACFS系統(tǒng)被徹底刪除


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI