1. <var id="fe6gj"></var>

    <rp id="fe6gj"><nav id="fe6gj"></nav></rp>

    <noframes id="fe6gj"><cite id="fe6gj"></cite>

    <ins id="fe6gj"><button id="fe6gj"><p id="fe6gj"></p></button></ins>
    1. <tt id="fe6gj"><i id="fe6gj"><sub id="fe6gj"></sub></i></tt>
        始創于2000年 股票代碼:831685
        咨詢熱線:0371-60135900 注冊有禮 登錄
        • 掛牌上市企業
        • 60秒人工響應
        • 99.99%連通率
        • 7*24h人工
        • 故障100倍補償
        您的位置: 網站首頁 > 幫助中心>文章內容

        Oracle 創建create user 及授權grant

        發布時間:  2012/9/3 16:49:35

        查看登陸的用戶:

        以下都可以: 
          show   user; 
          select   sys_context('userenv','session_user')   from   dual;  -
         

          select   user   from   dual;   
         
          查看所有登錄的用戶必須為DBA 用戶: 
          select   username   from   v$session;

        sys、system等DBA 用戶查看 其他用戶(test)中的對象(表):
        SQL> select * from test.student;


        創建一個普通用戶都把該用戶用起來的流程:
        1、創建用戶
        SQL>create user test indentified by test;
        這樣就創建了一個用戶名密碼都為test的用戶
        但這個時候test還是不能登陸成功的,我們需要賦予相應的權限

        2、賦予create session的權限
        SQL>grant create session to test;
        這樣test用戶就能成功登陸進去

        但是此時用戶還是不能創建表 我們需要賦予用戶創建表的權限:
        SQL>grant create table to test;
        但是用戶此時還不能創建表 因為需要有使用表空間的權限(相當于 用戶有了進房間的鑰匙 但是沒有進大門的鑰匙。。。)

        所以也應該賦予相應的權限
        SQL>grant unlimited tablespace to test;
        這個時候用戶就擁有了創建表的權限 由于表是用戶test的 相應的他就擁有了對創建的表的增刪查改的權限了

        3、查看用戶擁有什么權限可以通過查詢一個系統的視圖(數字字典)
        SQL>select * from user_sys_privs;
        這樣就可以知道當前用戶的權限

        4、撤銷權限
        SQL> revoke create table from test;

        -----------------------------
        一些常用視圖的區分
        dba_tables  dba_all_tables  user_tables  user_all_tables  all_tables  all_all_tables
        當前用戶所屬的所有表(注意大寫)
        SQL> select tablespace_name,table_name from user_all_tables where table_name='STUDENT';
        SQL> select table_name,tablespace_name from user_tables where table_name='STUDENT';
        TABLE_NAME                     TABLESPACE_NAME
        ------------------------------ ------------------------------
        STUDENT                        USERS

        sys 要查看dba_all_tables,ALL_ALL_TABLES才能查看到 test 用戶的表。
        SQL> select owner,table_name,tablespace_name from dba_all_tables where owner='TEST';
        SQL> select owner,table_name,tablespace_name from all_all_tables where owner='TEST';
        SQL> select owner,table_name,tablespace_name from dba_tables  where owner='TEST';
        SQL> select owner,table_name,tablespace_name from ALL_tables  where owner='TEST';
        OWNER                          TABLE_NAME                     TABLESPACE_NAME
        ------------------------------ ------------------------------ ------------------------------
        TEST                           STUDENT                        USERS

        1.DBA_ALL_TABLES describes all object tables and relational tables in the database. Its columns are the same as those in ALL_ALL_TABLES.
        2.ALL_ALL_TABLES describes the object tables and relational tables accessible to the current user.
        3.USER_ALL_TABLES describes the object tables and relational tables owned by the current user. Its columns (except for OWNER) are the same as those in
        ALL_ALL_TABLES.
        ----------------------------------------------------------------------

        情景一:
        用戶test 用戶test1
        test1的用戶創建了個表mytab 并且插入了一些數據
        那么 test用戶是否可以訪問到test1的mytab怎么訪問?
        答:不可以,必須先授權
        test1必須授權給test :grant select on mytab to test;
        那么這個時候test可以通過 select * from test1.mytab;來訪問mytab中的數據
        如果想把某個表(對象)的所有權限都賦予給test那么可以:
        grant all on mytab to test;
        撤銷所有權限
        revoke all on mytab to test;

         

        總結
        對于系統權限由sys來做
        對于對象權限由 誰擁有誰授權

        系統權限
            grant create session to test;
            grant create table to test;
           grant unlimited tablespace to test;

           revoke create session from test;
           revoke create table from test;
           revoke unlimited tablespase from test;
           grant create session to public;  //表示把創建表的權限賦予所有人
           select * from user_sys_privs;  //返回當前用戶的所有系統權限

        對象權限
            grant select on mytab to test;
           grant all on mytab to test;

           revoke select on mytab from test;
           revoke all on mytab from test;

           select * from user_tab_privs;  //返回當前用戶所有的對象權限
          
           對象權限可以控制到列
           grant update(name) on mytab to test;
           grant insert(id) on mytab to test;

           select * from user_col_privs;
           注意、:查詢和刪除不能控制到列  
            需要有commit的 insert update insert

        權限的傳遞
          系統權限的傳遞:
           grant alter table to A with admin option;
          那么A可以通過把該權限傳遞給B,如果想B也可以傳遞下去那么可以也帶上with admin option
           grant alter table to B;
          對象權限的傳遞:
           grant select on mytab to A with grant option;
          那么A可以把在表mytab的select權限賦予給B,如果B想也能傳遞該select權限也可以帶上with grant option
           grant select on mytab to B;
         

        登陸EM 的用戶必須有一下權限
        創建了一個用戶testem,并有如下授權
        create user testem identified by testem;
        grant create session,select any dictionary to testem;  // testem可以登陸EM,但是還不是em的管理員。
        grant MGMT_USER to testem;

        非em管理員:(在“管理”下面沒有下圖選項)

         
        通過EM 登陸來增加 EM管理員:
        名稱:testem
        電子郵件地址沒有為此管理員定義電子郵件地址。
        有權訪問所有目標的超級管理員權限。
        數據庫系統權限: SELECT ANY DICTIONARY
        數據庫角色: MGMT_USER


        本文出自:億恩科技【www.endtimedelusion.com】

        服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質保障!--億恩科技[ENKJ.COM]

      1. 您可能在找
      2. 億恩北京公司:
      3. 經營性ICP/ISP證:京B2-20150015
      4. 億恩鄭州公司:
      5. 經營性ICP/ISP/IDC證:豫B1.B2-20060070
      6. 億恩南昌公司:
      7. 經營性ICP/ISP證:贛B2-20080012
      8. 服務器/云主機 24小時售后服務電話:0371-60135900
      9. 虛擬主機/智能建站 24小時售后服務電話:0371-60135900
      10. 專注服務器托管17年
        掃掃關注-微信公眾號
        0371-60135900
        Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權所有  地址:鄭州市高新區翠竹街1號總部企業基地億恩大廈  法律顧問:河南亞太人律師事務所郝建鋒、杜慧月律師   京公網安備41019702002023號
          0
         
         
         
         

        0371-60135900
        7*24小時客服服務熱線

         
         
        av不卡不卡在线观看_最近2018年中文字幕_亚洲欧美一区二区三区_一级A爱做片免费观看国产_日韩在线中文天天更新_伊人中文无码在线