Audit on dropped and recreate table - oracle

I have a table that is dropped every day and then recreated.
I executed some audit actions on that table (select, update, delete, insert, all).
Now I want to use the noaudit command to disable audit, but the table is already dropped, so I get an object does not exist exception.
When this table is recreated, will the audit work on it?
I have version oracle 11g.
Thanks.

Related

oracle flashback feature for tables of a specific user in a database

I am trying to implement a flashback feature in oracle 11g. I have successfully implemented it but it is not restricted to a single user instead, whenever I restore a flashback it affects all the tables/views for all the users. Is there some way to restrict the restoration to a particular user and avoiding the rest.
Example: I have a database "db" and there are 4 users "a,b,c,d" now, I want to restore the flashback such that it only affects user "a"?
Use the command FLASHBACK TABLE instead of FLASHBACK DATABASE to only affect specific tables.
For example:
create table table1(a number) enable row movement;
create table table2(a number) enable row movement;
--Wait one second.
flashback table jheller.table1, jheller.table2 to timestamp systimestamp - interval '1' second;
Keep in mind that table flashback uses UNDO, while database flashback uses flashback logs. Table flashback depends on UNDO retention and is more picky about things like DDL.

ORA-07445 when enabling Unified Auditing with Oracle Database 12.2

When enabling the below Unified Auditing policies in Oracle database 12.2, a generic error ORA-07445 in the v$alert_log and ORA-03114 for each new log-on occur.
ORA-07445: exception encountered: core dump [kxes_evaopn2_setup_rpiswu_args()+73] [SIGSEGV] [ADDR:0x218] [PC:0x2DCCFA9] [Address not mapped to object] [].
ORA-03114: not connected to ORACLE.
This bug happens consistently on three tested 12.2 databases.
However, the error does not happen if the UPPER function calls in the WHEN clause are removed. Could this be a bug in 12.2? Also, wondering if this is a valid workaround to remove the UPPER function calls.
-- create policies
CREATE AUDIT POLICY sox_audit_ddl
ACTIONS
CREATE ASSEMBLY,
CREATE AUDIT POLICY,
CREATE CLUSTER,
CREATE CONTEXT,
CREATE DATABASE LINK,
CREATE DIMENSION,
CREATE DIRECTORY,
CREATE DISK GROUP,
CREATE EDITION,
CREATE FLASHBACK ARCHIVE,
CREATE FUNCTION,
CREATE INDEX,
CREATE INDEXTYPE,
CREATE JAVA,
CREATE LIBRARY,
CREATE MATERIALIZED VIEW ,
CREATE MATERIALIZED VIEW LOG,
CREATE MATERIALIZED ZONEMAP,
CREATE OPERATOR,
CREATE OUTLINE,
CREATE PACKAGE,
CREATE PACKAGE BODY,
CREATE PFILE,
CREATE PLUGGABLE DATABASE,
CREATE PROCEDURE,
CREATE PROFILE,
CREATE RESTORE POINT,
CREATE ROLE,
CREATE ROLLBACK SEGMENT,
CREATE SCHEMA,
CREATE SCHEMA SYNONYM,
CREATE SEQUENCE,
CREATE SPFILE,
CREATE SYNONYM,
CREATE TABLE,
CREATE TABLESPACE,
CREATE TRIGGER,
CREATE TYPE,
CREATE TYPE BODY,
CREATE USER,
CREATE VIEW,
ALTER ASSEMBLY,
ALTER AUDIT POLICY,
ALTER CLUSTER,
ALTER DATABASE,
ALTER DATABASE LINK,
ALTER DIMENSION,
ALTER DISK GROUP,
ALTER FLASHBACK ARCHIVE,
ALTER FUNCTION,
ALTER INDEX,
ALTER INDEXTYPE,
ALTER JAVA,
ALTER LIBRARY,
ALTER MATERIALIZED VIEW ,
ALTER MATERIALIZED VIEW LOG,
ALTER MATERIALIZED ZONEMAP,
ALTER OPERATOR,
ALTER OUTLINE,
ALTER PACKAGE,
ALTER PACKAGE BODY,
ALTER PLUGGABLE DATABASE,
ALTER PROCEDURE,
ALTER PROFILE,
ALTER RESOURCE COST,
ALTER ROLE,
ALTER ROLLBACK SEGMENT,
ALTER SEQUENCE,
ALTER SESSION,
ALTER SYNONYM,
ALTER SYSTEM,
ALTER TABLE,
ALTER TRIGGER,
ALTER TYPE,
ALTER TYPE BODY,
ALTER USER,
ALTER VIEW,
TRUNCATE CLUSTER,
TRUNCATE TABLE,
RENAME,
DROP ASSEMBLY,
DROP AUDIT POLICY,
DROP CLUSTER,
DROP CONTEXT,
DROP DATABASE LINK,
DROP DIMENSION,
DROP DIRECTORY,
DROP DISK GROUP,
DROP EDITION,
DROP FLASHBACK ARCHIVE,
DROP FUNCTION,
DROP INDEX,
DROP INDEXTYPE,
DROP JAVA,
DROP LIBRARY,
DROP MATERIALIZED VIEW ,
DROP MATERIALIZED VIEW LOG,
DROP MATERIALIZED ZONEMAP,
DROP OPERATOR,
DROP OUTLINE,
DROP PACKAGE,
DROP PACKAGE BODY,
DROP PLUGGABLE DATABASE,
DROP PROCEDURE,
DROP PROFILE,
DROP RESTORE POINT,
DROP ROLE,
DROP ROLLBACK SEGMENT,
DROP SCHEMA SYNONYM,
DROP SEQUENCE,
DROP SYNONYM,
DROP TABLE,
DROP TABLESPACE,
DROP TRIGGER,
DROP TYPE,
DROP TYPE BODY,
DROP USER,
DROP VIEW
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
CREATE AUDIT POLICY sox_audit_dml
ACTIONS
INSERT,
UPDATE,
DELETE
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
CREATE AUDIT POLICY sox_audit_tcl
ACTIONS
COMMIT,
ROLLBACK
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
CREATE AUDIT POLICY sox_audit_dcl
ACTIONS
GRANT,
REVOKE
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
CREATE AUDIT POLICY sox_audit_misc
ACTIONS
ANALYZE CLUSTER,
ANALYZE INDEX,
ANALYZE TABLE,
ASSOCIATE STATISTICS,
AUDIT,
CHANGE PASSWORD,
COMMENT,
DISASSOCIATE STATISTICS,
EXECUTE,
FLASHBACK TABLE,
LOCK TABLE,
LOGOFF,
LOGON,
NOAUDIT,
PURGE INDEX,
PURGE TABLE,
PURGE TABLESPACE,
SET ROLE,
SET TRANSACTION
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
-- enable policies
AUDIT POLICY sox_audit_ddl;
AUDIT POLICY sox_audit_dml;
AUDIT POLICY sox_audit_tcl;
AUDIT POLICY sox_audit_dcl;
AUDIT POLICY sox_audit_misc;

unable to drop or alter table on postgresql

We recently encountered a problem using the postgres-xl software, there is a table we can not drop can not alter, will always be in the execution state. We checked the Internet, and some answered that the table is locked, but the lifting of the lock Table or can not drop and alter. There are also replied that there is no transaction submitted, we use the sql statement can be found to have not submitted the transaction, but it can not rollback and commit, said the transaction does not exist.

What happened to my table in my oracle database?

I have a situation where yesterday my code was working ok, but today I find that my code fails because a SQL query fails on my Oracle database. The query fails because the table used in the query does not exists. I am no Oracle expert so I am reaching out to you Oracle experts out there. Is there a way to see in a log file or log table when my table disappeared and who dropped my table?
Thanks
Depending on previous configuration one would hope that a production database would have auditing turned on. Try
select * from sys.AUD$
The audit table can log almost every user action including dropping tables or revoking grants but has to be configured.
Assuming you have the recyclebin turned on in your database, you might be able to restore the dropped table. As the user who owns the table, you can run this query:
select * from USER_RECYCLEBIN
or if you have SYS access you can check the query:
SELECT * from DBA_RECYCLEBIN;
Then as a user owns the table, run this FLASHBACK command to restore it:
FLASHBACK TABLE <your table name> TO BEFORE DROP;
If you get ORA-38305 you might have a tablespace issue - either run it as a different user or make sure it using a locally managed tablespace.

Get Triggers from Version Enabled Table in Oracle

I am new to Oracle Workspace Manager. I have a trigger that fills my IDs every time i insert a record. I created the trigger before I enable the versioning of my table.
After versioning was enabled in my table, I can no longer find my trigger but have these triggers instead:
OVM_DELETE_7
OVM_INSERT_7
OVM_UPDATE_7
What I wanted to do is Query the triggers that I created on my tables. Is there a way to do that without disabling the versioning on my table? I have too many versioned-enabled tables and that would be a hassle disabling the version in every table just for that query.
To get a list of triggers created on a version-enabled tables that you(current user) owns, you can query USER_WM_TAB_TRIGGERS view or ALL_WM_TAB_TRIGGERS view (if you've been granted create any trigger privilege) to get information about triggers for all version-enabled tables.

Resources