文档课题:测试Kill MMON进程对数据库的影响.
数据库:oracle 11.2.0.4
1、异常模拟
[oracle@racogg:~]$ ps -ef | grep mmon | grep -v grep
oracle 13879 1 0 Jan06 ? 00:00:11 ora_mmon_orcl
[oracle@racogg:~]$ ps -ef | grep ora_smon | grep -v grep
oracle 13875 1 0 Jan06 ? 00:00:05 ora_smon_orcl
[oracle@racogg:~]$ kill -9 13879
[oracle@racogg:~]$ ps -ef|grep ora_smon
oracle 13875 1 0 Jan06 ? 00:00:05 ora_smon_orcl
说明:如上kill mmon进程后,数据库不会出现down机的异常,但无法自动生成AWR快照.
2、开启MMON进程
说明:kill mmon进程后并不会自动开启,虽然重启数据库能实现重启mmon进程,但在生产环境不太现实.
以下演示在不关闭数据库的情况下重启mmon进程,生产环境需选择在业务空闲时启动restricted模式,然后立即禁用.
2.1、启用restricted模式
[oracle@racogg:~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Jan 7 14:46:06 2024
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
sys@ORCL 2024-01-07 14:46:06> alter system enable restricted session;
System altered.
sys@ORCL 2024-01-07 14:46:23> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
2.2、启用restricted模式后的影响
[oracle@racogg:~]$ sqlplus sys/oracle_4U@192.168.133.196:1521/orcl as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Jan 7 14:47:25 2024
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12526: TNS:listener: all appropriate instances are in restricted mode
Enter user-name:
[oracle@racogg:~]$ sqlplus sys/oracle_4U@orcl as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Jan 7 14:48:52 2024
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12526: TNS:listener: all appropriate instances are in restricted mode
Enter user-name:
[oracle@racogg:~]$ ps -ef | grep mmon | grep -v grep
oracle 74927 1 0 14:46 ? 00:00:00 ora_mmon_orcl
小结:如上所示,启用restricted模式后无法通过简易&tnsnames的方式连接数据库,但mmon进程被成功开启.
2.3、关闭restricted模式
[oracle@racogg:~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Jan 7 14:49:10 2024
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
sys@ORCL 2024-01-07 14:49:10> alter system disable restricted session;
System altered.
sys@ORCL 2024-01-07 14:50:11> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
小结:通过本地服务器连接数据库,关闭restricted模式.
2.4、关闭restricted模式后的影响
[oracle@racogg:~]$ sqlplus sys/oracle_4U@orcl as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Jan 7 14:50:20 2024
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
sys@ORCL 2024-01-07 14:50:20> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@racogg:~]$ sqlplus sys/oracle_4U@192.168.133.196:1521/orcl as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Jan 7 14:50:25 2024
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
sys@ORCL 2024-01-07 14:50:11> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@racogg:~]$ ps -ef | grep mmon | grep -v grep
oracle 74927 1 0 14:46 ? 00:00:00 ora_mmon_orcl
小结:关闭restricted模式后,简易&tnsnames方式成功连接数据库.