HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Copy primary keys/clustered indexes from Prod to DEv/Test env

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
clusteredprodprimarydevindexesenvkeystestfromcopy

Problem

We followed the best practices of creating Primary Keys/Clustered indexes on tables which are actively queried on prod.

Now there is a scenario where we need to get the similar above changes done onto DEV/test. Since we did not expect we might require this on dev, we never documented so as to map similar changes.

Is there a better and faster way of doing this rather than , manually scripting out and creating them henceforth.

Thanks.

Solution

For a start unless this was an absolute emergency you have done everything backwards: you should not make changes to production that have not been made in dev/test first to make sure they have the desired effect. Develop, test, then release the changes to production.

Setting that aside: There are a number of tools out there that claim to compare schema, and some try to generate a script to bring one schema into sync with another reference one (though I'd be wary of running such a generated script without a detailed review first!).

http://opendbdiff.codeplex.com/ came up in a quick search though I've not used the project myself. It seems to fit the need you describe. There are also products from RedGate & other SQL related software houses (search for "schema compare") and a tool built in to some editions of Visual Studio which your developers may already have available.

Context

StackExchange Database Administrators Q#142472, answer score: 5

Revisions (0)

No revisions yet.