7 Understanding the Oracle RAC Installed Configuration

This chapter describes the Oracle Real Application Clusters (Oracle RAC) installed configuration. This chapter contains the following topics:

7.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 in 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.

7.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, you provide the group names of operating system groups. These operating system groups are designated with the logical role of granting operating system group authentication for administration system privilege for Oracle Database and Oracle ASM.

In an Oracle RAC cluster, the group ID number (GID) for system privileges groups must be identical on each cluster member node. One operating system group can be designated the logical group whose members are granted all system privileges for Oracle Database and Oracle ASM, including the OINSTALL system privileges for installation owners. You can also delegate logical system privileges to two or more actual operating system groups. Oracle recommends that you designate separate operating system groups for each logical system privilege. This 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 7-1:

Table 7-1 Role-Allocated Oracle System Privileges Operating System Groups

Logical Operating System Group Name Default Actual UNIX or Linux Group Name System Privileges Authenticated By Group Membership

OINSTALL

oinstall

Install system privileges for installation owners, which includes privileges to write to the central oraInventory directory for each server, and other privileges granted to Oracle binary installation owner users.

OSDBA

dba

SYSDBA system privileges for an Oracle Database, which includes all system privileges for the database.

OSOPER

oper

SYSOPER startup and shutdown system privileges for an Oracle Database.

OSBACKUPDBA

backupdba

SYSBACKUP backup and recovery system privileges for an Oracle Database.

OSDGDBA

dgdba

SYSDG system privileges to administer and monitor Oracle Data Guard.

OSKMDBA

kmdba

SYSKM system privileges for encryption key management for applications such as Oracle Wallet Manager.

OSASM

asmadmin

SYSASM system privileges for Oracle ASM on a cluster, which includes all system privileges for Oracle ASM storage.

OSOPER for ASM

asmoper

SYSOPER startup and shutdown system privileges for Oracle ASM on the cluster.

OSDBA for ASM

asmdba

SYSDBA for ASM system privileges to obtain read and write access to files managed by Oracle ASM; all Oracle Database software owners must be a member of this group.


See Also:

7.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 Grid installation owner 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'

7.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

7.5 ORATAB Configuration for Oracle RAC

Oracle creates an entry for each Oracle RAC database in the oratab configuration file. The oratab file is created by the root.sh script during installation, and it is updated by the Database Configuration Assistant when creating or deleting a database. The oratab file entry is also created automatically by the Database Agent when a database is first started on a node where it has not run previously. Oracle ASM Agent creates Oracle ASM oratab entries.

Oracle Enterprise Manager uses the oratab file during service discovery to determine the name of the Oracle RAC database, and to determine if the database should be started automatically when the system is restarted.

The database entry has the following syntax:

$DB_UNIQUE_NAME:$ORACLE_HOME:N

A colon (:) is used as the field terminator. A new line terminates the entry. Lines beginning with a pound sign (#) are comments. Because all the instances of an Oracle RAC database have the same DB_UNIQUE_NAME, but each instance has its own ORACLE_SID, use the $DB_UNIQUE_NAME environment variable in the oratab file as the database entry.

The $DB_UNIQUE_NAME identifier for your Oracle RAC database must be unique across your enterprise. $ORACLE_HOME is the directory path to the database, and N indicates that the database should not be started at restart time. The following is an example entry for a database named sales:

sales:/u01/app/oracle/sales:N

7.6 Database Components Created Using Database Configuration Assistant

This section describes the database components that DBCA creates, which include:

7.6.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 7-2 shows the tablespace names used by an Oracle RAC database and the types of data they contain.

Table 7-2 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), INDEX and EXAMPLE 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.

7.6.2 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.

7.6.3 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:

7.7 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 redo logs.

See Also:

7.8 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

7.9 Oracle Net Services Configuration for Oracle RAC Databases

Users can access an Oracle RAC database using a client/server configuration or through one or more middle tiers, with or without connection pooling. 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.

This section contains the following topics:

See Also:

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

7.9.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 should 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.

7.9.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 is comprised of 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, which is represented 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.

7.9.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 7-1, "Connecting to Oracle RAC Using the Easy Connect Naming Method" 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.

7.9.4 Understanding SCANs

This section contains the following topics:

7.9.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 your platform for more information about SCAN configuration and requirements

7.9.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

7.9.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

7.9.5 How to Connect to an Oracle RAC Database Using SCANs

Oracle recommends that you configure Oracle RAC database clients to use the SCAN and the Easy Connect naming method to connect to the database instead of configuring the tnsnames.ora file.

Clients configured to connect to the cluster using node 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.

Example 7-1 Connecting to Oracle RAC Using the Easy Connect Naming Method

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

If the SCAN is resolved by DNS, then DNS returns all three SCAN VIP addresses in round-robin order to the client. If the SCAN is resolved by GNS, then DNS zone delegation sends the lookup request to GNS, which then returns all three SCAN VIP addresses in round-robin order to the client.

The client then 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.

7.9.6 Listener Configuration for an Oracle RAC Database

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, 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).

7.9.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

7.9.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 Figure 7-1.

  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 7-1 Load Balancing Actions for Oracle RAC Connections That Use SCAN

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

7.10 Performance Features of Oracle Net Services and Oracle RAC

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

7.10.1 Load Balancing of Connections to Oracle RAC Databases

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.

There are two types of load balancing that you can implement for an Oracle RAC database: client-side and server-side load balancing. 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:

7.10.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.

7.10.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, 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 and dedicated server configurations

7.11 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.

The following sections describe the Oracle Net Services configuration files and parameters for an Oracle RAC database:

7.11.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

7.11.2 Net Service Names and the tnsnames.ora File

The installation process creates a tnsnames.ora file on each node. This 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 that you use in the tnsnames.ora file is singular, because you can specify only one service name. The SERVICE_NAME parameter is not the same as 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:

  • 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.

For example, after you create the database, 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:

7.11.3 Net Service Names Created by DBCA

DBCA creates net service names for connections as described in the following sections:

7.11.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 DBCA enables Oracle Enterprise Manager to discover an Oracle RAC database, and should 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.

Example 7-2 Example 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, 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.

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.

7.11.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 7-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)
    )
  )

7.11.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. The following sections describe Oracle Net listener configuration:

Note:

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

7.11.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:

7.11.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:

7.11.4.3 Managing Multiple Listeners for an Oracle RAC Database

To administer Oracle Database 12c Release 1 (12.1) local and SCAN listeners using the lsnrctl command, set your ORACLE_HOME environment variable to the path for the Grid home. Do not attempt to use the lsnrctl commands from Oracle home locations for earlier releases, because they cannot be used with Oracle Database 12c Release 1 (12.1).

For listeners not managed by Oracle Clusterware, you can use a non-default 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. To use a non-default location for a listener managed by Oracle Clusterware, you must use SRVCTL and the setenv command to modify the value of TNS_ADMIN for each listener.

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

The listener.ora file is the configuration file for a listener. It 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 RAC with Server Control Utility (SRVCTL) commands, or by using 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 7-4 Example listener.ora File for an Oracle RAC Node

The following is an example listener.ora file 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:
/u01/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

7.11.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 following directory by default:

Grid_home/network/admin

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 entry 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 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: