Audit of Dropped table

Hi
i have Oracle 10g R2 i'm facing one problem, that there is a table which has been dropped it's in Recycle Bin there is many information about dropped table like Dropped time, user and etc..
But i want to know the Terminal or Machine name which the drop command was issued.
Please guide me in this regard.
Nasir

Hi Masir,
For DDL auditing, consider a DDL trigger:
http://www.dba-oracle.com/t_ddl_triggers.htm
Using the Data Definition Language (DDL) triggers, the Oracle DBA can automatically track all changes to the database, including changes to tables, indexes, and constraints. The data from this trigger is especially useful for change control for the Oracle DBA.
DDL triggers execute every time a DDL statement is executed, and adds new entries to your new table, as shown below:
connect sys/manager
create or replace trigger
DDLTrigger
AFTER DDL ON DATABASE
BEGIN
insert into
perfstat.stats$ddl_log
user_name,
ddl_date,
ddl_type,
object_type,
owner,
object_name
VALUES
ora_login_user,
sysdate,
ora_sysevent,
ora_dict_obj_type,
ora_dict_obj_owner,
ora_dict_obj_name
END;
HTH . ..
Don Burleson

Similar Messages

  • Can database activities of creating or dropping tables/packages be tracked in the security/system logs

    Can database activity like create or drop tables and packages be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?
    Can purging of oracle log, n case the file has become big or even tempered be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?

    2765539 wrote:
    Can database activity like create or drop tables and packages be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?
    Can purging of oracle log, n case the file has become big or even tempered be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?
    Your first question is easy, you configure audit to log to the OS audit trail with
    alter system set audit_trail=os scope=spfile;
    and then enable audit for whatever actions you want to capture. All documented in the Security Guide.
    Your second question makes no sense unless you explain what you mean by "oracle log".

  • Allowing a user to create/drop tables in another users schema

    We have a central shared schema (TEAM). So we can monitor who is doing what users have there own login(USER1, USER2...). Is there a way to allow a user to create/drop objects in another user.
    I.e.
    SQL> connect USER1
    SQL> create team.table1(col1 char(1));
    SQL> drop table team.table1:
    How can this be set up?
    Ben

    Here is what you can do, If you want to keep track of what users are doing.
    Open the glogin.sql file and set the spool like this
    spool /oracle/audit/SID_&_user.logEverytime user logs in it will be populated and you will be able to see who is doing what.
    You can remove the write permission on glogin.sql so that no one can modify it.
    You also need to create a script like this, which would rename it every time same user would login.
    #!/bin/ksh
    time=`date +"%b"_"%d"_"%H"_"%M"`
    ##you need to pass some more variables and while loop to include all the users## ( This is just for an example)
    if [ -f /oracle/audit/SID_SYS.log ]
    then
    mv /oracle/audit/SYS.log /oracle/audit/SYS.log.$time
    fiEdit the glogin.sql file with this script information like this
    host /oracle/audit/file.kshHope this helps, if you need more information let me know.

  • Who have dropped table

    Hello expert,
    Please tell me how to find out who have dropped a table in the oracle database.
    Many Thanks,

    Yes, it is possible the table is in the recycle bin and can be recovered. It is also possible that there has been demand for space in the tablespace in question and that the recycle bin copy space has had to be reused. It will depend on the environment, but checking the recycle bin is an excellent starting point providing the database is 10g+.
    Querying v$sql for the drop command is also time (and load) dependent.
    I suggest you configure auditing in all production environments to audit DDL since tables should rarely be created, altered, or dropped in production. Knowing when objects are added, altered, and dropped can be valuable when trying to track down process changes and for some other DBA tasks.
    HTH -- Mark D Powell --
    Add 10g+ requirement to first paragraph.
    Edited by: Mark D Powell on Jun 17, 2011 7:26 AM

  • Unable to drop table

    Hello,
    I'm currently tring to drop a table using a process trigered by a button click
    Icreated my button and also a "PL/SQL process" and I put
    DROP TABLE &P0_TABLE_NAME. CASCADE CONSTRAINTS;
    inside field "source" with ticking the checkbox "Do not validate PL/SQL code (parse PL/SQL code at runtime only)."
    But when a click on the button I have the following error
    ORA-06550: line 1, column 7: PLS-00103: Encountered the symbol "DROP" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe
         Error      Error while dropping table
    OK      
    Do anyone have a clue about this ?
    Debug trace is
    A C C E P T: Request="Purge"
    0.00: Metadata: Fetch application definition and shortcuts
    0.00: alter session set nls_language="AMERICAN"
    0.00: alter session set nls_territory="AMERICA"
    0.00: ...NLS: Set Decimal separator="."
    0.00: ...NLS: Set NLS Group separator=","
    0.00: ...NLS: Set date format="DD-MON-RR"
    0.00: ...Setting session time_zone to +02:00
    0.00: NLS: wwv_flow.g_flow_language_derived_from=0: wwv_flow.g_browser_language=en-us
    0.00: Fetch session state from database
    0.01: ...Check session 2289784661666743 owner
    0.01: ...Check for session expiration:
    0.01: ...Metadata: Fetch Page, Computation, Process, and Branch
    0.01: Session: Fetch session header information
    0.01: ...Metadata: Fetch page attributes for application 121, page 2
    0.01: ...Validate item page affinity.
    0.03: ...Validate hidden_protected items.
    0.03: ...Check authorization security schemes
    0.03: Session State: Save form items and p_arg_values
    0.03: ...Session State: Save "P0_TABLE_NAME" - saving same value: "STATPHI_595730051"
    0.04: ...Session State: Save "P2_TABLE_NAME" - saving same value: "STATPHI_595730051"
    0.04: ...Session State: Save "P2_TYPE" - saving same value: "2"
    0.04: ...Session State: Save "P2_CALENDAR" - saving same value: "PA"
    0.04: ...Session State: Save "P2_FILE_NAME" - saving same value: ""
    0.04: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.04: Branch point: BEFORE_COMPUTATION
    0.04: Computation point: AFTER_SUBMIT
    0.04: Tabs: Perform Branching for Tab Requests
    0.04: Branch point: BEFORE_VALIDATION
    0.04: Perform validations:
    0.04: Branch point: BEFORE_PROCESSING
    0.04: Processing point: AFTER_SUBMIT
    0.04: Item button "P2_PURGE_TABLE" pressed process.
    0.04: ...Process "DROP TABLE": PLSQL (AFTER_SUBMIT) DROP TABLE &P0_TABLE_NAME. CASCADE CONSTRAINTS;
    0.06: Encountered unhandled exception in process type PLSQL
    0.06: Show ERROR page...
    0.06: Performing rollback...
    ----

    Hi user631592 ;-)
    You can't used directly a DDL statment.
    But you can use an EXECUTE IMMEDIATE in your process.
    SO
    BEGIN
    EXECUTE IMMEDIATE ' DROP TABLE STATPHI_595730051';
    END;
    Regards

  • Drop table if exists in sql statement

    Oracle: 10G
    Is there a way to check if table exist and then only drop table. Something like:
    drop table (select table_name from user_tables where lower(table_name) = 'o2i_filing_dest')

    As already suggested, you could e.g. use an anonymous PL/SQL block as part of your SQL script, e.g. something like that:
    set echo on
    spool <your_log_file>
    WHENEVER SQLERROR EXIT FAILURE
    DECLARE
      PROCEDURE EXEC_DONT_FAIL( P_CMD IN VARCHAR2 ) IS
        e_table_or_view_does_not_exist exception;
        pragma exception_init(e_table_or_view_does_not_exist, -942);
        e_type_does_not_exist exception;
        pragma exception_init(e_type_does_not_exist, -4043);
        e_sequence_does_not_exist exception;
        pragma exception_init(e_sequence_does_not_exist, -2289);
      BEGIN
        EXECUTE IMMEDIATE P_CMD;
      EXCEPTION
      WHEN e_table_or_view_does_not_exist OR e_type_does_not_exist OR e_sequence_does_not_exist THEN
          NULL;
      END;
    BEGIN
      EXEC_DONT_FAIL('drop type <type_name1> force');
      EXEC_DONT_FAIL('drop view <view_name1>');
      EXEC_DONT_FAIL('drop table <table_name1> purge');
      EXEC_DONT_FAIL('drop sequence <seq_name1>');
    END;
    CREATE TABLE ...Note that the literals in angle brackets are just placeholders for demonstration purposes, you need to use your actual object names/file names there.
    Of course you could also use a FOR ... LOOP in the PL/SQL block that queries e.g. USER_OBJECTS to find out which objects to drop.
    That way it is ensured that only expected exceptions will be ignored but all others will raise and stop your script in that case.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/
    Edited by: Randolf Geist on Sep 25, 2008 10:09 AM
    Clarification regarding angle brackets added

  • ORA-00604 error occured at recursive level1,ORA-20123 Insufficient privileges: you cannot drop table cls_lrn_tab_unique TABLE,ORA-06512

    Dear All,
         I created one table like
    create table cls_lrn_tab_unique (F_no number unique UK_F_NO );
    after performing some operations I want to delete the same.
    At that time i got following error. Please help me and tell what is the reason for the error.
    ORA-00604 error occured at recursive level1
    ORA-20123 Insufficient privileges: you cannot drop table cls_lrn_tab_unique TABLE,
    ORA-06512 at line no 2
    Thanks and Regards
    Prasad

    26bffcad-f9a2-4dcf-afa0-e1e33d0281bf wrote:
    Dear All,
         I created one table like
    create table cls_lrn_tab_unique (F_no number unique UK_F_NO );
    after performing some operations I want to delete the same.
    At that time i got following error. Please help me and tell what is the reason for the error.
    ORA-00604 error occured at recursive level1
    ORA-20123 Insufficient privileges: you cannot drop table cls_lrn_tab_unique TABLE,
    ORA-06512 at line no 2
    Thanks and Regards
    Prasad
    ORA-20123 is a localized/customized error code & message; therefore any solution depends upon what is unique inside your DB now.
    I suspect that some sort of TRIGGER exists, which throws posted error, but this is just idle speculation on my part.
    How do I ask a question on the forums?
    https://forums.oracle.com/message/9362002#9362002

  • How to recover the data from a  dropped table in production/archive mode

    How to recover the data/change on a table that was dropped by accident.
    The database is on archive mode.

    Oracle Version. ? If 10g.
    Try this Way
    SQL> create table taj as select * from all_objects where rownum <= 100;
    Table created.
    SQL> drop table taj ;
    Table dropped.
    SQL> show recyclebin
    ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
    TAJ              BIN$b3MmS7kYS9ClMvKm0bu8Vw==$0 TABLE        2006-09-10:16:02:58
    SQL> flashback table taj to before drop;
    Flashback complete.
    SQL> show recyclebin;
    SQL> desc taj;
    Name                                      Null?    Type
    OWNER                                              VARCHAR2(30)
    OBJECT_NAME                                        VARCHAR2(30)
    SUBOBJECT_NAME                                     VARCHAR2(30)
    OBJECT_ID                                          NUMBER
    DATA_OBJECT_ID                                     NUMBER
    OBJECT_TYPE                                        VARCHAR2(19)
    CREATED                                            DATE
    LAST_DDL_TIME                                      DATE
    TIMESTAMP                                          VARCHAR2(19)
    STATUS                                             VARCHAR2(7)
    TEMPORARY                                          VARCHAR2(1)
    GENERATED                                          VARCHAR2(1)
    SECONDARY                                          VARCHAR2(1)
    SQL>M.S.Taj

  • Drop table

    I created a table with tablename USER using an access to oracle converter. now I am unable to drop the table, it says invalid table name.

    These are keyword and NOT at all recommended as table name. You can find those types of words by querying
    SELECT * FROM v$reserved_words ORDER BY 1 and avoid use of these words as object name.
    However. Now you can enclose the name with a double quote to overcome the situation.
    DROP TABLE "USER"

  • Cannot drop table

    Versions are Oracle 11.2.0.1.0 and SQL Developer 4.0.0.12 on Windows 7 Ultimate SP1.
    Hi
    I'm following the CBT Nuggets SQL Fundementals training (video #11) and cannot drop a table I have just created.  The command executed and error are:
    drop table newprods;
    Error starting at line : 1 in command -
    drop table newprods
    Error report -
    SQL Error: ORA-00604: error occurred at recursive SQL level 1
    ORA-20000: Cannot drop object
    ORA-06512: at line 2
    00604. 00000 -  "error occurred at recursive SQL level %s"
    *Cause:    An error occurred while processing a recursive SQL statement
               (a statement applying to internal dictionary tables).
    *Action:   If the situation described in the next error on the stack
               can be corrected, do so; otherwise contact Oracle Support.
    As the HR user I created two tables and created a FK constraint between them.  After truncating the table with this FK, I am unable to drop it.  Even if I remove the FK, the error is the same.  Issing the command in SQL*Plus gives the same error.
    This is the first time I have created any tables since installing Oracle on this machine and is my first attempt at dropping a table.  I have not created any sequences, triggers or views based on these newly created tables.
    Does anyone have any ideas?
    Cheers

    C:\Oracle>sqlplus hr@orcl
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 4 18:58:55 2013
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> CREATE TABLE table1 (column1 VARCHAR2(20 BYTE));
    Table created.
    SQL> select * from table1;
    no rows selected
    SQL> drop table table1;
    drop table table1
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-20000: Cannot drop object
    ORA-06512: at line 2
    SQL>
    Can I run a query to see if there are any triggeres on the table?
    EDIT: Ok it looks like no triggers:
    SQL> show user
    USER is "SYS"
    SQL> select * from DBA_TRIGGERS where table_name like '%table1%';
    no rows selected
    SQL> select * from USER_TRIGGERS where table_name like '%table1%';
    no rows selected

  • Error when trying drop table

    Why ?
    SQL> drop table SYSADM.TMP_FATOR cascade constraints;
    drop table SYSADM.TMP_FATOR cascade constraints
    ORA-00054: resource busy and acquire with NOWAIT specified

    check the active sessions and kill them all except for the one you are logged into ...and then try drop the table
    --Chaitanya                                                                                                                                                                                                                                                               

  • How to restore a dropped table when recycle bin is purged??

    how to restore a dropped table when recycle bin is purged??

    You should be asking general database questions in General Questions - and not in the Objects forum.
    Restoring a dropped table means restoring a logical or physical backup of that table.

  • Dropping tables in Oracle 10g Express

    I have several schemas created in my oracle express db. And I have created 1 user, 'met' that has privs to do anything in any schema.
    If user met drops a table in the acct schema, it does not go in the acct recyclebin like I would think. It is renamed BIN$...... and left in the acct schema.
    If acct drops a table in the acct schema, then it shows up in the acct recyclebin as the same name it had in the schema.
    We have 40+ schemas, and I don't want to login as each individual user to manage there tables, I want one account to manage them all, but do not want to leave alot of BIN$..... tables in the schema when I drop a table.
    I know I can purge them, and remove them for good, but If I want to drop a table, and have a backup for a while, I want it to be in the recyclebin.
    Anyway to fix this, or is this just how it work?

    You may want to use the purge command:
    PURGE recyclebin;
    Or disable the recycle bin parameter, which will diables the flashback feature and won't allow you to recover any mistakenly dropped table:
    RECYCLE_BIN=FALSE;
    Regards.

  • Drop table is not Working in SQL

    Hi,
    I am trying to drop table in below code in dynamic way, but facing error. 
    Looking for your support.
    /**********************************RESET************************/
    if @TypeOfUpdate='Reset'
    Begin
    Drop table [' + @DestinationTable + ']  
    exec('select * into [' + @DestinationTable + '] from openrowset(''Microsoft.ACE.OLEDB.12.0'', ''Excel 12.0;HDR=YES;Database=' + @TABLENAME + ''', ' + ''' select * from '+@SourceSheet + ''')')
    PRINT 'Congratulations!!!! Database is Reset.';
    END
    above is part of SP code where I am getting an error if i run the below code. 
    EXEC [ImportExcelFile_Reset] 'C:\temp\TestFiles\OPENASNs.xlsx','Sheet1', 'test', 'Reset'
    ------------Error-------
    (1 row(s) affected)
    Msg 3701, Level 11, State 5, Procedure ImportExcelFile_Reset, Line 53
    Cannot drop the table '' + @DestinationTable + '', because it does not exist or you do not have permission.
    Msg 2714, Level 16, State 6, Line 1
    There is already an object named 'test' in the database.
    SharePoint_Consultant_EMEA

    You you need a dynamic SQL statement for drop too. :)
    if @TypeOfUpdate='Reset'
    Begin
    exec('Drop table '+ @DestinationTable+';
    select * into [' + @DestinationTable + ']
    from openrowset(''Microsoft.ACE.OLEDB.12.0'', ''Excel 12.0;HDR=YES;Database=' +
    @TABLENAME + ''', ' + ''' select * from '+@SourceSheet + ''')')
    PRINT 'Congratulations!!!! Database is Reset.';.......
    Satheesh
    My Blog | How to ask questions in technical forum

  • Dropping Table: ORA-00054

    When going to drop a table in a particular schema, I receive the following error:
    ORA-00054: resource busy and acquire with NOWAIT specified.
    My command:
    drop table schema1.table1;
    I've tried the above drop command several times. No matter what, I keep on getting the same error. How can I successfully drop this table? I also tried logging out & back into my toad session.

    Looks like you were having quite some trouble with your toad connections. This one and the other insert problem.
    Try Oracle SQL Developer and/or SQLPLUS
    Not only there are native Oracle products, but also they are free to use with your database.
    http://www.oracle.com/technology/products/database/sql_developer/index.html

Maybe you are looking for