dcsimg
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: How to find ER relationships

  1. #1
    Join Date
    Feb 2001
    Posts
    44
    Is therw a way to find how many Entity-relationships exist in Database?

  2. #2
    Join Date
    Apr 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    1,203
    Well, relationship between entities can often be distingushed by looking at Foreign Keys from one table to another. I assume you don't have a ERD of the database schema. What are you trying to do?
    OCP 8i, 9i DBA
    Brisbane Australia

  3. #3
    Join Date
    May 2001
    Location
    Chennai
    Posts
    57

    Exclamation Thid party utility...

    Just an info...

    There r some 3rd party utlity which can actually do the reverse engineering of ur database schema...

    ER-Win is one such for Windows OS...

    This s/w has a feature where in u can design ur database and get a script which can b used to create a database r reverse engineer ur schema where by u get the relational intergrity of that schema from the database server in a diagramatical manner...

    Really an useful tool...

    Kevin


  4. #4
    Join Date
    Dec 2001
    Location
    USA
    Posts
    620
    rem Script Description: This script will document all entity relationships for a given Schema
    rem Owner. It will identify all Parent/Child entities for a given table, and
    rem also the columns (attributes) that are used in defining the
    rem relationship.
    rem
    rem Output file: erd.lis
    rem
    rem Usage Information: SQLPLUS {user id)/{user password}
    rem @entity_relations.sql
    rem

    set echo off verify off ;

    column table_name format A30;

    accept OwnerName prompt 'Enter Schema Owner Name: ';

    TTITLE LEFT 'Child Tables for the table: ' table_name;

    break on TABLE_NAME ;

    spool erd.lis

    SELECT B.TABLE_NAME table_name, C.COLUMN_NAME, C.POSITION
    FROM ALL_CONSTRAINTS A, ALL_CONSTRAINTS B, ALL_CONS_COLUMNS C
    WHERE A.CONSTRAINT_NAME = B.R_CONSTRAINT_NAME
    AND A.TABLE_NAME = C.TABLE_NAME
    AND A.CONSTRAINT_NAME = C.CONSTRAINT_NAME
    AND A.OWNER = UPPER('&&OwnerName')
    ORDER BY B.TABLE_NAME, C.POSITION;

    TTITLE LEFT 'Parent Tables for the table: 'table_name

    SELECT A.TABLE_NAME table_name, C.COLUMN_NAME, C.POSITION
    FROM ALL_CONSTRAINTS A, ALL_CONSTRAINTS B, ALL_CONS_COLUMNS C
    WHERE A.CONSTRAINT_NAME = B.R_CONSTRAINT_NAME
    AND B.TABLE_NAME = C.TABLE_NAME
    AND B.CONSTRAINT_NAME = C.CONSTRAINT_NAME
    AND B.OWNER = UPPER('&&OwnerName')
    ORDER BY A.TABLE_NAME, C.POSITION;

    spool off;
    set echo on verify on ;
    clear columns;
    clear breaks;
    ttitle off;




    Hope this is your requirement.

    Thanks,
    Sam
    ------------------------
    To handle yourself, use your head. To handle others, use your heart

  5. #5
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    You can reverse engineer the database schema with Oracle Designer.

    If you go into Design Editor, there is an option to Capture Design of database.

    Good luck.
    David Knight
    OCP DBA 8i, 9i, 10g

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width