{"id":992,"date":"2015-12-30T05:21:22","date_gmt":"2015-12-30T05:21:22","guid":{"rendered":"http:\/\/haisins.epac.to\/wordpress\/?p=992"},"modified":"2015-12-30T05:21:22","modified_gmt":"2015-12-30T05:21:22","slug":"fgafine-grating-auditing","status":"publish","type":"post","link":"http:\/\/haisins.synology.me\/wordpress\/?p=992","title":{"rendered":"FGA(Fine Grating Auditing)"},"content":{"rendered":"<p>SQL&gt; conn hr\/hr<\/p>\n<p>SQL&gt;@$ORACLE_HOME\/sqlplus\/demo\/demobld.sql<\/p>\n<p><\/p>\n<p>&#8212; HR schema\uc5d0\uc11c emp,dept \ud14c\uc774\ube14\uc5d0 \ub300\ud55c \ud1b5\uacc4\uc815\ubcf4 \uc0dd\uc131\uc744&nbsp;<span style=\"line-height: 1.5;\">\ud574\uc57c\ub9cc, Auditing\uc774 \uc81c\ub300\ub85c \ub41c\ub2e4.<\/span><\/p>\n<p><\/p>\n<p>SQL&gt;analyze table emp compute statistics;<\/p>\n<p><\/p>\n<p>SQL&gt;analyze table dept compute statistics;<\/p>\n<p><\/p>\n<p>grant select on emp to sh;<\/p>\n<p>grant select on dept to sh;<\/p>\n<p><\/p>\n<p>conn system\/manager<\/p>\n<p><\/p>\n<p>begin<\/p>\n<p>&nbsp; &nbsp;dbms_fga.add_policy(<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OBJECT_SCHEMA=&gt;&#8217;HR&#8217;,<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OBJECT_NAME=&gt;&#8217;EMP&#8217;,<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;policy_name=&gt;&#8217;AUD_EMP_SAL_MGR&#8217;,<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AUDIT_CONDITION=&gt;&#8217;deptno in (10,20)&#8217;,<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AUDIT_COLUMN=&gt;&#8217;sal,mgr&#8217;,<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;handler_schema=&gt;&#8217;system&#8217;,<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;handler_module=&gt;&#8217;INS_EMP_TRAIL&#8217;,<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;enable=&gt;TRUE);<\/p>\n<p>&nbsp; &nbsp;end;<\/p>\n<p>\/<\/p>\n<p><\/p>\n<p>CREATE table AUD_EMP_TRAIL (<\/p>\n<p>&nbsp; object_schema varchar2(80),<\/p>\n<p>&nbsp; object_name varchar2(80),<\/p>\n<p>&nbsp; policy_name varchar2(80)<\/p>\n<p>);<\/p>\n<p><\/p>\n<p>CREATE PROCEDURE system.INS_EMP_TRAIL(<\/p>\n<p>&nbsp; p_object_schema varchar2,<\/p>\n<p>&nbsp; p_object_name varchar2,<\/p>\n<p>&nbsp; p_policy_name varchar2)<\/p>\n<p>AS&nbsp;<\/p>\n<p>BEGIN<\/p>\n<p>&nbsp; &nbsp;insert into system.AUD_EMP_TRAIL<\/p>\n<p>&nbsp; &nbsp;values( p_object_schema,p_object_name,p_policy_name);<\/p>\n<p>end;<\/p>\n<p>\/<\/p>\n<p><\/p>\n<p>1) sh\ub85c \uc811\uc18d<\/p>\n<p>&nbsp; &nbsp;conn sh\/sh<\/p>\n<p>&nbsp; &nbsp;select * from hr.emp;<\/p>\n<p><\/p>\n<p>2) sh\ub85c \uc811\uc18d HR\uc758 EMP \ud14c\uc774\ube14\uc758 empno,ename,sal\uc744 \uc870\uac74\uc5c6\uc774 \uc870\ud68c<\/p>\n<p>&nbsp; &nbsp;show user<\/p>\n<p>&nbsp; &nbsp;select empno,ename,sal from hr.emp;<\/p>\n<p><\/p>\n<p>3) system\uc73c\ub85c \uc811\uc18d<\/p>\n<p>&nbsp; &nbsp;conn system\/manager<\/p>\n<p>&nbsp; &nbsp;select ename from hr.emp where detpno=20;<\/p>\n<p><\/p>\n<p>&nbsp; &nbsp;select * from hr.emp where deptno in (10,20,30);<\/p>\n<p><\/p>\n<p>\ub370\uc774\ud130 \ub515\uc154\ub108\ub9ac\ub97c \ud1b5\ud574 &nbsp;Auditing \uc815\ubcf4\uac00 \uc815\uc0c1\uc801\uc73c\ub85c \uc0dd\uc131\ub418\uc5c8\ub294 \ud655\uc778<\/p>\n<p><\/p>\n<p>show user<\/p>\n<p>select to_char(timestamp,&#8217;YYYYDDHHH24MI&#8217;) as timestamp<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp;db_user,policy_name,sql_text<\/p>\n<p>from dba_fga_audit_trail;<\/p>\n<p><\/p>\n<p>select * from aud_emp_trail;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL&gt; conn hr\/hr SQL&gt;@$ORACLE_HOME\/sqlplus\/demo\/demobld.sql &#8212; HR schema\uc5d0\uc11c emp,dept \ud14c\uc774\ube14\uc5d0 \ub300\ud55c \ud1b5\uacc4\uc815\ubcf4 \uc0dd\uc131\uc744&nbsp;\ud574\uc57c\ub9cc, Auditing\uc774 \uc81c\ub300\ub85c \ub41c\ub2e4. SQL&gt;analyze table emp compute statistics; SQL&gt;analyze table dept compute statistics; grant select on emp to sh; grant select on dept to sh; conn system\/manager begin &nbsp; &nbsp;dbms_fga.add_policy( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OBJECT_SCHEMA=&gt;&#8217;HR&#8217;, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OBJECT_NAME=&gt;&#8217;EMP&#8217;, &nbsp; &nbsp; &nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"spay_email":""},"categories":[336],"tags":[530],"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/992"}],"collection":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=992"}],"version-history":[{"count":0,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/992\/revisions"}],"wp:attachment":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=992"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}