Getting list of populated database tables only

Hi, recently started a new company and new to Oracle 10g. The database system they have has around 5000 tables. The majority of these are not used (it is an off the shelf package). What I am trying to do is get a list of all tables in the database BUT only those that contain records (not the empty tables) and then copy this to an excel spreadsheet. We use a tool called aquadata to run sql enquiry statements on.

You didn't understand that reply. You could just spool this into a file with a .csv extension, and then open the file with excel.
SQL> set head off
SQL> spool xyz.csv
SQL> select table_name from dba_tables where num_rows > 0;
SQL> exit
$ more xyz.csvEdit: And this is even easier: http://laurentschneider.com/wordpress/2007/05/export-to-excel.html
Edit 2: All answers you are likely to get around here assume you use the built in Oracle tool called sqlplus. Many people think using the built in command line tool is much better for administrative tasks than some other tool. If you must do it in some other tool, you should ask how to do it whereever that tool is supported.
Edit 3: You got an answer to the question you asked, but it could be your idea of "database" is what we call "schema" or "user." If you aren't logging in as a dba (which you shouldn't if you don't know the basic concepts, which you can and should read in the concepts guide), there is a similar table called "user_tables" in each schema, as well as one called "all_tables," which differs from user_table in that you may have been granted access to other user's tables. It may be in your tool, you could select table_name from user_tables where row_count > 0; and simply cut and paste that into excel. Or not. If you use dba_tables, you probably also want to select owner, table_name.
Edited by: jgarry on Feb 9, 2012 9:31 AM
Edited by: jgarry on Feb 9, 2012 9:38 AM
Edited by: jgarry on Feb 9, 2012 10:58 AM

Similar Messages

  • Query to get list of linked server tables referenced inside a stored procedure

    Hi,
    SQL Server 2005 sp4
    I have a requirement to get list of linked server tables referenced insider a stored procedure
    Ex:
    Databases       DB1          DB2
    Tables:            T1             T2                            
    Use DB1
    Go
    Create proc P1
    begin
    select * from T1
    select * from DB2.dbo.T2
    end
    I am looking for a query which can return a result with output as below. sp_depends is not helping here as it does not work for cross DB objects, any other thoughts.
    Tables
    T1,
    DB2.dbo.T2

    On SQL 2005, you will have to do it manually.
    On SQL 2008 or later, you could have used sys.sql_expression_dependencies.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to get string value from database table using Visual Studio 2005?

    Hi,
    Im developing plugin in illustrator cs3 using visual studio 2005. I need to get the values eneterd in database. Im able to get the integer values. But while getting string values it is returning empty value.
    Im using the below code to get the values from database table
    bool Table::Get(char* FieldName,int& FieldValue)
        try
            _variant_t  vtValue;
            vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
            FieldValue=vtValue.intVal;
        CATCHERRGET
        sprintf(m_ErrStr,"Success");
        return 1;
    Im using the below code to get the values.
    AIErr getProjects()
        char buf[5000];
        int i;   
        std::string  catName;
        ::CoInitialize(NULL);
        Database db;
        Table tbl;
        errno_t err;
        err = fopen(&file,"c:\\DBResult.txt","w");
        fprintf(file, "Before Connection Established\n");
        //MessageBox(NULL,CnnStr,"Connection String",0);
        if(!db.Open(g->username,g->password,CnnStr))
            db.GetErrorErrStr(ErrStr);
            fprintf(file,"Error: %s\n",ErrStr);
        fprintf(file, "After Connection Established\n");
    if(!db.Execute("select ProjectID,ProjectName from projectsample",tbl))
            db.GetErrorErrStr(ErrStr);
            fprintf(file,"Error: %s\n",ErrStr);
        int ProjectID;
        int UserID;
        int ProjectTitle;
        char ProjectName[ProjectNameSize];
        if(!tbl.ISEOF())
            tbl.MoveFirst();
        ProjectArrCnt=0;
        for(i=0;i<128;i++)
            buf[i]='\0';
            int j=0;
        while(!tbl.ISEOF())
            if(tbl.Get("ProjectID",ProjectID))
                fprintf(file,"Project ID: %d ",ProjectID);
                ProjectInfo[ProjectArrCnt].ProjectID = ProjectID;
                sprintf(buf,"%d",ProjectID);
                //MessageBox(NULL, buf,"f ID", 0);
                j++;
            else
                tbl.GetErrorErrStr(ErrStr);
                fprintf(file,"Error: %s\n",ErrStr);
                break;
            //if(tbl.Get("ProjectTitle",ProjectName))
            if(tbl.Get("ProjectName",ProjectName))
                MessageBox(NULL,"Inside","",0);
                fprintf(file,"ProjectTitle: %s\n",ProjectName);
                //catName=CategoryName;
                ProjectInfo[ProjectArrCnt].ProjectName=ProjectName;
                //sprintf(buf,"%s",ProjectName);
                MessageBox(NULL,(LPCSTR)ProjectName,"",0);
            else
                tbl.GetErrorErrStr(ErrStr);
                fprintf(file,"Error: %s\n",ErrStr);
                break;
            ProjectArrCnt++;
            //MessageBox(NULL, "While", "WIN API Test",0);
            tbl.MoveNext();
        //MessageBox(NULL, ProjectInfo[i].ProjectName.c_str(),"f Name", 0);
        ::CoUninitialize();
        //sprintf(buf,"%s",file);
        //MessageBox(NULL,buf,"File",0);
        fprintf(file, "Connection closed\n");
        fclose(file);
        for(i=0;i<ProjectArrCnt;i++)
            sprintf(buf,"%i",ProjectInfo[i].ProjectID);
            //MessageBox(NULL,buf,"Proj ID",0);
            //MessageBox(NULL,ProjectInfo[i].ProjectName.c_str(),"Project Name",0);
        return 0;
    In the above code im geeting project D which is an integer value. But not able to get the project name.
    Please some one guide me.

    As I said in the other thread, this really isn't the place to ask questions about a database API unrelated to the Illustrator SDK. You're far more like to find people familliar with your problem on a forum that is dedicated to answering those kinds of questions instead.

  • How to get multiple rows from database table?

    hello !
    I need to get multiple rows from a OLEDB database table and display them on a table object.
    I did "Wrap in subfrom" on the table,  set  subform of the table to "flowed", and checked "Repeat row for each data item" of Row1 of the table.
    But I can get only one row on the table object.
    I need your help.
    Thanks

    Hi,
    best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
    Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
    Frank

  • Creating a collection from a list and joining the list to a database table

    I would like to have opinions on good ways to process rows, based on a provided list of key values, joining the collected list against a source table to retrieve additional information related to the key. In this simple example, the procedure accepts a list of employee numbers. The goal is to print a list of names associated with those numbers. The method is to materialize the list of employee numbers as rows and join those rows to a source table to get the names. I have used BULK COLLECT. I don't know if this is a good approach and I would value suggestions. I would also like to understand why we cannot cast PLSQL tables using a type defined in the procedure's specification (why the type needs to exist as an object before we can cast it, like this:
    SELECT * FROM TABLE ( CAST ( SOME_FUNCTION(&some parameter) AS SOME_TYPE ) );
    Anyway, here is my demo SQL, which you should be able to execute against the SCOTT schema without any changes. Thanks for your help!
    declare
    type employee_numbers is table of emp.empno%type index by binary_integer;
    type employee_names is table of emp.ename%type index by binary_integer;
    type employees_record is record (empno employee_numbers, person_name employee_names);
    records employees_record;
    employees_cursor sys_refcursor;
    employee_number_list varchar2(30) default '7369,7499,7521';
    begin
    open employees_cursor for
    with t as (
    select regexp_substr(employee_number_list, '[^,]+', 1, level) as employee_number
    from dual
    connect by regexp_substr(employee_number_list, '[^,]+', 1, level) is not null
    ) select emp.empno, emp.ename
    from t join emp on (emp.empno = t.employee_number)
    order by 2
    fetch employees_cursor bulk collect into records.empno, records.person_name;
    dbms_output.put_line('number of records: '||records.empno.count());
    for i in 1 .. records.empno.count
    loop
    dbms_output.put_line(chr(39)||records.empno(i)||chr(39)||','||chr(39)||records.person_name(i)||chr(39));
    end loop;
    end;

    >
    It looks like I have confirmation that BULK COLLECT is a good way to go collect rows for processing
    >
    Well maybe and maybe not. Bear in mind that those demos were only basic demos for the purpose of illustrating how functionality CAN be used. They do not tell you WHEN to use them.
    BULK COLLECT uses expensive PGA memory and unless you know that only a small number of rows will be collected you can have some serious memory issues. Any heavy duty use of BULK COLLECT should generally have a LIMIT clause to limit the number of elements in the collection for each loop iteration.
    Always use SQL if possible.
    Also, for your use case you might be bette served using a PIPELINED function. Instead of collecting ALL rows into a nested table as in your example a PIPELINED function returns one row at a time but is still used as if it were a table using the same TABLE operator.
    Here is simple example code for a PIPELINED function
    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    -- pipelined function
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
    select * from table(get_emp(20))

  • List Creation From Database Table

    I have a form that has two data blocks based on database tables:
    Block #1 = ORDER_LINE
    Block #2 = ORDER_CODE
    The ORDER_LINE block has an item in it that corresponds to an item in the ORDER_CODE block. I want to create a TLIST for this item in the ORDER_LINE block that populates the list from the values for the corresponding item in the ORDER_CODE block. I know that I can use the POPULATE_LIST built in and need a record group, etc, but I have not been able to make any of this work. Can anyone provide good instructions on how to do this? I find the On Line Help within Forms to be totally useless.
    Thanks.

    976798 wrote:
    --Hello..I want to ask that How to bind a list item with  table values? this below code does not populate items from database to list item.Pls any body give me solution.
    declare
         group_id RecordGroup;
         list_id Item:=Find_Item('LST_CLASS');
         status number;
    begin
         group_id:=Create_Group_From_Query('Answer_List','select CLASS_ID,CLASS_NM from CLASS_MSTR');
         status:=Populate_Group('Answer_List');
         message(to_char(status));
         Populate_List(list_id,group_id);
         end;Welcome to the Oracle Forums. Please take a few minutes to review the following:
    <ul>
    <li>Oracle Forums FAQ
    <li>Before posting on this forum please read
    <li>10 Commandments for the OTN Forums Member
    <li>How to ask questions the smart way
    </ul>
    Following these simple guidelines will ensure you have a positive experience in any forum; not just this one!
    Check this link: How to Dynamically Populate a Pop List ?
    Hope this helps
    Hamid
    If someone's response is helpful or correct, please mark it accordingly.

  • How to import oracle 9i database tables only to oracle 10g express edition

    I had a database dump file created in oracle 9i now i want to import the 9i database table to oracle 10xe...

    Depends whats in the export file, was it a full, user, or tablespace export?
    One way to find out whats in the dump file, run an import show=y and it will only pull out the DDL for the objects in the file
    $ imp file=<dumpfile name> log=implog.log show=y
    username: system
    There are lots of options and ways to run imp, 10g Utilities doc has all the details, here's the chapter on the original imp and exp utilities: http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/exp_imp.htm#i1023560
    If you only want one schema, just the tables, no data, no indexes, create your target user, and do a schema import no rows, no indexes, maybe leave out the grants and statistics too:
    $ sqlplus /nolog
    SQL> connect system
    SQL> create user target_user identified by <passwd> default tablespace <tblspc>;
    SQL> exit;
    $ imp file=... log=... fromuser=<source username> touser=target_user rows=n indexes=n statistics=none grants=n

  • Maxl/esscmd to get list of applications/databases that user has access to

    Is there any maxl/esscmd to get the list of applications/databases that a user has access to?
    I know that LISTGROUPUSERS 'groupName' -- this list all users of a group.
    Can anyone help please?

    MaxL
    display privilege user SomeUser;

  • ADF:two dependent navigation lists on one database table

    Hello,
    I´ve got one table with adress informations and I like to define two navigation lists (drop down lists) on which the first one shows the streets and the second one shows the names. When I select the street in the first one I like to see the names in the second list only of the selected street.
    How can I realize this? In my datacontrol I´ve got one dataview with the several attributes and I can create the two lists but they don´t depent on each other.
    Many Thanks!

    Hi!
    Thank you for your reply, Frank.
    But the examples you mean, are based on two or more tables and worked with Master/Detail tables. I only have one table and I like to define two select choices for two columns of that one table. For example, one selectchoicelist for name and the other one for street. So the results are the rows which are matching the two selected criteria.
    Regards
    Sven

  • WLST - Get List of JDBC Multi DataSource Only..

    Hi All, I am trying to get a list of Multi DataSources using wlst. The list should only have multi data source not the regular ones. I am able to get the all but not the multi data sources, is there an attribute which can uniquely identify the Multi data source. Please advise.

    This is a bit hacky but seems to work:
    from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
    from com.bea.wli.config import Ref
    alsbCore = findService(ALSBConfigurationMBean.NAME, ALSBConfigurationMBean.TYPE)
    refs = alsbCore.getRefs(Ref.DOMAIN)
    it = refs.iterator()
    while it.hasNext():
        r = it.next()
        if r.getTypeId() == Ref.PROJECT_REF:
            print(r.getProjectName())Edited by: paddys on Mar 5, 2012 4:48 PM
    Code formatting

  • Populating database tables in event handler method - error

    Friends,
    I am trying to insert values into ztable in an event handler method in a WDA application.
    This is the code. ZDATA1 is a ztable with two fields: MANDT and ZKTOKD of data element char01.
    types: begin of zs,
    zktokd type char01,
    end of zs.
    data: zitab type table of zs,
    zstruct like line of zitab.
    zstruct-zktokd =  's'.
    append zstruct to zitab.
    INSERT zdata1 FROM TABLE zitab.
    I am getting the error: "The Work area "ZITAB" is not long enough...
    Please let me know what is missing.
    Thanks and Regards.

    Hi,
    The error is here
    types: begin of zs,
    zktokd type char01,
    end of zs.
    data: zitab type table of zs ,
    zstruct like line of zitab.
    "passed the Internal table name which is wrong
    Correct one
    data:
    zitab type table of zs,
    zstruct like line of ZS. " Here we have to give the type you have declared above.
                                    " Zstruct acts like a workarea.
    Regards
    Lekha

  • Get exact row from database table

    This is part of my source code that displays one row from getQuest recordset. Always first.
    <body>
    <p><?php echo $row_getQuest['content']; ?></p>
    <p>: <?php echo $row_getQuest['prom1']; ?></p>
    <p><?php echo $row_getQuest['prom2']; ?></p>
    <?php echo $row_getQuest['dos1']; ?>(); <?php echo $row_getQuest['dos2']; ?> (); <?php echo $row_getQuest['dos3']; ?> (); <?php echo $row_getQuest['dos4']; ?>(); <?php echo $row_getQuest['dos5']; ?> (); <?php echo $row_getQuest['dos6']; ?> (); <?php echo $row_getQuest['dos7']; ?> ().
    </body>
    Can i change it so, that on this page it always displayed row with exact position in the table - for example second or 15th - independently of row contents and rows deletition, moving or changing in table?

    But if I add 5 rows to table, then delete all of them and add 5 again - auto incremented id will 6 for first in table and 10 for last. If i delete all and add 5 again it will be 11...15 and so on. As I said - I cannot rely on row contens - because I'm planning to delete and add data from that table frequently. Or other solution could be to allways keep id from 1 to [amount of rows]. I do not know how this is done.
    Or am I wrong about id?

  • Getting list of reports  and related tables used in those reports using sdk

    some columns are changing in the database tables.
    we like to know how many reports are affected by that .
    please can any one help me in getting list of reports and tables associated with them using  bo sdk.
    thanks for your help in advance

    Open the report with RAS. Then with the ReportClientDocument object:
    oReportClientDocument.getDatabaseController().getDatabase().getTables() will trutns Tables collection object that contains the table information for the report. Then use get() to get Itable object.

  • Remove direct update of database table for VBUk and VBRK

    hello,
    we are updating  database table only for thse two single fields VBRK-FKDAT_RL and VBUK-RELIK using direct UPDATE statements.
    Could you please suggest some function modules or BAPI ?
    BDC is not possible as some fields are not editable.
    Awaiting your responses.
    I have tried RV_INVOICE_DOCUMENT_READ, RV_INVOICE_DOCUMENT_UPDATE, RV_INVOICE_DOCUMENT_ADD.

    The fields aren't editable for a reason.  If you explain the reason for the requirement and what is the trigger for changing the values, you might get a better response.  Why isn't this handled via configuration for instance?

  • Updating database table from co11n transaction ?

    I got a requirement to add two new addional fields  and want to save it in the standard table for reporting purpose. I follwed the steps like :
    1. I created new fields in the table AFRU using appending struture. and activated it using se14.
    2. I created a project and entered the enhancment (CONFPP07)  and i created the screen-exit. then i declared thse two fields in the include : ZXCOFTOP. once i activated the screen exit it appeared in the CO11N TCODE but when i enter some values in this fields , its getting stored  in the variable but i dont know how to store this value in the table AFRU .
    3. for updating i used the exit CONFPP05 and my would be like AFRUD_TAB-ZZSHIF = CAPTAIN.
    but the problem is its not getting updated in the database table AFRU.
    should i have to use module ...endmodule in ( SAPLCORU_S - 900 screen , exit : CONFPP07 ) and write code... , like the we follow
    for ztransaction or how should i solve this issue ?

    So, according to your code, it means that :
    1) your screen field is WA_AFRUD-ZZSHIF
    2) WA_AFRUD is declared as global (in ZXCOFTOP)
    Is that true?
    In PAI: EXIT_SAPLCORU_S_101, you should only do:
    move wa_afrud-zzshif to es_afrud-zzshif.
    In Exit : EXIT_SAPLCORF_105, you have to replace 'A'
    LOOP AT AFRUD_TAB.
    AFRUD_TAB-ZZSHIF = *wa_afrud-zzshif.* "'A'
    MODIFY AFRUD_TAB.
    ENDLOOP.
    Note that LOOP AT  is problable not the good coding (I think that this exit has to remain empty), it was just a test to check it works
    Did you think to activate your project in CMOD? (you have to activate both project, and the exits)
    Are you sure your exit is called. Did you debug it?
    See also Note 12831 (program SAPRSMODCHECK) to check there is no problem between project/exits
    Edited by: Sandra Rossi on Oct 17, 2008 6:59 PM

Maybe you are looking for

  • Runtime error during opening a process chain in rspcm

    Hello, i created a process chain just a simple one which loads Data from the DataSource into a DSO and then into a InfoCube. I executed this processchain without activiating my Initial-Request in the DSO. So i got a hanging Request there, i deleted a

  • Limit of free reader?

    Hi I have a pdf with several images inserted into it, these images were inserted as 300dpi when the pdf was made.  However, if I copy and paste the picture, it appears as 72dpi, is this a limit of the free reader or has somebody messed up with the sa

  • How to get Acrobat print dialog in Safari

    I am asking this question here as well as in the Win forum as I do not know if it is a Win ony issue: When IE or Firefox is displaying a .pdf the browser print button, file/print and ctrl-p take you to the Acrobat Reader print dialog and the .pdf its

  • Zoom Search and dropped meta tag

    I'm using the Zoom Search engine with my Web help and I like it very much. I'm now trying to use Zoom's category feature. I can't base the categories on the url, so I'm using the zoom meta tag instead. However, when I go to publish the Web help, Robo

  • Getting an error message when in the AppStore

    Help! When in the AppStore I keep getting the following error message: ConnectionManager::invoke:: Failed to find service connection URL What the heck does that mean? It happens when trying to purchase an app, even a free one.... And also when I try