Deploy database file and log file to different folders

Packages and compresses schema and contents of SQL Server databases

Moderators: JonathanWatts, Chris Auckland, David Atkinson, david connell, Anu Deshpande, Michelle Taylor, james.billings, Marianne

Deploy database file and log file to different folders

Postby le001ya » Wed Jan 07, 2009 12:57 am

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?
le001ya
 
Posts: 10
Joined: Tue Dec 19, 2006 11:11 pm

Postby Linda Hawksworth » Fri Jan 09, 2009 12:53 pm

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.
Linda Hawksworth
 
Posts: 192
Joined: Mon Jun 25, 2007 11:32 am

Postby le001ya » Fri Jan 09, 2009 4:25 pm

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.
le001ya
 
Posts: 10
Joined: Tue Dec 19, 2006 11:11 pm

Work Around - Change the "PackageMain.cs" file

Postby le001ya » Thu Jan 15, 2009 1:23 am

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.");
}
}
le001ya
 
Posts: 10
Joined: Tue Dec 19, 2006 11:11 pm


Return to SQL Packager 6

Who is online

Users browsing this forum: No registered users and 0 guests