check "active" connection to oracle library (via ACCESS to oracle)

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

check "active" connection to oracle library (via ACCESS to oracle)

hello fellow SAS-users,

 

we are trying to "check" for an "active" ACCESS to oracle connection (which is set via libname at the start of the process).

The connection is working most of the times, but as the oracle instance is setup in a way that there is a limited number of "licenses" that have concurrent access to the database, we are running into some problems during heavy load times.

 

Is there an intelligent way to check for "active" connection to the oracle instance, besides trying to "load data" (data step, pass through) and checking for error codings? Is there some meta-information about the current status of the library/connection?

 

thanks in advance for any helpful insights!


Accepted Solutions
Solution
‎03-20-2018 11:23 AM
SAS Employee
Posts: 117

Re: check "active" connection to oracle library (via ACCESS to oracle)

Run this bit of code to test:

/* Input the libref for the library you want to test here */

%let LibrefToTest=%upcase(ORION);
/* test if Libref is actually assigned */
%let LibrefAssigned=%eval(NOT(%sysfunc(libref(%superq(LibrefToTest)))));

/* test if Libref can access any tables */
proc sql noprint;
   select count(*)>0
   into: TablesAccessible trimmed
   from dictionary.tables
   where libname = "%superq(LibrefToTest)"
  ;
quit;

/* If both of these are 1, all is well. Otherwise, reconnect */
%put &=LibrefAssigned &=TablesAccessible ;

When the connection is good, both variable values will be 1 (true)

When the libref is still assigned, but no tables can be accessed, LIBREFASSIGNED=1 TABLESACCESSIBLE=0

 

Hope this helps.

Mark

View solution in original post


All Replies
Valued Guide
Posts: 564

Re: check "active" connection to oracle library (via ACCESS to oracle)

Haven't done this, yet, but using the options "connection" and "connection_group", see http://documentation.sas.com/?docsetId=acreldb&docsetTarget=p1qft7bzdij79zn1bxh59mc3w8xj.htm&docsetV... for details, seems to be a possibility to limit the number of connections by using the same group name.

New Contributor
Posts: 3

Re: check "active" connection to oracle library (via ACCESS to oracle)

Posted in reply to andreas_lds
actually, we are trying to live with the (externally given) limitations, not install those.
I will have a look at the proposed item, maybe there are also parts to check the current status/connection.
Solution
‎03-20-2018 11:23 AM
SAS Employee
Posts: 117

Re: check "active" connection to oracle library (via ACCESS to oracle)

Run this bit of code to test:

/* Input the libref for the library you want to test here */

%let LibrefToTest=%upcase(ORION);
/* test if Libref is actually assigned */
%let LibrefAssigned=%eval(NOT(%sysfunc(libref(%superq(LibrefToTest)))));

/* test if Libref can access any tables */
proc sql noprint;
   select count(*)>0
   into: TablesAccessible trimmed
   from dictionary.tables
   where libname = "%superq(LibrefToTest)"
  ;
quit;

/* If both of these are 1, all is well. Otherwise, reconnect */
%put &=LibrefAssigned &=TablesAccessible ;

When the connection is good, both variable values will be 1 (true)

When the libref is still assigned, but no tables can be accessed, LIBREFASSIGNED=1 TABLESACCESSIBLE=0

 

Hope this helps.

Mark

New Contributor
Posts: 3

Re: check "active" connection to oracle library (via ACCESS to oracle)

Hi Mark,

 

thanks a lot, that was just the strategy I was looking for.

We will check for library assignment and the access via dictionary.tables!

 

Thanks for your quick help!

SAS Employee
Posts: 117

Re: check "active" connection to oracle library (via ACCESS to oracle)

My pleasure - you are most welcome!
Mark
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 105 views
  • 2 likes
  • 3 in conversation