当前位置: 首页 > Linux, Oracle, oracle 10g, oracle 11g > 正文

ORA-27086 unable to lock file – already in use导致数据库无法restore控制文件

在恢复数据库的时候遇到ORA-27086 unable to lock file – already in use错误,控制文件无法restore。数据库版本11.2.0.4.0,操作系统版本CentOS 5.11。

RMAN> restore controlfile from '/data/ivldb/lv2_20150720/level_2_ivldb_controfile_1130_1.ctl';

Starting restore at 2015-07-20 13:43:18
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/20/2015 13:43:26
ORA-19870: error while restoring backup piece /data/ivldb/lv2_20150720/level_2_ivldb_controfile_1130_1.ctl
ORA-19504: failed to create file "/data/ivldb/uatdb/control02.ctl"
ORA-27086: unable to lock file - already in use
Linux-x86_64 Error: 37: No locks available
Additional information: 10

经查询,oracle用户对这块磁盘有读写权限,权限和目录都没有问题,那为什么会有这个问题呢?想了下,确定肯定是nfs挂载的磁盘出了问题,由于本地磁盘空间不足,SA通过nfs挂载的方式,挂了一块磁盘,数据库恢复是先恢复到这块共享磁盘上,然后在之前的数据库确定不需要的时候,删掉之前的数据库再讲数据文件拷贝到本地磁盘上。

[root@SL010A-IVOD01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              39G  4.3G   33G  12% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                  32G  3.9G   28G  13% /dev/shm
/dev/sda4             1.1T  969G   30G  98% /data
10.0.97.30:/data/nfs_share
                      1.8T  1.4T  449G  76% /data/ivldb

通过查看nfs挂载命令,发现没有指定nolock模式。

[root@SL010A-IVOD01 ~]# history | grep mount
  944  umount /data/ivldb/
  946  umount /data/ivldb/
  950  mount 10.0.97.30:/data/nfs_share /data/ivalue/

卸载掉这块磁盘,重新指定nolock模式挂载,先关闭数据库(当前是NOMOUNT状态)。

[oracle@SL010A-IVOD01 uatdb]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jul 20 13:46:38 2015

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown abort
ORACLE instance shut down.

卸载nfs磁盘,指定nolock挂载。

[root@SL010A-IVOD01 ~]# umount /dev/ivldb
[root@SL010A-IVOD01 ~]# mount -o nolock 10.0.97.30:/data/nfs_share /data/ivldb

启动数据库到NOMOUNT状态。

SQL> startup nomount
ORACLE instance started.

Total System Global Area 4275781632 bytes
Fixed Size                  2260088 bytes
Variable Size            2013266824 bytes
Database Buffers         2248146944 bytes
Redo Buffers               12107776 bytes

进行RMAN恢复控制文件,问题解决。

[oracle@SL010A-IVOD01 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Jul 20 13:48:02 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: IVLDB (not mounted)

RMAN>  restore controlfile from '/data/ivldb/lv0_20150718/level_0_ivldb_controfile_1118_1.ctl';

Starting restore at 2015-07-20 13:48:29
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=4348 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/data/ivldb/uatdb/control02.ctl
Finished restore at 2015-07-20 13:48:30

Mount命令的nolock模式通常是挂载到一个较旧版本的nfs服务器时使用,禁用nfs文件锁功能,挂载nfs默认是开启文件锁功能的,这就导致了上面的故障,下面是man手册中,关于挂载nfs的相关内容。

Mount options for nfs
       Instead of a textual option string, parsed by the kernel, the nfs file system expects a binary argument of  type  struct  nfs_mount_data.   The
       program mount itself parses the following options of the form 鈥榯ag=value鈥 and puts them in the structure mentioned: rsize=n, wsize=n, timeo=n,
       retrans=n, acregmin=n, acregmax=n, acdirmin=n, acdirmax=n, actimeo=n, retry=n, port=n, mountport=n, mounthost=name,  mountprog=n,  mountvers=n,
       nfsprog=n,  nfsvers=n,  namlen=n.   The option addr=n is accepted but ignored.  Also the following Boolean options, possibly preceded by no are
       recognized: bg, fg, soft, hard, intr, posix, cto, ac, tcp, udp, lock.  For details, see nfs(5).

       Especially useful options include

       rsize=32768,wsize=32768
              This causes the NFS client to try to negotiate a buffer size up to the size specified.  A large buffer size  does  improve  performance,
              but both the server and client have to support it.  In the case where one of these does not support the size specified, the size negoti-
              ated will be the largest that both support.

       intr   This will allow NFS operations (on hard mounts) to be interrupted while waiting for a response from the server.

       nolock Do not use locking. Do not start lockd.

 

本文固定链接: http://www.dbdream.com.cn/2015/07/ora-27086-unable-to-lock-file-already-in-use%e5%af%bc%e8%87%b4%e6%95%b0%e6%8d%ae%e5%ba%93%e6%97%a0%e6%b3%95restore%e6%8e%a7%e5%88%b6%e6%96%87%e4%bb%b6/ | 信春哥,系统稳,闭眼上线不回滚!

该日志由 dbdream 于2015年07月20日发表在 Linux, Oracle, oracle 10g, oracle 11g 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: ORA-27086 unable to lock file – already in use导致数据库无法restore控制文件 | 信春哥,系统稳,闭眼上线不回滚!
关键字: , , , , ,

ORA-27086 unable to lock file – already in use导致数据库无法restore控制文件:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter