SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Downloaden Sie, um offline zu lesen
Oracle audit - Fine-Grained Audit

Bildiyiniz kimi Oracle verilənlər bazasında müxtəlif hadisələrə audit təyin etmək olurdu. Bunlara misal SQL
sorğusu, hüquqlar (privileges), sxema və obyektlər. Əlavə olaraq fine-grained audit istifadə edərək verilənlər
bazasındakı fəaliyyətlərə belə ki, cədvəllər üzərində əməliyyatlar və ya fəaliyyət zamanına nəzarət göstərə bilərik.

Bugün mən sizə fine-grained audit haqqında məlumat verəcəm. İlk dəfə bu audit özəlliyi Oracle 9i da təqdim
olunmuşdur. Məqsəd istifadəçinin cədvəldən etdiyi sorğunu (select) audit qeydini yazmaq idi. Çünki digər audit
metodları ilə cədvəldəki dəyişikliyi audit-ləmək mümkün idi.

Diqqət, FGA, AUDIT_TRAIL parameterindən aslı deyil və bütün ona aid audit qeydləri FGA_LOG$ cədvəlinə
yazır.

Siz fine-grained auditing dən aşağıdakı hallarda istifadə edə bilərsiniz:
       Cədvəllər (misal üçün) səhər 9-dan axşam 6-ya dək və ya həftə sonları;
       Korporativ şəbəkə xarici İP istifadəsi;
       Cədvəl sütunu seçmək (select) və ya dəyişmək (Selecting or updating a table column);
       Cədvəlin sütunundakı dəyəri dəyişmək (Modifying a value in a table column)

Gəlin bir nümunəyə baxaq. Öncə gəlin audit_trail parameterini VB təyin edək və VB restart edək. Bu parameter
dəyişiklikdən sonra effektiv olması üçün VB yenidən açılmalıdır (restart olmalıdır).

SQL> alter system set audit_trail=DB scope=spfile;
System altered.

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.

Total System Global Area 422670336 bytes
Fixed Size           1336960 bytes
Variable Size       310380928 bytes
Database Buffers       104857600 bytes
Redo Buffers          6094848 bytes
Database mounted.
Database opened.
SQL>

SQL> show parameters audit_trail

NAME                                TYPE           VALUE
------------------------------------ ----------- ------------------------------
audit_trail                          string       DB
--Yeni cədvəl yaradaq və ona bir neçə sətr daxil edək

SQL> conn ulfet/ulfet
Connected.
SQL> create table telebeler (
id number,
f_name varchar2(10),
l_name varchar2(15),
lesson_name char(20),
score number);

Table created.

SQL> insert into telebeler values(1, 'Azer', 'Ibrahimov', 'History', 5);
1 row created.

SQL> insert into telebeler values(2, 'Kerim', 'Veliyev', 'History', 2);
1 row created.

SQL> insert into telebeler values(3, 'Ulfet', 'Tanriverdiyev', 'History', 4);
1 row created.

SQL> insert into telebeler values(4, 'Mamed', 'Aliyev', 'History', 3);
1 row created.

SQL> insert into telebeler values(5, 'Omar', 'Tanriverdiyev', 'History', 5);
1 row created.

SQL> commit;
Commit complete.

Cədvəlimiz hazırdır, audit polisimizi təyin edək.

Aşağıdakı polisi telebeler cədvəlindəki score sütunun dəyərinin 4 və 4-dən böyük olduğu halda audit qeydini
edəcək.

--Connect as sys
SQL> conn sys/?????? as sysdba

Connected.

SQL> BEGIN
  DBMS_FGA.add_policy(
   object_schema => 'ULFET',
   object_name => 'TELEBELER',
   policy_name => 'CHECK_SCORE_AUDIT',
   audit_condition => 'score >= 4',
   audit_column => 'SCORE');
END;
/
  2 3 4 5 6 7 8 9
PL/SQL procedure successfully completed.

İndisə ulfet istifadəçisi ilə VB bağlanaq və bəzi select –lər yazaq.
Sorğularımız audit-ə düşməsi üçün “where” yazaraq score sütununa uyğun dəyərlər yazaq.

SQL> select * from telebeler where score <=3;
   ID           F_NAME       L_NAME                    LESSON_NAME                SCORE
    ---------- ------------   ---------------           --------------------        ----------
    2            Kerim        Veliyev                   History                    2
    4            Mamed       Aliyev                     History                     3

SQL> select * from telebeler where score=5;
   ID           F_NAME       L_NAME                    LESSON_NAME               SCORE
    ---------- ------------   ---------------           --------------------       ----------
    1            Azer         Ibrahimov                History                     5
    5            Omar        Tanriverdiyev             History                    5

SQL> select * from telebeler where score>=4;
   ID           F_NAME      L_NAME                     LESSON_NAME               SCORE
    ---------- ------------  ---------------            --------------------       ----------
    1            Azer        Ibrahimov                 History                     5
    3            Ulfet       Tanriverdiyev             History                    4
    5            Omar        Tanriverdiyev             History                    5

SQL>.

İndisə sys istifadəçisi kimi daxil olub yoxlayaq.

--Connect as sys
SQL> conn sys/?????? as sysdba

SQL> select db_user,policy_name,sql_text,TIMESTAMP from dba_fga_audit_trail order by 4;

DB_USER POLICY_NAME                            SQL_TEXT                                                    TIMESTAMP
---------------- ----------------------        ---------------------------------------------------------   -----------------------
ULFET            CHECK_SCORE_AUDIT             select * from telebeler where score=5                       07-DEC-12
ULFET            CHECK_SCORE_AUDIT             select * from telebeler where score>=4                      07-DEC-12

VB-dakı FGA polisilərin siyahısını görmək üçün DBA_AUDIT_POLICIES görünüşündən (view) istifadə edə
bilərsiniz.

SQL> SELECT POLICY_NAME FROM DBA_AUDIT_POLICIES;

POLICY_NAME
-----------------------------
CHECK_SCORE_AUDIT

SQL>

Oralce 9i versiyasında fine-grained audit məhdud imkanlara sahib idi, lakin Oracle 10g-dən başlayaraq bu inkişaf
etdirildi və beləliklə DML əmrləridə (statements) daxil edildi. Bu özəllikdən istifadə edə bilmək üçün
DBMS_FGA.ADD_POLICY prosedurundakı statement_types parametrinə dəyər(lər) mənimsətmək lazımdır.


statement_types => 'SELECT,INSERT,UPDATE,DELETE');
Fine-Grained Audit Polisini istifadə etmək üçün istifadəçiyə DBMS_FGA PL/SQL paketinə çalışdırma (execute)
haqqı verilməlidir. Bu paket SYS istifadəçisinə məxsusdur.

Aşagıdakı əmrlərdən istifadə edərək fine-grained auditin istifadəsini bağlayıb (disable) və ya aça bilərik (enable)

SQL> BEGIN
DBMS_FGA.DISABLE_POLICY(
  object_schema  => 'ULFET',
  object_name   => 'TELEBELER',
  policy_name   => 'CHECK_SCORE_AUDIT');
END;
/ 2 3 4 5 6 7

PL/SQL procedure successfully completed.

SQL>

SQL> BEGIN
DBMS_FGA.ENABLE_POLICY(
  object_schema     => 'ULFET',
  object_name      => 'TELEBELER',
  policy_name     => 'CHECK_SCORE_AUDIT',
  enable        => TRUE);
END;
/ 2 3 4 5 6 7 8

PL/SQL procedure successfully completed.

SQL>

FGA polisini silmək üçün:

SQL> BEGIN
DBMS_FGA.DROP_POLICY(
  object_schema  => 'ULFET',
  object_name   => 'TELEBELER',
  policy_name   => 'CHECK_SCORE_AUDIT');
END;
/

PL/SQL procedure successfully completed.

Oracle 11g də FGA üçün yeni özəllik var. Bu DBMS_AUDIT_MGMT paketindən istifadə edərək audit cədvəllərinin
tablespace –lərini dəyişmək mümkündür.

Susma halına görə (default) audit trail SYS.AUD$ və SYS.FGA_LOG$ cədvəliləri SYSTEM tablespace də
yerləşirlər. Audit cədvəllərin tablespace-lərini dəyişmək üçün aşağıdakı əmri icra etmək lazımdır:

BEGIN
DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION(
 AUDIT_TRAIL_TYPE     => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
 AUDIT_TRAIL_LOCATION_VALUE => 'AUD_AUX');
END;
Bu nümunədə:
    AUDIT_TRAIL_TYPE: VB dakı audit trail tipinə əsaslanır. Aşağıdakılardan birini daxil edin:
       DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD: Standart audit trail cədvəli, AUD$.
       DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD: Fine-grained audit trail cədvəli, FGA_LOG$.
       DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD: Həm standart həmdə fine-grained audit trail
          cədvəlləri.
    AUDIT_TRAIL_LOCATION_VALUE: Hədəf tablespace təyin edir. Bu nümunə AUDİT_TABLES
      tablespace-ni istifadə edir.

Gəlin tətbiq edək

SQL> conn /as sysdba
Connected.

SQL> SELECT table_name, tablespace_name FROM dba_tables
WHERE table_name IN ('AUD$', 'FGA_LOG$') ORDER BY 1;
TABLE_NAME                     TABLESPACE_NAME
------------------------------  ------------------------------
AUD$                            SYSTEM
FGA_LOG$                        SYSTEM
SQL>

Audit cədvəllərinin saxlanılması üçün yeni tablespace quraq.

SQL> create tablespace audit_tables datafile '/u01/app/oracle/oradata/testdb/audit_tables1' size 50m
autoextend on;

Tablespace created.
SQL>

İndisə fine-grained audit trail cədvəlinin tablespace-ni yeni tablespace-ə daşıyaq.

SQL> BEGIN
 DBMS_AUDIT_MGMT.set_audit_trail_location(
  audit_trail_type       => DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD,
  audit_trail_location_value => 'AUDIT_TABLES');
END;

/ 2    3    4    5    6

PL/SQL procedure successfully completed.
SQL>

Diqqət, bu əmr icra olunan zaman səbrli olun. Bu uzun zaman çəkə bilər və bu bir başa audit cədvəlinin
ölçüsündən aslıdır.

--Yuxarıdakı select-i bir daha icra edək

SQL> SELECT table_name, tablespace_name FROM dba_tables
WHERE table_name IN ('AUD$', 'FGA_LOG$') ORDER BY 1;

TABLE_NAME                               TABLESPACE_NAME
--------------------------------------    ------------------------------
AUD$                                      SYSTEM
FGA_LOG$                                  AUDIT_TABLES
Mənbə:
http://docs.oracle.com/cd/E11882_01/server.112/e25789/cmntopc.htm#CNCPT89153
http://docs.oracle.com/cd/E11882_01/network.112/e16543/auditing.htm#DBSEG60681

Weitere ähnliche Inhalte

Empfohlen

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Oracle audit fga - azerbaycan dilinde

  • 1. Oracle audit - Fine-Grained Audit Bildiyiniz kimi Oracle verilənlər bazasında müxtəlif hadisələrə audit təyin etmək olurdu. Bunlara misal SQL sorğusu, hüquqlar (privileges), sxema və obyektlər. Əlavə olaraq fine-grained audit istifadə edərək verilənlər bazasındakı fəaliyyətlərə belə ki, cədvəllər üzərində əməliyyatlar və ya fəaliyyət zamanına nəzarət göstərə bilərik. Bugün mən sizə fine-grained audit haqqında məlumat verəcəm. İlk dəfə bu audit özəlliyi Oracle 9i da təqdim olunmuşdur. Məqsəd istifadəçinin cədvəldən etdiyi sorğunu (select) audit qeydini yazmaq idi. Çünki digər audit metodları ilə cədvəldəki dəyişikliyi audit-ləmək mümkün idi. Diqqət, FGA, AUDIT_TRAIL parameterindən aslı deyil və bütün ona aid audit qeydləri FGA_LOG$ cədvəlinə yazır. Siz fine-grained auditing dən aşağıdakı hallarda istifadə edə bilərsiniz:  Cədvəllər (misal üçün) səhər 9-dan axşam 6-ya dək və ya həftə sonları;  Korporativ şəbəkə xarici İP istifadəsi;  Cədvəl sütunu seçmək (select) və ya dəyişmək (Selecting or updating a table column);  Cədvəlin sütunundakı dəyəri dəyişmək (Modifying a value in a table column) Gəlin bir nümunəyə baxaq. Öncə gəlin audit_trail parameterini VB təyin edək və VB restart edək. Bu parameter dəyişiklikdən sonra effektiv olması üçün VB yenidən açılmalıdır (restart olmalıdır). SQL> alter system set audit_trail=DB scope=spfile; System altered. SQL> shut immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 422670336 bytes Fixed Size 1336960 bytes Variable Size 310380928 bytes Database Buffers 104857600 bytes Redo Buffers 6094848 bytes Database mounted. Database opened. SQL> SQL> show parameters audit_trail NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ audit_trail string DB
  • 2. --Yeni cədvəl yaradaq və ona bir neçə sətr daxil edək SQL> conn ulfet/ulfet Connected. SQL> create table telebeler ( id number, f_name varchar2(10), l_name varchar2(15), lesson_name char(20), score number); Table created. SQL> insert into telebeler values(1, 'Azer', 'Ibrahimov', 'History', 5); 1 row created. SQL> insert into telebeler values(2, 'Kerim', 'Veliyev', 'History', 2); 1 row created. SQL> insert into telebeler values(3, 'Ulfet', 'Tanriverdiyev', 'History', 4); 1 row created. SQL> insert into telebeler values(4, 'Mamed', 'Aliyev', 'History', 3); 1 row created. SQL> insert into telebeler values(5, 'Omar', 'Tanriverdiyev', 'History', 5); 1 row created. SQL> commit; Commit complete. Cədvəlimiz hazırdır, audit polisimizi təyin edək. Aşağıdakı polisi telebeler cədvəlindəki score sütunun dəyərinin 4 və 4-dən böyük olduğu halda audit qeydini edəcək. --Connect as sys SQL> conn sys/?????? as sysdba Connected. SQL> BEGIN DBMS_FGA.add_policy( object_schema => 'ULFET', object_name => 'TELEBELER', policy_name => 'CHECK_SCORE_AUDIT', audit_condition => 'score >= 4', audit_column => 'SCORE'); END; / 2 3 4 5 6 7 8 9 PL/SQL procedure successfully completed. İndisə ulfet istifadəçisi ilə VB bağlanaq və bəzi select –lər yazaq.
  • 3. Sorğularımız audit-ə düşməsi üçün “where” yazaraq score sütununa uyğun dəyərlər yazaq. SQL> select * from telebeler where score <=3; ID F_NAME L_NAME LESSON_NAME SCORE ---------- ------------ --------------- -------------------- ---------- 2 Kerim Veliyev History 2 4 Mamed Aliyev History 3 SQL> select * from telebeler where score=5; ID F_NAME L_NAME LESSON_NAME SCORE ---------- ------------ --------------- -------------------- ---------- 1 Azer Ibrahimov History 5 5 Omar Tanriverdiyev History 5 SQL> select * from telebeler where score>=4; ID F_NAME L_NAME LESSON_NAME SCORE ---------- ------------ --------------- -------------------- ---------- 1 Azer Ibrahimov History 5 3 Ulfet Tanriverdiyev History 4 5 Omar Tanriverdiyev History 5 SQL>. İndisə sys istifadəçisi kimi daxil olub yoxlayaq. --Connect as sys SQL> conn sys/?????? as sysdba SQL> select db_user,policy_name,sql_text,TIMESTAMP from dba_fga_audit_trail order by 4; DB_USER POLICY_NAME SQL_TEXT TIMESTAMP ---------------- ---------------------- --------------------------------------------------------- ----------------------- ULFET CHECK_SCORE_AUDIT select * from telebeler where score=5 07-DEC-12 ULFET CHECK_SCORE_AUDIT select * from telebeler where score>=4 07-DEC-12 VB-dakı FGA polisilərin siyahısını görmək üçün DBA_AUDIT_POLICIES görünüşündən (view) istifadə edə bilərsiniz. SQL> SELECT POLICY_NAME FROM DBA_AUDIT_POLICIES; POLICY_NAME ----------------------------- CHECK_SCORE_AUDIT SQL> Oralce 9i versiyasında fine-grained audit məhdud imkanlara sahib idi, lakin Oracle 10g-dən başlayaraq bu inkişaf etdirildi və beləliklə DML əmrləridə (statements) daxil edildi. Bu özəllikdən istifadə edə bilmək üçün DBMS_FGA.ADD_POLICY prosedurundakı statement_types parametrinə dəyər(lər) mənimsətmək lazımdır. statement_types => 'SELECT,INSERT,UPDATE,DELETE');
  • 4. Fine-Grained Audit Polisini istifadə etmək üçün istifadəçiyə DBMS_FGA PL/SQL paketinə çalışdırma (execute) haqqı verilməlidir. Bu paket SYS istifadəçisinə məxsusdur. Aşagıdakı əmrlərdən istifadə edərək fine-grained auditin istifadəsini bağlayıb (disable) və ya aça bilərik (enable) SQL> BEGIN DBMS_FGA.DISABLE_POLICY( object_schema => 'ULFET', object_name => 'TELEBELER', policy_name => 'CHECK_SCORE_AUDIT'); END; / 2 3 4 5 6 7 PL/SQL procedure successfully completed. SQL> SQL> BEGIN DBMS_FGA.ENABLE_POLICY( object_schema => 'ULFET', object_name => 'TELEBELER', policy_name => 'CHECK_SCORE_AUDIT', enable => TRUE); END; / 2 3 4 5 6 7 8 PL/SQL procedure successfully completed. SQL> FGA polisini silmək üçün: SQL> BEGIN DBMS_FGA.DROP_POLICY( object_schema => 'ULFET', object_name => 'TELEBELER', policy_name => 'CHECK_SCORE_AUDIT'); END; / PL/SQL procedure successfully completed. Oracle 11g də FGA üçün yeni özəllik var. Bu DBMS_AUDIT_MGMT paketindən istifadə edərək audit cədvəllərinin tablespace –lərini dəyişmək mümkündür. Susma halına görə (default) audit trail SYS.AUD$ və SYS.FGA_LOG$ cədvəliləri SYSTEM tablespace də yerləşirlər. Audit cədvəllərin tablespace-lərini dəyişmək üçün aşağıdakı əmri icra etmək lazımdır: BEGIN DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION( AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD, AUDIT_TRAIL_LOCATION_VALUE => 'AUD_AUX'); END;
  • 5. Bu nümunədə:  AUDIT_TRAIL_TYPE: VB dakı audit trail tipinə əsaslanır. Aşağıdakılardan birini daxil edin:  DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD: Standart audit trail cədvəli, AUD$.  DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD: Fine-grained audit trail cədvəli, FGA_LOG$.  DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD: Həm standart həmdə fine-grained audit trail cədvəlləri.  AUDIT_TRAIL_LOCATION_VALUE: Hədəf tablespace təyin edir. Bu nümunə AUDİT_TABLES tablespace-ni istifadə edir. Gəlin tətbiq edək SQL> conn /as sysdba Connected. SQL> SELECT table_name, tablespace_name FROM dba_tables WHERE table_name IN ('AUD$', 'FGA_LOG$') ORDER BY 1; TABLE_NAME TABLESPACE_NAME ------------------------------ ------------------------------ AUD$ SYSTEM FGA_LOG$ SYSTEM SQL> Audit cədvəllərinin saxlanılması üçün yeni tablespace quraq. SQL> create tablespace audit_tables datafile '/u01/app/oracle/oradata/testdb/audit_tables1' size 50m autoextend on; Tablespace created. SQL> İndisə fine-grained audit trail cədvəlinin tablespace-ni yeni tablespace-ə daşıyaq. SQL> BEGIN DBMS_AUDIT_MGMT.set_audit_trail_location( audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD, audit_trail_location_value => 'AUDIT_TABLES'); END; / 2 3 4 5 6 PL/SQL procedure successfully completed. SQL> Diqqət, bu əmr icra olunan zaman səbrli olun. Bu uzun zaman çəkə bilər və bu bir başa audit cədvəlinin ölçüsündən aslıdır. --Yuxarıdakı select-i bir daha icra edək SQL> SELECT table_name, tablespace_name FROM dba_tables WHERE table_name IN ('AUD$', 'FGA_LOG$') ORDER BY 1; TABLE_NAME TABLESPACE_NAME -------------------------------------- ------------------------------ AUD$ SYSTEM FGA_LOG$ AUDIT_TABLES