Oracle 12c Clusterware讓ACFS 檔案系統在主機重啟後自動Mount的兩種方法

dbhelper發表於2014-12-03

方法一:acfsutil registry

用於general purpose ACFS filesystems,與其他Resource沒有關聯關係,使用此方法註冊後在registry 裡有一份該FS的資訊,同時在clustware資源組裡也能看到該FS的資訊

 

方法二:srvctl add filesystem

用於在11g裡被稱為CRS-Managed ACFS filesystemsACFS檔案系統,和其它資源存在依賴關係,比如基於ACFSDatabase Home,使用此方法註冊後僅在clustware資源組裡能看到該FS的資訊,acfsutil registry輸出是空的,若此時再想透過acfsutil registry -a來註冊這個FS的資訊,會得到ACFS-03131: volume /dev/asm/acfsvol11-418 already exists in the Oracle Registry as。。。錯誤,可見acfsutil registryclustware裡的ACFS資訊是共享的,互相間不能重複的。

 

環境準備:

create diskgroup acfsdg1 external redundancy disk '/dev/raw/raw1' size 1024m attribute 'compatible.rdbms'='12.1.0.0.0','compatible.asm'='12.1.0.0.0','compatible.advm'='12.1.0.0.0';

 

alter diskgroup acfsdg1 add volume acfsvol11 size 400m;

 

mkfs -t acfs -v /dev/asm/acfsvol11-418 400M;    --gridroot執行

 

 

?  Acfsutil registry的使用:

--準備工作中建好ADVM後可以看到clusterware Resource中已經有了Advm

root@ora12c1:/>crsctl status res -t

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

Name           Target  State        Server                   State details      

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

Local Resources

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

ora.ACFSDG1.ACFSVOL11.advm

               ONLINE  ONLINE       ora12c1                  Volume device /dev/a

                                                             sm/acfsvol11-418 is

                                                             online,STABLE

               ONLINE  ONLINE       ora12c2                  Volume device /dev/a

                                                             sm/acfsvol11-418 is

                                                             online,STABLE

 

-- 使用者執行acfsutil registry註冊ACFSOCR,看到/acfs1已經在兩個節點自動mount

root@ora12c1:/>acfsutil registry -a /dev/asm/acfsvol11-418 /acfs1      –Root使用者執行

acfsutil registry: mount point /acfs1 successfully added to Oracle Registry

 

root@ora12c1:/>df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda2             7.9G  5.5G  2.1G  73% /

tmpfs                 1.9G  1.3G  671M  66% /dev/shm

/dev/sda1             248M   50M  186M  21% /boot

/dev/sda5             504M   23M  456M   5% /tmp

/dev/mapper/homevg-home_lv

                      2.7G   36M  2.6G   2% /home

/dev/mapper/oraclevg-oracle_lv

                       32G   28G  2.6G  92% /oracle12c

ORA12c                585G  325G  261G  56% /media/sf_ORA12c

/dev/asm/acfsvol11-418

                      416M   78M  339M  19% / 

 

root@ora12c2:/>df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda2             7.9G  5.5G  2.1G  73% /

tmpfs                 1.9G  1.3G  673M  65% /dev/shm

/dev/sda1             248M   50M  186M  21% /boot

/dev/sda5             504M   23M  456M   5% /tmp

/dev/mapper/homevg-home_lv

                      2.7G  744M  1.9G  29% /home

/dev/mapper/oraclevg-oracle_lv

                       32G   12G   18G  40% /oracle12c

ORA12c                585G  325G  261G  56% /media/sf_ORA12c

/dev/asm/acfsvol11-418

                      416M   78M  339M  19% /acfs1

 

--clusterware resource裡也加入了/acfs1

root@ora12c2:/>crsctl status res -t

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

Name           Target  State        Server                   State details      

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

Local Resources

ora.acfsdg1.acfsvol11.acfs

               ONLINE  ONLINE       ora12c1                  mounted on /acfs1,ST

                                                             ABLE

               ONLINE  ONLINE       ora12c2                  mounted on /acfs1,ST

                                                             ABLE

 

--檢視資源的AUTO_START屬性為Always

root@ora12c1:/oracle12c>crsctl status res ora.acfsdg1.acfsvol11.acfs -f | grep AUTO_START

AUTO_START=always

 

--acfsutil registry裡有了註冊的資訊

root@ora12c2:/>acfsutil registry

Mount Object:

  Device: /dev/asm/acfsvol11-418

  Mount Point: /acfs1

  Disk Group: ACFSDG1

  Volume: ACFSVOL11

  Options: none

  Nodes: all

 

--這兩個檢視應該是包含mounted acfs volumes的,但不知為何沒有記錄?

select * from v$asm_filesystem

select * from v$asm_acfsvolumes

 

--使用srvctl add filesystems嘗試將/acfs1加入clusterware資源,顯示資源已經加入

grid@ora12c1:/home/grid>srvctl add filesystem -device /dev/asm/acfsvol11-418 -path /acfs1

PRCA-1022 : ACFS file system resource already exists for disk group acfsdg1 and volume acfsvol11

 

--,同時刪除/acfs1註冊資訊 

acfsutil registry -d /acfs1  --root執行

 

--註冊資訊已無法查詢到,兩節點上/acfs1也已被Umount

root@ora12c1:/>acfsutil registry

 

結果為空

 

root@ora12c1:/>df -k

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda2              8256952   5686276   2151248  73% /

tmpfs                  1962100   1275388    686712  66% /dev/shm

/dev/sda1               253871     50455    190309  21% /boot

/dev/sda5               516040     23328    466500   5% /tmp

/dev/mapper/homevg-home_lv

                       2830288     36712   2650040   2% /home

/dev/mapper/oraclevg-oracle_lv

                      33011568  28720344   2614324  92% /oracle12c

ORA12c               613414908 340800332 272614576  56% /media/sf_ORA12c

 

root@ora12c2:/>df -k

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda2              8256952   5686468   2151056  73% /

tmpfs                  1962100   1273868    688232  65% /dev/shm

/dev/sda1               253871     50456    190308  21% /boot

/dev/sda5               516040     23300    466528   5% /tmp

/dev/mapper/homevg-home_lv

                       2830288    761588   1925164  29% /home

/dev/mapper/oraclevg-oracle_lv

                      33011568  12515524  18819144  40% /oracle12c

ORA12c               613414908 340800332 272614576  56% /media/sf_ORA12c

 

--clustware中也已經沒有了ora.acfsdg1.acfsvol11.acfs資源資訊

root@ora12c2:/>crsctl status res –t

?  Srvctl add filesystem的使用:

--加入/acfs3資源到clustware resource

root@ora12c2:/>  filesystem -device /dev/asm/acfsvol11-418 -path  

--檢視ora.acfsdg1.acfsvol11.acfs資源已經建立但狀態為Offline

root@ora12c2:/>crsctl status res –t

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

Name           Target  State        Server                   State details      

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

Local Resources

ora.acfsdg1.acfsvol11.acfs

               OFFLINE OFFLINE      ora12c1                  STABLE

               OFFLINE OFFLINE      ora12c2                  STABLE

 

--啟動資源

srvctl start filesystem -device /dev/asm/acfsvol11-418

 

--檢視ora.acfsdg1.acfsvol11.acfs資源已經Mount,檢查/acfs3已經在兩節點Mount

root@ora12c2:/>crsctl status res –t

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

Name           Target  State        Server                   State details      

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

Local Resources

ora.acfsdg1.acfsvol11.acfs

               ONLINE  ONLINE       ora12c1                  mounted on /acfs3,ST

                                                             ABLE

               ONLINE  ONLINE       ora12c2                  mounted on /acfs3,ST

                                                             ABLE

 

root@ora12c2:/>df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda2              8256952   5686504   2151020  73% /

tmpfs                  1962100   1273924    688176  65% /dev/shm

/dev/sda1               253871     50456    190308  21% /boot

/dev/sda5               516040     23304    466524   5% /tmp

/dev/mapper/homevg-home_lv

                       2830288    761588   1925164  29% /home

/dev/mapper/oraclevg-oracle_lv

                      33011568  12516692  18817976  40% /oracle12c

ORA12c               613414908 340815776 272599132  56% /media/sf_ORA12c

/dev/asm/acfsvol11-418

                        425984     79136    346848  19% /acfs3

 

root@ora12c1:/>df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda2              8256952   5686296   2151228  73% /

tmpfs                  1962100   1274368    687732  65% /dev/shm

/dev/sda1               253871     50455    190309  21% /boot

/dev/sda5               516040     23328    466500   5% /tmp

/dev/mapper/homevg-home_lv

                       2830288     36712   2650040   2% /home

/dev/mapper/oraclevg-oracle_lv

                      33011568  28736400   2598268  92% /oracle12c

ORA12c               613414908 340815840 272599068  56% /media/sf_ORA12c

/dev/asm/acfsvol11-418

                        425984     79136    346848  19% /acfs3

 

--檢視資源的AUTO_START屬性為 

root@ora12c1:/oracle12c>crsctl status res ora.acfsdg1.acfsvol11.acfs -f | grep AUTO_START

AUTO_START=restore

 

--檢視registry 

root@ora12c1:/>acfsutil registry

結果為空

 


 此處若加-u USER代表名為USER的使用者可以使用srvctl start/stop filesystemmount/umount這個FS;若使用acfsutil registry –d命令也可以起到將FS umount的效果但是會受到如下報錯:CRS-0245:  User doesn't have enough privilege to perform the operation

acfsutil registry: ACFS-03145: unable to remove ACFS volume /dev/asm/acfsvol11-418 from Oracle Registry;和srvctl不同的是使用acfsutil registry –a是不能夠將FS mount的,因為acfstuil registry –a需要先註冊,再Mount,註冊的動作只有root能做

 /acfs1目錄不必預先用mkdir建立,註冊完後會自動建

 也可以使用12兩條命令代替,效果一樣:

1、  srvctl stop filesystem -device /dev/asm/acfsvol11-418

2、  srvctl remove filesystem -device /dev/asm/acfsvol11-418

 此處若加-u USER的起到的作用同 Acfsutil registry章節

 

 /acfs3目錄會自動建立

 注意若用acfstutil registry -a註冊後,此處屬性值是Always

 為空的原因是使用srvctl add fileystem/acfs3成為了crs-managed acfs filesystem,所以其啟動和停止要視資源之間的依賴關係而定。加到registry裡意味著每次機器啟動後都要啟動。所以registry是空的

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8494287/viewspace-1354984/,如需轉載,請註明出處,否則將追究法律責任。

相關文章