1.建立用户,指定哪一个表空间
create user test2 identified by "123" default tablespace BDCDJ_XC temporary tablespace BDCDJ_XC_temp;数据库
2.建立角色
CREATE ROLE SELECT_ROLE ide
3.给角色分配权限
grant connect to SELECT_ROLE;
grant create synonym to SELECT_ROLE;spa
4.分配某些表的select权限
如:
grant select on BDCDJ_XC.BDC_CF to SELECT_ROLE;blog
--能够经过语句生成:
select 'grant select on '||owner||'.'||object_name||' to test2;'
from dba_objects
where owner in ('BDCDJ_XC') and object_type='TABLE'table
5.建立同义词给用户
如:
create or replace SYNONYM test2.BDC_CF FOR BDCDJ_XC.BDC_CF;test
--能够经过语句生成全部表:
SELECT 'create or replace SYNONYM BDCDJ_XC.' || object_name|| ' FOR ' || owner || '.' || object_name|| ';'
from dba_objects
where owner in ('BDCDJ_XC') and object_type='TABLE';登录
6.把角色赋予指定帐户
grant SELECT_ROLE to test2; object
7.删除角色
drop role SELECT_ROLE;select
8.检查角色的权限
select * from dba_sys_privs where grantee='SELECT_ROLE'
--------------------- 权限
这样其余人只有经过这个帐号登陆查询,表名不列出来,表空间不列出来。
能够建立database_link可是查询时报“表或视图不存在”
create database link to_bdcxc
connect to test2 identified by "123"
using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.xx.xxx)
(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ))'
select* from bdc_cf@to_bdcxc;
也就没法经过create table ..select复制数据库。
create table bdc_cf as select * from bdc_cf@to_bdcxc;
这样办法可行否,给个意见。