这篇文章主要介绍“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='
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磁盘组改名字的方法”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!