Red Gate forums :: View topic - Deploy database file and log file to different folders
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Packager 6
SQL Packager 6 forum

Deploy database file and log file to different folders

Search in SQL Packager 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
le001ya



Joined: 19 Dec 2006
Posts: 10

PostPosted: Wed Jan 07, 2009 12:57 am    Post subject: Deploy database file and log file to different folders Reply with quote

Is there an option to create the database file and the database log file in separated locations when run the SQL Packager executable from the command line? What would be the work around if an option is not available?
Back to top
View user's profile Send private message
Linda Hawksworth



Joined: 25 Jun 2007
Posts: 192

PostPosted: Fri Jan 09, 2009 12:53 pm    Post subject: Reply with quote

If you are creating a .EXE package, when you run through the SQL Packager wizard to create the executable, you get to the last pane and then click on "Extra Package Info..." button. Select the "Database Properties" tab and you then have the option to specify the Database folder and Log folder amongst other things.
Back to top
View user's profile Send private message
le001ya



Joined: 19 Dec 2006
Posts: 10

PostPosted: Fri Jan 09, 2009 4:25 pm    Post subject: Reply with quote

The SQL Package Executable is run from the command line in silent mode (with the /quiet option). How can I specify the database folder and log folder without going through the wizard? Check the SQL Package 6.0 help file in the section titled "Running the package" using the command line for details.
Back to top
View user's profile Send private message
le001ya



Joined: 19 Dec 2006
Posts: 10

PostPosted: Thu Jan 15, 2009 1:23 am    Post subject: Work Around - Change the "PackageMain.cs" file Reply with quote

private static void ParseCommandLine(string[] args, PackageExecutor packageExecutor)
{
string var;
packageExecutor.Retry = false ;
for (int nIndex = 0; nIndex < args.Length; nIndex++)
{
string arg = args[nIndex];

var = "/server:";
if(arg.ToLower().StartsWith(var))
{
packageExecutor.ServerName = arg.Substring(var.Length).Trim();
if (packageExecutor.ServerName.Length == 0 && ((nIndex+1) < args.Length) )
{
packageExecutor.ServerName = args[++nIndex];
}
continue;
}
var = "/database:";
if(arg.ToLower().StartsWith(var))
{
packageExecutor.DatabaseName = arg.Substring(var.Length).Trim();
if (packageExecutor.DatabaseName.Length == 0 && ((nIndex+1) < args.Length) )
{
packageExecutor.DatabaseName = args[++nIndex];
}
continue;
}
var = "/username:";
if(arg.ToLower().StartsWith(var))
{
packageExecutor.UserName = arg.Substring(var.Length).Trim();
packageExecutor.IntegratedSecurity = false;
continue;
}
var = "/password:";
if(arg.ToLower().StartsWith(var))
{
packageExecutor.Password = arg.Substring(var.Length);
packageExecutor.IntegratedSecurity = false;
continue;
}
var = "/quiet";
if(arg.ToLower().StartsWith(var))
{
packageExecutor.Quiet = true;
continue;
}
var = "/makedatabase";
if(arg.ToLower().StartsWith(var))
{
packageExecutor.MakeDatabase = true;
continue;
}
//begin custom code
var = "/databaselocation:";
if (arg.ToLower().StartsWith(var))
{
packageExecutor.DatabaseProperties.DatabaseLocation = arg.Substring(var.Length).Trim();
if (packageExecutor.DatabaseProperties.DatabaseLocation.Length == 0 && ((nIndex + 1) < args.Length))
{
packageExecutor.DatabaseProperties.DatabaseLocation = args[++nIndex];
}
continue;
}
var = "/loglocation:";
if (arg.ToLower().StartsWith(var))
{
packageExecutor.DatabaseProperties.LogLocation = arg.Substring(var.Length).Trim();
if (packageExecutor.DatabaseProperties.LogLocation.Length == 0 && ((nIndex + 1) < args.Length))
{
packageExecutor.DatabaseProperties.LogLocation = args[++nIndex];
}
continue;
}
//end custom code
var = "/presql:";
if(arg.ToLower().StartsWith(var))
{
packageExecutor.PreSqlFile = arg.Substring(var.Length);
continue;
}
var = "/postsql:";
if(arg.ToLower().StartsWith(var))
{
packageExecutor.PostSqlFile = arg.Substring(var.Length);
continue;
}
}
if (packageExecutor.DatabaseName.Length == 0)
{
throw new ApplicationException("Database name cannot be empty.");
}
if (packageExecutor.ServerName.Length == 0)
{
throw new ApplicationException("SQL Server name cannot be empty.");
}
}
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group