Iam a student and one of the questions i am stuck is to implement an IT management rule on all tables in oracle in my own schema using pl/sql.I dont have DBA previlege and the requirement is that on fridays from 08:00-09:00 none of the tables should be available and should display message saying its maintainance time. so basically I have prevent myself from accessing the tables in my schema during those times. I have used the following DML trigger for insert,update and delete
create or replace TRIGGER test_trig
BEFORE INSERT OR UPDATE OR DELETE ON employees
FOR EACH ROW
WHEN (TO_CHAR (SYSDATE, 'DY')='THU' AND
(TO_CHAR(SYSDATE, 'HH24:MI'))BETWEEN '20:25' AND '20:30')
DECLARE
e_invalid_time EXCEPTION;
BEGIN
//DBMS_OUTPUT.put_line (' Tables are unavailable at this time.Please try again
later');
RAISE_APPLICATION_ERROR(-20500, 'You may insert'
||' into EMPLOYEES table only during '
||' normal business hours.');
EXCEPTION
WHEN e_invalid_time THEN
DBMS_OUTPUT.put_line (' Tables are unavailable at this time.Please try again
later');
END test_trig;
But this will only be effective on one table. And SELECT queries will be still performed.I have about 6 tables
I read Fine grain auditing will help with select and all DML commands. what is the bet approach?This is for educational purposes.
Best Answer
You can put the database in a Quiesced State (Oracle Database Administrator's Guide)
Restrict access. Only DBAs will be able to access the DB (i.e. user SYS or SYSTEM):
Restore the database to normal operation: