Oracle9i DBA Fundamentals II Handbook

download Oracle9i DBA Fundamentals II Handbook

of 97

Transcript of Oracle9i DBA Fundamentals II Handbook

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    1/97

    CHAP 1 Networking OverviewNetwork Environment Challenges Configuring the network environment Maintaining the network Tuning, troubleshooting, and monitoring the network Implementing security in the network Integrating legacy systems

    Configuring the Network EnvironmentTo implement a successful networking environment consider the following questions: What type of network are you configuring? Is it a small network with a few clients, or a more complexnetwork with many clients and many servers? Are you using a single protocol or multiple protocols? Is the network static or expanding? What configuration options do you have? Are there user-friendly tools available to configure the network? Is your network strictly client/server or is it multi-tiered?

    Maintaining the Network

    How much network maintenance is required for your enterprise? Will you add clients and servers to your network? Do you anticipate frequent upgrades?

    Tuning, Troubleshooting, and Monitoring the Network Does your network include the needed tools? How large a workload do you anticipate? Number of users Number of transactions Number of nodes Location of nodes

    Implementing Security in the Network

    Do you need to secure your network environment? Is secure and sensitive information being transmitted over the network? What tools are available for implementing security?

    Integrating Legacy SystemsHow will your legacy systems interact with your networking environment?

    Simple Network: Two-Tier Network connects client and server Client and server speak the same language or protocolThe client and server communicate over a network using a given protocol, which must be installed onboth the client and the server. A common error in client-server network development is to prototype anapplication in a small, two-tier environment and then scale up by simply adding more users to the server.

    Simple to Complex Network: N-Tier Client can be a thin client or a PC Middle tier can contain applications and services Server holds actual data Translation services (as in adapting a legacy application on a mainframe to a client-server environmentor acting as a bridge between protocols)

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    2/97

    Scalability services (as in acting as a transaction-processing monitor to balance the load of requestsbetween servers) Intelligent agent services (as in mapping a request to a number of different servers, collating theresults, and returning a single response to the client)

    Complex Network IssuesNetworks should improve communication rather than impede distributed operations.

    In a more complex network environment, several issues must be addressed: Different hardware platforms that run different operating systems Multiple protocols used on these platforms Variable syntax issues between the different but connected applications Different geographical locations in which the connected applications resideA well-designed complex network can support a large-scale distributed system.

    Oracle9i Networking Solutions Connectivity Directory Services Scalability Security

    Accessibility

    Connectivity: Key Features Protocol independence Comprehensive platform support Integrated GUI administration tools Multiple configuration options Tracing and diagnostic toolset Basic security

    Connectivity: Oracle Net ServicesOracle Net Services provides the industrys broadest support for network transport protocols, includingTCP/IP, TCP/IP with SSL, Named Pipes Novell SPX/IPX, IBM LU6.2, and DECnet. For simple

    environments, Oracle Net Services default settings provide a transparent name resolution adapter. Thiseliminates the need for generating configuration files. For more complicated environments, Oracle NetServices employs the Oracle Internet Directory to store connection information.Oracle Net Services addresses Internet connectivity through integration of standard solutions such asRemote Authentication Dial-In User Service (RADIUS) and Lightweight Directory Access Protocol (LDAP)with legacy systems.

    Connectivity: Database Connectivity with HTTP/IIOPConnections to the database are not limited to Oracle Net Services alone; clients can establishconnections by using Internet protocols such as Hypertext Transfer Protocol (HTTP) and Internet Inter-ORB Protocol (IIOP). Using these Internet protocols, users can run applications from within a Webbrowser to connect directly to an Oracle9idatabase. Internet technologies such as iFS (Internet FileSystem), Enterprise JavaBeans (EJB), and the Internet standard Secure Sockets Layer (SSL) protocolprovide added security to network connections.Directory Services: Directory Naming

    Process of resolving a network alias using an LDAP-compliant directory server Clients must be configured to use LDAP-compliant directory server

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    3/97

    LDAP is an Internet standard for directory services. A well defined standard interface to a single, extensible directory service, such as the Oracle

    Internet Directory Rapid development and deployment of directory-enabled applications An array of programmatic interfaces that enables seamless deployment of Internet-ready

    applications.

    Directory Services: Oracle Internet DirectoryAn Oracle database-based LDAP V3 directory server with the high performance, scalability, robustness,and availability of Oracle9i, used for centralizing database user,Features:

    1. Integrates tightly with Oracle8i and Oracle9i databases.2. Scalability, secure Internet Computing3. Secure & reliable directory structure

    High AvailabilityOracle Internet Directory is designed to meet the needs of a variety of important applications. Forexample, it supports full, multimaster replication between directory servers: If one server in a replicationcommunity becomes unavailable, then a user can access the data from another server. Information about

    changes made to directory data on a server is stored in special tables on the Oracle9i database. Theseare replicated throughout the directory environment byOracle9i Replication, a robust replicationmechanism.Oracle Internet Directory also takes advantage of all the availability features of the Oracle9i. Becausedirectory information is stored securely in the Oracle9i database, it is protected by Oracle's backupcapabilities. Additionally, the Oracle9i database, running with large datastores and heavy loads, canrecover from system failures quickly.SecurityOracle Internet Directory offers comprehensive and flexible access control. An administrator can grant orrestrict access to a specific directory object or to an entire directory subtree. Moreover, Oracle InternetDirectory implements three levels of user authentication: anonymous, password-based, and certificate-based using Secure Socket Layer (SSL) Version 3 for authenticated access and data privacy.

    Scalability: Oracle Shared ServerA database server that is configured to allow many user processes to share very few server processes, sothe number of users that can be supported is increased. With shared server configuration, many userprocesses connect to a dispatcher. The dispatcher directs multiple incoming network session requests toa common queue. An idle shared server process from a shared pool of server processes picks up arequest from the queue. This means that a small pool of server processes can serve a large number ofclients. Contrast with dedicated server.Dispatcher: A process that enables many clients to connect to the same server without the need for adedicated server process for each client. A dispatcher handles and directs multiple incoming networksession requests to shared server processes.

    Enables large no. of user to connect a database simultaneously Database resources are shared resulting in efficient memory and processing usage Connections are routed via a dispatcher Server process are not dedicated to each client Server processes serve client processes as needed

    Known as Oracle Multithreaded Server in Oracle8i

    Scalability: Connection ManagerConnection Manager is a gateway process and control program tool normally configured and installed ona middle tier. Connection Manager offers:

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    4/97

    Multiplexing of connections: Connection Manager can handle several incoming connections and transmitthem simultaneously over a single outgoing connection to the destination. The configuration is offeredonly in a TCP/IP environment. Cross-protocol connectivity: Using this feature, a client and a server can communicate with differentnetwork protocols. Network access control: Using Connection Manager, designated clients can connect to certain servers ina network based on the TCP/IP protocol.

    Benefits of Connection Manager Supports more users on the end tier if you use a middle tier to deploy Connection Manager andprovides for better use of resources and scalability Enables cross-protocol communication Can act as an access control mechanism

    Security: Oracle Advanced Security FeaturesOracle Advanced Security provides data privacy, integrity, authentication, single sign-on, andEncryption /Data Privacy: Encodes between network nodes RC4 Encryption, DES Encryption, Triple-DES EncryptionAuthentication:

    User authentication through several third-party authentication services, and through the use of SSL anddigital certificates Kerberos, Radius, CyberSafeData Integrity To ensure data integrity of data packets during transmission, Using MD5 or SHA encryption algorithmsSingle sign-on lets a user access multiple accounts and applications with a single password, enteredduring a single connection.

    Security: Oracle Net Services & firewalls Oracle Corporation works with key firewall vendors to provide firewall support. Oracle Net Firewall Proxy kit allows firewall vendors to provide Connection support for Oracleenvironment.

    Oracle Net Firewall Proxy based on Oracle Connection Manager Two types: Proxy based firewalls Stateful packet inspection firewalls

    Accessibility: Heterogeneous ServicesMuch of the processing power of Oracle Transparent Gateways for Oracle7 and earlier versions of thesever has been integrated into Oracle8i and later versions of the Oracle database server as a modulecalled Heterogeneous Services. Enables access of legacy data as if it resides in a single, local relational database. Retrieve and modify data stored in a non-Oracle system using Oracle SQL dialect. Execute stored procedures at the non-Oracle systems, services or APIs using Oracle PL/SQL calls. Issue these SQL statements or PL/SQL calls from either Oracle client applications like SQL*Plus orOracle programmatic interfaces like Pro*C or OCI.The term "non-Oracle system" refers to the following:Any system accessed by PL/SQL procedures written in C (that is, by external procedures)Any system accessed through SQL (that is, by Oracle Transparent Gateways or generic connectivity)Any system accessed procedurally (that is, by procedural gateways)Oracle Transparent Gateway for Sybase on Solaris to access a Sybase database system operating on aSun Solaris platform or DB2, SQL Server, Informix

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    5/97

    Accessibility: External Procedures Functions written in 3GL language can be called from PL/SQL Allows developers more flexibility than SQL or PL/SQL provide Listener can listen for external procedure calls PL/SQL passes the following information to extproc (loads the shared library and invokes the ExternalProcedure):

    1. Shared library name

    2. External Procedure Name3. Parameters

    A PL/SQL procedure executing on an Oracle server can call an external procedure or function that iswritten in the C programming language and stored in a shared library. In order for the Oracle database toconnect to external procedures, the server must be configured with a net service name and the listenermust be configured with protocol address and service information. Oracle Net Configuration Assistantautomatically configures the necessary information during installation.

    Oracle Net Services Configuration and Administration ToolsOracle Net managerA graphical user interface tool that combines configuration abilities with Oracle Names component controlto provide an integrated environment for configuring and managing Oracle Net. It can be used on either

    the client or server. Integrated with Oracle Enterprise managerOracle Net Configuration AssistantOracle Net Configuration Assistant allows you to configure basic elements of the network, includingnaming methods, listeners, and directory service access.Oracle Net Configuration Assistant runs in twodifferent modes: installation mode and stand-alone mode.Oracle Net Control UtilitiesOracle Net Manager provides the following tools to help you start, stop, configure and control eachNetwork component.- Listener Control utility- Oracle Connection Manager- Oracle Names Control utility

    *************************************************************************************

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    6/97

    CHAP 2 Oracle Net Architecture

    Oracle Net connectionsUsed to establish connections between applications on a network depending on:- The network configuration- The locations of the nodes- The applications

    - The network protocolConnections types- Client-server Application- Java Application- WebClient Application

    Client server application connection

    This illustration depicts the various layers of stack communication used in a client/server applicationconnection. On the client side, from the top down, the stack is constructed with the following layers: Client Application (uses OCI) Presentation - TTC Oracle Net Foundation Layer

    Oracle Protocol Support Network Protocol (TCP/IP, TCP/IP with SSL, VI, LU6.2)On the server side, from the top down, the stack is constructed with the following layers: RDBMS(uses OPI) Presentation - TTC Oracle Net Foundation Layer Oracle Protocol Support Network Protocol (TCP/IP, TCP/IP with SSL, VI, LU6.2)The Oracle Net Foundation Layer and Oracle Protocol Support comprise the Oracle Net. Associated withthe Oracle Net Foundation Layer on the client side is naming methods. Associated with Oracle NetFoundation Layer on both the client and server sides is security services.Client ApplicationDuring a session with the database, the client uses Oracle Call Interface (OCI)to interact with thedatabase server. OCI is a software component that provides an interface between the client applicationand the SQL language the database server understands.

    Two-Task Common (TTC)The presentation layer of OSI model used by client/server applications isTwo-Task Common (TTC). TTCprovides character set and data type conversion between different character sets or formats on the clientand database server.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    7/97

    Oracle Net Foundation LayerThe Oracle Net foundation layer is responsible for establishing and maintaining the connection betweenthe client application and database server, as well as exchanging messages between them. The OracleNet foundation layer is able to perform these tasks because of a technology called Transparent NetworkSubstrate (TNS). TNS provides a single, common interface functioning over all industry-standardprotocols. In other words, TNS enables peer-to-peer application connectivity. In a peer-to-peerarchitecture, two or more computers (called nodes when they are employed in a networking

    environment) can communicate with each other directly, without the need for any intermediary devices.On the client side, the Oracle Net foundation layer receives client application requests and resolves allgeneric computer-level connectivity issues, such as: The location of the database server or destination Whether one or more protocols are involved in the connection How to handle interrupts between client and database server based on the capabilities of eachOn the server side, the Oracle Net foundation layer performs the same tasks as it does on the client sideand also works with the listener to receive incoming connection requests.In addition to establishing and maintaining connections, the Oracle Net foundation layer communicateswith naming methods to resolve names and uses Oracle Advanced security services to ensure secureconnections. Oracle Net Foundation Layer - implementation of Session Layer in OSI Model

    Oracle Protocol SupportPositioned between the Oracle Net foundation layer and the network protocol layer, the Oracle protocolsupport layer is responsible for mapping TNS functionality to industry-standard protocols used in theclient/server connection. This layer supports the following network protocols: TCP/IP TCP/IP with SSL Named Pipes LU6.2 VI

    Oracle Program Interface (OPI)Instead of OCI, the database server usesOracle Program Interface (OPI). For each statement sent fromOCI, OPI provides a response.

    Web client application connectionUsing an application web server as a middle tier that is configured either of the following: The JDBC OCI driver (Java Application Client) The JDBC Thin driver (Java Applet Client)Connecting directly using HTTP/IIOP

    Web client application connection: Middle Tier Application Web ServerJava Application/Applet Client (Web Browser) ---HTTP Application Web server (client) Oracle Net/TCP/IPOracle Server

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    8/97

    Left Right

    Left figure: This illustration depicts stack communication layers used by JDBC drivers. The JDBC OCIdriver stack, from the top down, is constructed with the following layers:

    Java Client Application JDBC OCI Driver (uses OCI) Presentation - TTC Oracle Net Foundation Layer Oracle Protocol Support (TCP/IP, TCP/IP with SSL, VI, LU6.2) Network Protocol

    Right figure: The JDBC Thin driver stack, from the top down, is constructed with the following layers:

    JavaApplet / Application JDBC Thin Driver Presentation - JavaTTC JavaNet TCP/IP Network Protocol

    Web Connection using HTTP/IIOPOracle Net is not required but Oracle Database server must support the protocols/ Application Web servernot required. Client (Web Browser) ---HTTP/IIOPOracle Server(Oracle server support HTTP/IIOP)

    Web clients that do not require an application Web server to access applications can access the Oracledatabase directly, for example, by using a Java applet. In addition to regular connections, the databasecan be configured to accept HTTP and Internet Inter-ORB Protocol (IIOP) connections. These protocolsare used for connections to Oracle9i JVM in the Oracle9i instance.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    9/97

    The Oracle database server is also configured to support HTTP and IIOP.One Web browser uses the HTTP protocol to connect to the Oracle Net layer on the database server. Thesecond Web browser uses the IIOP protocol to connect to the Oracle Net layer on the database server.The third Web browser shows a communication stack. From the top down, the stack is constructed withthe following layers: 1. Java Applet 2.JDBC Thin Driver 3. JavaNetThis browser uses the TCP/IP network protocol to connect to the Oracle Net layer on the database.

    Connectivity Concepts and TerminologyDatabase Services: A database service entry contains the actual name of the database, as well as severalattributes, including those that constitute the connect descriptor.Service Name:A logical representation of a database, which is the way a database is presented to clients.Content Descriptor: The destination service is identified by its service name for Oracle9i or Oracle8idatabases or its Oracle System Identifier (SID) for Oracle8 databases.Listener: A process that resides on the server whose responsibility is to listen for incoming clientconnection requests and manage the traffic to the server. Every time a client requests a network sessionwith a server, a listener receives the actual request. If the client information matches the listenerinformation, then the listener grants/hands requests a connection to the server.Service Registration: Service registration provides the listener with the following information: Servicename for each running instance of the database Instance names(s) of the database Service handlers

    (dispatchers and dedicated server) available for the instance Dispatcher, instance, and node loadinformationService Handlers: Connection Points to an Database server; used as dedicated servers or dispatchers

    Oracle Net Configuration Models:Localized management: Network address information stored in local (tnsnames.ora) files on eachcomputer in the network.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    10/97

    Centralized management:Network address information is stored in centralized directory services, including a LDAP-compliantdirectory server or an Oracle Names server.Note: In future releases, Oracle Names will not be supported as a centralized naming method.Oracle naming methods:A resolution method used by a client application to resolve a name to a network address when

    attempting to connect to a database service. Oracle Net supports five naming methods:Local naming:A naming method that resolves a net service name, stored in a client's tnsnames.ora file,to a connect descriptor. Local naming is most appropriate for simple distributed networks with a smallnumber of services that change infrequently.Directory naming: A naming method that resolves a connect identifier to a connect descriptor, stored in acentral directory server or in an LDAP-compliant directory server, including Oracle Internet Directory,Microsoft Active Directory, or Novell Directory Services.Oracle Names: An Oracle directory service made up of a system of Oracle Names servers that providename-to-address resolution for each Oracle Net service on the network. Oracle names naming if you havean existing release 8.0 or release 7.x configurationHost naming:A naming method that enables users to connect to an Oracle database server by using ahost name alias in a TCP/IP environment. Host names are mapped to the server's global database name

    in an existing names resolution service, such as Domain Name System (DNS), Network InformationService (NIS) or a centrally-maintained set of /etc/hosts files.External naming:A category of naming methods that resolves services, stored in non-Oracle namingservices, to network addresses. External naming methods include: Network Information Service (SunNIS), Cell Directory Service (DCE CDS)Note: Small organization with a few databases can use Host naming or Local naming,Large organization with several databases should use Directory naming in a centralized LDAP-compliantdirectory server.

    Oracle Net Configuration Filesldap.ora: Located on the database server and client computers configured for centralized managementfeatures, this file contains parameters necessary to access a directory server.listener.ora: Located on the database server, this configuration file for the listener includes:

    * Protocol addresses it is accepting connection requests on* Database and nondatabase services it is listening for* Control parameters used by the listener

    names.ora: Located on the Oracle Names server, this file includes the location, domain information, andoptional configuration parameters for an Oracle Names server.sqlnet.ora: Located on client and database server computer, this file may contain:

    * Client domain to append to unqualified service names or net service names* Order of naming methods the client should use when resolving a name* Logging and tracing features to use* Route of connections* Preferred Oracle Names servers* External naming parameters* Oracle Advanced Security parameters* Database access control parameters

    tnsnames.ora: Located on the clients, this file contains net service names mapped to connect descriptors.This file is used for the local naming method.Note: Configuration files are typically created in $ORACLE_HOME/network/admin on UNIX, andORACLE_HOME\network\admin on Windows operating systems.*However, configuration files can be created in a variety of places, because Oracle Net searches for theconfiguration files in the following order:

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    11/97

    For sqlnet.ora and ldap.ora file, the current working directory from where an application is run.1. The directory specified by the TNS_ADMIN environment variable If the TNS_ADMIN environmentvariable is not defined as a variable on Windows NT, it may be in the registry.2. The $ORACLE_HOME/network/admin directory on UNIX, and the ORACLE_HOME\network\admindirectory on Windows operating systems.

    For cman.ora, listener.ora and tnsnames.ora1. The directory specified by the TNS_ADMIN environment variable If the TNS_ADMIN environmentvariable is not defined as a variable on Windows NT, it may be in the registry.2. On Unix global configuration directory. For Sun Solaris, this directory is /var/opt/oracle.4. The $ORACLE_HOME/network/admin directory on UNIX, and the ORACLE_HOME\network\admindirectory on Windows operating systems.

    Note: TNS_ADMIN :You can add the TNS_ADMIN parameter to change the directory name forconfiguration files from the default location. For example, if you set TNS_ADMIN toORACLE_BASE\ORACLE_HOME\test\admin, the configuration files are used fromORACLE_BASE\ORACLE_HOME\test\admin.

    *************************************************************************************

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    12/97

    CHAP 3 Basic Oracle Net Server Side Configuration

    Characteristics of the Listener ProcessThe listener is a process running on a node that listens for incoming connections on behalf of a databaseor a number of databases. The following are the characteristics of a listener: A listener process can listen for more than one database.

    Multiple listeners can listen on behalf of a single database to perform load balancing. The listener can listen on multiple protocols. The default name of the listener in Net8/Oracle Net is LISTENER. The name of the listener must be unique on the machine on which it resides, and per listener.ora file.

    Note: Oracle9i database only supported by an Oracle9i Listener, Oracle9i Listener can be used for earlierversions of Oracle database.

    Connection Methods:When a connection request is made by a client to a server, the listener performs one of the following: Spawns a process and bequeaths (passes) the connection to it (Dedicated Server Configuration) Hands Off the connection to a dispatcher in an Oracle Shared server configuration (not possible for

    Dedicated Server Configuration) Redirects the connection to a dispatcher or an existing server process (Shared Server Configuration)Note: connection session is bequeathed, Handed off or Redirected to an existing process the session istransparent to user. Detected only by turning on the tracing

    SPAWNED OR BEQUEATH SESSIONWhen the listener spawns a dedicated server process and bequeaths (passes) the connection to thededicated server process, the session is called a Bequeath session.The following sequence of events occurs:

    1. The listener receives a client connection request.2. The listener starts a dedicated server process, and the dedicated server inherits the connection

    request from the listener.3. The client is now connected directly to the dedicated server.

    If, because of OS or protocol a connection cannot be passed between two different processes on thesame machine, a redirect must take placed instead.Note: When a client disconnects, the dedicated server process associated with the client closes.

    This illustration shows the connection sequence described in the preceding text. It also shows a databaseinstance that contains a dedicated server process, enabling the client a connection to an Oracle database.

    Note: USE_SHARED_SOCKET:You can set the USE_SHARED_SOCKET parameter to TRUE to enablethe use of shared sockets. If this parameter is set to true, the network listener passes the socketdescriptor for client connections to the database thread. As a result, the client does not need to establisha new connection to the database thread and database connection time improves. Also, all database

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    13/97

    connections share the port number used by the network listener, which can be useful if you are settingup third-party proxy servers. FALSE is default.This parameter only works in dedicated server mode in a TCP/IP environment (using Windows SocketsAPI WINSOCK2). If this parameter is set, you cannot use the 9.0 listener to spawn Oracle 7.x databases.To spawn a dedicated server for an Oracle database not associated with the same Oracle home as thelistener and have shared socket enabled, you must also set the variable USE_SHARED_SOCKET for bothOracle homes.

    DIRECT HAND OFF CONNRECTIONSThe listener uses the dispatcher as a type of service handler to which it can direct client requests. Whenclient a client request arrives, the listener performs one of the following actions:

    Hands the connection request directly to a dispatcher. Issues a redirect message to the client, containing the protocol address of a dispatcher. The

    client then terminates the network session to the listener and establishes a network session tothe dispatcher, using the network address provided in the redirect message.

    The listener uses direct hand off whenever possible. Redirect messages are used, for example, whendispatchers are remote to the listener.

    1. The listener receives a client connection request.2. The listener hands the connect request directly to the dispatcher.

    3. The client is now connected to the dispatcher.

    This illustration shows the direct hand-off sequence described in the preceding text. It also shows adatabase instance that contains a dispatcher and two shared server processes. One of the shared serverprocesses picks up the connection request from the dispatcher, enabling a connection to an Oracledatabase.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    14/97

    REDIRECTED SESSION1. The listener receives a client connection request.2. The listener provides the location of the dispatcher to the client in a redirect message.3. The client connects directly to the dispatcher.

    This illustration shows the redirected connection sequence described in the preceding text. It also showsa database instance that contains a dispatcher and two shared server processes. One of the sharedserver processes picks up the connection request from the dispatcher, enabling a connection to an Oracledatabase.

    Service configuration and Registration:Listener configuration by two ways:Dynamic Service RegistrationA feature by which relies the PMON processautomatically registers information with a listener. Becausethis information is registered with the listener, the listener.ora file does not need to be configured with

    this static information.StaticService RegistrationFor Oracle8 and earlier releases, The listener.ora file must be configured, required for OEM and Externalprocedures or Heterogeneous Services.Service registration provides the listener with information about:

    1. Service names for each running instance of the database2. Instance names of the database3. Service handlers (dispatchers and dedicated servers) available for each instance4. These enable the listener to direct a client request appropriately.5. Dispatcher, instance, and node load information6. This load information enables the listener to determine which dispatcher can best handle a client

    connection request. If all dispatchers are blocked, the listener can spawn a dedicated server forthe connection.

    Dynamic Service registration offers the following benefits:Simplified configurationService registration reduces the need for the SID_LIST_LISTENER_NAME parameter setting, whichspecifies information about the databases served by the listener, in the listener.ora file.Note: The SID_LIST_listener_name parameter is still required if you are using Oracle Enterprise Managerto manage the database.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    15/97

    Connect-time failoverBecause the listener always knows the state of the instances, service registration facilitates automaticfailover of the client connect request to a different instance if one instance is down.In a static configuration model, a listener would start a dedicated server upon receiving a client request.The server would later find out that the instance is not up, causing an "Oracle not available" errormessage.Connection load balancing

    Service registration enables the listener to forward client connect requests to the least loaded instanceanddispatcher or dedicated server. This balances the load across the service handlers and nodes.

    Static Service Registration: Listener.ora fileWhen the Oracle software is installed, the LISTENER.ORA file is created for the starter database with thefollowing default settings: Listener name LISTENER Port 1521 Protocols TCP/IP and IPC SID name Default instance Host name Default host name

    The listener.ora file is used to configure the listener. The listener.ora file must reside on the machine ornode on which the listener is to reside. The listener.ora file contains configuration information for thefollowing: The listener name The listener address Databases that use the listener Listener parameters

    # LISTENER.ORA Network Configuration File: C:\oracle\ora92\network\admin\listener.ora# Generated by Oracle configuration tools.# The name of the listener. The default name is LISTENER.LISTENER =(DESCRIPTION_LIST =

    (DESCRIPTION =# The ADDRESS_LIST parameter contains a block of addresses at which the listener listens for# incoming connections. Each of the addresses defined in this block represents a different way by which# a listener receives connection.

    (ADDRESS_LIST =# IPC addresses identify both incoming connection requests from applications on the same node as the# listener and information# sent or registered by a database dispatcher. If the IPS addresses identify connection requests from the# same node, the KEY value # is equal to the service name of the database. If the addresses identify a# database dispatcher, the KEY value is equal to the database system identifier (SID). If the service# name is the same as the SID, only one IPC address is needed.

    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)))(ADDRESS_LIST =

    # The TCP address identifies incoming TCP connections from clients on the network attempting to# connect to port 1521. The clients use the port defined in their tnsnames.ora file to connect to this# listener. Based on the SID_LIST defined for this listener, the listener specifies the database to which to# connect.

    (ADDRESS = (PROTOCOL = TCP)(HOST = Comp1)(PORT = 1521)))

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    16/97

    ))

    # A listener can listen for more than one database on a machine.# The SID_LIST_listener_name block or parameter is where these SIDs are defined.SID_LIST_LISTENER =# The SID_LIST parameter is defined if more than one SID is defined.(SID_LIST =

    # The SID_DESC parameter must exist for each defined SID.(SID_DESC =(SID_NAME = PLSExtProc)

    # The ORACLE_HOME is where the home directory of the database is defined.# This enables the listener to identify the location of a database executable file.

    (ORACLE_HOME = C:\oracle\ora92)(PROGRAM = extproc)

    )# SID_DESC should match the value of the SERVICE_NAMES parameter in initialization parameter file

    (SID_DESC =# identifies Global Database name (form database_name.database_domain asGLOBAL_DBNAME: ORADB.us.oracle.com where db_name: ORADB db_Domain: us.oracle.com )

    (GLOBAL_DBNAME = ORADB.us.oracle.com)(ORACLE_HOME = C:\oracle\ora92)# The SID_NAME parameter defines the name of the SID on behalf of which the listener accepts# connections.

    (SID_NAME = ORADB))

    # By default, an example SID is defined here.#...sample additional SID description ...)STARTUP_WAIT_TIME_LISTENER = 0CONNECT_TIMEOUT_LISTENER = 10TRACE_LEVEL_LISTENER = OFF

    Listener.ora parameters

    Parameter DescriptionADDRESS Defines a single listener protocol address.

    CONNECT_TIMEOUT_listener_nameSets the number of seconds that the listener waits for theserver process to get a valid database query after the sessionhas started.

    LOG_DIRECTORY_listener_name(UNIX: $ORACLE_HOME/network/logNT: ORACLE_HOME\network\log)

    Controls the directory in which the log file is written.

    LOG_FILE_listener_name(listener.log)

    Specifies the filename to which the log information is written.

    LOGGING_listener_name(ON)

    By default, logging is always on unless you provide thisparameter and turn logging off.

    PASSWORDS_listener_name Sets a nonencrypted password for authentication to theListener Control utility (LSNRCTL).SAVE_CONFIG_ON_STOP_listener_name(FALSE)

    Any changes made by the LSNRCTL SET command are madepermanent if the parameter is set to TRUE.

    SERVICE_LIST_listener_name Defines the service served by the listener. This is the same asthe SID_LIST, made more generic for nondatabase servers.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    17/97

    SID_LIST_listener_name Defines the SID of the databases served by the listener. List ofSID descriptions

    STARTUP_WAIT_TIME_listener_name Sets the number of seconds that the listener sleeps beforeresponding to the first LSNRCTL STATUS command. Thisassures that a listener with a slowprotocol has time to start up before responding to a status

    request.TRACE_DIRECTORY_listener_name(UNIX: $ORACLE_HOME/network/traceNT: ORACLE_HOME\network\ltrace)

    Controls the directory in which the trace file is written.

    TRACE_FILE_listener_name(listener.trc)

    Sets the name of the trace file.

    TRACE_LEVEL_listener_name(OFF)

    Turns tracing off or to a specified level.

    USE_PLUG_AND_PLAY_listener_nameInstructs the listener to register with a well-known Namesserver. Continues to look for a well-known Names server untilone is found.

    Dynamic service registration: Configuring Service Registration

    Dynamic service registration is configured in the database initialization file. It does not require anyconfiguration in the listener.ora file. However, listener configuration must be synchronized with theinformation in the database initialization file.To ensure service registration works properly, the initialization parameter file should contain the followingparameters:SERVICE_NAMES for the database service nameINSTANCE_NAME for the instance nameFor example:SERVICE_NAMES=sales.us.acme.comINSTANCE_NAME=salesThe SERVICE_NAMES defaults to the global database name, which is comprised of the valuesfrom the DB_NAME and DB_DOMAIN parameters in the initialization parameter file.

    Dynamic service registration: Registering Information with the Default, Local ListenerBy default, the PMON process registers service information with its local listener on the default localaddress of TCP/IP, port 1521. As long as the listener configuration is synchronized with the databaseconfiguration, PMON can register service information with a nondefault local listener or a remote listeneron another node.If you want PMON to register with a local listener that does not use TCP/IP, port 1521,configure the LOCAL_LISTENER parameter in the initialization parameter file to locate the local listener. Ifyou are using shared server, you can also use the LISTENER attribute of the DISPATCHERS parameter inthe initialization parameter file to register the dispatchers with a nondefault local listener.

    Note: The LISTENER attribute overrides the LOCAL_LISTENER parameter.Set the LOCAL_LISTENER parameter as follows:

    LOCAL_LISTENER=listener_aliasSet the LISTENER attribute as follows:DISPATCHERS="(PROTOCOL=tcp)(LISTENER=listener_alias)"listener_alias is then resolved to the listener protocol addresses through a naming method, such as atnsnames.ora file on the database server.For example, if the listener is configured to listen on port 1421 rather than port 1521, you can set theLOCAL_LISTENER parameter in the initialization parameter file as follows:

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    18/97

    LOCAL_LISTENER=listener1Using the same listener example, you can set the LISTENER attribute as follows:DISPATCHERS="(PROTOCOL=tcp)(LISTENER=listener1)"You can then resolve listener1 in the local tnsnames.ora as follows:listener1=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1421)))

    Configuring Protocol Addresses Listener for Oracle9i JVMConnections to Oracle9i JVM (formerly named Oracle JServer in release 8.1) require the TCP/IP or TCP/IPwith SSL listening protocol addresses with presentation information.If the database is release 8.1 or earlier, configure protocol addresses statically, using the followingprocedure, even if a release 9.0 listener is used. If both listener and database are release 9.0, thisprocedure is unnecessary because configuration occursdynamically during service registration.To configure a protocol address for Oracle JServer release 8.1:1. Start Oracle Net Manager.2. In the navigator pane, expand Local > Listeners.3. Select an existing listener.4. From the list in the right pane, select Listening Locations.

    5. Choose Add Address. A new Address tab appears.6. Select the TCP/IP or TCP/IP with SSL protocol from the Protocol list.7. Enter the host name of the database in the Host field.8. Enter port 2481 if the selected protocol is TCP/IP in the Port field, or enter port 2482 if theselected protocol is TCP/IP with SSL in the Port field.9. Choose "Statically dedicate this address for JServer connections".10. Choose File > Save Network Configuration.The listener.ora file updates with the following:listener=(DESCRIPTION_LIST=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=2481))(PROTOCOL_STACK=

    (PRESENTATION=giop)(SESSION=raw))))

    LSNRCTL:Once the listener is configured, the listener can be administered with the Listener Control utilityUsing LSNRCTL commandMicrosoft Windows XP [Version 5.1.2600](C) Copyright 1985-2001 Microsoft Corp.C:\>lsnrctlLSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 09-OCT-2006 11:27:59Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.Welcome to LSNRCTL, type "help" for information.LSNRCTL>Control non default listener1. LSNRCTL> set current_listener [listener_name] 2.$listener start [listener_name]Starting and Stopping the ListenerSTOP Command: To stop the listener from the command line, enter:lsnrctl STOP [listener_name] or $listener stop [listener_name]where listener_name is the name of the listener defined in the listener.ora file. It is not necessary toidentify the listener if you are using the default listener, named LISTENER.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    19/97

    START Command: To start the listener from the command line, enter:lsnrctl START [listener_name] $listener start [listener_name]where listener_name is the name of the listener defined in the listener.ora file. It is not necessary toidentify the listener if you are using the default listener, named LISTENER.In addition to starting the listener, the Listener Control utility verifies connectivity to the listener.

    Monitoring Runtime Behavior: The STATUS and SERVICES commands provide information about the

    listener. When entering these commands, follow the syntax as shown for the STOP and STARTcommands.

    STATUS CommandThe STATUS command provides basic status information about a listener, including a summary of listenerconfiguration settings, the listening protocol addresses, and a summary of services registered with thelistener.STATUS Specifies the following: (status can obtain by OEM console)

    * Name of the listener* Version of listener* Start time and up time* Tracing level

    * Logging and tracing configuration settings* listener.ora file being used* Whether a password is set in listener.ora file* Whether the listener can respond to queries from an SNMP-based network management system

    You need to set an encrypted password for the listener, LSNR. Which two options could you use to setthe password? (Choose two.)A. use Oracle Net ManagerB. use the Listener Control utility

    LSNRCTL SET and SHOW ModifiersThe SET modifier is used to change listener parameters in the Listener Control utility environment.

    LSNRCTL> SET trc_level ADMINThe SHOW modifier is used to display the values of the parameters set for the listener.LSNRCTL> SHOW connect_timeout

    Command Description

    SET CONNECT_TIMEOUTDetermines the amount of time the listener waits for a valid connectionrequest after a connection has been started.

    SET CURRENT_LISTENER Sets or shows parameters when multiple listeners are used.

    Command Description

    CHANGE_PASSWORD Dynamically changes the encrypted password of a listener.EXIT Quits the LSNRCTL utility.HELP Provides the list of all available LSNRCTL commands.QUIT Provides the functionality of the EXIT command.RELOAD Shuts down everything except listener addresses and rereads the listener.ora

    file. You use this command to add or change services without actually stoppingthe listener.

    SAVE_CONFIGCreates a backup of your listener configuration file (called listener.bak) andupdates the listener.orafile itself to reflect any changes.

    SERVICES Provides detailed information about the services the listener listens for.SET parameter This command sets a listener parameter.SHOW parameter This command lists the value of a listener parameter.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    20/97

    SET LOG_DIRECTORYSets a nondefault location for the log file or to return the location tothe default.

    SET LOG_FILE Sets a nondefault name for the log file.SET LOG_STATUS Turns listener logging on or off.

    SET PASSWORDChanges the password sent from the LSNRCTL utility to the listenerprocess for authentication purposes only.

    SET SAVE_CONFIG_ON_STOPSaves any changes made by the LSNRCTL SET command permanentlyif the parameter is on. All parameters are saved right before thelistener exits.

    SET STARTUP_WAITTIMESets the amount of time the listener sleeps before responding to aSTART command.

    SET TRC_DIRECTORYSets a nondefault location for the trace file or to return the location tothe default.

    SET TRC_FILE Sets a nondefault name for the trace file.SET TRC_LEVEL Turns on tracing for the listener.Note: The SHOW command has the corresponding parameters of the SET command except PASSWORD.*************************************************************************

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    21/97

    CHAP 4 Naming Method Configuration

    Host Naming: Connecting to oracle database using Oracle Net Services Client Software Your client and server are connecting using TCP/IP. The host name is resolved through an IP address translation mechanism such as Domain NameServices (DNS), Network Information Services (NIS), or a centrally maintained TCP/IP /etc/hosts file.

    No Oracle Connection Manager features or security options are requested.Advantages:

    1. Requires minimal user configuration. The user can provide only the name of the host to establisha connection.

    2. Eliminates the need to create and maintain a local names configuration file (tnsnames.ora)3. Eliminates the need to understand Oracle Names or OID administration procedures.

    Disadvantage:Available only in a limited environment, identify only one SID per node.

    Host Naming Client Side: Client-Side RequirementsIf you are using the host naming method, you must have TCP/IP installed on your client machine. Inaddition you must install Oracle Net Services and the TCP/IP protocol adaptor.

    The host name is resolved through an IP address translation mechanism such as Domain Name Services(DNS), Network Information Services (NIS), or a centrally maintained TCP/IP host file: that means thatthis should be configured from the client side before attempting to use the host naming method.Required: sqlnet.ora file [names.directory_path = (HOSTNAME)]

    Host Naming Server Side: Server-Side RequirementsIf you are using the host naming method, you must have TCP/IP installed on your server machine aswell. You also need to install Oracle Net Services and the TCP/IP protocol adaptor on the server side. Default listener named LISTENER running on TCP/IP, port 1521. The LOCAL_LISTENER parameter is set in the initialization parameter file to locate the local listener.Note: The host name must match the connect string you specify from your client. The additionalinformation included is the database to connect to.Required: sqlnet.ora [names.directory_path = (HOSTNAME, tnsnames)] and tnsnames.ora file

    File Example: listener.oraSID_LIST_LISTENER =(SID_LIST =(SID_DESC =(GLOBAL_DBNAME = wwed151-sun.us.oracle.com) # Host Naming Server Side(ORACLE_HOME = /oracle803)(SID_NAME = TEST)Connecting from client: sqlplus username/[email protected]

    Local NamingSimple distributed networks with a small number of services that change infrequently.Advantages:

    * Provides a relatively straightforward method for resolving net service name addresses* Resolves net service names across networks running different protocols* Configured using Graphical configuration tool (Oracle Net Manager)

    Disadvantage: Requires local configuration of all net service name and address changes stored intnsnames.ora fileRequired: Client> sqlnet.ora and tnsnames.ora file Server> listener.ora fileRequired: sqlnet.ora [names.directory_path = (tnsnames)]

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    22/97

    Generated Files:tnsnames.ora fileA configuration file that contains net service names mapped to connect descriptors. This file is used forthe local naming method. The tnsnames.ora file must reside in one of the following locations:

    1. The directory specified by the TNS_ADMIN environment variable If the TNS_ADMIN environmentvariable is not defined as a variable on Windows NT, it may be in the registry.

    2. The node's global configuration directory. For Sun Solaris, this directory is /var/opt/oracle.Windows NT does not have a central directory.

    3. The $ORACLE_HOME/network/admin directory on UNIX or the ORACLE_HOME\network\admindirectory on Windows operating systems.

    Which one of the following statements about the TNSPING utility is correct?Ans. It does not require the username and password to check the connectivity of the service.

    # TNSNAMES.ORA Network Configuration File: C:\oracle\ora92\network\admin\tnsnames.ora# Generated by Oracle configuration tools.

    ORADB =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = papai)(PORT = 1521))

    )(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = ORADB)

    ))

    INST1_HTTP =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = papai)(PORT = 1521))

    )(CONNECT_DATA =(SERVER = SHARED)(SERVICE_NAME = MODOSE)(PRESENTATION = http://HRService)

    ))

    EXTPROC_CONNECTION_DATA =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

    )

    (CONNECT_DATA =(SID = PLSExtProc)(PRESENTATION = RO)

    ))

    Parameter Description

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    23/97

    ORADB NET Service name and domain name.

    DESCRIPTIONKeyword for describing the connect descriptor.Descriptions are always specified the same way.

    ADDRESSKeyword for the address specification. If multipleaddresses are specified, use the keywordADDRESS_LIST prior to the ADDRESS.

    PROTOCOL Specifies the protocol used.

    HOSTProtocol-specific information for TCP/IPspecifies thehost name of the server or IP address. Can differ foranother protocol.

    PORT Protocol specific information for TCP/IPspecifies theport number on which the server side listener islistening.

    CONNECT_DATA Specifies the database SID to which to connect.

    sqlnet.ora fileA configuration file for the client or server that specifies the:

    Client domain to append to unqualified service names or net service names

    Preferred order of naming methods that the client should use when resolving a name External naming parameters

    The sqlnet.ora file must reside in one of the following locations:1. The directory specified by the TNS_ADMIN environment variable If the TNS_ADMIN environment

    variable is not defined as a variable on Windows NT, it may be in the registry.2. The $ORACLE_HOME/network/admin directory on UNIX or the ORACLE_HOME\network\admin

    directory on Windows operating systems.

    # SQLNET.ORA Network Configuration File: C:\oracle\ora92\network\admin\sqlnet.ora# Generated by Oracle configuration tools.SQLNET.AUTHENTICATION_SERVICES= (NTS)NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)NAMES.DIRECTORY_PATH parameter controls how Oracle Net Services resolves net service names into

    correct descriptors

    Configuring the client profile (sqlnet.ora file) with USE_DEDICATED_SERVER=onto enableDEDICATED_SERVER from shared server environment.

    Troubleshooting

    ORA-12154: TNS:could not resolve service nameCause: Oracle Net could not locate the content descriptor/net service name specified in the tnsnames.oraconfiguration file.Action: Perform these steps:1. Verify that a tnsnames.ora file exists.2. Verify that there are not multiple copies of the tnsnames.ora file.3. In the tnsnames.ora file, verify that the net service name specified in your connect string is mapped toa connect descriptor.4. Verify that there are no duplicate copies of the sqlnet.ora file.5. If you are using domain names, verify that your sqlnet.ora file contains a NAMES.DEFAULT_DOMAINparameter. If this parameter does not exist, you must specify the domain name in your connect string.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    24/97

    6. If you are not using domain names, and this parameter exists, delete it or disable it by commenting itout.7. If you are connecting from a login dialog box, verify that you are not placing an "@" symbol beforeyour connect net service name.8. Activate client tracing and repeat the operation.

    ORA-12198: TNS:could not find path to destinationORA-12203: TNS:unable to connect to destinationCause: The client cannot find the desired database.Action: Perform these steps:1. Verify that you have entered the net service name you wish to reach correctly.2. Verify that the net service name ADDRESS parameters in the connect descriptor.3. If using local naming, verify that the tnsnames.ora file is stored in the correct directory.4. Verify that the listener on the remote node has started and is running.Enter: lsnrctlLSNRCTL> STATUS [listener_name]

    listener_name is the name of the listener defined in the listener.ora file. It is not necessary to identify thelistener if you are using the default listener, named LISTENER.If the output indicates the listener is not running, try starting it with the command:LSNRCTL> START [listener_name]5. If you are connecting from a login box, verify that you are not placing an "@" symbol before yourconnect net service name.

    ORA-12533: TNS:illegal ADDRESS parametersCause: The protocol specific parameters in the ADDRESS section of the designated connect descriptor areincorrect.Action: Correct the protocol address.

    TNS-12541 TNS:no listener

    Cause: The connection request could not be completed because the listener is not running.Action: Ensure that the supplied destination address matches one of the addresses used by the listener.Compare the TNSNAMES.ORA entry with the appropriate LISTENER.ORA file (or TNSNAV.ORA if theconnection is to go by way of an Interchange). Check STATUS of listener and START the listener on theremote machine.

    ORA-12520 TNS:listener could not find available handler for requested type of server Which actionshould you take first to investigate the problem?Ans. Executing the LSNRCTL SERVICES command to verify that the instances are registeredwith the listener and that the appropriate service handler exists and is ready

    *************************************************************************

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    25/97

    CHAP 5 Usage and Configuration of Oracle Shared Server

    Server ConfigurationsDedicated server (two-task) processShared server process [part of Oracle Shared server architechture]

    Dedicated Server Processes

    The user process and server process are separate. Each user process has its own server process. The user and server processes can run on different machines to take advantage of distributedprocessing. There is a one-to-one ratio between the user and server processes. Even when the user process is not making a database request, the dedicated server exists but remainsidle. The dedicated server process is sometimes referred to as a shadow process, because it is acting onbehalf of one user process only.

    The program interface in use here depends on whether the user and the dedicated server processes areon the same machine. If they are, the host operating systems interprocess communication mechanism is

    used for the program interface between processes.

    The Oracle Shared ServerIn a shared server configuration, client user processes connect to a dispatcher. PMON process registersthe location and load the dispatchers with the listener. Service Registration does not require , thelistener.ora file.

    A dispatcher can support multiple client connections concurrently. Each client connection isbound to a virtual circuit. A virtual circuit is a piece of shared memory used by the dispatcher for clientdatabase connection requests and replies. The dispatcher places a virtual circuit on a common queuewhen a request arrives.

    An idle shared server picks up the virtual circuit from the common queue, services the request,and relinquishes the virtual circuit before attempting to retrieve another virtual circuit from the commonqueue. This approach enables a small pool of server processes to serve a large number of clients. A

    significant advantage of shared server architecture over the dedicated server model is the reduction ofsystem resources, enabling the support of an increased number of users.

    The shared server architecture requires Oracle Net Services. User processes targeting the sharedserver must connect through Oracle Net Services, even if they are on the same machine as the Oracleinstance.

    There are several things that must be done to configure your system for shared server.A number of different processes are needed in a shared server system:

    1. A network listener process that connects the user processes to dispatchers or dedicated servers(the listener process is part of Oracle Net Services, not Oracle).

    2. One or more dispatcher processes3. One or more shared server processes

    Benefits of Oracle Shared Server Reduces the number of processes against an instance Increases the number of possible users Achieves load balancing Reduces the number of idle server processes Reduces memory usage and system overhead

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    26/97

    When to Use a Dedicated Server Submitting batch jobs (it is expected that there will be little or no idle time) Connecting with Server Manager as SYSDBA to start up, shut down, or perform recovery Connecting as internal

    To request a dedicated server, the clause SERVER=DEDICATED must be included in the Oracle Net TNS

    connection string within the tnsnames.ora file:

    TEST.world =(DESCRIPTION =

    (ADDRESS =(PROTOCOL = TCP)(HOST = wwed151-sun)(PORT = 1521)

    )(CONNECT_DATA = (SERVICE_NAME = TEST.US.ORACLE.COM)

    (SERVER=DEDICATED))

    )

    Technical Note: For most platforms, if your machine has plenty of memory to support dedicatedservers, you should use that configuration. In this situation, performance is likely to be better.There are exceptions such as NT, in which performance may improve using the shared serverconfiguration due to the asynchronous nature of shared server architecture.

    Connecting to the Shared Server1 The listener process waits for any connection requests from a user process. When a process requests aconnection, the listener determines whether to connect the user process a dispatcher (depending on theload of the dispatcher) or assign it a dedicated server process.2 If the user process can connect to a dispatcher, the listener gives the user process the address of adispatcher process. If the user process requests a dedicated server, the listener creates a dedicated

    server process and connects the user process to it.3 Once the connection has been established, either through a dispatcher or a dedicated server process,the connection is maintained for the duration of the session.

    Technical NoteIf the user call is from across a network, the dispatcher process chosen by the listener must match theprotocol of the network being used.

    Processing a Request1 A user sends a request to its dispatcher.2 The dispatcher places the request into the request queue in the System Global Area (SGA).3 A shared server picks up the request from the request queue and processes the request.4 The shared server places the response on the calling dispatchers response queue.5 The response is handed off to the dispatcher.6 The dispatcher returns the response to the user.Once the user call has been completed, the shared server process is released and is available to serviceanother user call in the request queue.

    Request Queue One request queue is shared by all dispatchers.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    27/97

    Shared servers monitor the request queue for new requests. Requests are processed on a first-in, first-out basis.

    Response Queue Shared servers place all completed requests on the calling dispatchers response queue. Each dispatcher has its own response queue in the SGA. Each dispatcher is responsible for sending completed requests back to the appropriate user process.

    Users are connected to the same dispatcher for the duration of a session.

    The SGA and PGAThe contents of the System Global Area (SGA) and the Program Global Area (PGA) differ when dedicatedservers or shared servers are used.Dedicated Server:user session data is kept in the PGA.SGA:Shared pool and other memory structuresPGA:Stack space|User session data|Cursor state

    Shared Server:user session data is held in the SGA.DSGA:[User session data|Cursor state] Shared pool and other memory structuresPGA:Stack space

    Text and parsed forms of all SQL statements are stored in the SGA. The cursor state contains run-time memory values for the SQL statement, such as rows retrieved. User session data includes security and resource usage information. The stack space contains local variables for the process.Technical Note: The change in the SGA and PGA is transparent to the user; however, if supportingmultiple users, you need to increase the SHARED_POOL_SIZE per connection.Each shared server process needs to access the data spaces of all sessions so that any server can handlerequests from any session. Space is allocated in the SGA for each sessions data space. You can limit theamount of space that a session can allocate by setting the resource limit PRIVATE_SGA to the desiredamount of space in the user profile.

    Initialization Parameters for Shared Server

    Parameter Description

    Required Initialization Parameters for Shared Server

    DISPATCHERS Configures dispatcher processes in the shared server architecture.

    SHARED_SERVERS Specifies the number of shared server processes created when an instanceis started up.

    Optional. If you do not specify the following parameters, Oracle selects appropriate defaults.

    MAX_DISPATCHERS Specifies the maximum number of dispatcher processes that can runsimultaneously.

    MAX_SHARED_SERVERS Specifies the maximum number of shared server processes that can runsimultaneously.

    CIRCUITS Specifies the total number of virtual circuits that are available for inboundand outbound network sessions.

    SHARED_SERVER__SESSIONS Specifies the total number of shared server user sessions to allow. Settingthis parameter enables you to reserve user sessions for dedicated servers.

    Other initialization parameters affected by shared server that may require adjustment.

    LARGE_POOL_SIZE Specifies the size in bytes of the large pool allocation heap. Shared server

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    28/97

    Parameter Description

    may force the default value to be set too high, causing performanceproblems or problems starting the database.

    SESSIONS Specifies the maximum number of sessions that can be created in thesystem. May need to be adjusted for shared server.

    The DISPATCHERS ParameterDISPATCHERS configures dispatcher processes in the shared server architecture. The parsing softwaresupports a name-value syntax to enable the specification of attributes in a position-independent case-insensitive manner. For example: DISPATCHERS = (PROTOCOL=TCP) (DISPATCHERS=3)Parameter Type String (Specify as a quoted string)Parameter class: Dynamic (can use ALTER SYSTEM to modify)Default value: NULL

    Attribute Description

    PROTOCOL(PRO or PROT)

    The network protocol for which the dispatchers listen

    ADDRESS (ADD or ADDR) The network address on which the dispatchers listen (Includes the

    protocol)DESCRIPTION (DES or DESC) The network description of the end point on which the dispatchers will

    listen (Includes the protocol)DISPATCHERS(DIS or DISP)

    The initial number of dispatchers to start (default is 1)

    SESSIONS (SES or SESS) The maximum number of network sessions for each dispatcherDefault is OS specific (16k)

    LISTENER (LIS, LIST) The network name of an address or address list of the listeners withwhich the dispatchers register (The listener or listeners can reside onother nodes.)The LISTENER attribute facilitates administration of multi-homed hosts.This attribute specifies the appropriate listeners with which thedispatchers will register. The LISTENER attribute overrides theLOCAL_LISTENER parameter. non-default port (not 1521)

    CONNECTIONS (CON orCONN)

    An integer specifying the maximum number of network connections toallow for each dispatcher. The default is set by OS-specific. 1024 forSolaris and NT

    Initial no. of dispatchers = CEIL(avg. no of concurrent sessions/connections per dispatcher)900 users concurrently connected by TCP/IP and supports 255 connections per process.Ceil(900/255) = ceil(3.52) = 4DISPATCHERS = (PROTOCOL=TCP) (DISPATCHERS=4)Connections per dispatcher dependence in OS.n.b. CEIL returns smallest integer greater than or equal to n.Example: The following example returns the smallest integer greater than or equal to 15.7:

    SELECT CEIL(15.7) "Ceiling" FROM DUAL; Ceiling: 16

    MAX_DISPATCHERSMAX_DISPATCHERS specifies the maximum number of dispatcher processes allowed to be runningsimultaneously. The default value applies only if dispatchers have been configured for the system.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    29/97

    The value of MAX_DISPATCHERS should at least equal the maximum number of concurrent sessionsdivided by the number of connections for each dispatcher. For most systems, a value of 250 connectionsfor each dispatcher provides good performance. if the parameter file starts dispatchers for TCP and IPC,you cannot later start dispatchers for protocol without changing the parameter file and restarting theinstance.

    Parameter type: IntegerDefault value: 5Parameter class: StaticRange of values: 5 or the number of dispatchers configured, whichever is greater [OS dependent]

    MAX no. of dispatchers = CEIL(MAX no of concurrent sessions/connections per dispatcher)Adding or Removing Dispatchers If the load on the dispatcher processes is consistently high, start additional dispatcher processes toroute user requests without waiting. You may start new dispatchers until the number of dispatchersequals MAX_DISPATCHER. The load on the dispatchers can be monitored using the data dictionary views V$CIRCUIT and V$DISPATCHER.

    In contrast, if the load on dispatchers is consistently low, reduce the number of dispatchers.The following example adds a dispatcher process where the number of dispatchers was previously two:ALTER SYSTEM SET DISPATCHERS=(PROTOCOL=TCP)(DISPATCHERS=3);You can also use the ALTER SYSTEM command to remove dispatchers to the number specified inDISPATCHERS. If you want to have fewer than that, edit the init.ora file, and bounce the database.

    SHARED_SERVERSSHARED_SERVERS specifies the number of server processes that you want to create when an instance isstarted up. If system load decreases, this minimum number of servers is maintained. Therefore, youshould take care not to set SHARED_SERVERS too high at system startup.

    Parameter type: IntegerDefault value: If you are using shared server architecture, then the value is 1. If you are not

    using shared server architecture, then the value is 0.Parameter class: Dynamic: ALTER SYSTEMRange of values: Operating system-dependent

    Modifying the Minimum Number of Shared Server ProcessesAfter starting an instance, you can change the minimum number of shared server processes by using theSQL ALTER SYSTEM command. Oracle will eventually terminate servers that are idle when there are more shared servers than theminimum limit you specify. If you set SHARED_SERVERS to 0, Oracle terminates all current servers when they become idle anddoes not start any new servers until you increase SHARED_SERVERS. Setting SHARED_SERVERS to 0 effectively disables the multithreaded server temporarily.To control the minimum number of shared server processes, you must have the ALTER SYSTEM privilege.The following statement sets the number of shared server processes to two: ALTER SYSTEM SETSHARED_SERVERS = 2

    MAX_SHARED_SERVERSMAX_SHARED_SERVERS specifies the maximum number of shared server processes allowed to berunning simultaneously. If artificial deadlocks occur too frequently on your system, you should increase

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    30/97

    the value of MAX_SHARED_SERVERS.Allocates shared servers dynamically based on length of requestqueue.

    Parameter type: IntegerDefault value: Derived from SHARED_SERVERS (either 20 or 2*SHARED_SERVERS)Parameter class: StaticRange of values: Operating system-dependent

    Estimating the Maximum Number of Shared ServersIn general, set this parameter for an appropriate number of shared server processes at times of highestactivity. Experiment with this limit, and monitor shared servers to determine an ideal setting for thisparameter.To get the maximum numbers of servers started, query the data dictionary viewV$SHARED_SERVER_MONITOR.

    CIRCUITSCIRCUITS specifies the total number of virtual circuits that are available for inbound and outboundnetwork sessions. It is one of several parameters that contribute to the total SGA requirements of aninstance.

    Parameter type: IntegerDefault value: Derived:

    * If you are using shared server architecture, then the value of SESSIONS* If you are not using the shared server architecture, then the value is 0

    Parameter class: Static

    SHARED_SERVER_SESSIONSSHARED_SERVER_SESSIONS specifies the total number of shared server architecture user sessions toallow. Setting this parameter enables you to reserve user sessions for dedicated servers.

    Parameter type: IntegerDefault value: Derived: the lesser of CIRCUITS and SESSIONS - 5

    Parameter class: StaticRange of values: 0 to SESSIONS - 5

    Verifying Setup Verify that the dispatcher has registered with the listener when the database was started by issuing:

    $ lsnrctl servicesLSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 11-OCT-2006 09:14:29Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))Services Summary...Service "ORADB" has 2 instance(s).Instance "ORADB", status UNKNOWN, has 1 handler(s) for this service...Handler(s):"DEDICATED" established:0 refused:0

    LOCAL SERVERInstance "ORADB", status READY, has 1 handler(s) for this service...Handler(s):"DEDICATED" established:0 refused:0 state:ready

    LOCAL SERVERService "ORADBXDB" has 1 instance(s).

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    31/97

    Instance "ORADB", status READY, has 1 handler(s) for this service...Handler(s):"D000" established:0 refused:0 current:0 max:1002 state:ready

    DISPATCHER (ADDRESS=(PROTOCOL=tcp)(HOST=papai)(PORT=1075))

    Service "PLSExtProc" has 1 instance(s).Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

    Handler(s):"DEDICATED" established:0 refused:0

    LOCAL SERVERThe command completed successfully

    Verify that you are connected using Shared Server by making a single connection. Query V$CIRCUIT,and that should show one entry per Shared Server connection.

    *****Select dispatcher, circuit, server, status from V$CIRCUIT;

    The following are useful views for obtaining information about your shared server configuration and formonitoring performance.

    View Description

    V$DISPATCHER Provides information on the dispatcher processes, including name,network address, status, various usage statistics, and index number.

    V$DISPATCHER_RATE Provides rate statistics for the dispatcher processes.

    V$QUEUE Contains information on the shared server message queues.

    V$SHARED_SERVER Contains information on the shared server processes.

    V$CIRCUIT Contains information about virtual circuits, which are user connectionsto the database through dispatchers and servers.

    V$SHARED_SERVER_MONITOR Contains information for tuning shared server.

    V$SESSION This View lists session information for each current session. V$SGA Contains size information about various system global area (SGA)

    groups. May be useful when tuning shared server.

    V$SGASTAT Detailed statistical information about the SGA, useful for tuning.

    V$SHARED_POOL_RESERVED Lists statistics to help tune the reserved pool and space within theshared pool.

    *************************************************************************

    CHAP 6 Backup and Recovery Overview

    Backup and Recovery Issues

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    32/97

    Protect the database from numerous types of failures Increase Mean-Time-Between-Failures (MTBF) Decrease Mean-Time-To-Recover (MTTR) Minimize data loss

    This section contains these topics:* Statement Failure

    * Process Failure* User Error* Network Failure* Database Instance Failure* Media FailureStatement Failures:Causes of Statement Failures Logic error in an application Attempt to enter bad data into the table Attempt an operation with insufficient privileges Attempt to create a table but exceed allotted quota limits Attempt an INSERT or UPDATE to a table, causing an extent to be allocated, but with insufficient free

    space left in the tablespace

    Resolutions for Statement Failures Correct the logic flow of the program. Modify and reissue the SQL statement. Provide the necessary database privileges. Change the users quota limit by using the ALTER USER command. Add file space to the tablespace. Enable resumable space allocation

    User Process Failures:Causes of User Process Failures The user performed an abnormal disconnect in the session.

    The users session was abnormally terminated. The users program raised an address exception terminating the session.

    Resolution of User Process Failures PMON rolls back the transaction and releases any resources and locks being held by it. The PMON process detects an abnormally terminated user process.

    PMON Background ProcessThe PMON background process is usually sufficient for cleaning up after an abnormally terminated userprocess. The PMON process detects an abnormally terminated server process. The PMON process rolls back the transaction of the abnormally terminated process, and releases anyresources and locks it has acquired.

    User Error Failures:Common Causes of User Error Failures The user accidentally drops or truncates a table. The user deleted all rows in a table that are required. The user committed data, but discovered an error in committed data.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    33/97

    Resolution of User Errors Train the database users. Recover from a valid backup. Bring back or Import a table from export file. Use LogMiner to determine the time of error. Recover with a point-in-time recovery. Use LogMiner to perform object level recovery.

    [LogMiner is a relational tool that lets you read, analyze, and interpret online and archived log files usingSQL. You can also use LogMiner Viewer to access LogMiner functionality. LogMiner Viewer, which isavailable with Oracle Enterprise Manager, provides a graphical user interface to LogMiner.] Use FlashBack to view and repair historical data.[Oracle9iprovides a new feature called Flashback Query, which lets you view and repair historical data.Flashback Query offers the ability to perform queries on the database as of a certain wall clock time oruser-specified system commit number (SCN).]

    Network FailureWhen your system uses networks such as local area networks and phone lines to connect clientworkstations to database servers, or to connect several database servers to form a distributed databasesystem, network failures such as aborted phone connections or network communication software failures

    can interrupt the normal operation of a database system. For example:* A network failure can interrupt normal execution of a client application and cause a process failure tooccur. In this case, the Oracle background process PMON detects and resolves the aborted serverprocess for the disconnected user process, as described in the previous section.

    * A network failure can interrupt the two-phase commit of a distributed transaction. After the networkproblem is corrected, the Oracle background process RECO of each involved database automaticallyresolves any distributed transactions not yet resolved at all nodes of the distributed database system.

    Instance Failure:An instance failure may occur for numerous reasons: A power outage occurs that causes the server to become unavailable. The server becomes unavailable due to hardware problems such as a CPU failure or memory corruptionor the operating system crashes.

    One of the Oracle server background processes (DBWR, LGWR, PMON, SMON, CKPT) experiences afailure.

    To recover from instance failure, the DBA: Starts the instance by using the startup command. The Oracle server will automatically recover,performing both the roll forward and rollback phases. Investigates the cause of failure by reading the instance alert.log file and any other trace files that weregenerated during the instance failure

    Recovery from Instance Failure No special recovery action needed from DBA Start the instance Wait for the database to be opened notification Notify users Check alert file to get the reason of the failure

    No recovery action needs to be performed by you. All required redo information is read by SMON. Torestore from this type of failure, start the database:SQL> connect / as sysdba;Connected.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    34/97

    SQL> startup pfile=initDB00.ora;. . .Database opened. After the database has opened, notify users that any data that they did not commit will need to be re-entered. There may be a time delay between starting the database and the Database opened notificationthisis the roll forward phase that takes place while the database is mounted.

    SMON performs the roll forward process by applying changes recorded in the online redo log files fromthe last checkpoint. Rolling forward recovers data that has not been recorded in the database files, but has been recordedin the online redo log, including the contents of rollback segments. Rollback can occur while the database is open, since either SMON or a server process can perform therollback operation. This allows the database to be available for users faster.

    Media Failures:Causes of Media Failures Head crash on a disk drive Physical problem in reading from or writing to database files File was accidentally erased

    Resolutions for Media Failures The recovery strategy depends on which backup method was chosen and which files are affected. If available, apply archived redo log files to recover data committed since the last backup.

    Defining a Backup and Recovery Strategy Business requirements Technical requirements Operational requirements Management concurrence

    Questions for the DBAHere are some questions to consider when selecting a backup strategy:

    Does management understand the tradeoffs involved in their expectations of system availability? Is management willing to dedicate the resources needed to ensure a successful backup and recoverystrategy? Does management understand the importance of making backups and prepare recovery procedures?

    Business requirementsMTTR (Mean-Time-To-Recover):Database availability is a key issue for a DBA. In the event of a failure the DBA should strive to reducethe Mean-Time-To-Recover (MTTR). This strategy ensures that the database is unavailable for theshortest possible amount of time. Anticipating the types of failures that can occur and using effectiverecovery strategies, the DBA can ultimately reduce the MTTR.MTBF (Mean-Time-Between-Failure):Protecting the database against various types of failures is also a key DBA task. To do this, a DBA mustincrease the Mean-Time-Between-Failures (MTBF). The DBA must understand the backup and recoverystructures within an Oracle database environment and configure the database so that failures will notoccur often.Evolutionary Process: A backup and recovery strategy evolves as business, operational, and technicalrequirements change. It is important that both the DBA and management review the validity of a backupand recovery strategy on a regular basis.

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    35/97

    Operational Requirements 24-hour operations User and operator appreciation Testing and validating backups

    Testing BackupsHere are some questions to consider when selecting a backup strategy:

    Can I depend on system administrators, vendors, backup DBAs, and so forth when I need help? Can I test my backup and recovery strategies at frequently scheduled intervals? Are backup copies stored off-site? Is a plan well documented and maintained?

    Database VolatilityOther issues that impact operational requirements include the volatility of the data and structure of thedatabase. Here are some questions to consider when selecting a backup strategy: Are tables frequently updated? Is data highly volatile? If so, you will need backups more frequently than a business where data isrelatively static. Does the structure of the database change often?

    How often do you add data files?

    Technical Requirements Resources: Hardware, software, manpower, and time Physical image copies of the operating system files Logical copies of the objects in the database Database configurations Transaction volume affects desired frequency of backups

    Here are some questions to consider when selecting a backup strategy: How much data do you have? Do you have the machine power and capacity to support backups? Is the data easily recreated?

    Can you reload the data into the database from a flat file? Does the database configuration support resiliency to different types of failures?

    Disaster Recovery Issues How will your business be affected in the event of a major disaster? Earthquake, flood, fire, or complete loss of machine Malfunction of storage hardware or software Loss of key personnel, such as the database administrator Do you have a plan for testing your strategy periodically? Do you perform the strategy tests?

    Natural DisasterPerhaps your data is so important that you must ensure resiliency even in the event of a complete systemfailure. Natural disasters and other issues can affect the availability of your data and must be consideredwhen creating a disaster recovery plan. Here are some questions to consider when selecting a backupstrategy: What will happen to your business in the event of a serious disaster such as: Flood, fire, earthquake, or hurricane Malfunction of storage hardware or software

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    36/97

    If your database server fails, will your business be able to operate during the hours, days, or evenweeks it might take to get a new hardware system? Do you store backups off-site?Solutions Off-site backups Standby Database feature that enables a DBA to fall back on another database that is configured as astandby in case the primary database fails.

    Geomirroring Messaging TP monitorsLoss of Key PersonnelIn terms of key personnel, consider the following questions: How will a loss of personnel affect your business? If your DBA leaves the company or is unable to work, will your database system continue to run? Who will handle a recovery situation if the DBA is unavailable?

    Oracle Availability and FeaturesOracle features for maintaining high availability of database include:Oracle Parallel Server: Oracle Parallel Server is an optional feature that enables multiple database

    instances to use one single database on a cluster. So, when one node fails, another node can take overthe tasks of the first node. The implementation of Oracle Parallel Server is discussed in detail in aseparate course, Implementing Parallel Server.Oracle FailSafe: The Oracle FailSafe feature is available on WindowsNT platforms only. In thisenvironment, two nodes share a disk system on which a database is located. At any one point, only oneinstance is operational. When the instance that is operational fails, the other node instantiates (starts theinstance) automatically.

    ************************************************************************

    CHAP 7 Instance Media Recovery Structures

    Memory Structures:

  • 8/14/2019 Oracle9i DBA Fundamentals II Handbook

    37/97

    Type Description

    Data buffer cacheMemory area used to store blocks read from data files. Data is read into theblocks by server process and written out by DBWn asynchronously.

    Log bufferMemory containing before and after image copies of changed data to be writtento the redo logs.

    Large pool

    An optional memory area used in SGA for I/O by RMAN backup and restore,

    session memory for oracle share server and Oracle XA.

    Shared poolStores parsed versions of SQL statements, PL/SQL procedures, and datadictionary information.

    Java Pool Used in server memory for all session specific Java code and data within JVM.

    Background Processes

    Type Description

    Database writer(DBWn)

    Writes dirty buffers from the data buffer cache to the data files. This activity isasynchronous.

    Log writer(LGWR) Writes data from the redo log buffer to the redo log files.

    System monitor(SMON)

    Performs automatic instance recovery. Recovers space in temporary segmentswhen they are no longer in use. Merges contiguous areas of free space

    depending on parameters set.Process monitor(PMON)

    Cleans up the connection/server process dedicated to an abnormally terminateduser process. Performs rollback and releases the resources held by the failedprocess.

    Checkpoint(CKPT)

    Synchronizes the headers of the data files and control files with the current redolog and checkpoint numbers.

    Archiver (ARCn)(optional)

    A process that automatically copies redo logs that have been marked forarchiving.

    The User ProcessThe user process is created