JarJarrr
JarJarrr

Reputation: 410

SqlPackage.exe takes a long time

So we are working on adding SQL DACPACs as part of our continues integration. We do this with powershell script running "sqlpackage.exe" with each DacPac file. we have about 12 DBs so it's about 12 DacPacs.

Everytime we run "sqlpackage.exe" to publish or script the DacPac we notice that it will take between 0.5-1+ min to complete initialization. Most of this time is being taken during initialization flow when "sqlpackage.exe" begins.

i'm trying to find a way to reduce this if possible since we have 12 DBs we are talking about at least 12 min for DB Deployment which is too much for us.

Do you know of any way to be able to reduce this?

Upvotes: 5

Views: 3740

Answers (2)

benpage
benpage

Reputation: 4618

This might be too late but potentially useful for others - we found that opening up all ports in the firewall on the SQL server solved our problem of deployment taking a long time. Went from about 4-5 minutes to about 1 minute.

Upvotes: 0

Mark
Mark

Reputation: 2926

The time up front is, I believe, used to get the current schema from the database, compare it to what's in the dacpac, and come up with the change scripts required. There is no way to eliminate that using a dacpac.

However, you could do it ahead of time by having SqlPackage create the upgrade scripts and then at deploy-time just run the scripts. This could reduce downtime to just the time it takes to run the script, and, as suggested, if run in parallel the down time could be dramatically reduced.

If all your DBs are guaranteed to be in the same (schema) state you could just create a single upgrade script off the first DB and run it on all DBs.

Upvotes: 1

Related Questions