Book a Demo

Author Topic: Reverse engineering schemas from Oracle DB into separate packages  (Read 3572 times)

marcel700

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Hello everybody,

I would like to ask someone for help with creating a physical model of our Oracle DB. I tried to read a lot of stuff about it, but with no success to solve my problem.

Our project DB has a lot of schemas, with a lot of tables and other objects within each other. I've got the task to make a physical model from it. I've tried to reverse engineer it, which is functioning, but I would like to preserve DB structure in the model so that each schema in DB would have corresponding separate package in model, because when I just import from ODBC to one package, it get's really messy, as project browser doesn't show schema/owner name before the object name, like i was able to achieve in diagram, where it works fine for me.

I was able to achieve individual import from ODBC per schema into separate packages via right click on each package and choosing Code Engineering > Import DB Schema from ODBC. But here starts the problem. All Foreign keys are defined on each imported table (in project browser), but if I right click on the table and show properties, there are defined just links to corresponding tables that are also inside the package. There is no link to table that is in another package (representing another schema), even if there is FK defined on that table, to another table in another package. EA just doesn't know where to find the table of the opposite side of the relationship. As a result, when i place a table on the diagram and choose Import related elements (from the context menu), it shows me only tables that are inside that package, but not the ones belonging to relationships (FKs) that direct to table in another package.

Is there a way to tell EA where it finds tables that are in another package representing another schema? I would need to achieve this automatically, because there are hundreds of tables in database, so manual defining every link would be very time consuming.

I'm using Oracle 11.2 and Enterprise Architect 13.5

Thank you in advance for any suggestions.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Reverse engineering schemas from Oracle DB into separate packages
« Reply #1 on: February 15, 2022, 12:11:23 am »
I don't think EA does that natively.

What I would probably try

- Import the whole database
- Move the individual table to separate subpackages based on their owner (I would do that with a little script)

The problem might be (I'm not sure) that now EA doesn't recognize these tables in subpackages anymore, and so your compare/import from ODBC isn't going right anymore (EA creates new tables for tables in subpackages)

In that case you could
- move all tables back to the main package
- compare/import from ODBC
- move all tables back to their sub-packages

Moving tables from/to subpackages is something you could achieve with a very simple script.

Geert

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Reverse engineering schemas from Oracle DB into separate packages
« Reply #2 on: February 15, 2022, 02:09:11 am »
It cannot be done natively, this is one of Sparx EA many data modelling limitations.

It can be done as Geert describes, either using a script of manually. In several projects we ended up with a structure like

<<database>> [Database Name]
------[Schema Name 1]
------------Functions
------------Procedures
------------Queries
------------Sequences
------------Triggers
------------Tables
------------Views
------------Connections
------[Schema Name 2]
------------Functions
------------Procedures
------------Queries
------------Sequences
------------Triggers
------------Tables
------------Views
------------Connections
------[Schema Name ...]
------------Functions
------------Procedures
------------Queries
------------Sequences
------------Triggers
------------Tables
------------Views
------------Connections

All of the above are packages.

In previous versions, this structure had no impact on Sparx been able to reverse engineer and identify changes to existing objects. We have tried this with v15.
 

marcel700

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Reverse engineering schemas from Oracle DB into separate packages
« Reply #3 on: February 15, 2022, 02:19:21 am »
Hello,

Thank you for your quick response. I tried it and it seems Geert's concept works fine:-) Also i was able to synchronize tables that were moved to another package. The linkage stayed preserved after moving. So big thanks for your help:-)

Have a nice day.