Reputation: 71
We have a large (2000+) set of scripts used to deploy out database code. Does anyone know whether there is a tool that can be used to create a single deployment script that conforms to correct dependency order?
I understand that this can be done using Redgate's SQL Compare, however that's great if you have SQL Server. From the limited information on the Schema Compare for Oracle tool it doesn't appear to have this functionality.
Upvotes: 4
Views: 1413
Reputation: 1
The following is a general guideline for the order in which to run the installation scripts for different types of database objects:
Package specifications
Tables (with constraints and indexes) in proper order
Sequences (because they are most often used by triggers)
Triggers
Synonyms
Views (because they may reference functions, procedures, or synonyms)
Package bodies
Data (optionally disabling all constraints before loading the data and re-enabling them afterwards)
Package specifications are listed first because they will always be valid and other objects might refer to them. Package bodies should be the last object type created because they will probably refer to other object types. Because of dependency issues, you are encouraged to put functions and procedures into packages.
Upvotes: 0
Reputation: 5899
I'm not sure I've fully understood your problem, but you might want to try the following:
Upvotes: 1
Reputation: 35401
I'd go with the following order (broadly based on the order that objects are extracted with an EXPDP) :
Upvotes: 3
Reputation: 13583
I'd create a script to kick off your scripts in the proper order, depending on how they're implemented.
force
option so they're created if there's a generation order
issue or dependency to "code" types or other views and types)Kick off rdbms/admin/utlrp to recompile invalid objects when you're done to recompile invalid objects.
Upvotes: 2