We have two databases that point to the two different environments. Sometimes we are doing the change in one DB due to that we both DB is not in Sync. We need to identify the changed objects.
There are below ways to identify the missing objects.
·
Either we can check manually and identify the
missing object. This is a very difficult task and we will not get the correct
result.
·
Using the sql script we can get the missing
objects. It is very easy and we will get the correct data.
Below is the script to find the missing data.
DECLARE @SourceDatabase VARCHAR(50), |
Running this script.
As of now we both db are in sync.
Now we are creating one object in the AdventureWorks2012 DB.
USE [AdventureWorks2012] |
Now we are running the above script.
See we get the missing object details.
Let’s see one more example now we are creating the new
object in the AdventureWorks2012_UAT DB.
USE [AdventureWorks2012_UAT] |
Now we are running the above script.
See we get the missing object details.
Now doing the sync in both DBs.
After Sync we will see get the above result.