Академический Документы
Профессиональный Документы
Культура Документы
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).
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.
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
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)))
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
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 .
NOTE : pmon background process registers with listener. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu
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 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> alter system register; System altered. 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
(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
SBIDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = linuxserver)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sbi) ) )
LISTENER entry for SBI DATABASE
lsnrctl> status/services both having UNKNOWN and READY status. Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu
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