Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Balaji .

Asked: February 19, 2025 - 12:23 pm UTC

Last updated: April 04, 2025 - 1:11 am UTC

Version: Version 22.2.0.173

Viewed 100+ times

You Asked

Hi
We are looking to take a schema(abc) from our database to to a different server with a new schema name.
I am looking to find what are the dependencies on the abc schema in our packages/procedure/functions
and is there anything else i should be looking at.


regards,
Balaji

and Connor said...

I would start with DBA_DEPENDENCIES, ie

select *
from dba_dependencies
where referenced_owner = 'ABC';


which will cover more things (views etc).

And also, a good trawl your source code control system as well.

Rating

  (5 ratings)

Comments

Artificially intelligent spam?

Stew Ashton, February 24, 2025 - 7:39 am UTC

So this is new: use AI to generate a plausible answer to the question, then use that "answer" as a hook to get clicks. What next?
Chris Saxon
February 24, 2025 - 11:11 am UTC

Indeed; I've removed the spam answer.

A reader, March 30, 2025 - 6:51 pm UTC

Great question — moving a schema like abc to a new server with a different name definitely calls for a full dependency check. You're right to focus on packages, procedures, and functions. I'd also suggest checking views, triggers, and any hardcoded references in dynamic SQL.
Connor McDonald
April 01, 2025 - 3:32 am UTC

Yup

Additional considerations

Stew Ashton, April 01, 2025 - 8:47 am UTC

I regularly move schemas among test and development environments, with only developer access. This requires a script that creates all the objects (tables, code, etc.) in the proper order.
Here's my method:
- Get foreign key relationships between tables from USER_CONSTRAINTS joined to USER_INDEXES
- Get dependencies from USER_DEPENDENCIES
- Get indexes (other than those used by unique or primary key constraints) from USER_INDEXES
- Get any additional materialized views from USER_MVIEWS
- Get any additional objects from USER_OBJECTS (omitting Oracle-maintained stuff)

This all goes into a table with name, type, referenced_name, referenced_type. I remove the duplicates, then use a hierarchical query to put the objects in the proper order. The rest is beyond the scope of this question.

There may be additional dependencies hidden in literals, if you use dynamic SQL or SQL macros. This is one of the reasons why SQL macros are not a perfect substitute for parameterized views.
Connor McDonald
April 04, 2025 - 1:11 am UTC

Thanks for your input Stew.

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library