{"id":798,"date":"2014-10-18T16:25:35","date_gmt":"2014-10-18T16:25:35","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=798"},"modified":"2014-11-19T11:57:46","modified_gmt":"2014-11-19T11:57:46","slug":"sqlplus-ora-01017-invalid-usernamepassword-logon-denied","status":"publish","type":"post","link":"http:\/\/www.theSQLReport.com\/?p=798","title":{"rendered":"&#8220;SQLPLUS \/&#8221; &#8211; ORA-01017: invalid username\/password; logon denied"},"content":{"rendered":"<p>While working on my shell scripts, I hit a snag when I want sqlplus to authenticate using my operating system account without entering the login credentials.\u00a0 When I tested &#8220;sqlplus \/&#8221; with my user account &#8220;mike&#8221;, I received the error below:<\/p>\n<pre>ERROR: ORA-01017: invalid username\/password; logon denied\r\n<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_01.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-801 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_01.jpg\" alt=\"ORA-01017_01\" width=\"672\" height=\"205\" \/><\/a><\/p>\n<p>First I checked to see if my operating system account has permission in the database.\u00a0 I was able to use the query below:<\/p>\n<pre>SELECT username FROM dba_users WHERE password = 'EXTERNAL' ORDER BY username;\r\n<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_02.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-802 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_02.jpg\" alt=\"ORA-01017_02\" width=\"833\" height=\"312\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_02.jpg 833w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_02-300x112.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_02-210x78.jpg 210w\" sizes=\"(max-width: 833px) 100vw, 833px\" \/><\/a><\/p>\n<p>When I saw that my OS account did not have permissions in the database, I added the account.\u00a0 Please note that I put the prefix &#8220;ops$&#8221; in front of my OS account name.\u00a0 A more common OS account used is ops$oracle.\u00a0 Then I had to grant connect &amp; resource permissions.\u00a0 Some more advanced users might need the dba granted to accounts like ops$oracle.\u00a0 Below is the SQL that I used to add my OS account:<\/p>\n<pre>create user ops$mike\r\nidentified externally\r\ndefault tablespace USERS \r\ntemporary tablespace TEMP\r\nprofile DEFAULT \r\naccount unlock;\r\n\r\ngrant connect,resource to ops$mike;<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_03.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-803 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_03.jpg\" alt=\"ORA-01017_03\" width=\"424\" height=\"255\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_03.jpg 424w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_03-300x180.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_03-210x126.jpg 210w\" sizes=\"(max-width: 424px) 100vw, 424px\" \/><\/a><\/p>\n<p>Then I was able to test again, without having to logout and log back in.\u00a0 I was now ready to run sqlplus in my shell scripts without being prompted for a password.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_04.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-804 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_04.jpg\" alt=\"ORA-01017_04\" width=\"768\" height=\"239\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_04.jpg 768w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_04-300x93.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/10\/ORA-01017_04-210x65.jpg 210w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>While working on my shell scripts, I hit a snag when I want sqlplus to authenticate using my operating system account without entering the login credentials.\u00a0 When I tested &#8220;sqlplus &hellip; <a class=\"readmore\" href=\"http:\/\/www.theSQLReport.com\/?p=798\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":801,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[36,30],"class_list":["post-798","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-logon-denied","tag-ora-01017"],"_links":{"self":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/798"}],"collection":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=798"}],"version-history":[{"count":6,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/798\/revisions"}],"predecessor-version":[{"id":809,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/798\/revisions\/809"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/801"}],"wp:attachment":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=798"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}