tips, tricks and techniques ...
Running Oracle Instant Client and related SQL*Plus on Mac OS X, with tnsnames.ora created and environment variables setup correctly was causing this error repeatedly, not allowing login into the database via “sqlplus” from a terminal/command line.
ORA-12169: TNS:Net service name given as connect identifier is too long
The tnsnames.ora file was good, and there was nothing unusual about the “service_name” used in the TNS entries. So this error was a bit surprising.
The reason was simple, the tnsnames.ora file had Windows encoding (CR/LF) instead of Unix/Linux encoding (just LF). Just saving the tnsnames.ora file in *nix format solved the problem !
Hope that this information is useful to others.
Shell scripts are often used as the glue to put various pieces together, and in automation of tasks (especially in the *nix world). Whether it is to ensure that any failures in processes are notified to support teams, or to marry ETL processes from tools like AbInitio or Informatica to perl code, shell scripts play an important and routine role, especially in *nix environments like Linux.
One of the common requirements in the shell scripting world is to ensure that two copies of the same script does not run at the same time. Whether kicked off accidentally, or because the earlier invocation took abnormally long to complete, in most cases the requirement is to have only one copy of a script executing at any given time. If a new copy gets kicked off, it should notice that another copy is running, and exit. It is also a requirement that the script be able to survive unplanned events like server restarts.