I was hoping to avoid having to do that. The odd thing about this issue is when we create our database from scripts generated from DB Ghost and then attempt the transfer everything works fine. It's once certain types of changes to that database are made that this problem happens.
Is there an example out there that scripts the entire database using the DependencyTree?
||| Dim srv As Server
Dim srvConn As ServerConnection
srv = New Server("MyServer")
srvConn = srv.ConnectionContext
srvConn.LoginSecure = True
Dim db As Database
db = srv.Databases("SourceDB")
Dim strDBName As String
strDBName = "DestDB"
Dim xfr As Transfer
xfr = New Transfer(db)
xfr.CopyAllObjects = True
xfr.CopyAllUsers = True
xfr.CopyData = True
xfr.Options.WithDependencies = True
xfr.Options.ContinueScriptingOnError = True
xfr.DestinationDatabase = strDBName
xfr.DestinationServer = srv.Name
xfr.DestinationLoginSecure = True
xfr.TransferData()
Thanks for the response, but that is essentially the code that I'm using when I run into trouble. Except I'm using the ScriptTransfer() function. But, both methods get the same error.
To try and break it down a little further, I executed the scripts in the StringCollection individually:
strColl = xsfr.ScriptTransfer()
Dim i As Integer
For i = 0 To strColl.Count - 1
dbEngagement.ExecuteNonQuery(strColl(i))
Next
I get an exception complaining about a view that doesn't exist while trying to create another view that is dependent upon it. So for some reason the Transfer object is getting the scripts out of order.
Further information:
I just went into Server Manager to check dependencies on the view in question. Server Manager didn't get the dependencies correct either. It left out the the sub-query when checking objects that this object depends on.
No comments:
Post a Comment