Creating new Database with SQLDMO crashes
- From: Tony D <TonyD@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 Apr 2005 10:05:06 -0700
Hi,
We have a VB.Net app that creates a new SQL database based on the structure
of another "template" database. In typical fasion, this VB.Net app casts a
reference to the RCW-wrapped SQLDMO library.
On our development machines and even in our 2-tier QA environment, this code
works fine. But on our Beta server (which is also 2-tier) it crashes and
completely bypasses the try..catch code. We've compared the .DLL versions of
DMO on both client and server machines and they look fine.
Originally, this was written as a web application, but because of potential
privilege problems, we've also re-written it as a Windows app.
As a web app we get an event log error that says there was a problem
"unloading a .Net application domain from memory" and the ASPNET process
crashes. As a Windows app we sometimes get a "Fatal Execution Engine
Failure", but it, too, always crashes.
The interesting thing is that, by monitoring the applications progress using
SQL profiler, we can see that it is dying near the end of the Database
creation process: the new database schema is created, objects (tables) are
created, but the transferring of data does not complete.
Here is some sample code:
---
oSQLServer = New CCW_SQLDMO.SQLServer
oSQLServer.Connect(strDbServerName, strSqlAdminUserID, strSqlAdminPassword)
' create a reference to the source database
DBSource = oSQLServer.Databases.Item(sourceSiteCode)
' configure the transfer object
oTransfer = New CCW_SQLDMO.Transfer
oTransfer.CopyAllDefaults = True
oTransfer.CopyAllObjects = True
oTransfer.CopyAllRules = True
oTransfer.CopyAllStoredProcedures = True
oTransfer.CopyAllTables = True
oTransfer.CopyAllTriggers = True
oTransfer.CopyAllUserDefinedDatatypes = True
oTransfer.CopyAllViews = True
oTransfer.CopySchema = True
oTransfer.ScriptType = CCW_SQLDMO.SQLDMO_SCRIPT_TYPE.SQLDMOScript_Default Or
CCW_SQLDMO.SQLDMO_SCRIPT_TYPE.SQLDMOScript_NoDRI
....
' copy schema
DBSource.ScriptTransfer(oTransfer,
CCW_SQLDMO.SQLDMO_XFRSCRIPTMODE_TYPE.SQLDMOXfrFile_Default, _
strFolderPath)
DBSource.Transfer(oTransfer)
---
The code is halting on the "ScriptTransfer" line.
--
- Tony D
.
- Prev by Date: Transactions
- Next by Date: Adding New Row...
- Previous by thread: Transactions
- Next by thread: Adding New Row...
- Index(es):
Relevant Pages
|