PLsql bilinmesi gerekenler -5

11-Audit OBJECTS:

önemli objeleri izleme. Bu iş her ne kadar admin tarafında yapılması gereken bir iş gibi gözuksede bazı durumlar yazılımcılık olmadan yapılamaz.

CREATE OR REPLACE TRIGGER create_object_trigger
AFTER CREATE ON DATABASE
BEGIN
INSERT INTO audit_object_mods
(mod_date, type_of_mod, mod_user,
instance_num, database_name,
object_owner, object_type, object_name)
VALUES
(sysdate, ora_sysevent, ora_login_user,
ora_instance_num, ora_database_name,
ora_dict_obj_owner, ora_dict_obj_type,
ora_dict_obj_name);
end;
/

tabi bu örnektende anlaşıldığı gibi daha önceden audit_object_mods isminde bir tablo yaratmamız gerekir.

CREATE OR REPLACE TRIGGER alter_object_trigger
AFTER ALTER ON DATABASE
BEGIN
INSERT INTO audit_object_mods
(mod_date, type_of_mod, mod_user,
instance_num, database_name,
object_owner, object_type, object_name)
VALUES
(sysdate, ora_sysevent, ora_login_user,
ora_instance_num, ora_database_name,
ora_dict_obj_owner, ora_dict_obj_type,
ora_dict_obj_name);
end;
/
Aşağıdaki şekildede raporlayabiliriz.
,

SET LINESIZE 130
SELECT mod_date, type_of_mod, mod_user, instance_num,
database_name, object_owner, object_type,
object_name
FROM audit_object_mods
ORDER BY mod_date, type_of_mod, object_owner,
object_type, object_name;

Bir başka örnekte ise plsql userının drop yapmasını önlemek mümkündür.

CREATE OR REPLACE TRIGGER stop_drop_trigger
BEFORE DROP ON plsql_user.SCHEMA
BEGIN
RAISE_APPLICATION_ERROR (
num => -20000,
msg => ‘Obje drop yapamazsınız’);
END;
/

SHOW USER
USER is “PLSQL_USER”
DROP TABLE temp;
drop table temp
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-20000: Obje drop yapamazsınız
ORA-06512: at line 2

Advertisements

About oracledocuments

Zekeriya Beşiroğlu, It joined the Bilginc IT Academy in July 2000. In the meantime, the Oracle Education, Oracle Data Base Management System and Oracle Internet Technologies, Oracle development technologies such as the training of Oracle products is responsible for training as consultants. During this task, since 1 April 2008 with 293 Oracle training in total, in 2150 Oracle customers successfully submitted. Oracle 10g New York in November 2002 have received training and education in Turkey was the first time the consultants. 20 April 2008 on education in Turkey 11g is the first who was a consultant. Oracle Real Application Cluster Expert advisor is certified is the first . Http://zekeriyabesiroglu.blogspot.com and Http://www.oracleforum.info owner and manager of the site. Its own has more than one hundred articles. In addition, creation and improvement of training materials are also related to work. Oracle products are used, database management and reporting Academy eruditely It also is working on. From the date of 1 January 2009 will continue to work as the Technical Director
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s