ORA-01078 &LRM-00109
SQL> startup mount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora'
错误原因:在oracle9i、10g、11g最近几个版本中,数据库默认使用spfile启动数据库,如果spfile不存在,则就会出现上述错误。
解决办法:
查询pfile文件位置,将pfile目录中的init.ora.2182020183512形式的文件copy到$ORACLE_HOME/dbs目录下命名为initorcl.ora即可。
具体操作如下:
[oracle@localhost ~]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@localhost ~]$ find /u01/app/oracle -name pfile
/u01/app/oracle/admin/orcl11g/pfile
[oracle@localhost ~]$ cd /u01/app/oracle/admin/orcl11g/pfile
[oracle@localhost pfile]$ ls
init.ora.2182020183512
[oracle@localhost pfile]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@localhost pfile]$ cp init.ora.2182020183512 /u01/app/oracle/product/11.2.0/db_1/initorcl.ora
[oracle@localhost pfile]$
此操作之后数据库startup mount即可成功。
ORA-00845: MEMORY_TARGET not supported on this system
SQL> startup mount
ORA-00845: MEMORY_TARGET not supported on this system
[oracle@localhost dbs]$ cd /u01/app/oracle/product/11.2.0/db_1/bin
[oracle@localhost bin]$ oerr ora 00845
00845, 00000, "MEMORY_TARGET not supported on this system"
// *Cause: The MEMORY_TARGET parameter was not supported on this operating system or /dev/shm was not sized correctly on Linux.
// *Action: Refer to documentation for a list of supported operating systems. Or, size /dev/shm to be at least the SGA_MAX_SIZE on each Oracle instance running on the system.
[oracle@localhost bin]$
解决办法:我自己将initorcl.ora中的memory_target设置为0后,解决了该问题。但是建议使用下面的方法:
在Oracle 11g for linux中似乎是用了一种新的机制来管理共享内存段,而不是传统的sys /dev/shm了。在alert.ora中可以找到更准确的错误描述:
Starting ORACLE instance (normal)
WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least 419430400 bytes. /dev/shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is 413466624 and used is 0 bytes. Ensure that the mount point is /dev/shm for this directory.
memory_target needs larger /dev/shm
解决办法之一:
解决的办法之一是增加tmpfs文件系统的容量:
修改/etc/fstab中tmpfs对应的行;
将原来的tmpfs /dev/shm tmpfs defaults 0 0 改成tmpfs /dev/shm tmpfs default,size=1024M 0 0,这样tmpfs增大为1G,重新mount /dev/shm使之生效。
[root@yft ~]# vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=420m 0 0
[root@yft ~]# mount -o remount /dev/shm
[root@yft ~]# df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 420M 0 420M 0% /dev/shm
SQL> startup
ORACLE instance started.
Total System Global Area 418484224 bytes
Fixed Size 1336932 bytes
Variable Size 406849948 bytes
Database Buffers 4194304 bytes
Redo Buffers 6103040 bytes
Database mounted.
Database opened.
此处参考了这篇文章:初始化参数之memory_target
ORA-01102: cannot mount database in EXCLUSIVE mode
SQL> startup mount
ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode
可能原因:
Oracle被异常关闭时,有资源没有被释放
1) Oracle的共享内存段或信号量没有被释放;
2) Oracle的后台进程(如SMON、PMON、DBWn等)没有被关闭;
3) 用于锁内存的文件lk和sgadef.dbf文件没有被删除。
解决思路:
如果是HA系统,检查其他节点是否已经启动实例检查Oracle进程是否存在,如果存在则杀掉进程检查信号量是否存在,如果存在,则清除信号量;
检查共享内存段是否存在,如果存在,则清除共享内存段;
检查锁内存文件lk和sgadef.dbf是否存在,如果存在,则删除。
此处我依靠下面的步骤解决掉了该问题(我遇到的问题是存在锁文件和共享内存段问题):
1) 如果存在lk和sgadef.dbf文件,则删除。
[oracle@localhost dbs]$ ls sgadef*$ ls sgadef*
ls: 无法访问sgadef*: 没有那个文件或目录
[oracle@localhost dbs]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ ls lk*
lkORCL11G
[oracle@localhost dbs]$ rm lk*
再次启动时又遇到下面的错误(ORA-00205: error in identifying control file, check alert log for more inf),继续解决:
SQL> startup mount
ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
ORA-00205: error in identifying control file, check alert log for more inf
2)a.查看共享内存段相关信息
[oracle@localhost dbs]$ ipcs -map
[oracle@localhost dbs]$ ipcs -map
--------- 消息队列 PID -----------
msqid 拥有者 lspid lrpid
-------- 共享内存 创建者/上次修改者 PID ----------
shmid 拥有者 cpid lpid
524288 root 19972 19995
557057 root 19972 18169
1540098 root 19972 19972
851971 root 19972 18169
819204 root 20214 18169
884741 root 19972 19972
983046 root 20276 18169
1998855 oracle 82166 6116
1114120 root 19972 18169
1146889 root 19972 19972
2195466 oracle 6387 6429
1376268 root 19972 19972
b. 根据ID号清楚共享内存段
[oracle@localhost dbs]$ ipcrm -m 1998855
我这里操作未成功,使用下面的操作成功了:
c. 查看信号量
[oracle@localhost dbs]$ ipcs -s
--------- 信号量数组 -----------键
semid 拥有者 权限 nsems
0x2a306eac 557056 oracle 660 154
0x5c23a1bc 950273 oracle 660 154
d. 清除oracle的信号量
[oracle@localhost dbs]$ ipcrm -s 557056
[oracle@localhost dbs]$ ipcrm -s 950273
e. 再次查询确认
[oracle@localhost dbs]$ ipcs -s
--------- 信号量数组 -----------键
semid 拥有者 权限 nsems
再查询共享内存段也没有问题了。
[oracle@localhost dbs]$ ipcs -m
------------ 共享内存段 --------------键
shmid 拥有者 权限 字节 nattch 状态
0x00000000 524288 root 777 16384 1 目标
0x00000000 557057 root 777 2129920 2 目标
0x00000000 1540098 root 777 1916928 1 目标
0x00000000 851971 root 777 2129920 2 目标
0x00000000 819204 root 600 524288 2 目标
0x00000000 884741 root 777 327680 1 目标
0x00000000 983046 root 600 524288 2 目标
0x00000000 1114120 root 600 524288 2 目标
0x00000000 1146889 root 777 1916928 1 目标
0x00000000 1376268 root 777 1916928 1 目标
到此问题解决:
SQL> startup mount
ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
Database mounted.
3)若是因为Oracle进程没有关闭:
$kill -9