I have another problem. Here is now what i'm doing:
Dim unTransfert As New Transfer(BDConfig)
unTransfert.CopyAllObjects = True
unTransfert.DropDestinationObjectsFirst = True
unTransfert.CopySchema = True
unTransfert.CopyData = False
unTransfert.Options.ContinueScriptingOnError = True
unTransfert.DestinationServer = ServeurLocal.Name.ToString
unTransfert.DestinationDatabase = NouvelleBD.Name.ToString
unTransfert.Options.IncludeIfNotExists = True
NouvelleBD.ExecuteNonQuery(unTransfert.ScriptTransfer())
This failed because of my views. If i tried to copy tables only it's working fine. I've tried to copy one by one the view and then i notice that most of then failed and i think i know the reason but i don't know what to do. I've notice that the view that failed are view where the SELECT contain other view. Since those view are not created yet i've got those error. This is a big problem. We have over 300 views and i don't know which one need which one.
Is it possible to copy the views without having this kind of problem ?
Thanks !This is the first time i'm using SMO so i'm probably making some mistakes. Instead of doing this line:
NouvelleBD.ExecuteNonQuery(unTransfert.ScriptTransfer())
Now i'm doing this:
unTransfert.TransferData()
I still have the same problem. But i've notice something. If i add:
unTransfert.CopyAllObjects = false
unTransfert.CopyAllTables = True
unTransfert.CopyAllViews = True
After running for some seconds i've got an error saying it can create this view because this table doesn't exists. In fact the table exist in my BD but while doing the tranfer the views seems to be create before all the table are added. Did i do something wrong ? All i want is to copy all object from one BD to a new one and i need to do this online.
I've been working on this for 2 days and it still not working :-(....
Is someone have an idea of what i'm missing ?
Thanks !!
No comments:
Post a Comment