平台: RHEL4.8, Oracle10.2.0.4.0
今天有一台物理备库, 设置切换后, 没法自动关闭, kill 相关 ora_ 进程不好使, 没办法只好手工 kill -9 相关 ora_ 进程, 这样就发生了如下即能关闭也不能启动的错误提示:
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Aug 3 10:11:01 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected.
ERROR:
ORA-01012: not logged on
SQL> startup;
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> shutdown immediate;
ORA-24324: service handle not initialized
ORA-24323: value not allowed
ORA-01089: immediate shutdown in progress - no operations are permitted
看来是Oracle的共享内存没有自动清除, 这也是 kill -9 这样的操作容易发生的故障.
$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x1c43cb64 1507329 oracle 640 4297064448 0
0x194b150a 1310722 oracle 775 1079228 0
可以看出还占用着4G的内存, 但nattch值却为0, 注:nattch表示挂在共享内存段上的进程数.
现在手工删除这段共享内存, 根据shmid值进行删除:
$ ipcrm -m 1507329
再次验证显示正常:
$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x194b150a 1310722 oracle 775 1079228 0
现在可以正常启动数据库了:
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Aug 3 10:17:29 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 4294967296 bytes
Fixed Size 2089472 bytes
Variable Size 2634026496 bytes
Database Buffers 1644167168 bytes
Redo Buffers 14684160 bytes
Database mounted.
Database opened.
SQL>
今天有一台物理备库, 设置切换后, 没法自动关闭, kill 相关 ora_ 进程不好使, 没办法只好手工 kill -9 相关 ora_ 进程, 这样就发生了如下即能关闭也不能启动的错误提示:
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Aug 3 10:11:01 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected.
ERROR:
ORA-01012: not logged on
SQL> startup;
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> shutdown immediate;
ORA-24324: service handle not initialized
ORA-24323: value not allowed
ORA-01089: immediate shutdown in progress - no operations are permitted
看来是Oracle的共享内存没有自动清除, 这也是 kill -9 这样的操作容易发生的故障.
$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x1c43cb64 1507329 oracle 640 4297064448 0
0x194b150a 1310722 oracle 775 1079228 0
可以看出还占用着4G的内存, 但nattch值却为0, 注:nattch表示挂在共享内存段上的进程数.
现在手工删除这段共享内存, 根据shmid值进行删除:
$ ipcrm -m 1507329
再次验证显示正常:
$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x194b150a 1310722 oracle 775 1079228 0
现在可以正常启动数据库了:
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Aug 3 10:17:29 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 4294967296 bytes
Fixed Size 2089472 bytes
Variable Size 2634026496 bytes
Database Buffers 1644167168 bytes
Redo Buffers 14684160 bytes
Database mounted.
Database opened.
SQL>
--End--
--------------
kill命令格式: kill -Signal pid pid是进程号,可以用 ps 命令查出 signal是发送给进程的信号,TERM(或数字9)表示“无条件终止” 下面是一个例子 $ whoami root $ ps auxw | grep vi #查询有没有运行vi程序 fenggz 13118 0.0 0.0 4140 1044 pts/1 S+ 05:33 0:00 vi root 13120 0.0 0.0 4836 640 pts/0 S+ 05:33 0:00 grep vi #答案:有运行,进程号13118 $ kill -9 13118 #把vi杀掉(无条件终止) $ ps auxw | grep vi root 13122 0.0 0.0 4404 640 pts/0 S+ 05:33 0:00 grep vi #没有vi了... $