Sie sind auf Seite 1von 17

Registering DB Service with Listener | Static vs.

Dynamic
Client connecting to the remote database Let it be, user scott is connecting remote database using sqlplus. I have a deep look here how the connection is established. Lets see .. SQL> username/password@net_service_name SQL> scott/tiger@orcltest When user scott issues this statement then the user can connect with the database. Here sqlplus asking TNS to make a connection to orcltest using (userid scott and the password tiger). This is client request and can be found on CLIENT MACHINE that the file name is tnsnames.ora. The tnsnames.ora file can be identified $ORACLE_HOME/network/admin. Consider tnsnames file has this entry :

TNS (Transparent Network Substrate) looks tnsnames.ora for an entry called ORCLTESTDB. This is called as (tns.alias_name or net_service_name).

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


Here a request is sent through the normal OS network stack to (PORT = 1521) on (HOST = linuxserver) using (PROTOCOL = TCP), asking for a connection to (SERVICE_NAME = orcltest). These entry informations can be getting from tnsnames.ora file only. Ok , What about the listeners Part here ? The Listener is separate process that runs on database server side. It receives incoming client connection requests (who is trying to connect DB server) and make the connection (Server Process) between the client and the database instance. The listener is configured with the listener.ora file.
POINTS TO REMEMBER

If the listener goes down, new users would not be able to connect to my DB server but connected users would be able to work normally.

Static vs. Dynamic Instance Registration : (LISTENER)


Oracle Provides two methods service registered with listener - They are

STATIC and DYNAMIC READY - DYNAMIC REGISTRATION UNKNOWN - STATIC REGISTARTION

INSTANCE Static Registration : Means listener knows because of SID_LIST entry in the listener.ora : (SR). Static is the very basic method to register listener. we can add entries in $ORACLE_HOME\NETWORK\ADMIN\listener.ora file or netmgr (GUI) mode. Database service can be confirmed by following command , SQL> show parameter service; Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


STATIC registration is accomplished by configuring the SID_LIST section of the

listener.ora file. The configuration inside the listener.ora file looks like below.

$ lsnrctl start LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 15-MAR-2013 20:58:31 Copyright (c) 1991, 2005, Oracle. All rights reserved.: Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 10.2.0.4.0 - Production Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxserver)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linuxserver)(PORT=1521))) Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxserver)(PORT=1521)))

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


Services Summary... Service "MYDB.ORCLPROD.COM" has 1 instance(s). Instance "orclprod", status UNKNOWN, has 1 handler(s) for this service... Service "myorcltest" has 1 instance(s). Instance "orcltest", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
REGISTRATION STATUS IS UNKNOWN - WHY ?

Status is UNKNOWN. This status of unknown is the indication that this registration came from the SID_LIST section of listener.ora. Listener do
NOT

have any information about the status. Ok. Lets take a deep look.

Listener status with actual connection request SQL> conn user1/user1@ORCLTESTDB Connected. $ lsnrctl status Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxserver)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0))) Services Summary... Service " MYDB.ORCLPROD.COM " has 1 instance(s). Instance "orclprod", status UNKNOWN, has 1 handler(s) for this service... Service "myorcltest" has 1 instance(s). Instance "orcltest", status UNKNOWN, has 1 handler(s) for this service... Service "orclprod" has 1 instance(s). Instance "orclprod", status READY, has 1 handler(s) for this service... Service "orclprodXDB" has 1 instance(s). Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


Instance "orclprod", status READY, has 1 handler(s) for this service... Service "orclprod_XPT" has 1 instance(s). Instance "orclprod", status READY, has 1 handler(s) for this service... Service "orcltest" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orcltestXDB" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orcltest_XPT" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... The command completed successfully We can ignore the services XDB and XTP - Special internal uses for Oracle. Marked status is unknown because there is no mechanism to guarantee that the specified UNKNOWN status (Static Registation). If we ask connections to (MYDB.ORCLPROD.COM, myorcltest) the listener just saying NO databases named MYDB.ORCLPROD.COM or myorcltest. The READY instance comes from the database having registered with the listener (Dynamic Registration).

Dynamic Registration
Dynamic registration is accomplished when the pmon process of the database instance contacts the listener and requests registration. This occurs at instance startup, and every 60 seconds ( during life of the instance on port #1521). Three Initialization parameters that affect service_names .

DB_NAME, DOMAIN_NAME, SERVICE_NAMES

NOTE : pmon background process registers with listener. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


DYNAMIC REGISTRATION STEPS

First completely removing listener.ora , then restarting the listener and confirm no static registration is running. linux> $ rm rf listener.ora linux> $ ls -ld *.ora -rw-r--r-- 1 oracle oinstall 565 Mar 16 04:41 tnsnames.ora Stoping Listener linux> $ lsnrctl stop LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-MAR-2013 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) The command completed successfully Starting Listener $ lsnrctl start LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-MAR-2013 02:47:42 Copyright (c) 1991, 2005, Oracle. All rights reserved. Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 10.2.0.4.0 - Production Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxserver)(PORT=1521))) The listener supports no services The command completed successfully * Note: The listener started with all default values and support no services.* Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic Example : I Changes In orcltest database
SQL> show user; USER is "SYS" SQL> alter system set service_names='' scope=spfile; System altered. SQL> alter system set db_domain='' scope=spfile; System altered. SQL> startup force; ORACLE instance started. Database opened.

SQL> show parameter db_domain; NAME db_domain TYPE string VALUE -----------

SQL> show parameter service_names; NAME service_names TYPE string VALUE ------------

SQL> alter system register; System altered. SQL> select * from global_name; GLOBAL_NAME ORCLTEST.REGRESS.RDBMS.DEV.US.ORACLE.COM Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


Checking lsnrctl status for Dynamic Registration $ lsnrctl status LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-MAR-2013 04:56:20 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxserver)(PORT=1521))) Services Summary... Service "orclprod" has 1 instance(s). Instance "orclprod", status READY, has 1 handler(s) for this service... Service "orclprodXDB" has 1 instance(s). Instance "orclprod", status READY, has 1 handler(s) for this service... Service "orclprod_XPT" has 1 instance(s). Instance "orclprod", status READY, has 1 handler(s) for this service... Service "orcltest" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orcltestXDB" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orcltest_XPT" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... The command completed successfully POINTS TO NOTE : Service names for instance orcltest : (orcltest , orcltest_XPT , orcltestXDB). Service names for instance orclprod : (orclprod , orclprod_XPT , orclprodXDB). Service_names associated with the appropriate instance orcltest/orclprod and derived their name from the initialization parameter db_name. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic Example : II Changes In orcltest database
SQL> show user; USER is "SYS" SQL> alter system set service_names='mydb' scope=spfile; System altered.

SQL> startup force; ORACLE instance started. Database mounted Database opened. SQL> show parameter db_name NAME db_name TYPE string VALUE orcltest

SQL> show parameter service_names; NAME service_names TYPE string VALUE mydb ( see lsnrctl status o/p)

SQL> show parameter db_domain; NAME db_domain TYPE string VALUE

SQL> alter system register; System altered. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


Checking lsnrctl status for Dynamic Registration $ lsnrctl status LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-MAR-2013 04:56:20 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxserver)(PORT=1521))) Services Summary... Service "mydb" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orclprod" has 1 instance(s). Instance "orclprod", status READY, has 1 handler(s) for this service... Service "orclprodXDB" has 1 instance(s). Instance "orclprod", status READY, has 1 handler(s) for this service... Service "orclprod_XPT" has 1 instance(s). Instance "orclprod", status READY, has 1 handler(s) for this service... Service "orcltest" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orcltestXDB" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orcltest_XPT" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... The command completed successfully Service names for instance orcltest : (orcltest , orcltest_XPT , orcltestXDB). Service names for instance orclprod : (orclprod , orclprod_XPT , orclprodXDB). Additionaly new service_name mydb is derived from service_names. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic Example : III Setting db_domain in orcltest database
SQL> show user; USER is "SYS" SQL> alter system set db_domain='orcltest.com' scope=spfile; System altered.

SQL> startup force; ORACLE instance started. Database mounted Database opened. SQL> show parameter db_name NAME db_name TYPE string VALUE orcltest

SQL> show parameter service_names; NAME service_names TYPE string VALUE mydb

SQL> show parameter db_domain; NAME db_domain TYPE string VALUE ORCLTEST.COM

SQL> alter system register; System altered. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


Checking lsnrctl status for Dynamic Registration $ lsnrctl status LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-MAR-2013 20:15:34 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxserver)(PORT=1521))) Services Summary... Service "mydb.ORCLTEST.com" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orcltest.ORCLTEST.com" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orcltestXDB.ORCLTEST.com" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Service "orcltest_XPT.ORCLTEST.com" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... The command completed successfully All service names are derived from db_name (orcltest.ORCLTEST.com, orcltestXDB.ORCLTEST.com, orcltest_XPT.ORCLTEST.com ). This (mydb.ORCLTEST.com) is derived from service_names and additionly append the value of db_domain. POINTS TO NOTE IN DYNAMIC SERVICE REGISTRATION the status is always (READY), because the listener knows the instance is ready because the instance itself told the listener it was ready. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


Checking lsnrctl service for Dynamic Registration $ lsnrctl services LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-MAR-2013 20:15:34 Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) Services Summary... Service "mydb.ORCLTEST.com" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER Service "orcltest.ORCLTEST.com" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER Service "orcltestXDB.ORCLTEST.com" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Handler(s): "D000" established:0 refused:0 current:0 max:1022 state:ready DISPATCHER <machine: linuxserver, pid: 5216> (ADDRESS=(PROTOCOL=tcp)(HOST=linuxserver)(PORT=32783)) Service "orcltest_XPT.ORCLTEST.com" has 1 instance(s). Instance "orcltest", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER The command completed successfully

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


POINTS TO REMEMBER for ( DYNAMIC REGISTRATION ) The listener is quite capable of running without a listner.ora file . DR Service doesnt require any configuration in the listener.ora file. The registration is performed by the PMON process (background process). Pmon registers the DB instance info to the listener registration Pmon provides following information Name of the associated Instance. Current load and maximum load on instance Names of DB services provided by database. Information about dedicated servers and dispatchers i.e. Depends on database server mode i.e. DEDICATED/SHARED server mode. PMON process wakes up at every 60 seconds and provide information to the listener. If any problem arises and Pmon process fails (so not possible to register information with listener) in this case we can force. Using SQL> alter system register; Command help to find current listener ( If we configure multiple listeners) , Using LSNRCTL> show current listener; If we try to start up databases remotely should have a static entry and during service

(listener.ora entry) otherwise will not be able to connect to the database. Oracle netmgr is a utility used for configuring SQL*Net. To enable netmgr, for UNIX/LINUX systems linux> $ netmgr. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


STATUS : Static and Dynamic when using static Registration Even though the database is statically registered, the listener uses the Dynamic Registration information before using static service registration information. Lets check with new database named SBI
TNS entry for SBI DATABASE

SBIDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = linuxserver)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sbi) ) )
LISTENER entry for SBI DATABASE

SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = sbi) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) (GLOBAL_DBNAME =SBI) ) )


POINTS TO NOTE

lsnrctl> status/services both having UNKNOWN and READY status. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


Checking lsnrctl Status Service "SBI" has 2 instance(s). It is coming from Service Summary because of listener have entry with this name GLOBAL_DBNAME. $ lsnrctl status LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 21-MAR-2013 01:34:52 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linuxserver)(PORT=1521))) Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxserver)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0))) Services Summary... Service "SBI" has 2 instance(s). Instance "sbi", status UNKNOWN, has 1 handler(s) for this service... Instance "sbinst", status READY, has 1 handler(s) for this service... Service "sbi_XPT" has 1 instance(s). Instance "sbinst", status READY, has 1 handler(s) for this service... The command completed successfully

Instance SBI, status UNKNOWN Instance sbinst, status READY Even database is statically registered, it still registers dynamically with listener. In the case of both STATIC and DYNAMIC registration, the listener uses the dynamic registration information before using static service registration info. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Registering DB Service with Listener | Static vs. Dynamic


Checking lsnrctl Status $ lsnrctl services LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 21-MAR-2013 01:40:14 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linuxserver)(PORT=1521))) Services Summary... Service "SBI" has 2 instance(s). Instance "sbi", status UNKNOWN, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 LOCAL SERVER Instance "sbinst", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER Service "sbi_XPT" has 1 instance(s). Instance "sbinst", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER The command completed successfully

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Das könnte Ihnen auch gefallen