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!
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
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.
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
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!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.