Database Change Management
Database Change Management
Home | Profile | Register | Active Topics | Active Polls | Members | Private Messages | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?




 All Forums
 Support
 DB Ghost Support Forum
 Add pre-deployment for Source database
 New Topic  New Poll New Poll
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rpotter


5 Posts

Posted - 11/20/2013 :  14:35:10  Show Profile Send rpotter a Private Message  Reply with Quote
Currently there is a post-deployment for the source database, to allow for customizations on the source before it compares it to the target. In our case, I'm trying to create additional filegroups + files, which is achievable in the post-deployment except my source files are targeting specific tables/indexes to be created on these file groups which attempt to get created before the post-deployment runs (so it fails indicating the filegroup is not valid).

Is it possible to have a pre-deployment option on the source database added?

Is there another way to handle multiple file groups that is more elegant as well that I may be missing?

Thanks in Advance!

Google AdSense

USA
Mountain View


dbghost



66 Posts

Posted - 11/20/2013 :  18:41:54  Show Profile  Visit dbghost's Homepage Send dbghost a Private Message  Reply with Quote
What process are your running, Change Manager build-compare-sync or is this a packged deployment created using Packager Plus?
Go to Top of Page

rpotter



5 Posts

Posted - 11/20/2013 :  18:43:26  Show Profile Send rpotter a Private Message  Reply with Quote
Packager Plus -- should have noted that in the original details, sorry. Thanks for the quick response.
Go to Top of Page

dbghost



66 Posts

Posted - 11/20/2013 :  18:44:29  Show Profile  Visit dbghost's Homepage Send dbghost a Private Message  Reply with Quote
Ok and do these filegroups exist in the target already or are they new with this deployment?
Go to Top of Page

rpotter



5 Posts

Posted - 11/20/2013 :  18:50:36  Show Profile Send rpotter a Private Message  Reply with Quote
The target can be upgrading an existing database (with or without the filegroups present) or creating a new database using the packaged installer.

It doesn't actually make it to the target database for comparison yet in this case, as it throws the exception building the source database.
Go to Top of Page

dbghost



66 Posts

Posted - 11/20/2013 :  19:35:45  Show Profile  Visit dbghost's Homepage Send dbghost a Private Message  Reply with Quote
OK I think I'm nearly with you now. Packager Plus created the package OK but when you actually run the package it fails because the empty database it initially creates for population does not contain the file groups.
Was the package build from a set of scripts or was it build from an existing database? It might make a difference. I'll do a bit of testing to see what is wrong, it would be nice if the package automatically created the database with the file topology from the original build. I'm surprised it doesn't.

But if this is not working there may be ways to get round it depending on how much control or automation you have over the deployment.

(1) Have you wider deployment process run a an OSQL command that creates an empty database with the file groups you need. Then run the package in commandline mode with
/NoGUI /VesselDatabase:emptydb /server:yourserver /database:yourtarget /mode:upgrade
or
/NoGUI /VesselDatabase:emptydb /server:yourserver /mode:createnew

The package will simply populate the existing database (the empty vessel) you have prepared for it and then optionally upgarde the target.

(2) Or perhaps instead of using an osql command. use two packages. A stage one package that packages an empty database but uses a post build custom script to create the file groups. Then as above use that database as a VesselDatabase for the main package.

(3) Or perhaps the most straight forward; use Change Manager to create a build script from your source scripts and carefully edit the beginnig of the script to create the filegroups. Then use Packager Plus to create the package from the build script instead of from your source scripts. This way the package just runs the build script you gave it including the early statements that create the filegroups. If you choose this route I'll have to give you more detail on how to edit a build script for consumption by Packager Plus. Its easy but there is a trick to it.

I'll do some testing tomorrow and get back to you.
Go to Top of Page

dbghost



66 Posts

Posted - 11/21/2013 :  07:51:14  Show Profile  Visit dbghost's Homepage Send dbghost a Private Message  Reply with Quote
I'm sending you a large email explaining how to make it work now.
We will also be making this an automatic feature asap.
Go to Top of Page

Gary



12 Posts

Posted - 04/30/2014 :  21:36:29  Show Profile Send Gary a Private Message  Reply with Quote
quote:
Originally posted by dbghost
We will also be making this an automatic feature asap.


Could you please provide some public documentation for this feature? I've been experimenting with the /vesseldatabase switch, but being able to create a package from a build script would save me an awful lot of trouble.
Go to Top of Page

dbghost



66 Posts

Posted - 05/09/2014 :  11:24:44  Show Profile  Visit dbghost's Homepage Send dbghost a Private Message  Reply with Quote
These pre population scripts are now implemented. You will need to code these alter statements carefully.....

1/ use db_name() instead of hardcoding a name.
2/ check the file group does not already exist.
3/ Similarly with the extra files.

e.g.
DECLARE @dbName sysname SET @dbName = db_name()
DECLARE @alterStmt NVARCHAR(4000)
SET @alterStmt = 'IF NOT EXISTS(SELECT * FROM sys.filegroups WHERE NAME='SECONDGROUP') ALTER DATABASE [' + @dbName + '] ADD FILEGROUP [SECONDGROUP]'
EXEC (@alterStmt)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  New Poll New Poll
 Reply to Topic
 Printer Friendly
Jump To:
Database Change Management © Copyright 2005 Innovartis Ltd. Go To Top Of Page
Snitz Forums 2000
RSS Feed 1 RSS Feed 2
Powered by ForumCo 2000-2008
TOS - AUP - URA - Privacy Policy
ForumCo Free Blogs and Galleries
Signup for a free forum or Go Banner Free