{"id":10749,"date":"2019-07-28T16:15:55","date_gmt":"2019-07-28T16:15:55","guid":{"rendered":"https:\/\/ittutorial.org\/?p=10749"},"modified":"2019-07-28T16:51:30","modified_gmt":"2019-07-28T16:51:30","slug":"oracle-sql-tutorial-system-and-user-privileges","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/oracle-sql-tutorial-system-and-user-privileges\/","title":{"rendered":"Oracle SQL Tutorial &#8211; System and User Privileges"},"content":{"rendered":"<p>Hi everyone, i want to show you schema subject, system and user privileges. it <span lang=\"en\">seems easy but required for dba<\/span><\/p>\n<h3>SCHEMA :<\/h3>\n<div class=\"QmZWSe\">\n<div class=\"DHcWmd\">\n<div id=\"tw-target\">\n<div id=\"kAz1tf\" class=\"g9WsWb\">\n<div id=\"tw-target-text-container\" class=\"tw-ta-container tw-nfl\">\n<p class=\"tw-data-text tw-ta tw-text-small\" dir=\"ltr\"><span lang=\"en\">Schemas are called database objects aggregated together. <\/span><span lang=\"en\">A schema contains tables, procedures, sequences,synonyms, index and database links. <\/span><span lang=\"en\">Each of users has a schema, <\/span><span lang=\"en\">each schema has the same name as the user name. <\/span><span lang=\"en\">When a user is created, the schema with the same name is created.<br \/>\n<\/span><\/p>\n<p dir=\"ltr\"><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">While schemas logically hold users&#8217; objects, their physical counterparts are <strong>tablespace<\/strong>.<\/span><\/span><\/p>\n<h3>System Privileges:<\/h3>\n<p>The Database administrator has a multiple authority that users can grant in SQL language. <span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">A database administrator is the user with the highest authority in a database.<\/span><\/span><\/p>\n<ul>\n<li><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Creating Nnew Users<\/span><\/span><\/li>\n<li>Droping Users<\/li>\n<li>Droping Tables<\/li>\n<li>Backup Tables<\/li>\n<\/ul>\n<h3>Creating Users:<\/h3>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">In SQL, the user is created on the database side.<\/span><\/span> A normal user does not have the authorized to create users on the system.<\/p>\n<p>Basic syntax ;<\/p>\n<pre>CREATE USER \"USERNAME\" PROFILE \"DEFAULT\" IDENTIFIED BY PASSWORD DEFAULT TABLESPACE \"USERS\" TEMPORARY TABLESPACE \"TEMP\";<\/pre>\n<ul>\n<li><strong>DEFAULT TABLESPACE &#8220;USERS&#8221;<\/strong> <span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">specify the user&#8217;s storage in tablespace.<\/span><\/span><\/li>\n<li><strong>TEMPORARY TABLESPACE &#8220;TEMP&#8221;<\/strong> <span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">specify we specify the user&#8217;s temp tablespace.<\/span><\/span><span lang=\"en\"><br \/>\n<\/span><\/li>\n<li><strong>PROFILE &#8220;DEFAULT&#8221;<\/strong> <span class=\"tlid-translation translation\" lang=\"en\"><span title=\"\">which profile will be included<\/span><\/span><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<\/div>\n<h3>Granting System Rights To the User:<\/h3>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">A user can be granted the following rights by the database administrator, for example<br \/>\n<\/span><\/span><\/p>\n<ul>\n<li><strong>CREATE SESSION<\/strong> R<span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">equired to connect to the database.<\/span><\/span><\/li>\n<li><strong>CREATE TABLE\u00a0 <\/strong>R<span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">equired to create table on database.<br \/>\n<\/span><\/span><\/li>\n<li><strong>CREATE SEQUENCE<\/strong> R<span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">equired for objects that generate ascending or descending sequential numeric values in the database.<\/span><\/span><\/li>\n<li><strong>CREATE VIEW<\/strong> <span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Allows us to extract data from multiple tables in the database as if it were a single table.<\/span><\/span><\/li>\n<li><strong>CREATE PROCEDURE<\/strong> R<span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">equired to create procedure in the database<\/span><\/span><\/li>\n<\/ul>\n<p>Syntax,<\/p>\n<pre><strong>GRANT\u00a0<\/strong> \"<span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\"><span style=\"color: #800000\">authority name<\/span>\"\u00a0 <strong>to<\/strong> \"<span style=\"color: #800000\">user name<\/span>\";<\/span><\/span><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Database Role Concept :<\/span><\/span><\/h3>\n<h4><span style=\"color: #800000\"><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">What is the role<\/span><\/span> ?<\/span><\/h4>\n<p>Role consist of authorize and <span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">aims to facilitate authority management and dynamic. We can assign the necessary privileges under a role to users. \u00a0<\/span><\/span><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">When the privileges under the role change, this affects all users with that role.<\/span><\/span><\/p>\n<h4><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Role creation<\/span><\/span> :<\/h4>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">In SQL language, if you want to create a role, the following steps are followed<\/span><\/span>.<\/p>\n<pre><strong>CREATE ROLE<\/strong> <span style=\"color: #800000\">role_name<\/span><\/pre>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">If we want to give the role we created to a user<\/span><\/span> ,<\/p>\n<pre><strong>GRANT <\/strong><span style=\"color: #800000\">role_name<\/span> <strong>to <\/strong><span style=\"color: #800000\">user_name<\/span><\/pre>\n<p>&nbsp;<\/p>\n<h3>Object A<span class=\"gt-baf-term-text\"><span class=\"gt-baf-cell gt-baf-word-clickable\">uthority :<\/span><\/span><\/h3>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Object rights are privileges granted to users to perform a specific action on a particular table, view, or procedure.<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10782\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/07\/Screenshot_2-1.png\" alt=\"\" width=\"736\" height=\"327\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/07\/Screenshot_2-1.png 565w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/07\/Screenshot_2-1-300x133.png 300w\" sizes=\"auto, (max-width: 736px) 100vw, 736px\" \/><\/p>\n<p>Syntax,<\/p>\n<pre>GRANT object_priv [(columns)]\r\n\r\nON\u00a0\u00a0 object\r\n\r\nTO\u00a0 {user | role | PUBLIC} \r\n\r\n\r\n[WITH GRANT OPTION];\r\n\r\n<\/pre>\n<h3><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Granting object rights to other users<\/span><\/span> :<\/h3>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">In SQL, the rights of a user can be granted to different users if requested.<\/span><\/span><\/p>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">For example, If we want to give the query right in the Customers table to other users<\/span><\/span><\/p>\n<pre>SQL&gt; GRANT SELECT ON CUSTOMERS TO <span style=\"color: #800000\">Micheal<\/span><\/pre>\n<p>&nbsp;<\/p>\n<h3>Public Parameter :<\/h3>\n<p>All rights of the users table are used when you want to give other users in bulk.<\/p>\n<p>For example <span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Lazy&#8217;s products table, if we want other users to view, <\/span><\/span><\/p>\n<p>SQL&gt; GRANT SELECT ON <span style=\"color: #800000\">Lazy.products<\/span> TO PUBLIC<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Revocation of object rights<\/span><\/span> :<\/h3>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">In sql, REVOKE will revoke rights granted to other users.\u00a0 Also, the rights defined with WITH GRANT OPTION are revoked.<br \/>\n<\/span><\/span><\/p>\n<p>Syntax,<\/p>\n<pre>REVOKE {privilege [, privilege...] | ALL} ON object FROM {user [,user] | role | PUBLIC } [CASCADE CONSTRAINTS];<\/pre>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">We have come to the end of this article, I hope everything is descriptive See you in the next article<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi everyone, i want to show you schema subject, system and user privileges. it seems easy but required for dba SCHEMA : Schemas are called database objects aggregated together. A schema contains tables, procedures, sequences,synonyms, index and database links. Each of users has a schema, each schema has the same name as the user name. &hellip;<\/p>\n","protected":false},"author":67,"featured_media":9920,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3019],"tags":[4936,4929,5597,4875,5600,5609,4883,4873,4869,4910,5603,5607,5608,5605,5604,1340,5611,4870,4895,5602,5610,4905,5599,5601,4935,4926,4915,4921,4919,4920,4918,4917,3192,4872,4916,4928,4876,4912,4881,4880,4890,4867,3062,4879,4891,4923,4924,4922,4925,4909,4911,4877,4896,4908,4882,4884,4897,4901,4900,4898,4902,4903,4899,4871,3015,3018,4868,4904,4906,4893,4930,4934,4914,4933,4885,4887,4913,3000,4931,4889,4927,4907,4888,4886,4892,4874,4878,4894,4932,5598,5606],"class_list":["post-10749","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-oracle-sql","tag-case-insensetive","tag-create-view","tag-database-audit","tag-database-nedir","tag-database-schema","tag-grant","tag-insert-nedir","tag-kolay-sql","tag-mysql-sql","tag-or","tag-oracle-dba-title","tag-oracle-grant","tag-oracle-revoke","tag-oracle-role","tag-oracle-role-creating","tag-oracle-sql","tag-oracleprivileges-usage","tag-php-sql","tag-plsql","tag-publiv-parameter","tag-revoke","tag-right-outer-join","tag-schema","tag-schema-privileges","tag-selecting-multiple-colum","tag-sql-all-drop","tag-sql-all-statements","tag-sql-alter","tag-sql-alter-colum","tag-sql-alter-database","tag-sql-alter-statement","tag-sql-alter-table","tag-sql-and","tag-sql-baslangic-dersleri","tag-sql-creat-table","tag-sql-create-view","tag-sql-database","tag-sql-date-functions","tag-sql-dcl","tag-sql-ddl","tag-sql-delete","tag-sql-dersleri","tag-sql-distinct","tag-sql-dml","tag-sql-dml-nedir","tag-sql-drop-colum","tag-sql-drop-database","tag-sql-drop-statement","tag-sql-drop-table","tag-sql-filtering-data","tag-sql-functions","tag-sql-ifadeleri","tag-sql-ile-ne-yapilir","tag-sql-in-statement","tag-sql-insert","tag-sql-insert-nasil-yapilir","tag-sql-is-ilanlari","tag-sql-join-yapisi","tag-sql-kaynaklari","tag-sql-kullanmak","tag-sql-lef-join","tag-sql-left-outer-join","tag-sql-makaleleri","tag-sql-nasil-ogrenilir","tag-sql-nedir","tag-sql-ogrenme","tag-sql-ogrenmek","tag-sql-right-join","tag-sql-right-outer-join","tag-sql-select-islemi","tag-sql-set-auto-increment","tag-sql-sorting-results","tag-sql-subqueries","tag-sql-syntaxt-rule","tag-sql-tablo-olusturma","tag-sql-tablo-yapisi","tag-sql-to_char-function","tag-sql-tutorial","tag-sql-union-statement","tag-sql-update-islemi","tag-sql-view","tag-sql-where-statement","tag-sql-yapisi","tag-tablo-nedr","tag-tablodan-veri-cekmek","tag-temel-seviye-sql","tag-temel-seviyede-sql","tag-tsql","tag-union-table","tag-user-privileges","tag-what-is-role-in-sql"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/06\/sql-express.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/10749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=10749"}],"version-history":[{"count":3,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/10749\/revisions"}],"predecessor-version":[{"id":10783,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/10749\/revisions\/10783"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/9920"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=10749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=10749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=10749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}