一、oracle11g启动报错 ORA-01078和LRM-00109、ORA-00845、ORA-01102、ORA-01507
问题:
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 6 17:26:32 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> conn as sysdba
Enter user-name: orcl
Enter password:
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/data/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora'
SQL>
根据提示,查看此路径/data/u01/app/oracle/product/11.2.0/dbhome_1/dbs/下果然没有这个文件 initorcl.ora
[root@localhost ~]# cd /data/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[root@localhost dbs]# ll
总用量 24
-rw-rw----. 1 oracle oinstall 1544 6月 6 17:20 hc_JIAXU.dat
-rw-rw----. 1 oracle oinstall 1544 6月 6 17:17 hc_DBUA0.dat
-rw-r--r--. 1 oracle oinstall 2851 5月 15 2009 init.ora
-rw-r-----. 1 oracle oinstall 24 6月 6 17:18 lkJIAXU
-rw-r-----. 1 oracle oinstall 1536 6月 6 17:20 orapwJIAXU
-rw-r-----. 1 oracle oinstall 2560 6月 6 17:20 spfileJIAXU.ora
[root@localhost dbs]#
解决方法:可以将pfile参数文件拷贝过来并重新命名为initorcl.ora
[oracle@localhost ~]$ cd /data/u01/app/oracle/admin/JIAXU/pfile/
[oracle@localhost pfile]$ ll
总用量 4
-rw-r-----. 1 oracle oinstall 1818 6月 6 17:18 init.ora.562020172037
[oracle@localhost pfile]$ cp init.ora.562020172037 /data/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
[oracle@localhost pfile]$ cd /data/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
[oracle@localhost dbs]$ ll
总用量 28
-rw-rw----. 1 oracle oinstall 1544 6月 6 17:20 hc_JIAXU.dat
-rw-rw----. 1 oracle oinstall 1544 6月 6 17:17 hc_DBUA0.dat
-rw-r--r--. 1 oracle oinstall 2851 5月 15 2009 init.ora
-rw-r-----. 1 oracle oinstall 1818 6月 6 17:33 init.ora.562020172037
-rw-r-----. 1 oracle oinstall 24 6月 6 17:18 lkJIAXU
-rw-r-----. 1 oracle oinstall 1536 6月 6 17:20 orapwJIAXU
-rw-r-----. 1 oracle oinstall 2560 6月 6 17:20 spfileJIAXU.ora
[oracle@localhost dbs]$ mv init.ora.562020172037 initorcl.ora
[oracle@localhost dbs]$ ll
总用量 28
-rw-rw----. 1 oracle oinstall 1544 6月 6 17:20 hc_JIAXU.dat
-rw-rw----. 1 oracle oinstall 1544 6月 6 17:17 hc_DBUA0.dat
-rw-r--r--. 1 oracle oinstall 2851 5月 15 2009 init.ora
-rw-r-----. 1 oracle oinstall 1818 6月 6 17:33 initorcl.ora
-rw-r-----. 1 oracle oinstall 24 6月 6 17:18 lkJIAXU
-rw-r-----. 1 oracle oinstall 1536 6月 6 17:20 orapwJIAXU
-rw-r-----. 1 oracle oinstall 2560 6月 6 17:20 spfileJIAXU.ora
[oracle@localhost dbs]$
重新启动时报错
ORA-00845: MEMORY_TARGET not supported on this system
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 6 17:37:31 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
SQL>
查找资料后发现在oracle 11g中新增的内存自动管理的参数MEMORY_TARGET,它能自动调整SGA和PGA。
这个特性需要用到/dev/shm共享文件系统,而且要求/dev/shm必须大于MEMORY_TARGET,如果/dev/shm比MEMORY_TARGET小,就会报错。
解决方案:
1.初始化参数MEMORY_TARGET或MEMORY_MAX_TARGET不能大于共享内存(/dev/shm),为了解决这个问题,可以增大/dev/shm
mount -o remount,size=13G /dev/shm
2.为了确保操作系统重启之后能生效,需要修改/etc/fstab文件
vim /etc/fstab
# /etc/fstab
# Created by anaconda on Fri Jun 5 19:40:22 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=771b3c04-bc37-4d67-8ec7-c7827fe74210 /boot xfs defaults 0 0
tmpfs /dev/shm tmpfs defaults,size=13G 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
重新启动,连接成功。
但是每次启动会提示:ORA-01102: cannot mount database in EXCLUSIVE mode
关闭会提示:ORA-01507: database not mounted
SQL> startup
ORACLE instance started.
Total System Global Area 822579200 bytes
Fixed Size 2217832 bytes
Variable Size 482347160 bytes
Database Buffers 331350016 bytes
Redo Buffers 6664192 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode
SQL> shutdown
ORA-01507: database not mounted
ORACLE instance shut down.
SQL>
解决方案:
步:关闭数据库
执行sql命令: shutdown ,并退出sqlplus
SQL> shutdown
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost ~]$
第二步:
进入oracle的家目录(oraclehome)下的dbs目录里面
[oracle@localhost ~]$ cd /data/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
[oracle@localhost dbs]$
第三步:
检查文件名为 lk+*** 文件,语句为 fuser -u lk+***(这个代表前缀为lk的文件),比如说我的数据库为JIAXU,就会有一个lkJIAXU文件。执行fuser -u lkJIAXU,如果提示未找到fuser命令,安装psmisc包就可以了。
[oracle@localhost ~]$ fuser -u lkJIAXU
-bash: fuser: 未找到命令
[oracle@localhost ~]$ sudo yum install -y psmisc
[sudo] oracle 的密码:
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirror.lzu.edu.cn
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 psmisc.x86_64.0.22.20-16.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
==========================================================================================================
Package 架构 版本 源 大小
==========================================================================================================
正在安装:
psmisc x86_64 22.20-16.el7 base 141 k
事务概要
==========================================================================================================
安装 1 软件包
总下载量:141 k
安装大小:475 k
Downloading packages:
psmisc-22.20-16.el7.x86_64.rpm | 141 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : psmisc-22.20-16.el7.x86_64 1/1
验证中 : psmisc-22.20-16.el7.x86_64 1/1
已安装:
psmisc.x86_64 0:22.20-16.el7
完毕!
[oracle@localhost dbs]$ fuser -u lkJIAXU
/data/u01/app/oracle/product/11.2.0/dbhome_1/dbs/lkJIAXU: 52698(oracle) 52704(oracle) 52708(oracle) 52710(oracle) 52714(oracle) 52716(oracle) 52718(oracle) 52720(oracle) 52722(oracle) 52724(oracle) 52726(oracle) 52728(oracle) 52815(oracle) 52830(oracle) 52834(oracle) 52836(oracle) 52929(oracle) 53081(oracle)
[oracle@localhost dbs]$
第四步:
kill掉文件中的内容,执行 fuser -k + lk+***
[oracle@localhost dbs]$ fuser -k + lkJIAXU
Specified filename + does not exist.
/data/u01/app/oracle/product/11.2.0/dbhome_1/dbs/lkJIAXU: 52698 52704 52708 52710 52714 52716 52718 52720 52722 52724 52726 52728 52815 52830 52834 52836 52929 53081
[oracle@localhost dbs]$
第五步:
重启数据库,启动关闭正常。
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 6 18:11:04 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 822579200 bytes
Fixed Size 2217832 bytes
Variable Size 482347160 bytes
Database Buffers 331350016 bytes
Redo Buffers 6664192 bytes
Database mounted.
Database opened.
SQL>
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>