In my previous blog, I have explained Clustering, Grid Infrastructure. To understand what is a Scan/RAC Listener? First of all, one should know what is RAC? So kindly go through my previous blog if you haven't read the blog. Ok, Let's begin our journey...
For application users to connect database they need a connection string.
Let us take another example where Application A is connected to the instance using Service 1 and Application B is connected to the instance using Service 2. Now we observe high load on the database through AWR Reports we can easily find the culprit because of service.
Question is How services are useful in RAC Database?
In RAC Database we have two Different instances each having Different SID then why to use services. We can easily find through AWR Reports who is the culprit. But One thing to understand Services is the Underlying Framework of RAC Databases. Service is the first step to achieve high availability, scalability, and failover in RAC Environment. But How?
Let us consider two node RAC database. We know both Instances Sid will be different. How can application know it is connecting to the same database🤔 as SIDs are different and so far we know different SIDs mean different databases. To overcome this we make the same service in both the databases and instead of SIDs we use this service in our connection string. Now whether it connects Node 1 or Node 2 it is connecting to the same RAC database. Also, we have now two nodes for a single database that means scalability, but why not high availability. For that read till the end...
What about Failover?
Suppose application A is making a connection with Instance 1 using service and due to some reason instance 1 has crashed. Now application A will switch to 2nd Instance as another instance is having the same service. In this way, we can switch to another in case of a failover. But the question is how can an Application A switch over.
Agree, Both are using the same service but if node 1 is not available, the application request once send if will not receives any reply, for that application database is not available. That's why the concept of VIP was introduced by oracle and Clusterware manages the VIPs.
As we know IP is connected to a device but if that device is not available due to any reason then our IP would not be able to tell the application that Hey I am not available. That's why the concept of VIP came in the picture as if any node goes down VIP of that node switch over to the other node.
Now here the point. That node has two VIPs, suppose application tries to connect Node 1 it will send a request to Node 1 VIP and it has switched over to Node 2 as soon as the request reaches Node 1 it's VIP would reply back to the application that Hey I am not available. Kindly connect to another node. Now it will again check its connection string and connect the second VIP. If available it will fulfill the request or else will check the next VIP and so on. In this way for application database is available. Hence achieved high availability and failover.
Connect string for RAC databases prior to 11GR2.
In the above connection string, we have 3 RAC nodes. If one goes down the connection string itself check another node availability, but it again has some drawbacks as if we have to add another node then we have to append over-application connection string. To overcome this concept of SCAN came into the picture. Which we will discuss in the second part.
Thanks & Enjoy learning!!
What is a Database service in oracle?
For application users to connect database they need a connection string.
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(Sid=MyOracleSID)))
Here we are talking about services for Standalone Database:
In the above string, we have used Sid to connect the Database. Now suppose we have two different applications and user A of application 1 is connected to Instance similarly User B of application 2 is also connected to our instance. We have observed High load on the database now as we are using SID to connect the database there is no way to know who is the culprit application. Now comes in picture services.Let us take another example where Application A is connected to the instance using Service 1 and Application B is connected to the instance using Service 2. Now we observe high load on the database through AWR Reports we can easily find the culprit because of service.
Question is How services are useful in RAC Database?
In RAC Database we have two Different instances each having Different SID then why to use services. We can easily find through AWR Reports who is the culprit. But One thing to understand Services is the Underlying Framework of RAC Databases. Service is the first step to achieve high availability, scalability, and failover in RAC Environment. But How?
Let us consider two node RAC database. We know both Instances Sid will be different. How can application know it is connecting to the same database🤔 as SIDs are different and so far we know different SIDs mean different databases. To overcome this we make the same service in both the databases and instead of SIDs we use this service in our connection string. Now whether it connects Node 1 or Node 2 it is connecting to the same RAC database. Also, we have now two nodes for a single database that means scalability, but why not high availability. For that read till the end...
What about Failover?
Suppose application A is making a connection with Instance 1 using service and due to some reason instance 1 has crashed. Now application A will switch to 2nd Instance as another instance is having the same service. In this way, we can switch to another in case of a failover. But the question is how can an Application A switch over.
Agree, Both are using the same service but if node 1 is not available, the application request once send if will not receives any reply, for that application database is not available. That's why the concept of VIP was introduced by oracle and Clusterware manages the VIPs.
What is VIP?
Now here the point. That node has two VIPs, suppose application tries to connect Node 1 it will send a request to Node 1 VIP and it has switched over to Node 2 as soon as the request reaches Node 1 it's VIP would reply back to the application that Hey I am not available. Kindly connect to another node. Now it will again check its connection string and connect the second VIP. If available it will fulfill the request or else will check the next VIP and so on. In this way for application database is available. Hence achieved high availability and failover.
Connect string for RAC databases prior to 11GR2.
App_serv= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST=VIP1)(PORT=1521)) (ADDRESS = (PROTOCOL = TCP)(HOST=VIP2)(PORT=1521)) (ADDRESS = (PROTOCOL = TCP)(HOST=VIP3)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME=service1)) -- single service to connect
In the above connection string, we have 3 RAC nodes. If one goes down the connection string itself check another node availability, but it again has some drawbacks as if we have to add another node then we have to append over-application connection string. To overcome this concept of SCAN came into the picture. Which we will discuss in the second part.
Thanks & Enjoy learning!!
No comments:
Post a Comment