SQL Backup 5   

Toolkit Parameters

See Also

To run SQL Backup from the command line, you use a command of the format:

>SQLBackupC parameters

To run SQL Backup using the extended stored procedure, you use a command of the format:

master..sqlbackup 'parameters'

The parameters you can use are described in this topic.

Connection parameters

-U SQL_Server_user_name

The SQL Server user name to use to log in if you are using SQL Server authentication. For example:

-U sa

-P SQL_Server_password

The password to use to log in if you are using SQL Server authentication (command line only). For example:

-P MyPassword

-I

The name of the SQL Server instance to which you want to log on. If no value is entered, the default instance is used. For example:

-I ServerInstance2

To explicitly specify the default, use:

-I (local)

Process parameters

-SQL "Transact-SQL_statement"

The Transact-SQL statement for the backup or restore operation. For example:

-SQL "BACKUP DATABASE pubs TO DISK ='C:\Backups\pubs.sqb'"

For details of the standard commands you can use, and the extensions to the standard Transact-SQL syntax, see the topics in the SQL Syntax section of the Help:

Some examples are provided in Toolkit Syntax Examples.

-USE template_name

Indicates that you want to load the configuration values from the specified template. You save the template using the graphical user interface Back Up wizard. For example, you may have saved a template called Daily Full Backup:

-USE "Daily Full Backup"

This might be equivalent to using the -SQL parameter as follows:

-SQL "BACKUP DATABASE pubs TO DISK ='<AUTO>'"

Examples

The following command backs up the pubs database on the SQL Server's default instance using Windows authentication:

>SQLBackupC -SQL "BACKUP DATABASE pubs TO DISK ='C:\Backups\pubs.sqb' WITH PASSWORD = 'MyPassword'"

To log on to a named instance using SQL Server authentication, you would use the following:

>SQLBackupC -SQL "BACKUP DATABASE pubs TO DISK ='C:\Backups\pubs.sqb' WITH PASSWORD = 'MyPassword'" -I ServerInstance2 -U sa -P MyPassword

 

 

 


© Red Gate Software Ltd 2007. All Rights Reserved.