| Author |
Message |
le001ya
Joined: 19 Dec 2006 Posts: 10
|
Posted: Wed Jan 07, 2009 12:57 am Post subject: Deploy database file and log file to different folders |
|
|
| 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 |
|
 |
Linda Hawksworth
Joined: 25 Jun 2007 Posts: 192
|
Posted: Fri Jan 09, 2009 12:53 pm Post subject: |
|
|
| 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 |
|
 |
le001ya
Joined: 19 Dec 2006 Posts: 10
|
Posted: Fri Jan 09, 2009 4:25 pm Post subject: |
|
|
| 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 |
|
 |
le001ya
Joined: 19 Dec 2006 Posts: 10
|
Posted: Thu Jan 15, 2009 1:23 am Post subject: Work Around - Change the "PackageMain.cs" file |
|
|
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 |
|
 |
|
|
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