zoukankan      html  css  js  c++  java
  • rename交换表名字对其他对象及授权的影响实验

    很久不来了,一直忙,今天来看看,刚刚做了一个关于海量数据在线分区方案的测试(oracle 10.2.0.1 for 32 bit winxp):

    --创建user:tt并授权
    sqlplus / as sysdba
    create user tt identified by tt default tablespace users temporary tablespace temp;
    grant connect to tt;

    --user:test下创建表及基于它的过程、函数、视图、同义词,并给user:tt授权
    sqlplus test/test

    create or replace procedure p_test
    is
    begin
    insert into test values(10,'ww');
    commit;
    end p_test;
    /

    create or replace FUNCTION F_test return char
    as
      v_cnt int;
      begin
      select count(*) into v_cnt from test;
      return v_cnt;
    end;
    /

    create or replace view v_test
    as
    select * from test;

    create or replace synonym s_test for test;

    grant select on test to tt;

    --user:tt下检查test.test表查询
    sqlplus tt/tt
    select * from test.test;

    --测试:
    sqlplus test/test

    create table test_bk as select * from test;
    rename test to test_old;
    rename test_bk to test;

    sqlplus tt/tt
    select * from test.test

    connect test/test
    select * from v_test;
    select * from s_test;
    select f_test() from dual;
    exec p_test;


    --结果:
    1、授权(select on test)失效;
    2、过程(p_test)、函数(f_test)、视图(v_test)失效,但使用时会自动编译;
    3、同义词(s_test)不失效;
     

    Oracle & Mysql & Postgresql & MSSQL 调优 & 优化
    ----------------------------------------------------------
    《高性能SQL调优精要与案例解析》
    blog1:http://www.cnblogs.com/lhdz_bj
    blog2:http://blog.itpub.net/8484829
    blog3:http://blog.csdn.net/tuning_optmization
  • 相关阅读:
    Codeforces 831 A Unimodal Array 模拟(我感觉我现在比任何时候都理解程序员就是专门写各种Bug这句话)
    HDU 1205 吃糖果 鸽巢原理
    UVA 12716 GCDXOR 数论
    HDU 6152 Friend-Graph Ramsey定理 组合数学
    UVA 10791 Minimum Sum LCM 数论
    DFS系列 POJ(自认为的讲解)
    HDU 5101
    gets,gets_s,fgets函数
    vector理解一波~~~
    BestCoder Round #74 (div.1) 1002Shortest Path(hdoj5636)
  • 原文地址:https://www.cnblogs.com/lhdz_bj/p/2369761.html
Copyright © 2011-2022 走看看