{"id":33674,"date":"2023-05-02T10:21:01","date_gmt":"2023-05-02T10:21:01","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=33674"},"modified":"2023-05-02T10:21:03","modified_gmt":"2023-05-02T10:21:03","slug":"oracle-tutorials-how-to-add-additional-user-and-grant-his-access-in-oracle","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/oracle-tutorials-how-to-add-additional-user-and-grant-his-access-in-oracle\/","title":{"rendered":"Oracle Tutorials: How to add additional user and grant his access in Oracle"},"content":{"rendered":"\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Here are the steps to add an additional user <span class=\"hljs-keyword\">and<\/span> grant them access in Oracle:\n\nConnect to the database <span class=\"hljs-keyword\">as<\/span> a user with administrative privileges, such <span class=\"hljs-keyword\">as<\/span> SYS <span class=\"hljs-keyword\">or<\/span> SYSTEM:\n\n$ sqlplus sys\/&lt;password&gt; <span class=\"hljs-keyword\">as<\/span> sysdba\nReplace &lt;password&gt; with the password <span class=\"hljs-keyword\">for<\/span> the SYS <span class=\"hljs-keyword\">or<\/span> SYSTEM user.\n\nCreate a <span class=\"hljs-keyword\">new<\/span> user using the CREATE USER command:\n$ CREATE USER &lt;username&gt; IDENTIFIED BY &lt;password&gt;;\n\nReplace &lt;username&gt; with the name of the <span class=\"hljs-keyword\">new<\/span> user <span class=\"hljs-keyword\">and<\/span> &lt;password&gt; with their password.\n\nGrant privileges to the <span class=\"hljs-keyword\">new<\/span> user using the GRANT command. <span class=\"hljs-keyword\">For<\/span> example, to grant the user privileges to create tables <span class=\"hljs-keyword\">and<\/span> insert data into them:\n\n$ GRANT CREATE TABLE, INSERT ANY TABLE TO &lt;username&gt;;\n\nYou can grant any privileges that the user needs to perform their job.\n\nOptionally, create a <span class=\"hljs-keyword\">new<\/span> role <span class=\"hljs-keyword\">and<\/span> assign it to the <span class=\"hljs-keyword\">new<\/span> user using the CREATE ROLE <span class=\"hljs-keyword\">and<\/span> GRANT ROLE commands. <span class=\"hljs-keyword\">For<\/span> example:\n\n$ CREATE ROLE &lt;role_name&gt;;\n$ GRANT &lt;role_name&gt; TO &lt;username&gt;;\n\nYou can add privileges to the role using the GRANT command, then assign the role to any additional users <span class=\"hljs-keyword\">as<\/span> needed.\n\nVerify that the user can log in to the database by connecting <span class=\"hljs-keyword\">as<\/span> the <span class=\"hljs-keyword\">new<\/span> user:\n\n$ sqlplus &lt;username&gt;\/&lt;password&gt;\n\n<span class=\"hljs-keyword\">Exit<\/span> SQL*Plus when you are done:\n$ <span class=\"hljs-keyword\">exit<\/span>\n\nThat<span class=\"hljs-string\">'s it! You have added a new user and granted them the necessary privileges to work in the database.\n\n\n\n\n\n\n<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-33674","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/33674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=33674"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/33674\/revisions"}],"predecessor-version":[{"id":33675,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/33674\/revisions\/33675"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=33674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=33674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=33674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}