<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Decode360's Blog

    業(yè)精于勤而荒于嬉 QQ:150355677 MSN:decode360@hotmail.com

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
      302 隨筆 :: 26 文章 :: 82 評論 :: 0 Trackbacks
    一、CREATE SESSION + CREATE TABLE權(quán)限無法創(chuàng)建表
    ?
    ??? 簡單說明:RESOURCE角色會默認賦給USER一個UNLIMITED TABLESPACE權(quán)限,但CREATE TABLE角色不會給用戶此權(quán)限,所以需要進行手動說明一個quota unlimited on的動作,如下舉例:

    ?
    I recommend you
    ?
    alter user USERNAME default tablespace <something OTHER than system> quota
    unlimited on <something OTHER than system>;
    ?
    That user can actually create tables, they just cannot create tables that
    allocate space ;)?
    ?
    ops$tkyte@ORA817.US.ORACLE.COM> create user a identified by a;
    User created.
    ?
    ops$tkyte@ORA817.US.ORACLE.COM> grant create session, create table to a;
    Grant succeeded.
    ?
    ops$tkyte@ORA817.US.ORACLE.COM> connect a/a
    Connected.
    ?
    ops$tkyte@ORA817.US.ORACLE.COM> create table t (x int);
    create table t (x int)
    *
    ERROR at line 1:
    ORA-01950: no privileges on tablespace 'SYSTEM'
    ?

    ops$tkyte@ORA817.US.ORACLE.COM> create global temporary table t ( x int );
    Table created.
    ?
    ops$tkyte@ORA817.US.ORACLE.COM> connect /
    Connected.
    ?
    ops$tkyte@ORA817.US.ORACLE.COM> alter user a default tablespace users
    ? 2? quota unlimited on users;
    User altered.
    ?
    ops$tkyte@ORA817.US.ORACLE.COM> connect a/a
    Connected.
    ?
    ops$tkyte@ORA817.US.ORACLE.COM> create table tt ( x int );
    Table created.
    ?
    ?
    ?
    二、關(guān)于權(quán)限創(chuàng)建的建議

    ?
    It follows with this advice:
    ?
    do not use connect, resource or DBA unless you have to.? Somethings require DBA
    (the products look for that role unfortunately) but you should not need connect
    (which has WAY too much power) and resource (even more)
    ?
    create your OWN roles and use those instead.?
    ?
    ?
    ?
    三、關(guān)于隱藏的Unlimited Tablespace權(quán)限的賦予和收回
    ?
    ??? 簡單說明:DBA、RESOURCE角色并不含有Unlimited Tablespace權(quán)限,但是當(dāng)把角色賦予USER時,會隱含得賦予用戶Unlimited Tablespace權(quán)限,當(dāng)revoke時也默認得收回。但是顯式的Unlimited Tablespace權(quán)限只能賦給USER,不能賦給ROLE。

    ?
    UNLIMITED TABLESPACE cannot actually be granted to a role at all!? so, it is
    not in the data dictionary.
    ?
    you cannot revoke unlimited tablespace from a role (in fact, you cannot even
    really grant it to a role)
    ?
    you can however from a user.
    ?
    ops$tkyte@ORA9IR2> grant unlimited tablespace to scott;
    ?
    Grant succeeded.
    ?
    ops$tkyte@ORA9IR2> grant unlimited tablespace to connect;
    grant unlimited tablespace to connect
    *
    ERROR at line 1:
    ORA-01931: cannot grant UNLIMITED TABLESPACE to a role
    ?
    ?
    the granting of RESOURCE or DBA to a user will grant them unlimited tablespace.
    ?revoking will revoke it.
    ?
    I'll hypothesize:
    ?
    a) user was granted DBA and RESOURCE (that gave them unlimited tablespace)
    b) user was revoked DBA (that took it away)
    c) simply granting it to them will put it back...
    ?

    Consider:
    ?
    ops$tkyte@ORA9IR2> drop user a cascade;
    ?
    User dropped.
    ?
    ops$tkyte@ORA9IR2>
    ops$tkyte@ORA9IR2> create user a identified by a;
    ?
    User created.
    ?
    ops$tkyte@ORA9IR2>
    ops$tkyte@ORA9IR2> grant dba, resource to a;
    ?
    Grant succeeded.
    ?
    ops$tkyte@ORA9IR2>
    ops$tkyte@ORA9IR2> select 'tab', privilege from dba_tab_privs where grantee = 'A'
    ? 2? union all
    ? 3? select 'sys', privilege from dba_sys_privs where grantee = 'A'
    ? 4? union all
    ? 5? select 'rol', granted_role from dba_role_privs where grantee = 'A';
    ?
    'TA PRIVILEGE
    --- ----------------------------------------
    sys UNLIMITED TABLESPACE
    rol DBA
    rol RESOURCE
    ?
    now you see it...
    ?
    ops$tkyte@ORA9IR2>
    ops$tkyte@ORA9IR2> revoke dba from a;
    ?
    Revoke succeeded.
    ?
    ops$tkyte@ORA9IR2> select 'tab', privilege from dba_tab_privs where grantee = 'A'
    ? 2? union all
    ? 3? select 'sys', privilege from dba_sys_privs where grantee = 'A'
    ? 4? union all
    ? 5? select 'rol', granted_role from dba_role_privs where grantee = 'A';
    ?
    'TA PRIVILEGE
    --- ----------------------------------------
    rol RESOURCE
    ?
    Now you don't
    ?

    ops$tkyte@ORA9IR2>
    ops$tkyte@ORA9IR2> grant resource to a;
    ?
    Grant succeeded.
    ?
    ops$tkyte@ORA9IR2> select 'tab', privilege from dba_tab_privs where grantee = 'A'
    ? 2? union all
    ? 3? select 'sys', privilege from dba_sys_privs where grantee = 'A'
    ? 4? union all
    ? 5? select 'rol', granted_role from dba_role_privs where grantee = 'A';
    ?
    'TA PRIVILEGE
    --- ----------------------------------------
    sys UNLIMITED TABLESPACE
    rol RESOURCE

    now you see it again...
    ?
    ?
    ?
    四、查詢所有權(quán)限清單

    ?
    get the list of all privileges available:

    ops$tkyte@ORA9IR2> select * from system_privilege_map;
    ?
    ?PRIVILEGE NAME???????????????????????????? PROPERTY
    ---------- ------------------------------ ----------
    ??????? -3 ALTER SYSTEM??????????????????????????? 0
    .....?
    ?
    0 = valid, good
    1 = was valid, no longer is a privilege.?
    ?
    ?
    ?
    五、查看SYNONYM對應(yīng)的OBJECT的權(quán)限情況

    --------------------------------------------------------------------------------

    scott@ORA10GR1> select *
    ? 2??? from all_tab_privs
    ? 3?? where (table_schema,table_name) in ( select table_owner, table_name
    ? 4?????????????????????????????????? from all_synonyms
    ? 5????????????????????????????????? where synonym_name = 'TKYTE_T' )
    ? 6? /
    ?
    GRANTOR????GRANTEE??? TABLE_SCHEMA?? TABLE_NAME?PRIVILEGE?????GRA HIE
    ---------- ---------- -------------- ---------- ------------- --- ---
    OPS$TKYTE??SCOTT????? OPS$TKYTE??????T????????? SELECT????????NO? NO
    ?
    ?
    ?
    六、GRANT ANY ROLE權(quán)限的問題

    ??? 簡單說明:如果通過Package來為其他用戶分配權(quán)限,則這個Package的OWNER必須要有GRANT ANY ROLE的權(quán)限,但是執(zhí)行、取消執(zhí)行該Package則無需GRANT ANY ROLE權(quán)限,而僅需要有操作Package的權(quán)限就可以了。但是不建議為用戶賦GRANT ANY ROLE權(quán)限。


    If the GRANT statment is in a package the OWNER of the package needs the
    ability to grant the role, the user running the package needs no special privs.
    ?
    The invoker of the procedure does not need this privilege, only the OWNER
    (definer) does.?
    ?
    ?

    Don't grant "GRANT ANY ROLE", that will create a huge security problem.
    ?
    I was suggesting to the person here, that asked the question, that they NEED
    NOT
    grant this super powerful priv.? That all they needed to do was create a
    package that gave the grants as the owner of the objects -- grant execute on
    that package to this other user? and they are done.
    ?
    Don't grant GRANT ANY ROLE, that would be a really bad idea.?
    ?
    ?
    ?
    ??? 需要注意的是:GRANT ANY ROLE權(quán)限是不能分配DBA和RESOURCE角色給自己或其他USER的。這是因為這兩個ROLE在賦予時會默認得將UNLIMITED TABLESPACE系統(tǒng)權(quán)限同時賦給USER,而GRANT ANY ROLE并沒有賦予用戶系統(tǒng)權(quán)限的權(quán)限,因此失敗。

    ?
    Case, SYSTEM grant GRANT ANY ROLE to scott. SCOTT no able to grant DBA to self
    or any other user.
    ?
    system@o817> grant grant any role to scott;
    ?
    Grant succeeded.
    ?
    scott@o817> select * from dba_users;
    select * from dba_users
    ????????????? *
    ERROR at line 1:
    ORA-00942: table or view does not exist

    scott@o817> grant dba to scott;
    grant dba to scott
    *
    ERROR at line 1:
    ORA-01031: insufficient privileges

    scott@o817> grant dba to SYSTEM;
    grant dba to SYSTEM
    *
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ---------------------------------------------

    Try any role other then DBA or RESOURCE.?
    They fail because they implicity
    attempt to grant the privilege UNLIMITED TABLESPACE in addition to the ROLE
    (they are "magic", special)
    .? You'll find that scott can grant important stuff
    like JAVASYSPRIV to anyone (including himself).? Give me the ability to create
    a java stored procedure and GRANT ANY ROLE and I'll wreak havoc on your
    database.? Or, if you have DBA-like roles you've created (as you should), they
    can grant those.

    Powerful?? Yes, definitely.?
    ?
    ?
    ?
    七、ROLE危險性討論
    ?
    ??? 簡單說明:除了GRANT ANY ROLE角色外,execute any procedure、alter user等權(quán)限都會造成比較嚴(yán)重的風(fēng)險。可以使用戶獲得DBA權(quán)限(How?)


    GRANT ANY ROLE does allow 2 roles that are granted to DBA
    to be granted: EXP_FULL_DATABASE and IMP_FULL_DATABASE.
    The IMP_FULL_DATABASE role has the ability to drop any
    database object and create any database object.? Also,
    the privilege to EXECUTE ANY PROCEDURE opens up more
    possibilities (as does BECOME USER).?
    ?

    Followup:?
    Good point -- if you give me:
    ?
    o create session
    o execute any procedure
    ?
    I can take over your database and get ANY priv I want.? It would take about 30
    seconds for me to have DBA and anything else I wanted.?
    ?
    ?
    ?



    -The End-

    posted on 2009-03-26 21:34 decode360-3 閱讀(431) 評論(0)  編輯  收藏 所屬分類: Toy
    主站蜘蛛池模板: 久久综合日韩亚洲精品色| 日韩午夜免费视频| 亚洲αv在线精品糸列| 国产VA免费精品高清在线| 国产精品亚洲综合一区| 日日摸夜夜添夜夜免费视频| 日产乱码一卡二卡三免费| 亚洲AV无码XXX麻豆艾秋| 国产公开免费人成视频| 免费一级特黄特色大片| 亚洲人成人网站在线观看| 免费国产va视频永久在线观看| 又黄又大又爽免费视频| 一级做a爰片久久免费| 亚洲国产精品无码久久久蜜芽| 久久免费精品视频| 亚洲免费视频观看| 国产精品免费_区二区三区观看| 特级毛片A级毛片100免费播放| 久久久久国产成人精品亚洲午夜 | 亚洲91精品麻豆国产系列在线| 亚洲综合免费视频| 亚洲а∨天堂久久精品9966| 精品国产麻豆免费网站| 国产精品亚洲一区二区无码| 亚洲偷自拍拍综合网| 99爱免费观看视频在线| 亚洲午夜无码久久久久软件| 亚洲av无码成人精品区| 免费a级毛片无码a∨免费软件| 久久亚洲AV成人出白浆无码国产| 岛国av无码免费无禁网站| 色网站在线免费观看| 亚洲国产另类久久久精品| 免费观看国产网址你懂的| 亚洲av永久无码精品秋霞电影秋 | 亚洲理论片在线观看| 国产不卡免费视频| 一区二区三区四区免费视频| 亚洲中文字幕久久久一区| 亚洲高清无码在线观看|