Oracle monitoring is a server-side process that is responsible for monitoring requests from clients and can establish data links between the client computer and the database computer. After receiving the request, Oracle monitoring derives a server process to provide services. Database configuration provides both private and shared modes.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
Oracle monitoring is a server-side process responsible for monitoring requests from clients
The listener does not need to reside on the database host, that is, You can register the instance to the monitor on the remote host
The monitor is Oracle's own software or component
Local connections do not need to monitor, but remote connections must
oracle After listening to the request sent by the user process, a server process is derived to provide services. The server process has two modes according to the configuration of the database: proprietary mode and shared mode
Private mode: each client process There is a separate server process to establish a session to provide services. Most of more than 99% of databases are in this mode
Shared mode: There is a dispatcher called dispatch, which monitors and puts requests into the request queue. Dispatch will continuously query the request queue. When a request is found, it will transfer the request to the server process, and then provide services through the server process. After processing, it will feed back to the response queue. Dispatch will then forward the response queue to the user process. Similar to eating in a restaurant, the server process is equivalent to the chef, and dispatch is equivalent to the waiter. The waiter accepts the request and forwards it to the corresponding idle chef to provide service. Wherever the chef puts the dishes prepared, the waiter then serves them to the customer; this model is not used. After multiple
dbca databases are built, there will usually be a default monitor. There is no need to configure it. The default service port of the monitor is 1521.
Generally, one monitor is enough for a database, but if the concurrency is too large, it may be necessary. Configure multiple monitors. The non-default monitor port number is greater than 1024. The service name and port number between different monitors cannot be the same.
How to distinguish different libraries from monitors, so you need to register the instance as a service and register it to In listen,
Registration is to add the instances running on the host to the listener, so that the listener knows which instances are on the host
Configuration method
Dynamic registration
There are two types of service registration, one is dynamic registration, which actively and automatically registers the instance into the listen through the pmon process
Listening and instance In the startup sequence, when the monitor starts first, there is no problem. If it starts after the monitor, you can manually alter system register to register it, or leave it alone, pmon will register it after a while.
Generally, the default monitor is dynamic registration
No need for listener.ora file
The service status has the words status READY (library is in mount or open state)
pmon provides the instance name, service name, and service to the listener The type and address of the handler
The registered service names are db_name.db_domain, db_nameXDB.db_domain
If you want pmon to register to a non-default listener, you must configure the local_listener parameter
Configuring listening can be configured through netca graphics or command configuration
The default listening name is LISTENER. The configuration is as above. In fact, there is no such listener.ora, the default listen can also run normally, so let's add a non-default dynamic listener on port 1522, named listener2
First add a listener to the netmgr graphic
Or edit listener.ora to add a listener.
Then modify tnsnames.ora to add a listener2 string to modify the local_listener parameter (that is, change the listener Copy the section in to tnsnames.ora)
Set the local_listener parameter and register it manually,
[oracle@study admin]$ sql SQL*Plus: Release 11.2.0.1.0 Production on Thu Sep 19 17:07:41 2019 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 17:07:42 SYS@study> show parameter local_list NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ local_listener string 17:08:19 SYS@study> alter system set local_listener='LISTENER2'; System altered. Elapsed: 00:00:00.04 17:09:03 SYS@study> alter system register; System altered. Elapsed: 00:00:00.00 17:09:21 SYS@study> 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@study admin]$ lsnrctl status listener2 LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 19-SEP-2019 17:10:22 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=study.localdomain)(PORT=1522))) STATUS of the LISTENER ------------------------ Alias listener2 Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 19-SEP-2019 16:38:16 Uptime 0 days 0 hr. 32 min. 6 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/study/listener2/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=study.localdomain)(PORT=1522))) Services Summary... Service "study" has 1 instance(s). Instance "study", status READY, has 1 handler(s) for this service... Service "studyXDB" has 1 instance(s). Instance "study", status READY, has 1 handler(s) for this service... The command completed successfully [oracle@study admin]$
But in this case, the default is pmon It will not be registered in the default monitor, that is, it cannot be accessed from 1521. If you want 1521 and 1522 to provide services at the same time, you can delete the default monitor and change the configuration to
LISTENER2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = study.localdomain)(PORT = 1522)) (ADDRESS = (PROTOCOL = TCP)(HOST = study.localdomain)(PORT = 1521)) )
Since dynamic monitoring depends on PMON, delete the monitor Configuration file, the default listening is still valid, and the monitoring is still listening to localhost:1521. The LOCAL_LISTENER parameter controls where the instance dynamically registers itself. The default value of the LOCAL_LISTENER parameter is (ADDRESS = (PROTOCOL=TCP)(HOST=hostname)(PORT= 1521)), PMON still actively registers instances to listen. This is the registration method by default after dbca database is created.
It can be seen that dynamic monitoring requires that the monitoring and local_listener parameter configurations are consistent, and they are all empty by default. The configuration is the default monitoring. If it is not the default, just display and configure these two places
tnsnames
.ora在动态监听中不是必须的,只是为了配置个本地的字符串方便local_listener的配置命令而已,直接配置如下形式也ok
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=study.localdomain)(PORT=1521))'; 等同于alter system set local_listener='';
配置注册到多个监听,可以如下
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=study.localdomain)(PORT=1521))','(ADDRESS=(PROTOCOL=TCP)(HOST=study.localdomain)(PORT=1522))';
或者先在tnsnames.ora中配置多个地址的字符串
再设置alter systemset local_listener='LISTENER2';
在共享服务器模式下,可以配置listener的一个参数叫做dispatchers,把这个分派器注册到一个非默认监听
ALTER SYSTEM SET DISPATCHERS=”(PROTOCOL=tcp)(LISTENER=lsnr2)”;
select service_id,name from vactiveservices可以查出,前面2个服务是注册到监听的,后面2个是Oracle有两个内部的服务,SYSBACKGROUND是后台进程使用的,SYS$USERS提供给没有指定服务的用户会话使用
service_names是服务名,如果为空,会把db_name.db_domain 注册到监听
推荐教程:《Oracle视频教程》
The above is the detailed content of What is oracle monitoring. For more information, please follow other related articles on the PHP Chinese website!