{"id":459,"date":"2019-12-09T16:47:28","date_gmt":"2019-12-09T15:47:28","guid":{"rendered":"https:\/\/ilmarkerm.eu\/blog\/?p=459"},"modified":"2019-12-09T16:47:28","modified_gmt":"2019-12-09T15:47:28","slug":"bash-aliases-for-sqlcl","status":"publish","type":"post","link":"https:\/\/ilmarkerm.eu\/blog\/2019\/12\/bash-aliases-for-sqlcl\/","title":{"rendered":"Bash aliases for SQLcl"},"content":{"rendered":"<p>I have quite many different databases and would like to log in to them from my linux box using my AD username and password. Creating tnsnames.ora aliases for all of them is too much work, I&#8217;d like to just specify hostname and service from command line.<\/p>\n<p>Bash aliases to the rescue, but simple alias is not enough in this case, so just take it as an example how can more complex aliases be created in Bash.<\/p>\n<p>Just copy these functions to $HOME\/.bashrc, modify them according to your needs and done \ud83d\ude42<\/p>\n<p><script src=\"https:\/\/gist.github.com\/ilmarkerm\/c81c91915ad4184568b4b7ac0a72eba0.js\"><\/script><\/p>\n<p>This creates two &#8220;aliases&#8221; &#8211; sqls for secure database connection and sql for insecure. I also need to use instantclient driver for database connection (Radius authentication).<\/p>\n<p>Usage:<\/p>\n<pre><code>sqls rac-scan.example.com myapplicationservice.prod\nsqls rac-scan.example.com myapplicationservice.prod dbauser\nSQLS_OPTS=\"-verbose\" sqls rac-scan.example.com myapplicationservice.prod\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have quite many different databases and would like to log in to them from my linux box using my AD username and password. Creating tnsnames.ora aliases for all of them is too much work, I&#8217;d like to just specify hostname and service from command line. Bash aliases to the rescue, but simple alias is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,4],"class_list":["post-459","post","type-post","status-publish","format-standard","hentry","category-blog-entry","tag-linux","tag-oracle"],"_links":{"self":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/comments?post=459"}],"version-history":[{"count":3,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/459\/revisions"}],"predecessor-version":[{"id":462,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/459\/revisions\/462"}],"wp:attachment":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/media?parent=459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/categories?post=459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/tags?post=459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}