ÔõÑùÔÚOracleÊý¾Ý¿âÖÐÉèÖñíµÄÖ»¶ÁȨÏÞ£¿
ÔÚOracleÊý¾Ý¿âÖУ¬ÉèÖñíµÄÖ»¶ÁȨÏÞÊǺÜÊÇÖ÷ÒªµÄ²Ù×÷£¬¿ÉÒÔ±£»¤Êý¾ÝµÄÇå¾²ÐÔ²¢±ÜÃâÎó²Ù×÷¡£ÏÂÃ潫ÏÈÈÝÔõÑùÔÚOracleÊý¾Ý¿âÖÐÉèÖñíµÄÖ»¶ÁȨÏÞ£¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
Ê×ÏÈ£¬ÎÒÃÇÐèÒªÏàʶÔÚOracleÊý¾Ý¿âÖУ¬Óû§Í¨¹ýÊÚȨ»ñµÃ¶Ô±íµÄȨÏÞ¡£±íµÄȨÏÞ°üÀ¨SELECT£¨ÅÌÎÊ£©¡¢INSERT£¨²åÈ룩¡¢UPDATE£¨¸üУ©ºÍDELETE£¨É¾³ý£©µÈ²Ù×÷¡£ÔÚÕâÀÎÒÃǽ«ÏÈÈÝÔõÑù¸øÓû§ÉèÖÃÖ»¶ÁȨÏÞ£¬¼´Ö»ÔÊÐíÓû§ÅÌÎʱíµÄÊý¾Ý£¬²»ÔÊÐí¶Ô±í¾ÙÐÐÈκÎÐ޸ġ£
ÏÂÃæÊÇÏêϸµÄ°ì·¨ÒÔ¼°ÏìÓ¦µÄ´úÂëʾÀý£º
°ì·¨Ò»£º½¨ÉèÒ»¸öеÄÖ»¶ÁÓû§
CREATE USER readonly_user IDENTIFIED BY password;
µÇ¼ºó¸´ÖÆ
°ì·¨¶þ£ºÊÚÓèÅÌÎʱíµÄȨÏÞ
GRANT SELECT ON table_name TO readonly_user;
µÇ¼ºó¸´ÖÆ
°ì·¨Èý£º×÷·ÏÆäËû²Ù×÷ȨÏÞ
REVOKE INSERT, UPDATE, DELETE ON table_name FROM readonly_user;
µÇ¼ºó¸´ÖÆ
°ì·¨ËÄ£ºÈ·ÈÏȨÏÞÉèÖÃÀÖ³É
SELECT * FROM all_tab_privs WHERE grantee = 'readonly_user' AND table_name = 'table_name';
µÇ¼ºó¸´ÖÆ
ÕâÑù£¬ÎÒÃǾÍÀֳɵؽ«±íµÄÖ»¶ÁȨÏÞÊÚÓèÁËÐÂÓû§¡£Ö»¶ÁÓû§½«¿ÉÒÔÅÌÎʱíµÄÊý¾Ý£¬µ«ÎÞ·¨¶Ô±í¾ÙÐÐÈκÎÐ޸IJÙ×÷¡£
ÐèҪעÖصÄÊÇ£¬È¨ÏÞÉèÖÃÊǺÜÊÇÖ÷ÒªµÄ²Ù×÷£¬ÐèÒªÉóÉ÷¾ÙÐС£ÔÚ¸øÓû§ÉèÖÃȨÏÞʱ£¬Îñ±ØÈ·±£½öÊÚÓèÐëÒªµÄȨÏÞ£¬ÒÔÈ·±£Êý¾ÝµÄÇå¾²ÐÔºÍÍêÕûÐÔ¡£
×ܽáÆðÀ´£¬Í¨¹ýÒÔÉÏ°ì·¨ºÍ´úÂëʾÀý£¬ÎÒÃÇ¿ÉÒÔÔÚOracleÊý¾Ý¿âÖÐÉèÖñíµÄÖ»¶ÁȨÏÞ£¬±£»¤Êý¾ÝµÄÇå¾²ÐÔ£¬È·±£Êý¾Ý²»±»¶ñÒâ¸Ä¶¯»òɾ³ý¡£
ÒÔÉϾÍÊÇÔõÑùÔÚOracleÊý¾Ý¿âÖÐÉèÖñíµÄÖ»¶ÁȨÏÞ£¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡