Getting the tables actively used in the schema

Hello,
We are in need of releasing space from the schema we use.
Can anyone please suggest how to find the tables that has not been used for a given amount of time. So that we can drop the tables which are not effectively used by the application..
Thanks and Regards.
Sathiya

user13299583 wrote:
Thanks for the replies ..
Actually the application was designed/created long back .. Lots of changes has been incorporated and lots of features has been removed from the application..
But in the backend the associated tables were not removed and we feel that it occupies huge space in the server ..
I am afraid i can enable auditing as it is a production instance and lots of formalities are involved if we have restart the server ..
Is there any other way to find out the tables which has not been touched, for a period of time ..
The project has been switched over to many people so there are no proper documentation available .. So we are forced to find some alternatives to identify the unused tables ..
Thanks,
Sathiya.What about using triggers and logging?

Similar Messages

  • Change the Table being used insight the Procedure

    Dear All,
    I had 1 table "Customer" which is being used in 100 store procedures.
    Now I rename that table to "Customer_Q".
    Is there any method in SQL to repoint that table name insight All procs, without open my procedures?
    If not, pls suggest any smart way..

    Can you please throw some more light into it !!
    Another way is this which will do replace behind the scene
    DECLARE @Script varchar(max) = ''
    SELECT @script = @script + REPLACE(definition,'CREATE PROC','ALTER PROC') + CHAR(13) + CHAR(10) + ' GO ' + CHAR(13) + CHAR(10)
    FROM sys.sql_modules m
    INNER JOIN sys.objects o
    ON o.object_id = m.object_id
    AND o.type = 'P'
    WHERE definition like '% TableName %'
    --double check script before execution
    SELECT @script
    --once happy uncomment below line and run full script again
    --EXEC (@Script)
    see this for more details
    http://visakhm.blogspot.in/2012/03/advantages-of-using-syssqlmodules-view.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Get the Table name by providing the Sequence name

    Hello,
    I wish to retrieve the table name to which the sequence is related.
    I understand that when the sequence was created, no reference is mentioned to any table. The sequence may be used across many tables.
    But the DB definitely knows internally how many tables are referencing the particular sequence.
    So, can anyone help me in finding the table (or all tables) referencing one particular sequence.
    Thanks and Regards
    (Please treat this as urgent as i am desperately in need of such a query)

    I share Adrian's scepticism. Using the data dictionary we could find all the program units - TRIGGERS, TYPES, PROCEDURES, etc - which use the sequence. From there we can find all the TABLES that are also referenced by those programs. And that's as good as it gets in Oracle. We cannot definitely say which tables use which sequences (although a good naming convention helps).
    Of course, your DBA may have access to some accurate and up-to-date documentation. But that is maintained externally to the database and not derived from it.
    Cheers, APC

  • Script to generate all the tables and objects in a schema

    how to write a script to generate all the tables and objects in a schema.
    with toad the no of tables generated is not matching when i check from schema .

    Dear Sidhant,
    Try this script:
    set termout off
    set feedback off
    set serveroutput on size 100000
    spool ddl_schema.sql
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- DROP TABLES --');
    dbms_output.put_line('--');
        for rt in (select tname from tab order by tname) loop
            dbms_output.put_line('DROP TABLE '||rt.tname||' CASCADE CONSTRAINTS;');
        end loop;
    end;
    declare
        v_tname  varchar2(30);
        v_cname  char(32);
        v_type     char(20);
        v_null   varchar2(10);
        v_maxcol number;
        v_virg     varchar2(1);
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- CREATE TABLES --');
    dbms_output.put_line('--');
        for rt in (select table_name from user_tables order by 1) loop
            v_tname:=rt.table_name;
            v_virg:=',';
            dbms_output.put_line('CREATE TABLE '||v_tname||' (');
            for rc in (select table_name,column_name,data_type,data_length,
                                data_precision,data_scale,nullable,column_id
                    from user_tab_columns tc
                    where tc.table_name=rt.table_name
                    order by table_name,column_id) loop
                        v_cname:=rc.column_name;
                        if rc.data_type='VARCHAR2' then
                            v_type:='VARCHAR2('||rc.data_length||')';
                        elsif rc.data_type='NUMBER' and rc.data_precision is null and
                                             rc.data_scale=0 then
                            v_type:='INTEGER';
                        elsif rc.data_type='NUMBER' and rc.data_precision is null and
                                         rc.data_scale is null then
                            v_type:='NUMBER';
                        elsif rc.data_type='NUMBER' and rc.data_scale='0' then
                            v_type:='NUMBER('||rc.data_precision||')';
                        elsif rc.data_type='NUMBER' and rc.data_scale<>'0' then
                            v_type:='NUMBER('||rc.data_precision||','||rc.data_scale||')';
                        elsif rc.data_type='CHAR' then
                             v_type:='CHAR('||rc.data_length||')';
                        else v_type:=rc.data_type;
                        end if;
                        if rc.nullable='Y' then
                            v_null:='NULL';
                        else
                            v_null:='NOT NULL';
                        end if;
                        select max(column_id)
                            into v_maxcol
                            from user_tab_columns c
                            where c.table_name=rt.table_name;
                        if rc.column_id=v_maxcol then
                            v_virg:='';
                        end if;
                        dbms_output.put_line (v_cname||v_type||v_null||v_virg);
            end loop;
            dbms_output.put_line(');');
        end loop;
    end;
    declare
        v_virg        varchar2(1);
        v_maxcol    number;
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- PRIMARY KEYS --');
    dbms_output.put_line('--');
        for rcn in (select table_name,constraint_name
                from user_constraints
                where constraint_type='P'
                order by table_name) loop
            dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
            dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
            dbms_output.put_line ('PRIMARY KEY (');
            v_virg:=',';
            for rcl in (select column_name,position
                    from user_cons_columns cl
                    where cl.constraint_name=rcn.constraint_name
                    order by position) loop
                select max(position)
                    into v_maxcol
                    from user_cons_columns c
                    where c.constraint_name=rcn.constraint_name;
                if rcl.position=v_maxcol then
                    v_virg:='';
                end if;
                dbms_output.put_line (rcl.column_name||v_virg);
            end loop;
            dbms_output.put_line(')');
            dbms_output.put_line('USING INDEX );');
        end loop;
    end;
    declare
        v_virg        varchar2(1);
        v_maxcol    number;
        v_tname        varchar2(30);
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- FOREIGN KEYS --');
    dbms_output.put_line('--');
        for rcn in (select table_name,constraint_name,r_constraint_name
                from user_constraints
                where constraint_type='R'
                order by table_name) loop
            dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
            dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
            dbms_output.put_line ('FOREIGN KEY (');
            v_virg:=',';
            for rcl in (select column_name,position
                    from user_cons_columns cl
                    where cl.constraint_name=rcn.constraint_name
                    order by position) loop
                select max(position)
                    into v_maxcol
                    from user_cons_columns c
                    where c.constraint_name=rcn.constraint_name;
                if rcl.position=v_maxcol then
                    v_virg:='';
                end if;
                dbms_output.put_line (rcl.column_name||v_virg);
            end loop;
            select table_name
                into v_tname
                from user_constraints c
                where c.constraint_name=rcn.r_constraint_name;
            dbms_output.put_line(') REFERENCES '||v_tname||' (');
            select max(position)
                    into v_maxcol
                    from user_cons_columns c
                    where c.constraint_name=rcn.r_constraint_name;
            v_virg:=',';
            select max(position)
                into v_maxcol
                from user_cons_columns c
                where c.constraint_name=rcn.r_constraint_name;
            for rcr in (select column_name,position
                    from user_cons_columns cl
                    where rcn.r_constraint_name=cl.constraint_name
                    order by position) loop
                if rcr.position=v_maxcol then
                    v_virg:='';
                end if;
                dbms_output.put_line (rcr.column_name||v_virg);
            end loop;
            dbms_output.put_line(') );');
        end loop;
    end;
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- DROP SEQUENCES --');
    dbms_output.put_line('--');
        for rs in (select sequence_name
                from user_sequences
                where sequence_name like 'SQ%'
                order by sequence_name) loop
            dbms_output.put_line('DROP SEQUENCE '||rs.sequence_name||';');
        end loop;
    dbms_output.put_line('--');
    dbms_output.put_line('-- CREATE SEQUENCES --');
    dbms_output.put_line('--');
        for rs in (select sequence_name
                from user_sequences
                where sequence_name like 'SQ%'
                order by sequence_name) loop
            dbms_output.put_line('CREATE SEQUENCE '||rs.sequence_name||' NOCYCLE;');
        end loop;
    end;
    declare
        v_virg        varchar2(1);
        v_maxcol    number;
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- INDEXES --');
    dbms_output.put_line('--');
        for rid in (select index_name, table_name
                from user_indexes
                where index_name not in (select constraint_name from user_constraints)
                    and index_type<>'LOB'
                order by index_name) loop
            v_virg:=',';
            dbms_output.put_line('CREATE INDEX '||rid.index_name||' ON '||rid.table_name||' (');
            for rcl in (select column_name,column_position
                    from user_ind_columns cl
                    where cl.index_name=rid.index_name
                    order by column_position) loop
                select max(column_position)
                    into v_maxcol
                    from user_ind_columns c
                    where c.index_name=rid.index_name;
                if rcl.column_position=v_maxcol then
                    v_virg:='';
                end if;
                dbms_output.put_line (rcl.column_name||v_virg);
            end loop;
            dbms_output.put_line(');');
        end loop;
    end;
    spool off
    set feedback on
    set termout on Best Regards,
    Francisco Munoz Alvarez
    www.oraclenz.com

  • How to get list of active users with the details like samaccountname, name, department, job tittle, email in active directoy?

    how to get list of active users with the details like samaccountname, name, department, job tittle, email in active directoy?

    You can use third party software True Last Logon 2.9.You can export the file in excel for report creation.You can use the trial version this will achieve what you are looking for.
    True Last Logon displays the following Active Directory information:
    --Users real name and logon name
    --Detailed account status
    --Last Logon Date & Time
    --Last Logon Timestamp (Replicated value)
    --Account Expiry Date & Time
    --Enabled or Disabled Account
    --Locked Accounts
    --Password Expires
    --Password Last Set Date & Time
    --Logon Count
    --Bad Password Count
    --Expiry Date
    --You can also query for any other attribute (Example: Description, telephone Number, custom attibutes etc)
    Refer the below link for trial version:
    http://www.dovestones.com/products/True_Last_Logon.asp
    Best Regards,
    Sandesh Dubey.
    MCSE|MCSA:Messaging|MCTS|MCITP:Enterprise Adminitrator |
    My Blog
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • When I attempt to log on to I tunes I get the following message  "The registry settings used by the I tunes drivers for importing and burning CDs and DVDs are missing  This can happen as a result of installing other CD burning software  Please reinstall

    When I attempt to log on to I tunes I get the following message:
    "The registry settings used by the I Tunes drivers for importing and burning CDs and DVDs are missing.
      This can happen as a result of installing other CD burning software. Please re-install I Tunes."
    To my knowledge no new software has been installed.  I have tried un-installing and re-installing I Tunes but I still
    get the same message.
    Can anyone offer any suggestions?  Do I need to download a new driver?
    Bill Martin

    I can get down as far as step 11 but it shows nothing about upper filters and when I type on "If the Upper Filters entry is missing follow these instructions" nothing happens
    Do you mean you can't see the instructions on what to do if there is no UpperFilters entry?
    If so, here's the relevant instructions for that step:
    On the right side of the Registry Editor window, right-click the UpperFilters entry and choose Modify from the shortcut menu.
    Right-click the empty white space within the right-hand portion of the Registry Editor window. From the shortcut menu, choose New > Multi-String Value.
    Name this new value "UpperFilters" (without the quotes). Then, right-click the newly created UpperFilters entry and choose Modify from the shortcut menu.

  • I have windows 7 and when i start up i tunes i get a message..."The registry settings used by the i Tunes drivers for importing and burning CD's and DVD's are missing. This can happen as a result of installing other CD burning software. Please reinstall i

    when i start up i tunes i get the message,"The registry settings used by the i Tunes drivers for importing and burning CD's and DVD's are missing. This can happen as a result of installing other CD burning software. Please reinstall i Tunes." I tried reinstalling and still get the same message. when I ran the i Tunes diagnostics is says that the high and low filters are missing.
    when i was having trouble with my optical drive(before Dell sent me a new one) the dell tech support representative had me delete some reg. files to try to fix the problem. I was told this would not affect the new drive when i install it or any of my existing programs. here is what he had me do....
    Agent (CLKsmb_RyanJose_224427): "Click on Start
    Click on Run
    Type in REGEDIT
    Click on OK
    Click on the plus sign next to HKEY_LOCAL_MACHINE
    Click on the plus sign next to SYSTEM
    Click on the plus sign next to CurrentControlSet
    Click on the plus sign next to Control"
    Click on the plus sign next to Class
    Click on the plus sign next to {4D36E965-E325-11CE-BFC1-08002BE10318}
    On the right pane, click to highlight Upperfilters
    Right click on Upperfilters
    Click on Delete
    Click on OK
    On the right pane, click t
    o highlight Lowerfilters
    Right click on Lowerfilters
    Click on Delete
    Click on OK
    Right click on Silent Install
    Click on Delete
    Click on OK
    Close the Registry Editor
    Reboot the computer
    how can i get this message box to stop poping up every time i open i tunes? otherwise i tunes works fine. it still rips cd's. I just keep getting this message even after reinstalling i tines.
    thanks,
    chris

    Refer to this article to fix:
    iTunes for Windows: "Registry settings" warning when opening iTunes
    http://support.apple.com/kb/TS3299

  • How do you get a table to flow onto the second page?

    Since upgrading to Yosemite, I cannot figure out how to get my table to continue on to the second page. If you look at my screenshot, you can see that my table was so big so the whole thing was moved to the next page. I want it to remain on the 1st page and have additional rows continue on to the second page. In the previous version of pages, the column titles would also appear on the second page. Thank you very much for your help.

    Hi F.AD.;
    Go to View > Show Invisibles (Shift+Command+I).
    This will display Paragraph marks (¶) at the end of each paragraph.
    Delete the paragraph mark (¶) that is at the end of the paragraph before the table, i.e. just between the table and the paragraph.
    This will bring the table surely just beneath the paragraph (text), I suppose.
    Hi BePositive26;
    You didn't mention whether my suggestion made easy to solve your problem.
    Regards,

  • Is there a way to view all the table names in a certain schema?

    Is there a way to view all the table names in a certain schema?

    SELECT table_name FROM user_tablesThat won't do much good given this piece of information:
    i am trying to finish a lab for school but i don't know what tables are in my
    professor's schema. The appropriate solution is
    SELECT table_name
    FROM all_tables
    WHERE owner = 'PROFESSOR_YAFFLE'
    /This will show the names of the tables which Prof. Yaffle has granted to us.
    Cheers, APC

  • When starting iTunes I continually get an error message " The registry Settings used by the iTunes drivers for importing and burning CDs and DVDs are missing.  This can happen as a result of installing other CD burning software. Please reinstall iTunes."

    When starting iTunes I continually get an error message " The registry Settings used by the iTunes drivers for importing and burning CDs and DVDs are missing.  This can happen as a result of installing other CD burning software. Please reinstall iTunes."  I have unistalled and reinstalled iTunes several times and have cleaned up the registry using a 3rd party Windows utility.  Any tips on removing this error message for good?

    I'd start with the following document, with one modification. At step 12 after typing GEARAspiWDM press the Enter/Return key once prior to clicking OK. (Pressing Return adds a carriage return in the field and is important.)
    iTunes for Windows: "Registry settings" warning when opening iTunes

  • I have an Apple Powerbook G4, and my monitor doesn't function. I have an external display Monitor, however it's stuck in extended screen mode. How do I get it to mirror or duplicate the display without use of the on-board?

    As i had said, I have an Apple Powerbook G4, and my monitor doesn't function. I have an external display Monitor, however it's stuck in extended screen mode. How do I get it to mirror or duplicate the display without use of the on-board? Is there a Fn key combo i'm missing or is the issue more serious then i realize? any and all help and hints would be greatly apprichiated, thanks in advance.
    -Powerbook User

    The PowerBooks have an F-key that toggles mirrored and extended mode. My PB is loaned out right now but I think it was f7. The keycap has an icon on two overlapping rectangles, as I recall.
    EDIT: Yes! Found a pdf of the PB manual it shows F7 is the toggle:

  • When opening iTunes, I get the following error message: the registry setting used by the iTunes drivers for importing an burning CDs and DVDs are missing.  This can happen as a result of installing other CD burning software.  Please reinstall iTunes.

    When opening iTunes, I get the following error message: "The registry setting used by the iTunes drivers for importing an burning CDs and DVDs are missing.  This can happen as a result of installing other CD burning software.  Please reinstall iTunes."
    I have reinstalled iTunes twice and still get the message.
    Any clues??
    Thank you.

    I'd start with the following document, with one modification. At step 12 after typing GEARAspiWDM press the Enter/Return key once prior to clicking OK. (Pressing Return adds a carriage return in the field and is important.)
    iTunes for Windows: "Registry settings" warning when opening iTunes

  • Get the table's rowid of the session that is locking in RAC database

    I am a developer and not a DBA and I need to find th correct query to find the exact rowid of the record locked on a table. This is for a RAC database and locked record can be from the web form in oracle application server. When I try to get the correct row id, I get the following error:
    ORA-01410 - Invalid row id
    For the criteria, the output is Dbms_Rowid.rowid_create(1, -1, 36, 7845, 0), why I get a -1 for the ROW_WAIT_OBJ#?
    Additional Information: The lock type is DML and the lock mode is: Row Exclusive, the table is locked and the program is web oracle forms executiong.
    I am executing the query in Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
    How to accomplish gettting the correct rowid? Below is the selection criteria I have:
    select vs.inst_id,
    vs.audsid audsid,
    locks.sid sid,
    locks.type,
    locks.id1 id1,
    locks.id2 id2,
    locks.lmode lmode,
    locks.request request,
    locks.ctime ctime,
    locks.block block,
    vs.serial# serial#,
    vs.username oracle_user,
    vs.osuser os_user,
    vs.program program,
    vs.module module,
    vs.action action,
    vs.process process,
    decode(locks.lmode,
    0, '0 None',
    1, '1 NULL',
    2, '2 Row Share',
    3, '3 Row Exclusive',
    4, '4 Share',
    5, '5 Share Row Exclusive',
    6, '6 Exclusive', '?') lock_mode_held,
    decode(locks.request,
    0, '0 None',
    1, '1 NULL',
    2, '2 Row Share',
    3, '3 Row Exclusive',
    4, '4 Share',
    5, '5 Share Row Exclusive',
    6, '6 Exclusive', '?') lock_mode_requested,
    decode(locks.type,
    'MR', 'Media Recovery',
    'RT', 'Redo Thread',
    'UN', 'User Name',
    'TX', 'Transaction',
    'TM', 'DML',
    'UL', 'PL/SQL User Lock',
    'DX', 'Distributed Xaction',
    'CF', 'Control File',
    'IS', 'Instance State',
    'FS', 'File Set',
    'IR', 'Instance Recovery',
    'ST', 'Disk Space Transaction',
    'TS', 'Temp Segment',
    'IV', 'Library Cache Invalidation',
    'LS', 'Log Start or Log Switch',
    'RW', 'Row Wait',
    'SQ', 'Sequence Number',
    'TE', 'Extend Table',
    'TT', 'Temp Table',
    locks.type) lock_type,
    vs.row_wait_obj# row_wait_obj#,
    vs.row_wait_file# row_wait_file,
    vs.row_wait_block# row_wait_block#,
    vs.row_wait_row# row_wait_row#,
    dbms_rowid.rowid_create ( 1, vs.ROW_WAIT_OBJ#, vs.ROW_WAIT_FILE#, vs.ROW_WAIT_BLOCK#, vs.ROW_WAIT_ROW# ) rowid_created,
    objs.owner object_owner,
    objs.object_name object_name,
    objs.object_type object_type,
    round( locks.ctime/60, 2 ) lock_time_in_minutes,
    from gv$session vs,
    gv$lock locks,
    dba_objects objs,
    dba_tables tbls
    where locks.id1 = objs.object_id
    and vs.sid = locks.sid
    and objs.owner = tbls.owner
    and objs.object_name = tbls.table_name
    and objs.owner != 'SYS'
    -- and locks.type in ('TM', 'TX')
    order by lock_time_in_minutes;
    Edited by: user3564713 on Jun 10, 2012 10:56 PM

    Firstly, read this thread
    Identifying locked rows
    And the last bit from Randolf
    >
    It is a common misconception that you can locate a locked row in Oracle via a query. The point is that the information that you're querying only gets populated in case of a blocking lock, and even then not in every case, since you might have blocking locks that do not refer to a particular row.
    Oracle stores the lock information within the block, so if you identified in which block the row is located that you've attempted to lock, you could get detailed information about the row locks of that block by performing a block dump.
    Other than that Oracle doesn't maintain this information anywhere else and it is only externalized for blocking situations - it is a matter of design that there is no central lock manager in Oracle that would inherently limit scalability, hence the downside of that approach is that there is no central information pool where you could obtain detailed information about row level locks.
    >
    However, if you see support note "Sample Code to Select from a Table EXCLUDING Locked Rows [ID 186531.1]"
    You can take the same code from the script in that note to identify rowid of the locked rows.

  • Request in steps in deleting all the tables data in an user schema.

    Hi Gurus,
    Could some one please provide me the steps involved in deleting all the tables data in an user(schema)
    thanks in advance

    write a script as below
    sys@11GDEMO> select 'truncate table '||owner||'.'||table_name||';' from dba_tables where owner='SCOTT';
    'TRUNCATETABLE'||OWNER||'.'||TABLE_NAME||';'
    truncate table SCOTT.DEPT;
    truncate table SCOTT.EMP;
    truncate table SCOTT.BONUS;
    truncate table SCOTT.SALGRADE;
    truncate table SCOTT.EMPBACKUP;
    truncate table SCOTT.T_NAME;
    truncate table SCOTT.D_TEMP_STSC;
    Example:
    sys@11GDEMO> truncate table SCOTT.T_NAME;
    Table truncated.
    sys@11GDEMO>

  • My audiobook is for sale on iTunes, but iTunes is using the wrong "Preview" section.  The section they used is the only 30 sec. in Spanish and the rest of the book is in English. How can I get iTunes to fix this?

    My audiobook is for sale on iTunes, but iTunes is using the wrong "Preview" section.  The section they used is the only 30 sec. in Spanish and the rest of the book is in English. How can I get iTunes to fix this?

    Hello,
    Is your problem solved ? i got exactly the same problem... So boring...
    Thanks

Maybe you are looking for

  • Need to sum max values in a report with Hidden groupings

    I have looked all over and have not found my exact situation, so I am posting my first question.  I have a report that I have grouped on multiple levels.  So my report has a customer/header/detail/release grouping.  I have written a custom expression

  • COST OF PRINT HEAD?

    COST OF PRINT HEAD?

  • ESS with ERP2005 (without a Portal)

    Hi, in the moment we are using ESS with SAP Enterprise (4.7). Now we are planning the Upgrade to ERP2005. We have several customers who has outsourced their HR Processes to us. We maintain their ESS on our SAP Servers. If we change to ERP2005 the pro

  • Adobe in Design CS6 crashes when exporting to pdf

    I am running MAC OSX version 10.8.5 and every time i am trying to export a pdf from inDesign CS6 is chrashing. And i am doing the same loop again and again with the same results. The inDesign file is large (<8gb) and most of the items inside are embe

  • Updating lookup table using merge query

    Hi Experts, My requirement is, we have total 4 tables called x,y,z and a_lookup table. join column between all these tables is deptno. I need to update a_lookup table based on below conditions    condition1 :   Update a_lookup table with matched reco