?
Solved

Query Oracle for information on a Database

Posted on 2014-03-03
10
Medium Priority
?
275 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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 shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

770 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