一、单实例ASM恢复时遇到报错
[oracle@adg2 bin]$ rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Tue Sep 20 15:38:31 2022
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: BP0 (not mounted)
RMAN> restore controlfile from '/nfs/bp0/crtl_BP0_t1115611790_s34452_p1_20220917';
Starting restore at 20-SEP-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=754 device type=DISK
channel ORA_DISK_1: restoring control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/20/2022 15:38:46
ORA-19870: error while restoring backup piece /nfs/bp0/crtl_BP0_t1115611790_s34452_p1_20220917
ORA-19504: failed to create file "+DATAC1/BP0STD/cntrlbp0.dbf"
ORA-17502: ksfdcre:3 Failed to create file +DATAC1/BP0STD/cntrlbp0.dbf
ORA-15001: diskgroup "DATAC1" does not exist or is not mounted
ORA-15040: diskgroup is incomplete
RMAN> exit
二、排查ASM服务情况,磁盘组Mount情况
1、
[grid@adg2 ~]$ crsctl check has
CRS-4638: Oracle High Availability Services is online
[grid@adg2 ~]$ crsctl check css
CRS-4529: Cluster Synchronization Services is online
[grid@adg2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRS.dg
ONLINE ONLINE adg2 STABLE
ora.DATAC1.dg
ONLINE ONLINE adg2 STABLE
ora.RECOC1.dg
ONLINE ONLINE adg2 STABLE
ora.asm
ONLINE ONLINE adg2 Started,STABLE
ora.ons
OFFLINE OFFLINE adg2 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE adg2 STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE adg2 STABLE
--------------------------------------------------------------------------------
[grid@adg2 ~]$
[grid@adg2 ~]$ srvctl status asm
ASM 正在 adg2 上运行
[grid@adg2 ~]$
[grid@adg2 ~]$ sqlplus / as sysasm
SQL*Plus: Release 12.1.0.2.0 Production on Mon Sep 19 14:59:47 2022
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Automatic Storage Management option
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
+ASM STARTED
SQL> exit
2、
[root@adg2 ~]# su - grid
上一次登录:一 9月 19 17:21:38 CST 2022pts/0 上
[grid@adg2 ~]$ sqlplus / as sysasm
SQL> select name,state,total_mb,free_mb from v$asm_diskgroup;
NAME STATE TOTAL_MB FREE_MB
------------------------------ ----------- ---------- ----------
DATAC1 MOUNTED 3814656 3813440
RECOC1 MOUNTED 1907328 1906112
CRS MOUNTED 1907349 1907255
SQL>
[grid@adg2 ~]$ asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 1907349 1907255 0 1907255 0 N CRS/
MOUNTED EXTERN N 512 4096 67108864 3814656 3813952 0 3813952 0 N DATAC1/
MOUNTED EXTERN N 512 4096 67108864 1907328 1906624 0 1906624 0 N RECOC1/
ASMCMD>
******服务没问题,磁盘组也mount了 *******如果没有mount,是DISMOUNTED,
SQL> conn / as sysasm
Connected.
SQL>alter diskgroup DATAC1 mount;
Diskgroup altered.
三、oracle,grid用户属性检查,单实例连接ASM, Oracle用户和grid用户必须有相同的组
[root@adg2 ~]# id oracle
uid=1001(oracle) gid=1001(oinstall) 组=1001(oinstall),1002(dba),1003(oper),1004(asmadmin),1005(asmdba),1006(asmoper)
[root@adg2 ~]# id grid
uid=1002(grid) gid=1001(oinstall) 组=1001(oinstall),1002(dba),1004(asmadmin),1005(asmdba),1006(asmoper)
[root@adg2 ~]#
四、oracle家目录bin/oracle 需要oracle:asmadmin,并且u和g,需要加s共享权限,
[root@adg2 ~]# ll /u01/app/oracle/product/12.2.0/db_1/bin/oracle
-rwxr-x--x 1 oracle oinstall 323613240 9月 16 10:55 /u01/app/oracle/product/12.2.0/db_1/bin/oracle
[root@adg2 ~]# chown oracle:asmadmin /u01/app/oracle/product/12.2.0/db_1/bin/oracle
[oracle@adg2 bin]$ ls -lrt oracle
-rwxr-x--x 1 oracle asmadmin 323613240 9月 16 10:55 oracle
[oracle@adg2 bin]$ chmod u+s oracle
[oracle@adg2 bin]$ chmod g+s oracle
[oracle@adg2 bin]$ ll oracle
-rwsr-s--x 1 oracle asmadmin 323613240 9月 16 10:55 oracle
五、再次报错ORA-27303
[oracle@adg2 bin]$ rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Tue Sep 20 15:34:12 2022
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-27140: attach to post/wait facility failed
ORA-27300: OS system dependent operation:invalid_egid failed with status: 1
ORA-27301: OS failure message: Operation not permitted
ORA-27302: failure occurred at: skgpwinit6
ORA-27303: additional information: startup egid = 1001 (oinstall), current egid = 1004 (asmadmin)
六、这是有冲突,rman都进不去,必须把oracle执行程序的用户组改成错误的,关闭数据库
[oracle@adg2 bin]$ chmod u-s oracle
[oracle@adg2 bin]$ chmod g-s oracle
[oracle@adg2 bin]$ chmod o-s oracle
[oracle@adg2 bin]$ ls -lrt oracle
-rwxr-x--x 1 oracle asmadmin 323613240 9月 16 10:55 oracle
[oracle@adg2 ~]$ export ORACLE_SID=BP01
[oracle@adg2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Tue Sep 20 15:53:53 2022
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> exit
七、修改成正确的用户组和权限(共享权限必须有)
[oracle@adg2 bin]$ chmod u+s oracle
[oracle@adg2 bin]$ chmod g+s oracle
[oracle@adg2 bin]$ ll oracle
-rwsr-s--x 1 oracle asmadmin 323613240 9月 16 10:55 oracle
[oracle@adg2 bin]$
[oracle@adg2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Tue Sep 20 16:03:25 2022
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1.8321E+10 bytes
Fixed Size 3719832 bytes
Variable Size 9193917800 bytes
Database Buffers 9059696640 bytes
Redo Buffers 63385600 bytes
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
八、问题解决
[oracle@adg2 dbs]$ rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Tue Sep 20 16:04:20 2022
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: BP0 (not mounted)
RMAN> restore controlfile from '/nfs/bp0/crtl_BP0_t1115611790_s34452_p1_20220917';
Starting restore at 20-SEP-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1004 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
output file name=+DATAC1/BP0STD/cntrlbp0.dbf
output file name=+RECOC1/BP0STD/cntrlbp0.dbf
Finished restore at 20-SEP-22
RMAN>




