Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Query Oracle for information on a Database

Posted on 2014-03-03
10
Medium Priority
?
276 Views
Last Modified: 2014-03-04
I am in the process of developing an Application Catalog for our small group.  Part of the App Catalog is to show which databases and tables are used by the application.  I am planning on having a database that contains the Database names that our group currently works with.  What I want to do is given a Database name, query Oracle to get all the information about that database.  For example, I would like to get the following information:
* Tables in the database
* Field definitions for each table in the database
* Views in the database
* Indexes on each table
* Triggers used in the database and the tables associated with the triggers
* Sequences defined in the table
* Materialized Views
* Synonyms
* Public Synonyms
* any other info for the database

I would also like to be able to store the unique id associated with each table in the database so I can assign tables to specific applications.  For example:

Application 1 defined in the Application Catalog uses the Table1 and Table2 tables from the Test database.  The Test database contains 15 tables.  I want to be able to store a value in my table for the Application Catalog that shows the app uses  Table1 and Table2.  I don't want to store the actual table names because they are already defined in ORACLE and I don't want to "recreate the wheel".

I hope this makes sense and any help is greatly appreciated!
0
Comment
Question by:dyarosh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 2000 total points
ID: 39901725
Each oracle database has a view on which you could base your catalog, just click on the link: ALL_OBJECTS

Based on this view you can drill down to the Data Dictionary Views for each object
0
 

Author Comment

by:dyarosh
ID: 39901743
Is there a way to do this from a c# program?
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39901789
You can do whatever you want with C#.  I suggest you use ODP.Net as the data provider.

You can download it from here:
http://www.oracle.com/technetwork/topics/dotnet/downloads/net-downloads-160392.html?ssSourceSiteId=ocomen

That said:  Why do you want to mix objects within the same schema for different applications?

What you are describing doesn't make any sense.

Create a new schema for each application.  If the apps need to reference objects in the other schema, just create a synonym and grant the proper privs.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 39901790
And that the account you will use to login must have SELECT ANY DICTIONARY privilege.
0
 

Author Comment

by:dyarosh
ID: 39901813
Ok.  This is being used to associate databases with an application so we can tell when a database is no longer needed.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39901821
>>associate databases with an application so we can tell when a database is no longer needed.

I think you are not familiar with Oracle architecture.

In Oracle a database refers to the files on disk.

A schema is a database user that owns objects.

How do you plan on knowing when a set of database objects is no longer in use?
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 39901962
that's reverse logic
you need to analyze your c programs to see which tables you still need

if you have functionality which is almost never used, like year-end calculations,
checking the database for usage you might miss those tables and drop them

if you want to know if a database is no longer needed
add a logon trigger to it and log all the entries in a table
if no one has logged on for six months ... then it wasn't needed in those six months

if you were to enter the module name for all your apps in the session info,
you might be able to catch about 80% of the data you want
0
 
LVL 23

Expert Comment

by:David
ID: 39901983
Just my two cents, but is such an effort going to be useful to your audience?  Like the previous comment, is this something worth maintaining?

When I wear my data architect hat, I'm more likely to go after a relational model / CASE diagram, and business rules so that the developers know what constraints to include.
0
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 39903281
Want to know if a schema (database) is being used or not? -- Change the password and be ready to listen who complains.
:p
0
 

Author Closing Comment

by:dyarosh
ID: 39903381
Thank you.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question