1. 程式人生 > 程式設計 >Java元註解meta-annotation和依賴注入詳解

Java元註解meta-annotation和依賴注入詳解

Oracle rac asm 擴容

轉載自 這貨不是DBA:

Oracle rac asm 擴容-使用udev方式繫結multipath多路徑裝置

 

環境介紹:
故事發生在Oracle 11.2.0.4 RAC/ Linux 6.8 的資料庫叢集伺服器上。
DATA/ ARCH/ 磁碟組空間不足,進行擴容。

首先,如果要線上使用udev方式擴容asm,建議先備份兩個節點所有在用網絡卡資訊,避免bug誤刪除網絡卡資訊。備份至/tmp目錄下。(包括the ifcfg-eth0 (public), ifcfg-eth1 (private) and ifcfg-eth2 (backup)),注意11.2.0.3及以後在linux上的bug,見如下官網解釋:
Network interface going down when dynamically adding disks to storage using udev in RHEL 6 (文件 ID 1569028.1)
Applies to: 
Oracle Database - Enterprise Edition - Version 11.2.0.3 and later
Oracle Net Services - Version 11.2.0.4 to 11.2.0.4 [Release 11.2]
Linux x86-64
Symptoms
Dynamically added new disks to storage using udev rules(as per the docs note 414897.1, 1528148.1, 371814.1 etc).

During start_udev, udev has deleted the public network interface and this caused the listener to crash, and clusterware moved all services, scan listeners and the VIP on node 1 to node 2.

Changes
Trying to add disk to storage using udev
Cause
udev has deleted the public network interface.

Solution
As per RHEL you are advised to set HOTPLUG="no" for the network configuration scripts.

Add HOTPLUG="no" to the ifcfg-eth0 (public), ifcfg-eth1 (private) and ifcfg-eth2 (backup) network config files in /etc/sysconfig/network-scripts directory.

 

建議先做資料庫備份

1.停止資料庫及叢集服務

su - grid
srvctl stop listener
srvctl stop  database -d jyrac

rac1/rac2
su - root
/u01/11.2.0/grid/bin/crsctl stop crs

####################### rac1/rac2 begin ##############################

2.網絡卡資訊修改

注意:如果是使用網絡卡繫結,比如繫結後的網絡卡為bond0,則要在bond0的配置檔案裡新增hotplug配置資訊,在eth0裡新增不起作用。(實戰中所有在用網絡卡均新增)

備份所有網絡卡資訊至/tmp 目錄

rac1/rac2
cp ifcfg-eth0 /tmp/ifcfg-eth0bak
cp ifcfg-bond0 /tmp/ifcfg-bond0bak
cp ifcfg-eth1 /tmp/ifcfg-eth1bak
...

實際:
[root@jyrac1 network-scripts]# cp * /tmp/wkbak
[root@jyrac1 network-scripts]# 
[root@jyrac2 network-scripts]# cp * /tmp/wkbak/
[root@jyrac2 network-scripts]# 

修改網絡卡資訊

HOTPLUG="no"

重啟網路服務

service network restart
[root@jyrac1 network-scripts]# service network restart
Shutting down interface bond0:                             [  OK  ]
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface bond0:  Determining if ip address 192.168.20.11 is already in use for device bond0...
                                                           [  OK  ]
Bringing up interface eth0:  Determining if ip address 187.187.2.61 is already in use for device eth0...
                                                           [  OK  ]
[root@jyrac1 network-scripts]#

[root@jyrac2 network-scripts]# service network restart
Shutting down interface bond0:                             [  OK  ]
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface bond0:  Determining if ip address 192.168.20.12 is already in use for device bond0...
                                                           [  OK  ]
Bringing up interface eth0:  Determining if ip address 187.187.2.62 is already in use for device eth0...
                                                           [  OK  ]
[root@jyrac2 network-scripts]#

3.修改udev許可權檔案

備份udev檔案至/tmp 目錄

[root@jyrac1 network-scripts]# cp /etc/udev/rules.d/12-dm-permissions.rules /tmp/wkbak/
vi /etc/udev/rules.d/12-dm-permissions.rules
增加:

ENV{DM_NAME}=="arch4", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
ENV{DM_NAME}=="data3", OWNER:="grid", GROUP:="asmadmin", MODE:="660"

4.載入配置檔案

[root@rac-db1 /]# /sbin/udevadm control reload-rules

5.新增udev磁碟

(生產庫千萬別重啟udev,否則vip會漂移,且網絡卡資訊可能會被刪除,甚至宕庫,重啟監聽可解決)

udevadm trigger --subsystem-match=block --action=add
[root@jyrac1 network-scripts]# udevadm control reload-rules
unrecognized command
udevadm[27284]: unrecognized command
[root@jyrac1 network-scripts]# 
[root@jyrac1 network-scripts]# 
[root@jyrac1 network-scripts]# 
[root@jyrac1 network-scripts]# /sbin/udevadm control reload-rules
unrecognized command
udevadm[27682]: unrecognized command
[root@jyrac1 network-scripts]# find / -name udevadm
/sbin/udevadm
^C
[root@jyrac1 network-scripts]# 
[root@jyrac1 network-scripts]# 
[root@jyrac1 network-scripts]# 
[root@jyrac1 network-scripts]# cd
[root@jyrac1 ~]# /sbin/udevadm control reload-rules
unrecognized command
udevadm[27987]: unrecognized command
[root@jyrac1 ~]# ls -la /sbin/udevadm 
-rwxr-xr-x. 1 root root 137256 Oct 17  2013 /sbin/udevadm
[root@jyrac1 ~]# /sbin/udevadm control reload-rules
unrecognized command
udevadm[28151]: unrecognized command
[root@jyrac1 ~]# /sbin/start_udev
Starting udev:                                             [  OK  ]
[root@jyrac1 ~]# 

6.檢查磁碟屬性

ll -l /dev/dm*

如果有問題,可以考慮重啟multipath 或者udev試試。

/sbin/start_udev
or
service multipathd restart

再次檢查屬性,確認沒問題之後考慮啟動叢集服務。

[root@jyrac1 ~]# ll -l /dev/dm*
brw-rw----. 1 root disk     253,  0 Apr 11 18:23 /dev/dm-0
brw-rw----. 1 root disk     253,  1 Apr 11 18:23 /dev/dm-1
brw-rw----. 1 grid asmadmin 253, 10 Apr 11 18:23 /dev/dm-10
brw-rw----. 1 root disk     253, 11 Apr 11 18:23 /dev/dm-11
brw-rw----. 1 root disk     253, 12 Apr 11 18:23 /dev/dm-12
brw-rw----. 1 grid asmadmin 253, 13 Apr 11 18:23 /dev/dm-13
brw-rw----. 1 grid asmadmin 253, 14 Apr 11 18:23 /dev/dm-14
brw-rw----. 1 root disk     253,  2 Apr 11 18:23 /dev/dm-2
brw-rw----. 1 grid asmadmin 253,  3 Apr 11 18:23 /dev/dm-3
brw-rw----. 1 grid asmadmin 253,  4 Apr 11 18:23 /dev/dm-4
brw-rw----. 1 grid asmadmin 253,  5 Apr 11 18:23 /dev/dm-5
brw-rw----. 1 grid asmadmin 253,  6 Apr 11 18:23 /dev/dm-6
brw-rw----. 1 grid asmadmin 253,  7 Apr 11 18:23 /dev/dm-7
brw-rw----. 1 grid asmadmin 253,  8 Apr 11 18:23 /dev/dm-8
brw-rw----. 1 grid asmadmin 253,  9 Apr 11 18:23 /dev/dm-9
[root@jyrac1 ~]# 

[root@jyrac2 ~]# ll -l /dev/dm*
brw-rw---- 1 root disk     253,  0 Apr 11 18:25 /dev/dm-0
brw-rw---- 1 root disk     253,  1 Apr 11 18:25 /dev/dm-1
brw-rw---- 1 grid asmadmin 253, 10 Apr 11 18:25 /dev/dm-10
brw-rw---- 1 root disk     253, 11 Apr 11 18:25 /dev/dm-11
brw-rw---- 1 root disk     253, 12 Apr 11 18:25 /dev/dm-12
brw-rw---- 1 grid asmadmin 253, 13 Apr 11 18:25 /dev/dm-13
brw-rw---- 1 grid asmadmin 253, 14 Apr 11 18:25 /dev/dm-14
brw-rw---- 1 root disk     253,  2 Apr 11 18:25 /dev/dm-2
brw-rw---- 1 grid asmadmin 253,  3 Apr 11 18:25 /dev/dm-3
brw-rw---- 1 grid asmadmin 253,  4 Apr 11 18:25 /dev/dm-4
brw-rw---- 1 grid asmadmin 253,  5 Apr 11 18:25 /dev/dm-5
brw-rw---- 1 grid asmadmin 253,  6 Apr 11 18:25 /dev/dm-6
brw-rw---- 1 grid asmadmin 253,  7 Apr 11 18:25 /dev/dm-7
brw-rw---- 1 grid asmadmin 253,  8 Apr 11 18:25 /dev/dm-8
brw-rw---- 1 grid asmadmin 253,  9 Apr 11 18:25 /dev/dm-9
[root@jyrac2 ~]# 

7.啟動crs叢集服務

rac1/rac2
su - root
/u01/11.2.0/grid/bin/crsctl start crs

######################## rac1/rac2 end############################

8.檢查crs服務

su - grid
crs_stat -t
crsctl stat res -t

9.啟動資料庫

srvctl start  database -d jyrac

10.檢查資料庫狀態

crsctl stat res -t

11.檢查asm是否識別到未新增的磁碟

set linesize 300
col name for a20
select group_number,name,state,type,total_mb,free_mb,usable_file_mb,allocation_unit_size/1024/1024 unit_mb from v$asm_diskgroup order by 1;

GROUP_NUMBER NAME                 STATE                  TYPE           TOTAL_MB    FREE_MB USABLE_FILE_MB    UNIT_MB
------------ -------------------- ---------------------- ------------ ---------- ---------- -------------- ----------
           1 ARCH                 MOUNTED                EXTERN           614400     120548         120548          1
           2 DATA                 MOUNTED                EXTERN           409600      83773          83773          1
           3 OCR                  MOUNTED                NORMAL            15360      14434           4657          1
set linesize 300
col path for a50
select group_number,name,path,mount_status,state,redundancy,total_mb,free_mb,failgroup,create_date from v$asm_disk order by 1,2;

GROUP_NUMBER NAME                 PATH                                               MOUNT_STATUS   STATE            REDUNDANCY       TOTAL_MB    FREE_MB FAILGROUP                                                CREATE_DATE
------------ -------------------- -------------------------------------------------- -------------- ---------------- -------------- ---------- ---------- ------------------------------------------------------------ -----------------------
           0                      /dev/mapper/arch4                                  CLOSED         NORMAL           UNKNOWN                 0          0
           0                      /dev/mapper/data3                                  CLOSED         NORMAL           UNKNOWN                 0          0
           1 ARCH_0000            /dev/mapper/arch1                                  CACHED         NORMAL           UNKNOWN            204800      40180 ARCH_0000                                                21-MAY-2015 11:00:32
           1 ARCH_0001            /dev/mapper/arch2                                  CACHED         NORMAL           UNKNOWN            204800      40183 ARCH_0001                                                21-MAY-2015 11:00:32
           1 ARCH_0002            /dev/mapper/arch3                                  CACHED         NORMAL           UNKNOWN            204800      40185 ARCH_0002                                                21-MAY-2015 11:00:32
           2 DATA_0000            /dev/mapper/data1                                  CACHED         NORMAL           UNKNOWN            204800      41879 DATA_0000                                                21-MAY-2015 10:59:33
           2 DATA_0001            /dev/mapper/data2                                  CACHED         NORMAL           UNKNOWN            204800      41894 DATA_0001                                                21-MAY-2015 10:59:33
           3 OCR_0000             /dev/mapper/crs1                                   CACHED         NORMAL           UNKNOWN              5120       4812 OCR_0000                                                 21-MAY-2015 10:16:24
           3 OCR_0001             /dev/mapper/crs2                                   CACHED         NORMAL           UNKNOWN              5120       4810 OCR_0001                                                 21-MAY-2015 10:16:24
           3 OCR_0002             /dev/mapper/crs3                                   CACHED         NORMAL           UNKNOWN              5120       4812 OCR_0002                                                 21-MAY-2015 10:16:24

10 rows selected.

12.ASM擴容


alter diskgroup DATA add disk '/dev/mapper/data3' rebalance power 8;

alter diskgroup ARCH add disk '/dev/mapper/arch4' rebalance power 8;

13.檢查進度

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERATION  STATE         POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE
------------ ---------- -------- ---------- ---------- ---------- ---------- ---------- ----------- ----------------------------------------------------------------------------------------
           1 REBAL      WAIT              8
           2 REBAL      RUN               8          8      33914     108615       5606          13

SQL> 
set linesize 300
col path for a50
select group_number,name,path,mount_status,state,redundancy,total_mb,free_mb,failgroup,create_date from v$asm_disk order by 1,2;

轉自

郵箱:[email protected]
暱稱:A這貨不是DBA