{"id":2617,"date":"2019-03-12T13:20:14","date_gmt":"2019-03-12T10:20:14","guid":{"rendered":"https:\/\/sysdba.org\/?p=2617"},"modified":"2025-07-02T06:01:07","modified_gmt":"2025-07-02T06:01:07","slug":"user-roles-privileges","status":"publish","type":"post","link":"https:\/\/sysdba.org\/en\/user-roles-privileges\/","title":{"rendered":"User, Roles &#038; Privileges"},"content":{"rendered":"<p>User Management<\/p>\n<p>&nbsp;<\/p>\n<p>Creating users<br \/>\n[crayon]<br \/>\nCREATE USER omer IDENTIFIED BY sifreniz<\/p>\n<p>DEFAULT TABLESPACE users<\/p>\n<p>TEMPORARY TABLESPACE temp<\/p>\n<p>QUOTA UNLIMITED ON users;<br \/>\n[\/crayon]<br \/>\nGranting privileges<br \/>\n[crayon]<br \/>\nGRANT connect TO omer;<\/p>\n<p>GRANT create table, create procedure TO omer;<br \/>\n[\/crayon]<br \/>\nLocking and Unlocking User Accounts<br \/>\n[crayon]<br \/>\nalter user user_name account lock;<\/p>\n<p>alter user user_name account unlock;<br \/>\n[\/crayon]<br \/>\nSpecifying passwords<br \/>\n[crayon]<br \/>\nalter user user_name identified by new_password;<\/p>\n<p>ALTER USER user_name IDENTIFIED BY new_password ACCOUNT UNLOCK;<br \/>\n[\/crayon]<br \/>\nConfiguring an account lock after several failed login attempts<br \/>\n[crayon]<br \/>\n<span style=\"font-size: 0.9em; line-height: 1.3em;\">ALTER PROFILE &#8220;DEFAULT&#8221; LIMIT FAILED_LOGIN_ATTEMPTS DEFAULT<\/span><\/p>\n<p>ALTER PROFILE &#8220;DEFAULT&#8221; LIMIT FAILED_LOGIN_ATTEMPTS 9<br \/>\n[\/crayon]<br \/>\nConfiguring the DBMS to end a user session after being idle for a number of minutes.<br \/>\n[crayon]<br \/>\nALTER PROFILE &#8220;DEFAULT&#8221; LIMIT IDLE_TIME 15 &#8211;(resource_limit = &#8220;False&#8221; by default, isn&#8217;t active until the value is set to &#8220;True&#8221;.)<br \/>\n[\/crayon]<br \/>\nListing the users<br \/>\n[crayon]<br \/>\nset pages 999 lines 100<\/p>\n<p>col username format a20<\/p>\n<p>col status format a8<\/p>\n<p>col tablespace format a20<\/p>\n<p>col temp_ts format a20<\/p>\n<p>select username<\/p>\n<p>, account_status status<\/p>\n<p>, created<\/p>\n<p>, default_tablespace tablespace<\/p>\n<p>, temporary_tablespace temp_ts<\/p>\n<p>from dba_users<\/p>\n<p>order by username<br \/>\n[\/crayon]<br \/>\nRoles<br \/>\n[crayon]<br \/>\nselect *<\/p>\n<p>from dba_roles<\/p>\n<p>where role like &#8216;%role&#8217;<br \/>\n[\/crayon]<br \/>\nGranting roles to users<br \/>\n[crayon]<br \/>\nselect grantee<\/p>\n<p>, granted_role<\/p>\n<p>, admin_option<\/p>\n<p>from dba_role_privs<\/p>\n<p>where grantee like upper(&#8216;%username&#8217;)<\/p>\n<p>\/<br \/>\n[\/crayon]<br \/>\nPrivileges granted to specific roles<br \/>\n[crayon]<br \/>\nselect privilege<\/p>\n<p>, admin_option<\/p>\n<p>from role_sys_privs<\/p>\n<p>where role like &#8216;%role&#8217;<br \/>\n[\/crayon]<br \/>\nThe table rights given to specific roles<br \/>\n[crayon]<br \/>\nselect owner || &#8216;.&#8217; || table_name &#8220;TABLE&#8221;<\/p>\n<p>, column_name<\/p>\n<p>, privilege<\/p>\n<p>, grantable<\/p>\n<p>from role_tab_privs<\/p>\n<p>where role like &#8216;%role&#8217;<br \/>\n[\/crayon]<br \/>\nThe roles and privileges assigned to a specific user<br \/>\n[crayon]<br \/>\nSET SERVEROUTPUT ON<\/p>\n<p>SET VERIFY OFF<\/p>\n<p>SELECT a.granted_role &#8220;Role&#8221;,<\/p>\n<p>a.admin_option &#8220;Adm&#8221;<\/p>\n<p>FROM user_role_privs a;<br \/>\n[\/crayon]<\/p>\n<p>[crayon]<br \/>\nSELECT a.privilege &#8220;Privilege&#8221;,<\/p>\n<p>a.admin_option &#8220;Adm&#8221;<\/p>\n<p>FROM user_sys_privs a;<br \/>\n[\/crayon]<br \/>\nSET VERIFY ON<\/p>\n","protected":false},"excerpt":{"rendered":"<p>User Management, creating users&#8230;<\/p>\n","protected":false},"author":1,"featured_media":3448,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[383,338],"tags":[345],"class_list":["post-2617","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dba_i","category-oracle-tr","tag-oracle"],"_links":{"self":[{"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/posts\/2617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/comments?post=2617"}],"version-history":[{"count":1,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/posts\/2617\/revisions"}],"predecessor-version":[{"id":4820,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/posts\/2617\/revisions\/4820"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/media?parent=2617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/categories?post=2617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/tags?post=2617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}