Hi experts, I am struggling to understand how SAS metadata deals with AuthDomains. Any help is appreciated.
SAS version - 9.4M3.
We have an Oracle DB with 5 schemas and some generic code that is supposed to execute against different schemas.
All DB schemas have different passwords.
To deal with multiple schemas,
a) unix shell script passes oracle DB schema name to sas
b) autoexec.sas reads parameters and dynamically assigns Oracle libraries pointing to appropriate oracle schema.
The logic roughly looks like
libname ora user=¶m_schema schema=¶m_schema password=¶m_schema_password path=xxx;
when ¶m_schema =schema1, the above statement resolves to
libname ora user=schema1 schema=schema1 password=schema1_password path=xxx;
c) generic sas code runs using the libname assigned by autoexec.
This works fine so far.
To avoid defining schema passwords in macro variables,
(d) I created an authdomain OraAuth and added 5 userid/passwords to it, corresponding to 5 DB schemas.
(e) Changed autoexec.sas to
libname ora user=¶m_schema schema=¶m_schema authdomain=OraAuth path=xxx;
At runtime,
when ¶m_schema =schema1, I was expecting the above statement fetching schema1_password from OraAuth and define the libname properly.
when ¶m_schema =schema2, I was expecting the above statement fetching schema2_password from OraAuth and define the libname properly.
However, in reality, no matter which DB user/schema combination is used in the libname statement, OraAuth is only resolving schema1/schema1_password.
Is the above approach correct and valid ? SAS metadata obviously allowed multiple DB logins attached to the same OraAuth. Why doesn't it fetch the expected login object using the DB user/schema details from libname ?
I suggest creating separate authdomian for each schema.
Thanks @gwootton , @Sajid01, I will most likely end up doing this.
However, I am still curious, if SAS allows creating multiple logins per Authdomain, why would it select only the first credential for DB logins Authdomain?
Is this a known bug/limitation of SAS ?
For DefaultAuth, it does lookup the metauser against the user in all logins under DefaultAuth, fetches relevant credentials for the metauser.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.
Find more tutorials on the SAS Users YouTube channel.