
roundhouse - issue #13
Enhancement - During a restore, there should be a move to the default location if one has not been specified.
Also will probably add something to this effect to get the default location and move the items there by default (code from different project):
private string GetDefaultLocation(OleDbConnection conn)
{
string default_location = string.Empty;
try
{
string sql =
@" declare @SmoDefaultFile nvarchar
(512) exec master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultData', @SmoDefaultFile OUTPUT
SELECT @SmoDefaultFile";
OleDbCommand command = new OleDbCommand
(sql, conn); default_location = (string) command.ExecuteScalar(); } catch (Exception ex) { Log.LogError("Error getting default location from the database: " + ex.Message); }
return default_location;
}
Comment #1
Posted on Jan 19, 2010 by Happy PandaMight also want to take care of renaming the logical file as well to match the name of the database:
http://timothychenallen.blogspot.com/2007/02/sql-server-how-to-change-database- file.html
http://www.mssqltips.com/tip.asp?tip=1891&home
http://thedebugger.blogspot.com/2006/04/mssql-how-to-change-logical-file-name.html
Comment #2
Posted on Jul 1, 2011 by Happy PandaThere is actually an easier way to get to this information: https://github.com/chucknorris/roundhouse/issues/9
Comment #3
Posted on Jul 8, 2011 by Happy PandaFixed in revision 336
Comment #4
Posted on Jul 8, 2011 by Happy Panda(No comment was entered for this change.)
Comment #5
Posted on Jul 11, 2011 by Grumpy BirdIs it possible to just specify a path where I want the db and log files to get moved to? Like /moveToPath="e:\data".
Comment #6
Posted on Jul 11, 2011 by Happy PandaNotice the name of this enhancement was "if one has not been specified"? :D
https://github.com/chucknorris/roundhouse/wiki/ConfigurationOptions
The section on Restore has a restorecustomoptions
--rco, --restoreoptions, --restorecustomoptions=VALUE | RestoreCustomOptions - This provides the restoreany custom options as in MOVE='Somewhere or another'.
Comment #7
Posted on Jul 11, 2011 by Happy PandaYou have to fully comply with T-SQL though, not just a location. It becomes part of a T-SQL restore script.
http://msdn.microsoft.com/en-us/library/ms186858(v=sql.90).aspx
Comment #8
Posted on Jul 12, 2011 by Grumpy BirdHehe, I know about the custom option :) I'm already rolling my own restor script alongside Roundhouse so I was trying to get away from that, just specifying a path. Will this be possible to do with RH?
Comment #9
Posted on Jul 14, 2011 by Happy PandaThe new token replacer may be something that helps out with the names of the files.
{{DatabaseName}}
https://github.com/chucknorris/roundhouse/wiki/TokenReplacement
Comment #10
Posted on Jul 15, 2011 by Grumpy BirdBut since you're already moving db files to the default location, wouldn't it be easy to make it configurable?
Comment #11
Posted on Sep 28, 2011 by Happy Panda(No comment was entered for this change.)
Comment #12
Posted on Nov 27, 2011 by Happy Panda@goran, log a separate issue and we can prioritize it. Thanks.
Status: Fixed
Labels:
Type-Enhancement
Priority-Low
Milestone-Release0.8.5