6 Understanding the Oracle RAC Installed Configuration

There are many ways in which the Oracle Real Application Clusters (Oracle RAC) database is different from a single-instance Oracle database.

6.1 Understanding the Configured Environment in Oracle RAC

Oracle Net Configuration Assistant (NETCA) and Database Configuration Assistant (DBCA) configure your environment to meet the requirements for database creation and Oracle Enterprise Manager discovery of Oracle RAC databases.

Note:

Configuration files are created on each node of your cluster database.

Avoid changing host names after you complete your Oracle RAC installation, including adding or deleting domain qualifications. Node names are created from the host names during an Oracle Clusterware installation and are used extensively with database processes. Nodes with changed host names must be deleted from the cluster and added back with the new host names.

6.2 Understanding Operating System Privileges Groups

As an administrator, you often perform special operations such as shutting down or starting up a database, or configuring storage. Because only an administrator responsible for these administration decisions should perform these operations, system privileges for Oracle Database or Oracle Automatic Storage Management (Oracle ASM) administration require a secure authentication scheme.

Membership in special operating system groups enables administrators to authenticate to Oracle Database or Oracle ASM through the operating system rather than with a user name and password. This is known as operating system authentication. Each Oracle Database in a cluster can have its own operating system privileges groups, so that operating system authentication can be separated for each Oracle Database on a cluster. Because there can be only one Oracle Grid Infrastructure installation on a cluster, there can be only one set of operating system privileges groups for Oracle ASM.

During installation of Oracle Grid Infrastructure and Oracle Database, the installer creates operating system groups. These operating system groups are designated with the logical role of granting operating system authentication for administration system privileges for Oracle Database and Oracle ASM. Oracle Grid Infrastructure uses operating system authentication to manage Oracle Database. To enable this access, you must set the AUTHENTICATION_SERVICES parameter in the sqlnet.ora file to contain the value NTS, as described in the section "Net Services Profile File (sqlnet.ora)"

You can use a single operating system group as the logical group whose members are granted all system privileges for Oracle Database and Oracle ASM, or you can delegate system privileges to two or more operating system groups. Oracle recommends that you designate separate operating system groups for each logical system privilege. Using separate operating system groups enables you to grant one or more subsets of administrator system privileges to database administrators. These database administrators can then perform standard database administration tasks without requiring the SYSDBA system privileges.

System privileges groups are listed in Table 1-1.

See Also:

6.3 Understanding Time Zone Settings on Cluster Nodes

Oracle RAC requires that all cluster nodes have the same time zone setting.

During an Oracle Grid Infrastructure for a cluster installation, the installation process determines the time zone setting of the Oracle Installation user on the node where Oracle Universal Installer (OUI) runs. OUI uses that time zone value on all of the nodes as the default time zone setting for all processes that Oracle Clusterware manages. This default setting is used for databases, Oracle ASM, and any other managed processes.

However, if you start an instance with SQL*Plus, you must ensure that the time zone value that Oracle RAC uses is the same as the Oracle Clusterware time zone. You can change the time zone that Oracle Clusterware uses for a database by running the command:

srvctl setenv database -env 'TZ=time zone

6.4 Understanding the Server Parameter File for Oracle RAC

When you create the database, Oracle Database creates an SPFILE in the file location that you specify. This location can be either an Oracle ASM disk group or a cluster file system.

All instances in the cluster database use the same SPFILE at startup. Because the SPFILE is a binary file, do not directly edit the SPFILE with an editor. Instead, change SPFILE parameter settings using Oracle Enterprise Manager or ALTER SYSTEM SQL statements.

See Also:

Oracle Real Application Clusters Administration and Deployment Guide for information about creating and modifying SPFILE

6.5 Multiple Oracle Home Directories on Windows

Install each Oracle product in its own Oracle home.

The value for %ORACLE_BASE% is stored in the registry (for example, in HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0). The values for ORACLE_HOME and ORACLE_SID are also stored in the registry. Symbolic links for these directories, like those used on UNIX platforms, are not supported on Windows platforms

Oracle Universal Installer (OUI) records the values for environment variables such as ORACLE_BASE, ORACLE_HOME, and ORACLE_SID in the registry and also updates the value for the PATH environment variable for the user performing the installation. In Linux and UNIX systems, you must manually set these environment variables in the user session or user profile.

See Also:

Oracle Database Platform Guide for Microsoft Windows for more information about the registry keys

6.5.1 Changing the Current Setting for Oracle Home

Use Oracle Universal Installer (OUI) to change the current Oracle home.

This procedure changes the value of the default ORACLE_HOME variable in the registry to the value you selected. It also ensures that the %ORACLE_HOME%\bin directories for each product are listed in the correct order in your PATH environment variable.
  1. Start the Oracle Universal Installer.
  2. Click the Installed Products button.
  3. Click the Environment tab at the top of the window.
  4. Move the Oracle home directory that you want as your default to the top of the list.
  5. Apply the changes, and exit the installer.

6.6 About Pluggable Databases in Oracle RAC

A pluggable database (PDB) is a portable collection of schemas, schema objects, and nonschema objects that appears to an Oracle Net client as a non-CDB.

PDBs can be plugged into to CDBs. A CDB can contain multiple PDBs. Each PDB appears on the network as a separate database.

Starting in Oracle Database 12c, you must create a database as either a multitenant container database (CDB) or as an Oracle database that is non-CDB. This also applies to Oracle RAC databases. The only difference to the installation process is to choose whether to create the Oracle RAC database as a CDB or a non-CDB.

If you create an Oracle RAC database as a CDB and plug one or more PDBs into the CDB, then, by default, a PDB is not started automatically on any instance of the Oracle RAC CDB. With the first dynamic database service assigned to the PDB (other than the default database service which has the same name as the database name), the PDB is made available on those instances on which the service runs.

Whether a PDB is available on more than one instance of an Oracle RAC CDB is typically managed by the services running on the PDB. You can manually enable PDB access on each instance of an Oracle RAC CDB by starting the PDB manually on that instance.

See Also:

6.7 Database Components Created Using Database Configuration Assistant

Database Configuration Assistant (DBCA) create various database components.

6.7.1 Tablespaces and Data Files

For both single-instance and cluster database environments, Oracle Database is divided into smaller logical areas of space known as tablespaces.

Each tablespace corresponds to one or more data files on the shared storage.

Table 6-1 Tablespace Names Used with Oracle Real Application Clusters Databases

Tablespace Name Contents

SYSAUX

An auxiliary system tablespace that contains the DRSYS (contains data for Oracle Text), CWMLITE (contains the OLAP schemas), XDB (for XML features), ODM (for Oracle Data Mining), and INDEX schemas

SYSTEM

Consists of the data dictionary, including definitions of tables, views, and stored procedures needed by the database. Oracle Database automatically maintains information in this tablespace.

TEMP

Contains temporary tables and indexes created during SQL statement processing. You may need to expand this tablespace if you run a SQL statement that involves significant sorting, such as ANALYZE COMPUTE STATISTICS on a very large table, or the constructs GROUP BY, ORDER BY, or DISTINCT.

UNDOTBSn

Contains undo tablespaces for each instance that DBCA creates for automatic undo management

USERS

Consists of application data. As you create and enter data into tables, Oracle Database fills this space with your data.

EXAMPLE

Stores the sample schemas, if you opted to include them during database creation.

You cannot alter these tablespace names when using the preconfigured database configuration option from OUI. However, you can change the names of the tablespaces if you use the advanced database creation method.

As mentioned, each tablespace has one or more data files on shared file systems. The data file names created by the preconfigured database configuration options vary by storage type such as Oracle ASM or a cluster file system.

See Also:

6.7.2 About Control Files

The database is configured with two control files that must be stored on shared storage.

Every database must have one unique control file; any additional control files configured for the database are identical copies of the original control file. If a control file becomes unusable, then the database instance fails when it attempts to access the damaged control file. By multiplexing (creating multiple copies of) a control file on different disks, the database can achieve redundancy and thereby avoid a single point of failure.

See Also:

6.7.3 About Online Redo Log Files

Each database instance must have at least two online redo log files. The online redo log files for a database instance are called the redo thread.

Each Oracle RAC database instance has its own redo thread to avoid contention for a single set of online redo log files. In case of instance failure, the online redo log files must be accessible by the surviving instances. Therefore, the online redo log files for an Oracle RAC database must be placed on shared storage or Oracle ASM. If you use a file system for storage, then the file system must be a shared or cluster file system.

The file names of the redo log files that are created with the preconfigured database configuration option vary by storage type.

See Also:

6.8 About Managing Undo Tablespaces in Oracle RAC

Oracle Database stores rollback or undo information in undo tablespaces.

To manage undo tablespaces, Oracle recommends that you use Automatic Undo Management. Automatic Undo Management is an automated management mode for undo tablespaces that is easier to administer than manual undo management.

When Oracle ASM and Oracle Managed Files are used along with Automatic Undo Management, an instance that is started for the first time, and thus does not have an undo tablespace, has its undo tablespace created for it by another instance automatically. The same is also true for online redo logs.

See Also:

6.9 About Initialization Parameter Files

Oracle recommends using the server parameter file (SPFILE) for storing Oracle Database initialization parameters.

Oracle recommends that you store all SPFILEs on Oracle ASM, including the Oracle ASM SPFILE. SPFILEs must be located on shared storage; all instances in a cluster database can access this parameter file.

See Also:

Oracle Real Application Clusters Administration and Deployment Guide for more information about the creation and use of parameter files

6.10 Oracle Net Services Configuration for Oracle RAC Databases

When connecting to an Oracle Database, you can use a connect descriptor or a net service name.

For Oracle RAC databases, you can also use the single client access name (SCAN) to connect to any available instance of the Oracle RAC database. Users can access an Oracle RAC database using a client/server configuration or through one or more middle tiers, with or without connection pooling.

6.10.1 Database Services for an Oracle RAC Database

Each database is represented by one or more services. A service is identified by a service name, such as sales.example.com.

A client uses a service name to identify the database it must access. During installation, Oracle RAC databases are configured with a default database service that has the same name as the database. This service can be used for performing database management tasks. Additional services must be created for client and application connections to the database.

A service name can be associated with multiple database instances, and an instance can be associated with multiple services. The listener acts as a mediator between the client and database instances and routes the connection request to the appropriate instance. Clients connecting to a service do not have to specify which instance they want to connect to.

6.10.2 Naming Methods and Connect Descriptors

Each net service name is associated with a connect descriptor. A connect descriptor provides the location of the database and the name of the database service.

A connect descriptor includes one or more protocol addresses of the listener and the connect information for the destination service.

The information needed to use a service name to create a database connection can be stored in a repository, used by one or more naming methods. A naming method is a resolution method used by a client application to resolve a service name to a connect descriptor. Oracle Net Services offers several types of naming methods that support localized configuration on each client, or centralized configuration that can be accessed by all clients in the network.

6.10.3 Easy Connect Naming Method

The Easy Connect naming method eliminates the need to look up service names in the tnsnames.ora file or other repository for TCP/IP environments.

With Easy Connect, clients use a connect string for a simple TCP/IP address, which consists of a host name, and an optional port and service name. If you use this method, then no naming or directory system is required. See "Example: Connecting to Oracle RAC Using SCANs" for an example.

Networking elements for the Oracle Database server and clients are preconfigured for most environments. The Easy Connect naming method is enabled by default and does not require a repository. If you use a naming method other than Easy Connect, then additional configuration of Oracle Net Services may be required.

6.10.4 Understanding SCANs

The SCAN is a domain name registered to at least one and up to three IP addresses, either in domain name service (DNS) or in Grid Naming Service (GNS).

6.10.4.1 About the SCAN

The SCAN is a domain name registered to at least one and up to three IP addresses, either in domain name service (DNS) or in Grid Naming Service (GNS).

During the installation of Oracle Grid Infrastructure, several Oracle Clusterware resources are created for the SCAN:

  • A SCAN virtual IP (VIP) is created for each IP address that SCAN resolves to

  • A SCAN listener is created for each SCAN VIP

  • A dependency on the SCAN VIP is configured for the SCAN listener

SCANs are defined using one of two options:

  • The SCAN is defined in DNS

    If you configure a SCAN manually, and use DNS for name resolution, then your network administrator should create a single name for the SCAN that resolves to three IP addresses on the same network as the public network for the cluster. The SCAN name must be resolvable without the domain suffix (for example, the address sales1-scan.example.com must be resolvable using sales1-scan). The SCAN must not be assigned to a network interface, because Oracle Clusterware resolves the SCAN.

    The default SCAN is cluster_name-scan.domain_name. For example, in a cluster that does not use GNS, if your cluster name is sales1, and your domain is example.com, then the default SCAN address is sales1-scan.example.com:1521

  • The SCAN is defined in GNS

    When using GNS and DHCP, Oracle Clusterware configures the VIP addresses for the SCAN name that is provided during cluster configuration. The node VIP and the three SCAN VIPs are obtained from the DHCP server when using GNS. If a new server joins the cluster, then Oracle Clusterware dynamically obtains the required VIP address from the DHCP server, updates the cluster resource, and makes the server accessible through GNS.

Oracle recommends that you configure clients connecting to the cluster to use the SCAN name, rather than node VIPs used in releases before Oracle Grid Infrastructure 11g Release 2 (11.2). Clients connecting to Oracle RAC databases using SCANs do not have to be configured with addresses of each node that hosts a particular database or database instance. For example, if you configure policy-managed server pools for a cluster, then connecting to the database using a SCAN enables connections to server pools in that database, regardless of which nodes are allocated to the server pool. You can add or remove nodes from the database without having to reconfigure clients connecting to the database.

See Also:

Oracle Grid Infrastructure Installation Guide for Microsoft Windows x64 (64–bit) for more information about SCAN configuration and requirements

6.10.4.2 SCAN VIP Addresses

SCAN virtual IP addresses (VIPs) function like node VIPs. However, unlike node VIPs, SCAN VIPs can run on any node in the cluster.

Clients (users or applications) that connect using a SCAN instead of a node VIP name or address do not have to update the list of node names or addresses in their local tnsnames.ora file when nodes are added to or removed from the cluster, or when a database instance runs on a different node.

Note:

Configuring three SCAN VIPs in DNS does not by itself ensure failover of connections. Instead, the Oracle Client uses the returned SCAN VIPs to failover the connection request to a different SCAN listener. If the connection attempt to a SCAN VIP fails, then the client uses the next returned SCAN VIP address to connect. For this reason, Oracle recommends that you use Oracle Client 11g Release 2 or later clients for connections that use the SCAN

If you use GNS for name resolution, then you only provide the SCAN name during installation (for example, sales1-scan). GNS obtains DHCP address leases for three IP addresses and resolves these addresses to the SCAN. The GNS daemon listens for registrations. When a SCAN VIP starts on a node, it registers its addresses with GNS.

Service requests to the cluster domain that GNS manages are routed to the GNS VIP address, which routes these requests to the GNS daemon for the cluster. When GNS receives a request from a DNS for the SCAN, it returns the registered addresses of the SCAN listeners to the DNS. The DNS then returns the three SCAN VIP addresses to the client.

See Also:

Oracle Clusterware Administration and Deployment Guide for more information about SCAN names, listeners, and client service requests

6.10.4.3 SCAN Listeners

During Oracle Grid Infrastructure installation, SCAN listeners are created for as many IP addresses as there are SCAN VIP addresses assigned to resolve to the SCAN.

Oracle recommends that the SCAN resolves to three VIP addresses, to provide high availability and scalability. If the SCAN resolves to three addresses, then three SCAN VIPs and three SCAN listeners are created.

Each SCAN listener depends on its corresponding SCAN VIP. The SCAN listeners cannot start until the SCAN VIP is available on a node.

The addresses for the SCAN listeners resolve either through an external domain name service (DNS), or through the Grid Naming Service (GNS) within the cluster. SCAN listeners and SCAN VIPs can run on any node in the cluster. If a node where a SCAN VIP is running fails, then the SCAN VIP and its associated listener fails over to another node in the cluster. If the number of available nodes within the cluster falls to less than three, then one server hosts two SCAN VIPs and SCAN listeners.

See Also:

Oracle Clusterware Administration and Deployment Guide for more information about SCAN listeners

6.10.5 Example: Connecting to Oracle RAC Using SCANs

Oracle recommends that you configure Oracle Real Application Clusters (Oracle RAC) database clients to use the single client access name (SCAN) to connect to the database instead of configuring the tnsnames.ora file.

Clients configured to connect to the cluster using node virtual IP (VIP) addresses for Oracle RAC releases earlier than Oracle Database 11g Release 2 can continue to use their existing connection addresses; using the SCAN is not required. When an earlier release of Oracle Database is upgraded, the database is not only registered with the local listeners, but is also registered with the SCAN listeners, allowing clients to start using the SCAN to connect to that database.

Oracle Database 12c database clients use SCAN to connect to the database. Oracle recommends against using the easy connect method with SCAN because the easy connect method does not have the ability to specify timeouts and retries for connection establishment. Instead, applications should use an Oracle Net connect descriptor with the following format:

(DESCRIPTION =
      (CONNECT_TIMEOUT=90) (RETRY_COUNT=20)(RETRY_DELAY=3) (TRANSPORT_CONNECT_TIMEOUT=3)
                   ( ADDRESS = (PROTOCOL = TCP)(HOST=scan)(PORT=1521)))
                       (CONNECT_DATA=(SERVICE_NAME=service_name)))

scan represents the SCAN for your cluster. If you do not specify a port number, then the default value of 1521 is used for the TCP port identifier. The service_name is the name of a dynamic database service.

  1. If the Oracle RAC database runs on a cluster for which the SCAN is sales1-scan.mycluster.example.com, then you can submit a connection request for the database service oltp.example.com by using a connect descriptor similar to the following:
    sqlplus system/manager@sales1-scan.mycluster.example.com:1521/oltp
    
The method by which the addresses are returned to the client depend on which name resolution method your cluster uses.
  • If using Domain Name System (DNS), then DNS returns all three SCAN VIP addresses to the client.

  • If using Grid Naming Services (GNS), then DNS zone delegation sends the lookup request to GNS, which then returns all three SCAN VIP addresses to the client.

The client software uses one of the returned SCAN VIP addresses to contact a SCAN listener.

When a SCAN listener receives a connection request from a client, the SCAN listener identifies the least loaded instance in the cluster that provides the requested service. It then redirects the connection request to the local listener on the node where the least loaded instance is running, and the client is given the local listener address. The local listener then creates the connection to the database instance.

6.10.6 About Listener Configuration for an Oracle RAC Database

An Oracle RAC database uses multiple listeners to direct client requests to the available instances.

An Oracle database receives connection requests through the local listener. The local listener brokers a client request, handing off the request to the server. The listener is configured with a protocol address, and clients configured with the same protocol address can send connection requests to the listener. When a connection is established, the client and Oracle database communicate directly with one another.

The local listener, or default listener, is located in the Grid home when you have Oracle Grid Infrastructure installed. Local listeners are configured to respond to database connection requests, and to non-database connection requests, such as external procedures or Oracle XML Database (XDB) requests. When the database starts, the Database Agent process (oraagent.exe, previously known as racgimon) sets the LOCAL_LISTENER parameter to a connect descriptor that does not require an Oracle Net service name. The value for LOCAL_LISTENER is computed to be the endpoints of the Grid home listeners.

You can configure multiple Oracle Database listeners, each with a unique name, in one listener.ora file. Multiple listener configurations for database listeners are possible because each of the top-level configuration parameters has a suffix of the listener name or is the listener name itself. To configure a database to register with multiple local listeners, you must manually modify the LOCAL_LISTENER parameter.

Note:

Oracle recommends running only one listener for each node in most customer environments.

For an Oracle RAC database, the database parameter REMOTE_LISTENER identifies the SCAN listeners. The database registers with the local and SCAN listeners by using the connect description information contained in these parameters. Oracle Database 11g Release 2 and later instances only register with SCAN listeners as remote listeners. Upgraded databases register with SCAN listeners as remote listeners, and also continue to register with all node listeners.

The REMOTE_LISTENER parameter for an Oracle RAC database is always set to the SCAN address. For example, if the SCAN for the cluster is myscan, and the GNS subdomain for the cluster is mycluster.example.com, then the REMOTE_LISTENER parameter has the following value:

myscan.mycluster.example.com:1521

Note:

Do not set the REMOTE_LISTENER parameter for an Oracle RAC database to an Oracle Net alias that has a single address that uses the SCAN for the host name (HOST=scan).

6.10.7 Service Registration for an Oracle RAC Database

An Oracle Database 12c Release 1 (12.1) database service automatically registers with the listeners specified in the database initialization parameters LOCAL_LISTENER and REMOTE_LISTENER.

During registration, the listener registration (LREG) process sends information such as the service name, instance names, and workload information to the listeners. This feature is called service registration.

When a listener starts after the Oracle instance starts, and the listener is available for service registration, registration does not occur until the next time the Oracle Database LREG process starts its discovery routine. By default, the LREG discovery routine is started every 60 seconds. To override the 60-second delay, use the SQL statement ALTER SYSTEM REGISTER. This statement forces LREG to register the service immediately

Note:

Oracle recommends that you create a script to run the ALTER SYSTEM REGISTER statement immediately after starting the listener. If you run this statement when the instance is registered and all services are currently registered, or while the listener is down, then the statement has no effect.

See Also:

Oracle Database Net Services Administrator's Guide for more information about service registration

6.10.8 How Database Connections are Created When Using SCANs

Based on the environment, the following actions occur when you use a SCAN to connect to an Oracle RAC database using a service name.

The numbered actions correspond to the arrows shown in the figure displayed after the steps.

  1. The LREG process of each instance registers the database services with the default listener on the local node and with each SCAN listener, which is specified by the REMOTE_LISTENER database parameter. The listeners are dynamically updated on the amount of work being handled by the instances and dispatchers.

  2. The client issues a database connection request using a connect descriptor of the form:

    orausr/@scan_name:1521/webapp
    

    Note:

    If you use the Easy Connect naming method, then ensure that the sqlnet.ora file on the client contains EZCONNECT in the list of naming methods specified by the NAMES.DIRECTORY_PATH parameter.
  3. The client uses DNS to resolve scan_name. After DNS returns the three addresses assigned to the SCAN, the client sends a connect request to the first IP address. If the connect request fails, then the client attempts to connect using the next IP address.

  4. When the connect request is successful, the client connects to a SCAN listener for the cluster that hosts the sales database and has an instance offering the webapp service, which in this example is sales1 and sales2. The SCAN listener compares the workload of the instances sales1 and sales2 and the workload of the nodes on which they run. If the SCAN listener determines that node2 is less loaded than node1, then the SCAN listener selects node2 and sends the address for the local listener on that node back to the client.

  5. The client connects to the local listener on node2. The local listener starts a dedicated server process for the connection to the database.

  6. The client connects directly to the dedicated server process on node2 and accesses the sales2 database instance.

Figure 6-1 Load Balancing Actions for Oracle RAC Connections That Use SCAN

Description of Figure 6-1 follows
Description of "Figure 6-1 Load Balancing Actions for Oracle RAC Connections That Use SCAN"

6.11 Performance Features of Oracle Net Services and Oracle RAC

Oracle RAC databases provide the important benefits of connection load balancing and failover.

6.11.1 Load Balancing of Connections to Oracle RAC Databases

There are two types of load balancing that you can implement for an Oracle RAC database: client-side and server-side load balancing.

Services coordinate their sessions by registering their workload, or the amount of work they are currently handling, with the local listener and the SCAN listeners. Clients are redirected by the SCAN listener to a local listener on the least-loaded node that is running the instance for a particular service. This feature is called load balancing. The local listener either directs the client to a dispatcher process (if you configured the database to use shared servers), or directs the client to a dedicated server process.

Client-side load balancing balances the connection requests across the listeners. With server-side load balancing, the SCAN listener directs a connection request to the best instance currently providing the service by using the load balancing advisory.

See Also:

6.11.2 Connection Failover for Oracle RAC Databases

When a client issues a connection request using SCAN, the three SCAN addresses are returned to the client.

If the first address fails, then the connection request to the SCAN fails over to the next address. Using multiple addresses allows a client to connect to an instance of the database even if the initial instance has failed.

Oracle RAC provides failover with the node VIP addresses by configuring multiple listeners on multiple nodes to manage client connection requests for the same database service. If a node fails, then the service connecting to the VIP is relocated transparently to a surviving node, enabling fast notification of the failure to the clients connecting through the VIP. If the application and client are configured with transparent application failover options, then the client is reconnected to the surviving node.

6.11.3 Shared Server Configuration for an Oracle RAC Database

Standalone Oracle databases perform load balancing by distributing connections among the shared server dispatcher processes.

By default, Oracle Database Configuration Assistant (DBCA) configures your Oracle RAC database with dedicated servers, not shared servers. However, if you select the shared server option when using DBCA, then DBCA configures shared servers. Oracle RAC uses both dedicated and shared server processing when shared servers are configured.

See Also:

Oracle Database Net Services Administrator's Guide for more information about shared server configurations

6.12 Oracle Net Services Configuration Files and Parameters

Networking elements for the Oracle Database server and clients are preconfigured for most environments.

The Easy Connect naming method is enabled by default and does not require a repository. If you use a naming method other than Easy Connect, then additional configuration of Oracle Net Services may be required.

6.12.1 Database Initialization Parameters for Database Service Registration

An Oracle Database 12c Release 1 (12.1) database service automatically registers with the listeners specified in the LOCAL_LISTENER and REMOTE_LISTENER parameters.

During registration, the listener registration (LREG) process sends information such as the service name, instance names, and workload information to the listeners.

When a listener starts after the Oracle instance starts, and the listener is available for service registration, registration does not occur until the next time the Oracle Database LREG process starts its discovery routine. By default, the LREG discovery routine is started every 60 seconds. To override the 60-second delay, use the SQL statement ALTER SYSTEM REGISTER. This statement forces LREG to register the service immediately.

Note:

Oracle recommends that you create a script to run the ALTER SYSTEM REGISTER statement immediately after starting the listener. If you run this statement when the instance is registered and all services are currently registered, or while the listener is down, then the statement has no effect.

See Also:

Oracle Database Net Services Administrator's Guide for more information about service registration

6.12.2 Net Service Names and the tnsnames.ora File

The installation process creates a tnsnames.ora file on each node.

The tnsnames.ora file acts as a repository of net service names. Each net service name is associated with a connect identifier. A connect identifier is an identifier that maps a user-defined name to a connect descriptor. A connect descriptor contains the following information:

  • The network route to the service, including the location of the listener through a protocol address

  • The SERVICE_NAME parameter, with the value set to the name of a database service

Note:

The SERVICE_NAME parameter you use in the tnsnames.ora file is singular, because you can specify only one service name. The SERVICE_NAME parameter is different from the service_names database initialization parameter. The service_names database parameter defaults to the global database name, a name comprising the db_name and db_domain parameters in the initialization parameter file. When you add service names using SRVCTL or Oracle Enterprise Manager Cloud Control, it lists additional cluster-managed services for the database.

The tnsnames.ora file is located in both the Grid_home\network\admin and Oracle_home\network\admin directories. By default, the tnsnames.ora file is read from the Grid home when Oracle Grid Infrastructure is installed.

With Oracle Clusterware 11g Release 2 and later, the listener association no longer requires tnsnames.ora file entries. The listener associations are configured as follows:

  • Oracle Database Configuration Assistant (DBCA) no longer sets the LOCAL_LISTENER parameter. The Oracle Clusterware agent that starts the database sets the LOCAL_LISTENER parameter dynamically, and it sets it to the actual value, not an alias. So listener_alias entries are no longer needed in the tnsnames.ora file.

  • The REMOTE_LISTENER parameter is configured by DBCA to reference the SCAN and SCAN port, without any need for a tnsnames.ora entry. Oracle Clusterware uses the Easy Connect naming method with scanname:scanport, so no listener associations for the REMOTE_LISTENER parameter are needed in the tnsnames.ora file.

Example 6-1 Adding a Second Listener to an Oracle RAC Database

If you created a database named orcl1, to add a second listener, listening on port 2012, use a command similar to the following command to have the database register with both listeners on startup:

SQL> alter system set local_listener='(DESCRIPTION=(
ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.61)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.61)(PORT=2012))))' 
scope=BOTH SID='OCRL1';

See Also:

6.12.3 Net Service Names Created by DBCA

Oracle Database Configuration Assistant creates net service names for connecting to the database instances.

6.12.3.1 Net Service Names for Database Connections

Clients that connect to any instance of Oracle RAC use the SCAN in the connect descriptor.

You can also use net service names to connect to Oracle RAC. The default database service created by Oracle Database Configuration Assistant (DBCA) enables Oracle Enterprise Manager to discover an Oracle RAC database, and must not be used for client connections.

If you use DBCA to create an Oracle RAC database that is a multitenant container database (CDB), then DBCA creates a database service that has the same name as the database. Clients that use this database service can connect to any database instance for the Oracle RAC CDB. However, if you use DBCA to add a pluggable database (PDB) to an existing CDB, then DBCA does not create a database service for the new PDB.

The net service name does not require a fully qualified domain name for the server on which a database, database instance, or listener runs. SCANs are resolved by the DNS or GNS, which returns three addresses to the client. The client then submits connection requests to each address in succession until a connection is made.

Example 6-2 Net Service Name Entry for a Database Connection

This example shows a connect descriptor that is used in a tnsnames.ora file. The connect identifier in this case is the same as the cluster domain, mycluster.example.com. Instead of specifying the address for an individual server, a virtual Internet Protocol (VIP) address, or a cluster node name, the connect descriptor uses the SCAN, which is myscan.mycluster.example.com.

mycluster.example.com =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = host=myscan.mycluster.example.com)
      (PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = myApp)
    )
  )

Oracle Clusterware resolves connection requests that use the net service name mycluster.example.com to any of the database instances of the mycluster database that run the myApp database service. The specific cluster node on which the instance is running is invisible to the client.

6.12.3.2 Net Service Names for Instance Connections

Clients that connect to a particular instance of the database use the net service name for the instance.

Example 6-3 Example Net Service Name Entry for an Instance Connection

In this example, the connect identifier is the same as the instance name, mycluster1.example.com. The connect descriptor uses the SCAN to locate the instance within the cluster. Clients connecting to the net service name mycluster1.example.com are connected to the mycluster1 database instance of the mycluster database. Oracle Clusterware resolves that connection to the cluster node on which the instance is running. The specific cluster node on which the instance is running is invisible to the client.

mycluster1.example.com=
  (DESCRIPTION=
    (ADDRESS=(PROTOCOL=TCP)(HOST=myscan.mycluster.example.com)(PORT=1521))
    (CONNECT_DATA=
      (SERVICE_NAME=mycluster.example.com)
      (INSTANCE_NAME=mycluster1)
    )
  )

6.12.4 Listener Configuration and the listener.ora File

In Oracle RAC environments, Oracle recommends that you let the Oracle Agent manage Oracle listeners for Oracle Databases.

Note:

If you enable GNS, then you do not have to manually configure the listener.

6.12.4.1 Local Listener for an Oracle RAC Database

The local listener, or default listener, is located in the Grid home when you have Oracle Grid Infrastructure installed.

The listener.ora file is located in the Grid_home\network\admin directory. If needed, you can edit the listener.ora file for the Grid home listeners to define listener parameters for node and SCAN listeners. Do not modify the endpoints because these are automatically managed by the listener agent.

During Oracle Database creation, the LOCAL_LISTENER parameter is automatically configured to point to the local listener for the database. You can set a value manually for LOCAL_LISTENER. If you modify the value of the LOCAL_LISTENER parameter, then the Database Agent process does not automatically update this value. Oracle recommends that you leave the parameter unset so that the Database Agent process can maintain it automatically. If you do not set LOCAL_LISTENER, then the Database Agent process automatically updates the database associated with the local listener in the Grid home, even when the ports or IP address of that listener are changed.

See Also:

6.12.4.2 Remote Listeners for an Oracle RAC Database

A remote listener is a listener residing on one computer that redirects connections to a database instance on another computer.

For example, SCAN listeners are remote listeners. In Oracle RAC environments, Oracle recommends that you let the Oracle Agent manage the Oracle listeners for the databases.

See Also:

6.12.4.3 Managing Multiple Listeners for an Oracle RAC Database

In Oracle RAC environments, Oracle recommends that you let the Oracle Agent manage the Oracle listeners for the databases.

  • Use the lsnrctl executable located in the Grid home to administer Oracle Database 12c Release 1 (12.1) local and SCAN listeners.
    Do not attempt to use the lsnrctl executables from Oracle home locations for earlier releases, because they cannot be used with Oracle Database 12c Release 1 (12.1).
  • Use SRVCTL and the setenv command to modify the value of TNS_ADMIN for each listener.
    For listeners not managed by Oracle Clusterware, you can use a nondefault location for the listener.ora file by setting the TNS_ADMIN environment variable or registry value to point to the directory that contains the Oracle Net Services configuration files.

6.12.4.4 How Oracle Database Uses the Listener File (listener.ora)

The listener.orafile is the configuration file for a listener.

The listener.ora file can include the protocol addresses it is accepting connection requests on, a list of the database and other services it is listening for, and control parameters used by the listener. You can modify the configuration of the listeners used by Oracle Clusterware and Oracle Real Application Clusters (Oracle RAC) with Server Control Utility (SRVCTL) commands, or by using Oracle Net Configuration Assistant (NETCA). Manual editing of the listener.ora file is not required.

Each listener is configured with one or more protocol addresses that specify its listening endpoints. The listener agent dynamically updates endpoints with the listener. Starting with Oracle Database 11g Release 2, the listener.ora file now only contains an IPC key and the following information:

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

In the previous example, the protocol ADDRESS refers implicitly to the HOST endpoint of the local node. The listener.ora file is the same on every node for an Oracle RAC database. Listening endpoints, such as the port numbers, are dynamically registered with the listener.

Before you install Oracle RAC, during the Oracle Grid Infrastructure installation, NETCA creates and starts a default listener in the Grid home called LISTENER. The listener is configured with default protocol listening addresses. The listener is configured to respond to connection requests that are directed to one protocol address specified during installation.

During the Oracle RAC installation, the Oracle RAC database uses the listener in the Grid home, and configures service information about the Oracle RAC database. The database services automatically register their information with the listener, such as the service name, instance names, and load information. Dynamic service registration eliminates the need for static configuration of database services. However, static service configuration is required if you plan to use Oracle Enterprise Manager.

Example 6-4 Example listener.ora File for an Oracle RAC Node

The following is an example listener.ora file for the mycluster cluster as it would appear after installation, with an entry for a node named node1 and a SCAN listener.

LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_
SCAN1))))               # line added by Agent
LISTENER_NODE1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))
          # line added by Agent
# listener.ora.mycluster Network Configuration File:
C:\app\oracle\product\12.1.0\dbhome_1\network\admin\listener.ora.mycluster
# Generated by Oracle configuration tools.

LISTENER_NODE1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_NODE1=ON  # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON  # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON  # line added by Agent

6.12.5 Net Services Profile File (sqlnet.ora)

Oracle Universal Installer starts Oracle Net Configuration Assistant (NETCA) after the database software is installed. NETCA creates the Oracle Net Services profile, or the sqlnet.ora file.

In an Oracle Grid Infrastructure installation, the sqlnet.ora file is located in the Grid_home\network\admin directory by default.

For the local listener for the Oracle RAC database instance, the default location of the sqlnet.ora file is %ORACLE_HOME%\network\admin directory. In this directory there is a default sqlnet.ora file. Also, you can find a sample sqlnet.ora file in the subdirectory sample.

During installation of the Oracle RAC software, NETCA creates the following entries in the sqlnet.ora file, where %ORACLE_BASE% is the path to the Oracle base directory for the Oracle RAC installation:

NAMES.DIRECTORY_PATH=(TNSNAMES, EZCONNECT)
ADR_BASE =%ORACLE_BASE%

The AUTHENTICATION_SERVICES parameter (not shown in the above example) specifies the method by which users are authenticated for database access. The value NTS indicates that Microsoft Windows native authentication should be used to authorize access to the database. Oracle Databases that use Oracle Automatic Storage Management (Oracle ASM) and the databases that are managed by Oracle Grid infrastructure must use Windows native authentication, which is enabled by default.

The parameter NAMES.DIRECTORY_PATH specifies the priority order of the naming methods to use to resolve connect identifiers to connect descriptors. The ADR_BASE parameter specifies the base directory into which tracing and logging incidents are stored when Automatic Diagnostic Repository (ADR) is enabled for the database.

See Also: