StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Deploying to server - error when creating...Expand / Collapse
Author
Message
Posted 03/20/2008 8:29:28 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 08/06/2008 2:55:01 AM
Posts: 42, Visits: 227
Hi,

I'm using trial version of Database Deployment Toolkit. I'm using automatical creation of stored procedures. When deploying to SQL server for first time, everything is running correctly. When deploying the same database to server again, I receive an error stating that "An error occurred while creating the stored procedure XY" and that "There is already an object named XY" - for all stored procedures. When I delete these procedures from SQL server, it runs correctly.

Is there any possibility to include something like "If exists then drop..."? Or is there any workaround?

Thanks

George

Post #15056
Posted 03/20/2008 8:37:44 AM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 8:02:07 AM
Posts: 646, Visits: 22,668
Please try to delete your "Object Name History" in the DDT, that sounds like the problem or at least where to start.
Post #15057
Posted 03/20/2008 8:59:12 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 08/06/2008 2:55:01 AM
Posts: 42, Visits: 227
I have cleared history, then tried deploy ones more but the result is the same - for each stored procedure I receive result similar to this on:

X 20.3.2008 14:55:21 -> An error occurred while creating the stored procedure [M01].[ProductType_Delete].
X 20.3.2008 14:55:21 -> SqlException       
X 20.3.2008 14:55:21 ->   There is already an object named 'ProductType_Delete' in the database.       
X 20.3.2008 14:55:21 ->        
X 20.3.2008 14:55:21 -> Source     : .Net SqlClient Data Provider       
X 20.3.2008 14:55:21 ->        
X 20.3.2008 14:55:21 -> Stack Trace:        
X 20.3.2008 14:55:21 ->    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)       
X 20.3.2008 14:55:21 ->    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)       
X 20.3.2008 14:55:21 ->    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)       
X 20.3.2008 14:55:21 ->    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)       
X 20.3.2008 14:55:21 ->    at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)       
X 20.3.2008 14:55:21 ->    at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)       
X 20.3.2008 14:55:21 ->    at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()       
X 20.3.2008 14:55:21 ->    at MicroFour.StrataFrame.DBEngine.SQL.DatabaseMigrator.DeploySprocsOfPriority(Database parent, DatabaseInfo dbInfo, Int32 priority)       
X 20.3.2008 14:55:21 ->        

Post #15058
Posted 03/20/2008 9:30:38 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:52:53 AM
Posts: 4,586, Visits: 4,571
Is there any possibility to include something like "If exists then drop..."? Or is there any workaround?

This logic already exists   You are fighting something else.

First, as Keith mentioned, you can check your Object Name History.  However, I do not think that is your issue here.  It sounds to me like you have one schema name deployed on the server (i.e. dbo) and are trying to deploy a different schema (M01).  This can cause an issue.

In the 1.6.5 build we changed the logic of the DDT so that IT people can add their own sprocs, views, and UDFs to a database and they will be left alone byt eh DDT.  Previously we deleted them all.  We now set an extended property on the object so that we can tell which were deployed by the DDT.  The other problem you could be fighting here is that the sproc ProductType_Delete was manually added on the database and then added into the DDT...which this could potentially cause the error.  Finally, the last thing to check, is if you have a table name called ProductType and are allowing the DDT to created the DELETE sproc for you and you also have a sproc of this name...this would create a conflict and could present this error.

One thing to always try and do when you run into things like this is to deploy to a fresh database name (one that doesn't exist) or server so that you can troubleshoot the problem more easily.

If you can't get any of this to work, post your package file here and we will take a look at it and tell you where your issue is.

Post #15059
Posted 03/21/2008 3:12:29 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 08/06/2008 2:55:01 AM
Posts: 42, Visits: 227
First, as Keith mentioned, you can check your Object Name History.  However, I do not think that is your issue here.  It sounds to me like you have one schema name deployed on the server (i.e. dbo) and are trying to deploy a different schema (M01).  This can cause an issue.

- I have created whole database design by DDT - I haven't set anything on SQL server side. Actually my database contains table in 4 different schemas (correspoding to logic application modules)

In the 1.6.5 build we changed the logic of the DDT so that IT people can add their own sprocs, views, and UDFs to a database and they will be left alone byt eh DDT.  Previously we deleted them all.  We now set an extended property on the object so that we can tell which were deployed by the DDT.  The other problem you could be fighting here is that the sproc ProductType_Delete was manually added on the database and then added into the DDT...which this could potentially cause the error. 

- No, I haven't created any SP manually - all stored procedures has been created by DDT when checking "Create ... Stored procedure" in table properties

Finally, the last thing to check, is if you have a table name called ProductType and are allowing the DDT to created the DELETE sproc for you and you also have a sproc of this name...this would create a conflict and could present this error.

- As I have mentioned before, I have created tables and everything else was created automatically. I do not know what and where to set.

One thing to always try and do when you run into things like this is to deploy to a fresh database name (one that doesn't exist) or server so that you can troubleshoot the problem more easily.

- Well, I have deleted the database from SQL server. Then used DDT to deploy the project to database - everything succesfull, no error. The I tried to deploy the same project again - everything successfull (tables, indexes, primary keys etc.) - except stored procedures. The behavior is the same that I have described before.

If you can't get any of this to work, post your package file here and we will take a look at it and tell you where your issue is.

- I have attached my project and resulting log.

Thank You for Your assistence

  Post Attachments 
RCEL_Protocol.pkg (182 views, 18.13 KB)
RCEL_Protocol_results.txt (14 views, 39.63 KB)

Post #15076
Posted 03/21/2008 10:00:52 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:52:53 AM
Posts: 4,586, Visits: 4,571
Apparently a new bug has been introduced with 1.6.5 when using funny schema names.  We made a change to prevent all views, sprocs, and UDFs from being deleted and only remove the ones deployed by the DDT.  The problem is that the extended properties are not repsecting the schema name.  We have reproduced the problem and will post a fix once we get to the bottom of the issue.
Post #15083
Posted 03/21/2008 10:47:34 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 08/06/2008 2:55:01 AM
Posts: 42, Visits: 227
Thank You for info. I'm going to wait for the new version :-)
Post #15088
Posted 03/21/2008 1:11:39 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:52:53 AM
Posts: 4,586, Visits: 4,571
Here is the fix: http://forum.strataframe.net/FindPost15092.aspx 
Post #15093
Posted 03/22/2008 4:27:07 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame Beginner