记一次解决Oracle数据库连接失败

来源:互联网 发布:淘宝护肤品店铺标志 编辑:程序博客网 时间:2024/05/17 08:18

问题背景:使用PL/SQL Developer连接本地虚拟机(RedHat6.7)中的Oracle服务,报错如下:

ERROR:ORA-01034: ORACLE not availableORA-27101: shared memory realm does not existLinux-x86_64 Error: 2: No such file or directoryAdditional information: 3640Additional information: 248258503Process ID: 0Session ID: 0 Serial number: 0

解决过程:先利用XShell 连接本地RedHat,尝试利用sqlplus连接Oracle看是否能够连接,结果报错如下:

[oracle@Simon ~]$ sqlplus sys as sysdbaSQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 16 19:45:44 2017Copyright (c) 1982, 2014, Oracle.  All rights reserved.Enter password: ERROR:ORA-09817: Write to audit file failed.Linux-x86_64 Error: 28: No space left on deviceAdditional information: 12ORA-09945: Unable to initialize the audit trail fileLinux-x86_64 Error: 28: No space left on device

看到提示报错是No space left on device 后,利用df -m 查看磁盘空间无剩余:

[root@Simon ~]# df -mFilesystem                   1M-blocks  Used Available Use% Mounted on/dev/mapper/vg_simon-lv_root     26718 25351        11 100% /tmpfs                             1910     0      1910   0% /dev/shm/dev/sda1                          485    40       421   9% /boot

迅速确定问题所在,临时解决办法为删除 /var/lib/mlocate/ 目录下的 mlocate.db 文件释放磁盘空间:

[root@Simon ~]# cd /var/lib/mlocate/[root@Simon mlocate]# lsmlocate.db[root@Simon mlocate]# rm -rf mlocate.db 

释放完毕后,再次连接sqlplus,启动数据库,外部连接恢复正常。后更改虚拟机磁盘大小,问题消失。
知识点:locate 是在 linux 下实现快速查找文件的命令,而 mlocate.db 是存放文件位置信息的文件,此文件的更新通过crontab自动完成的。整个locate工作其实是由四部分组成的:

  1. /usr/bin/updatedb 主要用来更新数据库,通过crontab自动完成的
  2. /usr/bin/locate 查询文件位置
  3. /etc/updatedb.conf updatedb的配置文件
  4. /var/lib/mlocate/mlocate.db 存放文件信息的文件

详细用法请百度linux locate命令

2 0
原创粉丝点击