09:27:16 SQL> spool off;
09:27:21 SQL> spool c:\a.sql
09:27:53 SQL> select 'grant select,update,select on '||table_name||' to username;' from cat where TABLE_TYPE='TABLE';'GRANTSELECT,UPDATE,SELECTON'||TABLE_NAME||'TOUSERNAME;'
-------------------------------------------------------------------------
grant select,update,select on A to username;
grant select,update,select on B to username;
grant select,update,select on C to username;
grant select,update,select on D to username;
grant select,update,select on S to username;
grant select,update,select on SC to username;
grant select,update,select on TABLE1 to username;
grant select,update,select on TABLE2 to username;
grant select,update,select on TBA to username;
grant select,update,select on TBB to username;
grant select,update,select on TCC to username;
grant select,update,select on TCD to username;
grant select,update,select on TCN to username;
grant select,update,select on TLOB to username;
grant select,update,select on V_1 to username;已选择17行。实际:691
09:28:50 SQL> spool off;
09:29:04 SQL>
然后就编辑一下c:\a.sql
sql*plus里面
@c:\a.sql
09:27:21 SQL> spool c:\a.sql
09:27:53 SQL> select 'grant select,update,select on '||table_name||' to username;' from cat where TABLE_TYPE='TABLE';'GRANTSELECT,UPDATE,SELECTON'||TABLE_NAME||'TOUSERNAME;'
-------------------------------------------------------------------------
grant select,update,select on A to username;
grant select,update,select on B to username;
grant select,update,select on C to username;
grant select,update,select on D to username;
grant select,update,select on S to username;
grant select,update,select on SC to username;
grant select,update,select on TABLE1 to username;
grant select,update,select on TABLE2 to username;
grant select,update,select on TBA to username;
grant select,update,select on TBB to username;
grant select,update,select on TCC to username;
grant select,update,select on TCD to username;
grant select,update,select on TCN to username;
grant select,update,select on TLOB to username;
grant select,update,select on V_1 to username;已选择17行。实际:691
09:28:50 SQL> spool off;
09:29:04 SQL>
然后就编辑一下c:\a.sql
sql*plus里面
@c:\a.sql
SPOOL C:\A.SQL --->是什么意思?
select 'grant select,update,select on '||table_name||' to username;' from cat where TABLE_TYPE='TABLE'; 怎么做?比如实际上我要将TEST01下的所有表授权于TEST02怎么写:???
select 'grant select,update,select on '||table_name||' to TEST02;' from TEST01 where TABLE_TYPE='TABLE'是吗?可这样总感觉有问题/
spool c:\a.sql
select 'grant select,delete,update,select on '||table_name||' to TEST02;' from cat where TABLE_TYPE='TABLE';
spool off;
@c:\a.sql
SPOOL C:\A.SQL --->是什么意思?---》将以后的内容输出到文件C:\A.SQL比如实际上我要将TEST01下的所有表授权于TEST02怎么写:???
使用楼上 bzszp(SongZip) 的方法即可,
不过注意要用记事本编辑以下C:\A.SQL