Skip to main content

Posts

Oracle audit - Fine-Grained Audit

As you know in Oracle database has several audit options: SQL statement, privileges, schemas, objects, and network. Additionally we can use fine-grained auditing to monitor specific database activities, such as actions on a database table or times that activities occur.   Today I will stay on fine-grained audit option. Firstly it was introduced in Oracle9i Database to record an audit trail when a user selects from a table, not just changes it. Please note,  FGA  is independant of the AUDIT_TRAIL parameter setting and all audit records are stored in the FGA_LOG$ table, rather than the   AUD$   table.     If you prefer to write the fine-grained audit records to the SYS.FGA_LOG$ table, then set the audit_trail parameter for the DBMS_FGA.ADD_POLICY parameter to DB or  DB+EXTENDED. You can use fine-grained auditing to audit the following types of actions: Accessing a table b...

Oracle 11g new features: Recover dropped tablespace via RMAN, (Point In Time Recovery)

Today I will demonstrate how to recover damaged/dropped tablespace which we can use Oracle 11g`s feature to restore/recover tablespace PITR (Point In Time Recovery). To do that firstly I will create new tablespace then will create new user and make default tablespace to new user and the last I will create new table with some rows on mentioned tablespace. SQL> create tablespace rec_tbs datafile '/u01/app/oracle/oradata/ulfetdb/rec_tbsp01.dbf' size 50m; Tablespace created. SQL> create user ulfet identified by ulfet default tablespace rec_tbs; User created. SQL> alter user ulfet quota unlimited on rec_tbs; User altered. SQL> grant dba to ulfet; -- you can give only create session and create table not DBA role Grant succeeded. SQL> conn ulfet/ulfet Connected. SQL> create table rec_tbl_check (id number); Table created. SQL> insert into rec_tbl_check values(1); 1 row created. SQL> commit; Commit complete. --Check tablespace...

Using Log Mining

Today I will show you how to use log mining. Create new tablespace and move objects which belongs SYSAUX tablespace to new tablespace. SQL> create tablespace test_tbs datafile '/home/oracle/oracle/product/10.2.0/oradata/mydb/test_tbs01.dbf' size 100M autoextend on maxsize unlimited; Tablespace created. SQL> EXEC DBMS_LOGMNR_D.SET_TABLESPACE('TEST_TBS'); PL/SQL procedure successfully completed. SQL> Now start Log Mining and load archive log file into it Firstly, I created table under demo user and made some DML operations. Then using alter system switch logfile I enforce archive current log file.     SQL> create table demo.test(id number, str varchar2(10)); Table created. SQL> insert into demo.test values(1,'a'); 1 row created. SQL> insert into demo.test values(2,'b'); 1 row created. SQL> commit; Commit complete. SQL> delete from demo.test where id=2; 1 row deleted. S...