SAS Admins use LIBNAME Statement to test the connectivity to
the configured database. We can test the connection to the database from OS
level and LIBNAME statement in SAS Enterprise Guide (EG). Here I will explain
in detail about how to run LIBNAME statement in SAS EG and the initial
configuration needed to run the LIBNAME statement successfully.
LIBNAME Statement Oracle:
To run a LIBNAME state for Oracle database you need the
following:
- · Username and password of the Oracle database
- · SID/Schema/Path of the Oracle database
Example:
Let username is winter
and password is summer and SID is CHSLKJE.
For above given information, Libname statement will be:
LIBNAME test ORACLE user="winter" password="summer" path="CHSLKJE" schema="CHSLKJE";
Libname statement Oracle in SAS EG |
In above example, test is libref. Libref can be any name of
your choice. Don’t forget to add quotes, it throws error.
LIBNAME Statement throws error if you don’t do the following:
There should be entry in tnsnames.ora file in your host
machine. The entry will be having schema name, ip address and port number. It
should be like below image inside tnsnames.ora file.
Example:
In the above image, Service Name is the schema name or SID. Hostname
can be ip address or the name server. You should get the correct port number
from DB team.
Your host machine should have connectivity to the Oracle host
machine. The ip address you see in above machine is the Oracle host machine. To
check the connection you can use telnet command.
Example:
telnet 112.48.69.83 6482
For a successful
connection it will give below output:
Trying 112.48.69.83...
Connected to 112.48.69.83
Escape character is
'^]'.
The below output
means failure:
- Connection refused
- Name or Service not known
If this fails here, you won’t be able to run LIBNAME
statement successfully. Because, LIBNAME statement uses this Oracle
configuration file tnsname.ora to connect to their database machine.
You can comment below if you face any issues while running LIBNAME
statement for Oracle connectivity.
This is such an inspiring read! Your insights really resonate and make me think differently. Thank you for sharing!
ReplyDelete