您好,登錄后才能下訂單哦!
這篇文章主要介紹“oracle磁盤組改名字的方法”,在日常操作中,相信很多人在oracle磁盤組改名字的方法問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”oracle磁盤組改名字的方法”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
oracle 磁盤組改名字
創建磁盤組的時候不小心把OCR磁盤組的名字起錯了,下面模擬如何給ocr磁盤組改名字
參考文檔 (文檔 ID 1335975.1)
測試環境
操作系統版本 redhat 6.4
數據庫版本 11203
現在OCR存放在vote磁盤組,現在將VOTE磁盤組名字修改為OCRDG磁盤組,操作時需要有一個磁盤組做中轉磁盤組可以是一塊次哦按外部冗余也可以
1.查看集群狀態
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ARC.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DATADG01.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DATADG02.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.LISTENER.lsnr
ONLINE OFFLINE rac1
ONLINE ONLINE rac2
ora.VOTE.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.asm
ONLINE ONLINE rac1 Started
ONLINE ONLINE rac2 Started
ora.gsd
OFFLINE OFFLINE rac1
OFFLINE OFFLINE rac2
ora.net1.network
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.ons
ONLINE ONLINE rac1
ONLINE ONLINE rac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2
ora.cvu
1 ONLINE ONLINE rac2
ora.oc4j
1 ONLINE ONLINE rac1
ora.orcl.db
1 ONLINE ONLINE rac1 Open
2 ONLINE ONLINE rac2 Open
ora.rac1.vip
1 ONLINE ONLINE rac1
ora.rac2.vip
1 ONLINE ONLINE rac2
ora.scan1.vip
1 ONLINE ONLINE rac2
2.查看ocr的備份,和手工備份,緊急情況下沒有ocr的備份也不要緊,
在$CRS_HOME的cdata目錄下有ocr的自動備份,默認每天和每周都會保存的,只要沒做過架構變更,都一直可用。
[root@rac1 cdata]# pwd
/oracle/app/grid/11.2.0/cdata
[root@rac1 cdata]# ls -lrt
總用量 2852
drwxr-xr-x 2 grid oinstall 4096 1月 17 2016 localhost
drwxr-xr-x 2 grid oinstall 4096 1月 17 2016 rac1
-rw------- 1 root oinstall 272756736 9月 5 07:36 rac1.olr
drwxrwxr-x 2 grid oinstall 4096 9月 5 07:37 rac-cluster
查看ocr磁盤組的未知和votingdisk的位置。
[root@rac1 cdata]# /oracle/app/grid/11.2.0/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2904
Available space (kbytes) : 259216
ID : 635069277
Device/File Name : +VOTE
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
[root@rac1 cdata]# /oracle/app/grid/11.2.0/bin/crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 956b16ceaff14f4ebf37414725a67350 (/dev/asm-diskb) [VOTE]
2. ONLINE adb3a38f36514f2bbfcaa798303df4a1 (/dev/asm-diskc) [VOTE]
3. ONLINE aa9bfeef2ddd4f01bf212f8e020cd040 (/dev/asm-diskd) [VOTE]
查看OCR備份的位置和情況
查看自動備份:
ocrconfig -showbackup auto
查看手工備份:
ocrconfig -showbackup manual
顯示的備份全是系統自動備份ocr的備份,最下面的PROT-25提示沒有手動的備份
[root@rac1 cdata]# /oracle/app/grid/11.2.0/bin/ocrconfig -showbackup
rac1 2019/09/05 07:37:35 /oracle/app/grid/11.2.0/cdata/rac-cluster/backup00.ocr
rac1 2019/09/05 03:37:34 /oracle/app/grid/11.2.0/cdata/rac-cluster/backup01.ocr
rac1 2019/09/04 16:44:33 /oracle/app/grid/11.2.0/cdata/rac-cluster/backup02.ocr
rac1 2019/09/04 16:44:33 /oracle/app/grid/11.2.0/cdata/rac-cluster/day.ocr
rac1 2019/09/04 16:44:33 /oracle/app/grid/11.2.0/cdata/rac-cluster/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
su - grid
sqlplus / as sysasm
SQL> set line 200 pages 999
SQL> col path for a40
SQL> col name for a40
SQL> select group_number,path,header_status,total_mb/1024 total_GB,free_mb/1024 free_GB,state from v$asm_disk order by 2;
GROUP_NUMBER PATH HEADER_STATU TOTAL_GB FREE_GB STATE
------------ ---------------------------------------- ------------ ---------- ---------- --------
1 /dev/asm-diskb MEMBER 1 .69921875 NORMAL
1 /dev/asm-diskc MEMBER 1 .69921875 NORMAL
1 /dev/asm-diskd MEMBER 1 .69921875 NORMAL
3 /dev/asm-diske MEMBER 5 2.4296875 NORMAL
4 /dev/asm-diskf MEMBER 5 4.90722656 NORMAL
2 /dev/asm-diskg MEMBER 5 4.23242188 NORMAL
3. 替換ocr,用ARC磁盤組作為臨時OCR磁盤組(ARC以前事歸檔的磁盤組只有1個盤外部冗余,大小5G) root執行
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/ocrconfig -add +ARC
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/ocrconfig -delete +VOTE
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/crsctl replace votedisk +ARC
Successful addition of voting disk a1133130973b4f80bfc9a6d917eee626.
Successful deletion of voting disk 6b91880919e64fe3bfc01701f29256d1.
Successful deletion of voting disk 2a0eef6d3ee64f10bfa2040621cef851.
Successful deletion of voting disk a063e70967dd4fdcbf3b32e675c3246a.
Successfully replaced voting disk group with +ARC.
CRS-4266: Voting file(s) successfully replaced
查看替換是否成功,和新的OCR的位置
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2892
Available space (kbytes) : 259228
ID : 1965781783
Device/File Name : +ARC
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE a1133130973b4f80bfc9a6d917eee626 (/dev/asm-diskg) [ARC]
4. 遷移ASM的spfile,從VOTE遷移到ARC diskgroup上
[root@rac1 cdata]# su - grid
[grid@rac1 ~]$ asmcmd
ASMCMD> spget
+VOTE/rac-cluster/asmparameterfile/registry.253.901344197
sqlplus /as sysasm
create pfile='/home/grid/initasm.ora' from spfile;
create spfile='+ARC' from pfile='/home/grid/initasm.ora';
$ORACLE_HOME/bin/gpnptool get
5.重啟2個節點的集群
# /oracle/app/grid/11.2.0/bin/crsctl stop crs
# /oracle/app/grid/11.2.0/bin/crsctl start crs
6.卸載原來的VOTE磁盤組,如果磁盤組沒有mount就直接跳過執行下一步
# su - grid
$ sqlplus / as sysasm
> alter diskgorup VOTE dismount;
7.重命名磁盤組
原命令[grid@test ~]$ renamedg phase=both dgname=DATA newdgname=CRS asm_diskstring='<disk string>' verbose=true
grid用戶執行命令
[grid@rac1 ~]$ renamedg phase=both dgname=VOTE newdgname=OCRDG asm_diskstring='/dev/asm*' verbose=true
NOTE: No asm libraries found in the system
Parsing parameters..
Parameters in effect:
Old DG name : VOTE
New DG name : OCRDG
Phases :
Phase 1
Phase 2
Discovery str : /dev/asm*
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=both dgname=VOTE newdgname=OCRDG asm_diskstring=/dev/asm* verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm-diskc with disk number:1 and timestamp (33088676 -1089116160)
Identified disk UFS:/dev/asm-diskb with disk number:0 and timestamp (33088676 -1089116160)
Identified disk UFS:/dev/asm-diskd with disk number:2 and timestamp (33088676 -1089116160)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm-diskc with disk number:1 and timestamp (33088676 -1089116160)
Identified disk UFS:/dev/asm-diskb with disk number:0 and timestamp (33088676 -1089116160)
Identified disk UFS:/dev/asm-diskd with disk number:2 and timestamp (33088676 -1089116160)
Checking if the diskgroup is mounted or used by CSS
Checking disk number:1
Checking disk number:0
Checking disk number:2
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/asm-diskc
Modifying the header
Looking for /dev/asm-diskb
Modifying the header
Looking for /dev/asm-diskd
Modifying the header
Completed phase 2
Terminating kgfd context 0x7f5dc77880a0
8.查詢磁盤信息
SQL> set line 1000
SQL> set pages 599
SQL> col path format a30
SQL> select name,path,group_number,header_status,total_mb,free_mb from v$asm_disk;
NAME PATH GROUP_NUMBER HEADER_STATU TOTAL_MB FREE_MB
------------------------------ ------------------------------ ------------ ------------ ---------- ----------
/dev/asm-diskc 0 MEMBER 0 0
/dev/asm-diskd 0 MEMBER 0 0
/dev/asm-diskb 0 MEMBER 0 0
DATADG01_0000 /dev/asm-diske 2 MEMBER 5120 2488
DATADG02_0000 /dev/asm-diskf 3 MEMBER 5120 5025
ARC_0000 /dev/asm-diskg 1 MEMBER 5120 4011
6 rows selected.
SQL> select name,state,usable_file_mb,total_mb,free_mb,required_mirror_free_mb from v$asm_diskgroup;
NAME STATE USABLE_FILE_MB TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB
------------------------------ ----------- -------------- ---------- ---------- -----------------------
ARC MOUNTED 4011 5120 4011 0
DATADG01 MOUNTED 2488 5120 2488 0
DATADG02 MOUNTED 5025 5120 5025 0
OCRDG DISMOUNTED 0 0 0 0
9.掛載新命名的OCRDG磁盤組
alter diskgorup OCRDG mount;
10 遷移OCR和vote file到新的磁盤CRS
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/ocrconfig -add +OCRDG
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/ocrconfig -delete +ARC
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/crsctl replace votedisk +OCRDG
Successful addition of voting disk a109d7db3f9b4f92bf31f0496ccce75e.
Successful addition of voting disk 7423098d541f4f77bfc41c7672180af9.
Successful addition of voting disk b0a02397b8604f18bfca5319d03f9116.
Successful deletion of voting disk a1133130973b4f80bfc9a6d917eee626.
Successfully replaced voting disk group with +OCRDG.
CRS-4266: Voting file(s) successfully replaced
11.修改SPFILE路徑
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ sqlplus / as sysasm
SQL> create spfile='+OCRDG' from pfile='/home/grid/initasm.ora';
File created.
12.重啟2個節點的集群
crsctl stop crs
crsctl start crs
13.如果需要刪除臨時的磁盤組,執行刪除命令
drop diskgroup xxxxxx including contents;
14.更新集群信息,因為原來集群中記錄的VOTE磁盤組名字改成了OCRDG,
[grid@rac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ARC.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DATADG01.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DATADG02.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.LISTENER.lsnr
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.OCRDG.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.VOTE.dg
OFFLINE OFFLINE rac1
OFFLINE OFFLINE rac2
[grid@rac1 ~]$ srvctl remove diskgroup -g VOTE
15.驗證集群信息,集群資源中沒有了VOTE磁盤組
[grid@rac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ARC.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DATADG01.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DATADG02.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.LISTENER.lsnr
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.OCRDG.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.asm
ONLINE ONLINE rac1 Started
ONLINE ONLINE rac2 Started
到此,關于“oracle磁盤組改名字的方法”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。