首页
技术基础
备份恢复
SQL优化
诊断案例
BLOG
留言板
服务
生活
网摘
阅读
下载
墨天轮
English
eygle.com - 留言簿 - 回复留言 - Powered by eYgLe.Com
返回留言簿
回 复 留 言
留言ID:
留言原文:
To
:
eygle
老虎,帮帮忙吧,我们现在用的是oracle erp ,db 8174
现在我想吧所与owner得table的所有权付给apps,并授权grant权限,但是就是不知道执行sqlplus得时候应该用那个用户执行?apps我也试过了,提示不能授权给自己
脚本如下:
$vi b.sql
declare username varchar2(100) default 'SYS';
begin
for tablelist in (select owner,table_name from dba_tables
where owner not in ('SYS','SYSTEM','APPS') order by 1 )
loop
if tablelist.owner<> username then
execute immediate 'alter session set current_schema = '||tablelist.owner||'';
username = tablelist.owner;
end if;
execute immediate 'grant all on '||tablelist.owner||'.'||tablelist.table_name ||' to apps with grant option';
end loop;
end;
/
$svrmgrl
SVRMGR> connect internal
Connected.
SVRMGR> @b.sql
ORA-01929: no privileges to GRANT
ORA-06512: at line 10
SVRMGR>
$ sqlplus apps/apps@b.sql
SQL*Plus: Release 8.1.7.0.0 - Production on Fri May 6 13:47:42 2005
(c) Copyright 2000 Oracle Corporation.All rights reserved.
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
declare username varchar2(100) default 'SYS';
*
ERROR at line 1:
ORA-01749: you may not GRANT/REVOKE privileges to/from yourself
ORA-06512: at line 10
From
:
Remen
2005.05.05 22:43
管理密码:
请输入管理密码, 否则无法回复.
斑竹昵称:
信息图标: ( 随机 )
BB 代码:
字体
宋体
黑体
隶书
楷体
幼圆
Arial
颜色
天蓝
品蓝
蓝色
深蓝
橙色
橙红
深红
红色
砖红
暗红
绿色
灰绿
海绿
粉红
果红
桃红
紫色
紫蓝
棕木
沙褐
土黄
深褐
土绿
灰色
大小
1号
2号
3号
4号
5号
内容:
如果想删除回复, 请点击最下面的删除回复按钮.
[COLOR=blue] 使用dbms_sys_sql就可以了,写个完整的例子给你: declare sqltext varchar2(200); c integer; begin for userlist in (select user_id,username from all_users where username not in ('SYS','SYSTEM','EYGLE')) loop for tablelist in (select owner,table_name from dba_tables where owner = userlist.username) loop sqltext := 'grant all on '||tablelist.owner||'.'||tablelist.table_name ||' to eygle with grant option'; c := sys.dbms_sys_sql.open_cursor(); sys.dbms_sys_sql.parse_as_user( c,sqltext,dbms_sql.native,userlist.user_id); sys.dbms_sys_sql.close_cursor(c); end loop; end loop; end; / [/COLOR]
删 除 回 复
管理密码:
请输入管理员密码, 只有版主才能删除回复.
Copyright © 2003~2012
eygle.com
All Rights Reserved.
Powered by:
www.eygle.com