Hello, Ask Tom Team.
We have a .Net Core app connecting to a Oracle 18c RAC database. We are not using tnsnames.ora file (there is no oracle client installed on the client-server side). We are using managed .Net Core oracle client and the following connection string (easy method):
"Data Source=db-scan:1521/dbname;User Id=user;Password=pwd;Min Pool Size=1;Max Pool Size=60;Connection Lifetime=180;Connection Timeout=60;Incr Pool Size=5; Decr Pool Size=1;Pooling=true;Load Balancing=true;HA events=true;".
We do not know if this is the right way.
I have read an Oracle note:
https://docs.oracle.com/en/database/oracle/oracle-database/18/rilin/about-connecting-to-an-oracle-rac-database-using-scans.html#GUID-090555EB-7EB7-44DE-BD06-54FED5CF5712 They say:
...Instead, applications must 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)))
If this is correct, how can I specify settings such as : Pooling, Load Balancing, HA events... like the connection string we are actually using?
What is the recommended method to connect to an Oracle 18c RAC database from a .Net Core app?
Thanks in advanced.
Regards,
All of that information "(description=" is probably most easily placed inside a tnsnames.ora and then that can be used in the .Net connection string.
For example, I have the following in my tnsnames.ora file on my local PC (under XX\network\admin) where "XX" is where Oracle client is installed.
mydb =
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=xxx.yyy.com)
(PORT=1525)
)
(CONNECT_DATA=
(SERVICE_NAME=pdb1)
)
)
Then in my .Net connection, all I need do is:
Data Source=mydb;User Id=user;Password=pwd;....
and the details for "mydb" are collected from tnsnames.ora
Just as an aside, the (commonly used) practice of:
Min Pool Size=1;Max Pool Size=nn
is typically a bad idea. If you can handle a pool size of 'nn' (which seems very large!) then why aggressively try push that back down to 1 over time. You'll get better performance if those sessions are allowed to persist, with something like:
Min Pool Size=xx;Max Pool Size=xx+a little bit
where 'xx' is slightly more than the *typical* number of connections you expect.