grant select 用户B.表名 to 用户A
查询主表与引用表之间的关系
select a.owner as 主键拥有者,a.table_name as 主键表,--
b.column_name as 主键列,--
c.OWNER as 外键拥有者,--
c.table_name as 外键表,--
d.column_name as 外键列 --
from user_constraints a
left join user_cons_columns b
on a.constraint_name=b.constraint_name
left join user_constraints c
on c.R_CONSTRAINT_NAME=a.constraint_name
left join user_cons_columns d
on c.constraint_name=d.constraint_name
where a.constraint_type='P'
order by a.table_name
* 禁用试图 *
alter table 表名 disable constraint 约束名;
select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type='R' select 'alter table '||table_name||' enable constraint '||constraint_name||';' from user_constraints where constraint_type='R'
查询并导入空表
select table_name from user_tables where NUM_ROWS=0;
select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0 ;