oracle19c有备份情况下恢复ocr 和 votedisk

oracle19c有备份情况下恢复ocr 和 votedisk

 

模拟ocr文件所在磁盘组异常(生产环境谨慎操作)

dd if=/dev/zero of=/dev/asmdisk_1 bs=4096 count=1

 

参考文档:

How to Restore ASM Based OCR After Complete Loss of the CRS Diskgroup on Linux/Unix Systems (Doc ID 1062983.1)

How to recreate shared ASM password file in 12c GI cluster (Doc ID 1929673.1)

 

  1. 检查ocr备份所在位置

注意:此处将asm中存储的备份文件拷贝到文件系统/home/grid/ocrbackup/backup00.ocr

  1. 停集群,再次启动报错

  1. 停集群

/u01/app/19c/19.3.0/grid/bin/crsctl start crs -f

  1. 以nocrs方式启动集群

[root@db3n1 ~]# /u01/app/19c/19.3.0/grid/bin/crsctl start crs -excl -nocrs

CRS-4123: Oracle High Availability Services has been started.

CRS-2672: Attempting to start 'ora.evmd' on 'db3n1'

CRS-2672: Attempting to start 'ora.mdnsd' on 'db3n1'

CRS-2676: Start of 'ora.evmd' on 'db3n1' succeeded

CRS-2676: Start of 'ora.mdnsd' on 'db3n1' succeeded

CRS-2672: Attempting to start 'ora.gpnpd' on 'db3n1'

CRS-2676: Start of 'ora.gpnpd' on 'db3n1' succeeded

CRS-2672: Attempting to start 'ora.cssdmonitor' on 'db3n1'

CRS-2672: Attempting to start 'ora.gipcd' on 'db3n1'

CRS-2676: Start of 'ora.cssdmonitor' on 'db3n1' succeeded

CRS-2676: Start of 'ora.gipcd' on 'db3n1' succeeded

CRS-2672: Attempting to start 'ora.cssd' on 'db3n1'

CRS-2672: Attempting to start 'ora.diskmon' on 'db3n1'

CRS-2676: Start of 'ora.diskmon' on 'db3n1' succeeded

CRS-2676: Start of 'ora.cssd' on 'db3n1' succeeded

CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'db3n1'

CRS-2672: Attempting to start 'ora.ctssd' on 'db3n1'

CRS-2676: Start of 'ora.ctssd' on 'db3n1' succeeded

CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'db3n1' succeeded

CRS-2672: Attempting to start 'ora.asm' on 'db3n1'

CRS-2676: Start of 'ora.asm' on 'db3n1' succeeded

  1. 创建ocr所在磁盘组,采用和原磁盘组相同名称相同磁盘设备,否则有可能造成用户数据丢失,其他磁盘组无法正常mount

[grid@db3n1 ~]$ sqlplus / as sysasm

 

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Mar 11 12:51:17 2020

Version 19.3.0.0.0

 

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

 

SQL> alter system set asm_diskstring='/dev/asmdisk_*' scope=memory;

 

SQL> create diskgroup CRSDG  external redundancy disk '/dev/asmdisk_1' attribute 'COMPATIBLE.ASM' = '12.1.0';

 

Diskgroup created.

  1. 恢复ocr文件并替换votedisk

[root@db3n1 ~]# /u01/app/19c/19.3.0/grid/bin/ocrconfig -restore /home/grid/ocrbackup/backup00.ocr

[root@db3n1 ~]# /u01/app/19c/19.3.0/grid/bin/crsctl replace votedisk +CRSDG

Successful addition of voting disk ee19c242f1794f74bf3ffc34985f13bd.

Successfully replaced voting disk group with +CRSDG.

CRS-4266: Voting file(s) successfully replaced

  1. 配置asm启动参数文件并创建spfile

[grid@db3n1 ~]$ cat asm.ora

instance_type='asm'

large_pool_size=12M

remote_login_passwordfile= "EXCLUSIVE"

asm_diskstring           = "/dev/asmdisk_*"

asm_power_limit          = 1

[grid@db3n1 ~]$ sqlplus / as sysasm

 

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Mar 11 13:01:23 2020

Version 19.3.0.0.0

 

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

 

SQL> create spfile='+CRSDG' from pfile='/home/grid/asm.ora';

 

File created.

 

  1. 停集群,重新启动

[root@db3n1 ~]# /u01/app/19c/19.3.0/grid/bin/crsctl stop crs -f

[root@db3n1 ~]# /u01/app/19c/19.3.0/grid/bin/crsctl start crs

  1. 重建asm密码文件

$ asmcmd lspwusr

Username sysdba sysoper sysasm

SYS TRUE TRUE TRUE

CRSUSER__ASM_001 TRUE FALSE TRUE

ASMSNMP TRUE FALSE FALSE

$ asmcmd pwget --asm

+CRSDG/orapwASM

 

ASMCMD> pwcopy +CRSDG/orapwASM /tmp/asm.pwd

copying +CRSDG/orapwASM -> /tmp/asm.pwd

 

ASMCMD> pwcreate --asm +CRSDG/orapwASM -f --fromat 12 'oracle123_EeBluk34' 

ASMCMD> pwget --asm

+CRSDG/orapwASM

ASMCMD> lspwusr

Username sysdba sysoper sysasm

SYS TRUE TRUE FALSE

ASMCMD> orapwusr --grant sysasm SYS

ASMCMD> orapwusr --add ASMSNMP

Enter password: *********<<<<<<<<<<<<<<<<<<<<<welcome@1

ASMCMD> orapwusr --grant sysdba ASMSNMP

ASMCMD> lspwusr

Username sysdba sysoper sysasm

SYS TRUE TRUE TRUE

ASMSNMP TRUE FALSE FALSE

 

 

$ $GRID_HOME/bin/ocrdump /tmp/ocr.dmp

PROT-310: Not all keys were dumped due to permissions.

$ vi /tmp/ocr.dmp

 

--Search for below

SYSTEM.ASM.CREDENTIALS.USERS.CRSUSER__ASM_001]

ORATEXT : 3889b62c95b64f9bffae7aa8eaa6001d:oracle<<<<<<<<<<<<<<<<<<<<<<This is our credential to retrieve the password

SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_NONE, USER_NAME : oracle, GROUP_NAME : oinstall}

 

$ crsctl get credmaint -path /ASM/Self/3889b62c95b64f9bffae7aa8eaa6001d -credtype userpass -id 0 -attr passwd -local

VWadlWRmYlAc9hfKGuVslNz4XANSl<<<<<<<<<This is the password

 

 

ASMCMD> orapwusr --add CRSUSER__ASM_001

Enter password: *****************************<<<<<<<<Password taken from Step 2

ASMCMD> lspwusr

Username sysdba sysoper sysasm

SYS TRUE TRUE TRUE

ASMSNMP TRUE FALSE FALSE

CRSUSER__ASM_001 FALSE FALSE FALSE

ASMCMD> orapwusr --grant sysdba CRSUSER__ASM_001

ASMCMD> orapwusr --grant sysasm CRSUSER__ASM_001

ASMCMD> lspwusr

Username sysdba sysoper sysasm

SYS TRUE TRUE TRUE

ASMSNMP TRUE FALSE FALSE

CRSUSER__ASM_001 TRUE FALSE TRUE

[oracle@<HOSTNAME> ~]$ srvctl config asm

ASM home: <CRS home>

Password file: +CRSDG/orapwASM

Backup of Password file:

ASM listener: LISTENER

ASM instance count: 3

Cluster ASM listener: ASMNET1LSNR_ASM

 

 

重建ASM密码文件,否则远程节点启动报错:

2020-03-11 13:09:49.441 : CLSCRED:2673800960: (:CLSCRED0101:)clsCredDomInitRootDom: Using user given storage context for repository access.

2020-03-11 13:09:49.492 : USRTHRD:2673800960: [     INFO] {0:5:3} [ora.storage] 9348 Error 4 querying length of attr ASM_DISCOVERY_ADDRESS

 

2020-03-11 13:09:49.498 : USRTHRD:2673800960: [     INFO] {0:5:3} [ora.storage] 9348 Error 4 querying length of attr ASM_STATIC_DISCOVERY_ADDRESS

 

2020-03-11 13:09:49.569 : CLSCRED:2673800960: (:CLSCRED1079:)clsCredOcrKeyExists: Obj dom : SYSTEM.credentials.domains.root.ASM.Self.00a30fc85974ff83ffbea0bd92dc49bb.root not found

  1. 查看集群状态,已恢复正常

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值