Solved

Query Oracle for information on a Database

Posted on 2014-03-03
10
263 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
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 500 total points
Comment Utility
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
Comment Utility
Is there a way to do this from a c# program?
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
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
 
LVL 29

Expert Comment

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

Author Comment

by:dyarosh
Comment Utility
Ok.  This is being used to associate databases with an application so we can tell when a database is no longer needed.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
>>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 36

Expert Comment

by:Geert Gruwez
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Oracle SQL Syntax 8 56
PL/SQL - Leading zeros 7 39
File generation using utl_file 4 28
Best RAID for a BDD Oracle 4 13
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to recover a database from a user managed backup

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now