What is SCAN listener?

What is SCAN listener?

In an Oracle Real Application Clusters (RAC) environment, connecting to the database used to be a headache. You had to list every single server's IP address in your tnsnames.ora file. If you added a new server to the cluster, you had to update every single client machine in the company.

SCAN (Single Client Access Name) was introduced in Oracle 11g Release 2 to solve this forever. It provides a single, stable name for clients to connect to, no matter how many nodes are in the cluster.


1. What is SCAN?

SCAN is a feature that provides a single network name (e.g., sales-cluster-scan.example.com) for accessing an Oracle Database running in a cluster.

Instead of connecting to a specific server, the client connects to the SCAN Listener. Think of it as a Load Balancer that sits at the front door of your cluster, directing traffic to the best available room.


2. How it Works: The Three Layers

To understand SCAN, you have to look at how it interacts with the rest of the cluster:

  1. The SCAN Name: A single DNS entry that resolves to three IP addresses (usually) using a round-robin algorithm.

  2. The SCAN Listeners: Three processes running on different nodes in the cluster. They listen for incoming requests on the SCAN IPs.

  3. The Local Listeners: Every node still has its own "Local Listener" (usually named LISTENER).

The Connection Flow:

  • Step 1: The client asks for sales-cluster-scan. DNS gives back one of the three SCAN IPs.

  • Step 2: The client hits a SCAN Listener.

  • Step 3: The SCAN Listener looks at the cluster and says, "Node 3 is the least busy right now." It tells the client to go to Node 3's Local Listener.

  • Step 4: The client connects to the Local Listener on Node 3 and starts its session.


3. Why is SCAN a Big Deal?

A. Location Independence

You can add nodes to the cluster or take them away for maintenance, and you never have to change the client connection string. The SCAN name stays the same, even if the underlying servers change.

B. Intelligent Load Balancing

The SCAN listener knows the load of every instance in the cluster. It won't send a new user to a node that is currently at 99% CPU usage. It directs traffic to the "quietest" node.

C. Failover Support

If one of the three SCAN listeners fails, the other two take over its IP address. If a whole node fails, the SCAN IPs move to a surviving node. The "Front Door" is always open.


4. What does the Connection String look like?

Because of SCAN, your tnsnames.ora becomes incredibly simple:

Plaintext
SALES_DB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = sales-scan.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = sales_prod)
    )
  )

Notice there is only one HOST. You don't need to list node1-vip, node2-vip, etc.


5. Summary: SCAN vs. Local Listener

FeatureSCAN ListenerLocal Listener
QuantityUsually 3 per cluster.1 per node.
RoleTraffic Director / Load Balancer.Hands off the connection to the instance.
IP AddressVirtual (can move between nodes).Virtual (VIP) but stays on its home node.
Client InteractionThe "First Contact."The "Final Handshake."

6. Common Troubleshooting Tip

If you can't connect via SCAN, the first thing to check is DNS. SCAN requires "Round Robin" DNS. You can test this by running nslookup on your SCAN name:

Bash
nslookup sales-scan.example.com

If it doesn't return three distinct IP addresses, your network team hasn't set up the DNS entries correctly, and your load balancing will be lopsided.


Final Thought

SCAN is the "glue" that makes a multi-node RAC cluster feel like a single, easy-to-use database for the application developers. It removes the complexity of the grid and replaces it with a single, reliable URL.

Looking for servers Rental ?

Call Our Expert :


  • (call for rental enquiries)

Email us :