数据库生态圈(RDB & NoSQL & Bigdata)——专注于关系库优化(Oracle & Mysql & Postgresql & SQL Server )

https://www.cnblogs.com/lhdz_bj
http://blog.itpub.net/8484829
https://blog.csdn.net/tuning_optmization
https://www.zhihu.com/people/lhdz_bj

导航

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)不失效;
 

posted on 2012-02-27 14:08  lhdz_bj  阅读(298)  评论(0编辑  收藏  举报