Finding all tables of a database

hi,
i want to find out all table of a database .
how could i.
thnx

try this
DatabaseMetaData dbmd=con.getMetaData();
ResultSet rsTable=dbmd.getTables(null,null,"%",null);
while (rsTable.next())
//String tableCatalog = rsTable.getString(1);
//String tableSchema = rsTable.getString(2);
System.out.println("Table Name - "+rsTable.getString(3)+" - catalog  - "+rsTable.getString(1)+" - schema - "+rsTable.getString(2)+" - Type - "+rsTable.getString(4));
rsTable.close();

Similar Messages

  • How to find all table and views in the database

    Hi,
    I want to find all table and view name form the database can u tell me syntax.
    i.e. I am able to find out table name and view name in sql server ...like
    FOR VIEW :
    select table_name from information_schema.views where table_name not like 'sys%'
    FOR TABLE :
    select table_name from information_schema.tables where table_name not like 'sys%' and table_type='Base table'
    Thanks & Regards,
    Shirish

    Hello,
    Take a look at "dba_tables" and "dba_views" both of which are documented here:
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14237/toc.htm
    - Mark

  • Find all tables used in a stored procedure

    Hi,
    I have a requirement where i have to find all the tables used in a stored procedures from different  databases.
    Ex: i have a stored procedure where i use few tables from MASTER database and some from STAGE database.When i have written a query to find all tables used in the stored procedure, i am getting only those database table where i run the query and procedure
    exists.
    I have stored procedure SP1 in Master database, but i use the tables from both master and stage.
    When i run this, i am getting the tables only from Master database but not from stage. i hope my requirement is clear.
    I am trying to find all the tables from all databases used by a stored proc.
    ;WITH stored_procedures AS (
    SELECT 
    o.name AS proc_name, oo.name AS table_name,
    ROW_NUMBER() OVER(partition by o.name,oo.name ORDER BY o.name,oo.name) AS row
    FROM sysdepends d 
    INNER JOIN sysobjects o ON o.id=d.id
    INNER JOIN sysobjects oo ON oo.id=d.depid
    WHERE o.xtype = 'P')
    SELECT proc_name, table_name FROM stored_procedures
    WHERE row = 1
    ORDER BY proc_name
    Please advice

    Your question is not entirely clear. You need to run the query on different databases.
    You may find this blog post helpful
    How to get information about all databases without a loop
    Check the last script in that blog post and modify to your particular purpose.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How get all table name from database

    hi master
    sir
    how get all table name from database

    The big question is 'why'.
    Selecting from view 'dba_tables' will indeed give the list of all tables in the database, but that includes the dictionary tables and the internal tables, and many others that are probably not of interet to a person who needs to ask this question. Besides, the dba_tables view requires access to a DBA account.
    There are several other views: "user_tables" will list all the tables in this user's schema; and "all_tables" will list all the tables this user can access in some way.
    The above do not, of course, include any information about synonyms, sequences, views, indexes and so on.
    The correct answer and the meaningful answer may be two different things.

  • Insert into all tables on a Database on Test Server select from all tables on a database A from production server

     
    hi Friends ,i need a suggestion from  you on how to
    insert data to all tables on a Database  "A " on Test server
    Select data from all tables on  a Database  "A" on Production Server
    where id=123
    Database A is same with Structures on Test and Production also all Tables  will have  Id column in common.
    The purpose of this insert is ,as we all know Production has the latest data and i need to push to test server on request for particular ID only  ( may be weekly once or  twice a week )
    I  have a linked server setup name "LINQ" 
    Example for one table is below , like wise i need a script which does for 154 tables.
    Insert into ABC( id, name)---insert to test server
    Select Id, name  from  LINQ.ProdSerevrname.databasename.ABC where id = 123
    Please help me ..
    Thanks

    Why not use export import wizard for this if you've read access to production?
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Newbie ques : How to get the list of all tables in the database

    Hi,
    I'm very new to Oracle (using Oracle8i currently). I wanted to know if there is a way to get the list of all tables in the database. Like in mySQL you can use the command " show tables" to get the list of all the tables.
    Any help will e greatly appreciated. Please "cc" any reply to [email protected] also.
    thanks
    Deven

    Hi
    Select table_name, owner from all_tables;
    will give u all the tables in the database.
    all_tables, dba_tables, user_tables
    all_objects, dba_objects, dba_objects
    there are many, more tables. login as system and query the tab and try to describe the tables.
    Thanks
    Malar

  • How to search all columns of all tables in a database

    i need to search all columns of all tables in a database , i already write the code below , but i've got the error message below when run this script
    DECLARE
    cnt number;
    v_data VARCHAR2(20);
    BEGIN
    v_data :='5C4CA98EAC4C';
    FOR t1 IN (SELECT table_name, column_name FROM all_tab_cols where owner='admin' and DATA_TYPE='VARCHAR2') LOOP
    EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' ||t1.table_name|| ' WHERE ' ||t1.column_name || ' = :1' INTO cnt USING v_data;
    IF cnt > 0 THEN
    dbms_output.put_line( t1.table_name ||' '||t1.column_name||' '||cnt );
    END IF;
    END LOOP;
    END;
    Error report:
    ORA-00933: SQL command not properly ended
    ORA-06512: at line 7
    00933. 00000 - "SQL command not properly ended"
    *Cause:   
    *Action:
    Any help please

    SQL solutions by Michaels
    michaels>  var val varchar2(5)
    michaels>  exec :val := 'as'
    PL/SQL procedure successfully completed.
    michaels>  select distinct substr (:val, 1, 11) "Searchword",
                    substr (table_name, 1, 14) "Table",
                    substr (t.column_value.getstringval (), 1, 50) "Column/Value"
               from cols,
                    table
                       (xmlsequence
                           (dbms_xmlgen.getxmltype ('select ' || column_name
                                                    || ' from ' || table_name
                                                    || ' where upper('
                                                    || column_name
                                                    || ') like upper(''%' || :val
                                                    || '%'')'
                                                   ).extract ('ROWSET/ROW/*')
                       ) t
    --        where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
           order by "Table"or
    11g upwards
    SQL> select table_name,
           column_name,
           :search_string search_string,
           result
      from (select column_name,
                   table_name,
                   'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
              from cols
             where table_name in ('EMP', 'DEPT')),
           xmltable (str columns result varchar2(10) path '.')
    TABLE_NAME                     COLUMN_NAME                    SEARCH_STRING                    RESULT   
    DEPT                           DNAME                          es                               RESEARCH 
    EMP                            ENAME                          es                               JAMES    
    EMP                            JOB                            es                               SALESMAN 
    EMP                            JOB                            es                               SALESMAN 
    4 rows selected.

  • How can i find statistics tables in my database?

    code{
    Upgrade Statistics Tables Created by the DBMS_STATS Package
    If you created statistics tables using the DBMS_STATS.CREATE_STAT_TABLE procedure, then upgrade these tables by executing the following procedure:
    EXECUTE DBMS_STATS.UPGRADE_STAT_TABLE('SYS','dictstattab');
    In the example, 'SYS' is the owner of the statistics table and 'dictstattab' is the name of the statistics table. Execute this procedure for each statistics table.
    the above is one of the post upgrade step for 11gR2. How can i find statistics tables in my database?

    You need to read the complete context of this manual upgrade step:
    Step 33
    Upgrade Statistics Tables Created by the DBMS_STATS Package
    If you created statistics tables using the DBMS_STATS.CREATE_STAT_TABLE procedure, then upgrade these tables by executing the following procedure:
    EXECUTE DBMS_STATS.UPGRADE_STAT_TABLE('SYS','dictstattab');
    In the example, 'SYS' is the owner of the statistics table and 'dictstattab' is the name of the statistics table. Execute this procedure for each statistics table.You need to do this step for any statistics table that you created manually with DBMS_STATS.CREATE_STAT_TABLE.
    Marcus

  • How do I run sp_spaceused for all tables in a database?

    Hi,
    I am struggling to understand how to run the sp_spaceused sproc for all tables in a database.
    I know how to use it for one table but how would I replicate it automatically for each table in a given database?
    Regards,
    Ian.

    I just managed to alter the code of VidyaSagar and have pulled out all the information including Schema name. Below is what it looks like:
    set
    nocount
    on
    select
    'Database Name: ',
    db_name
    if
    exists(select
    name from tempdb..sysobjects
    where name='##tmp'
    drop
    table ##tmp
    create
    table ##tmp(TABLE_SCHEMA
    nvarchar(256),TABLE_NAME
    nvarchar(256),
    num_rows int,
    reserved_KB varchar(15),data_KB
    varchar(15),index_KB
    varchar(15),unsed_KB
    varchar(15
    go
    declare
    @tbl_schema nvarchar(256
    declare
    @tbl_name nvarchar(256
    declare
    @schema_tbl_name nvarchar(256
    declare
    tblname CURSOR
    for
    select
    TABLE_SCHEMA
    TABLE_NAME
    from
    INFORMATION_SCHEMA.TABLES
    where TABLE_TYPE='BASE
    TABLE' 
    open
    tblname
    Fetch
    next
    from tblname
    INTO @tbl_schema,@tbl_name
    WHILE
    @@FETCH_STATUS
    = 0
    BEGIN
    set @schema_tbl_name=@tbl_schema+'.'+@tbl_name
    insert
    into ##tmp(TABLE_NAME
    , num_rows
    , reserved_KB
    ,data_KB
    ,index_KB
    ,unsed_KB
    exec
    sp_spaceused
    @schema_tbl_name
    update ##tmp
    set TABLE_SCHEMA
    =@tbl_schema
    where TABLE_SCHEMA
    is
    NULL
    and TABLE_NAME=@tbl_name
    FETCH
    NEXT
    FROM tblname
    INTO @tbl_schema,@tbl_name 
    END
    CLOSE
    tblname
    deallocate
    tblname
    go
    select
    from
    ##tmp
    drop
    table ##tmp
    Warm Regards, Ajay

  • How to view all table of a database

    How to view all table of a database created on a oracle 9.2/10g database management system.
    How to view available tables of oracle dbms which comes by default with package.
    Thank you so much in advance!
    With Regards,
    Niks

    You posted the same question twice.
    How to view all table of a database

  • How to find all tables that are associated with a given domain name.

    I want to find all table, excluding the structures, of a given domain name, say, waers.
    Some of the tables are directly contains the domains while others are related with a data element which is connected to that domain.
    I want to find tables for all two case -either tables connected directly to the domain or connected via data element- and exclude the structures.
    thanks in advance.

    Hi,
    The following thing may help you.
    in se11-> search for tables having names like 'DD*'.
    From this list of tables you can find the required table to get domain, data element nad table name.
    one way of doing it:
    SELECT rollname domname
      FROM dd04l
      INTO CORRESPONDING FIELDS OF TABLE it_tab.
    SELECT rollname tabname
      FROM dd03l
      INTO CORRESPONDING FIELDS OF TABLE it_tab1
      FOR ALL ENTRIES IN it_tab
      WHERE rollname = it_tab-rollname.
    SORT it_tab1.
    DELETE ADJACENT DUPLICATES FROM it_tab1.
    LOOP AT it_tab1 INTO wa_tab.
      MODIFY it_tab FROM wa_tab
      TRANSPORTING tabname
      WHERE rollname = wa_tab-rollname.
    ENDLOOP.
    LOOP AT it_tab INTO wa_tab.
      WRITE:/ wa_tab-domname,
              wa_tab-tabname.
    ENDLOOP.
    Regards,
    Manoj Kumar P

  • Find all tables in db with column name of a particular string?

    I'm looking for all tables in a db that have a certain column name. How can I find this?

    John,
    thanks for your answer.
    John Mcginnis wrote:
    The quick search field in the schema browser is doing client-side filtering of the list of objects. This means we can only filter on things that we already have fetched from the database, like the object name. We have no current plans to extend the types of information that can filter on, although it is possible we might add the ability to filter based on a few other types of information that we generally fetch with the object name. However, filtering by column name would require pre-fetching the lists of columns for all tables and as such is not likely to be added to the schema browsers search field.
    I'm sure you guys had a Toad review to understand how things are done there.....so
    My 2 cents are: instead of pre-fetching the columns of all tables why don't you add a button below the table drop-down list which should fetch the tables based on the filter columns condition - exactly like Toad.
    Thanks,
    Dani

  • How to find affected tables in the database

    Hi Friends,
    Is there any way to find the tables affected in the database when book a trade in the Application in Oracle. Please help me to find the affected tables.
    Thanks,
    ragu.
    Edited by: user533548 on Apr 3, 2009 5:08 AM
    Edited by: user533548 on Apr 3, 2009 5:13 AM

    Hi Karthick_Arp,
    You take any application for example when you book details about a new employee the rows will be affected in the database we generally use the empid to identify
    what are the tables affected is there any way like this when you book a trade in the Application to find what are all the tables affected in the database.I think that
    you have understand my question.
    Thanks,
    ragu.
    Edited by: user533548 on Apr 3, 2009 5:09 AM
    Edited by: user533548 on Apr 3, 2009 5:13 AM

  • How to delete duplicate records in all tables of the database

    I would like to be able to delete all duplicate records in all the tables of the database. Many of the tables have LONG columns.
    Thanks.

    Hello
    To delete duplicates from an individual table you can use a construct like:
    DELETE FROM
        table_a del_tab
    WHERE
        del_tab.ROWID <> (SELECT
                                MAX(dups_tab.ROWID)
                          FROM
                                table_a dups_tab
                          WHERE
                                dups_tab.col1 = del_tab.col1
                          AND
                                dups_tab.col2 = del_tab.col2
                          )You can then apply this to any table you want. The only differences will be the columns that you join on in the sub query. If you want to look for duplicated data in the long columns themselves, I'm pretty sure you're going to need to do some PL/SQL coding or maybe convert them to blobs or something.
    HTH
    David

  • Creating sequences for all tables in the database at a time

    Hi ,
    I need to create sequences for all the tables in my database.
    i can create individually ,using toad and sqlplus.
    Can any one give me a code for creating the sequences dynamically at a time for all the tables.
    it is urgent ..
    Regards.

    I need to create sequences for majority of the tables that are having ID column
    which is sequences."The majority" is not the same as all. So you probably want to drive your generation script off the ALL_TAB_COLUMNS view...
    where column_name = 'ID'You need to think about this carefully. You might want different CACHE sizes or different INCREMENT BY clauses for certain tables. You might even (whisper it) want a sequence to be shared by more than one table.
    Code generation is a useful technique, but it is a rare application where one case fits all.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

Maybe you are looking for