如何一次为一组视图授予用户访问权限(选择,更新......)?
答案 0 :(得分:1)
您可以使用此脚本(未测试)
DECLARE
targetUser VARCHAR2(200 CHAR);
BEGIN
targetUser := 'fooBar';
FOR Rec IN (SELECT object_name, object_type FROM user_objects WHERE object_type IN ('VIEW')) LOOP
DBMS_OUTPUT.PUT_LINE('GRANT SELECT, UPDATE, INSERT, DELETE ON '||Rec.object_name||' TO ' || targetUser);
EXECUTE IMMEDIATE 'GRANT SELECT, UPDATE, INSERT, DELETE ON '||Rec.object_name||' TO ' || targetUser;
END LOOP;
END;
答案 1 :(得分:1)
在Oracle中还有(非常误导性地命名)构造称为CREATE SCHEMA
。通过使用此功能,您可以将多个数据库对象组合为一个“实体”,以供授予。