Command Line Interface - Backup - SQL Server iDataAgent
To run command line operations, you must first login to the CommServe.
From Command prompt, navigate to <Software_Installation_Directory>/Base and run the following command:
qlogin -cs <commserve name> -u <user name>
For example, to log on to CommServe 'server1' with username 'user1':
qlogin -cs server1 -u user1
- Download the backup_template.xml file and save it on the computer from where the command will be executed.
- Execute the following command from the <Software_Installation_Directory>/Base folder after substituting the parameter values.
qoperation execute -af backup_template.xml -subclientName xxxxx -clientName xxxxx -instanceName xxxxx
- Verify the status of the job using the following command:
qlist job −j jobID
- Once the job completes, log off from the CommServe using the qlogout command.
qlogout [−cs <commserve_host_name>] [−all] [−tf <tokenfile>] [−tk <token>] [−h]
|Performing a Full Backup||
qoperation execute -af backup_template.xml -backupLevel FULL -subclientName subclient1 -clientName client1 -instanceName client1/instance1
|Performing a Transaction Log Backup||
qoperation execute -af backup_template.xml -backupLevel INCREMENTAL -subclientName subclient1 -clientName client1 -instanceName client1/instance1
|Performing a Differential Backup||
qoperation execute –af backup_template.xml –backupLevel DIFFERENTIAL -subclientName subclient1 -clientName client1 -instanceName client1/instance1
|Performing an On-Demand Backup||
qoperation execute -af backup_template.xml -backupLevel FULL -subclientName subclient1 -clientName client1 -instanceName client1/instance1 -ondemandinputfile C:\test\myDBsContent.txt
where myDBsContent.txt is an input file that list the databases as follows:
To run on-demand backups for File/File Groups, the input file should list the database name, file group name and file name as follows:
In addition to the parameter values provided in the template xml file, if you want to include additional options for the backup, you can do so by selecting the required options from the CommCell Console and generate the command line xml script for the backup.
Follow the steps given below to generate a script which you can use to perform a backup from the command line interface:
- From the CommCell Browser, navigate to Client Computers | <Client> | SQL Server | <Instance>.
- Right click an <Subclient> and click Backup.
- Select the required backup options which you want to execute using the script.
- Click Save as Script.
- Enter the location to save the script along with the file name and extension. For example, "C:\scripts\myscript.bat" on Windows and "/usr/scripts/myscript.sh" on Unix. Alternatively, you can also click Browse and navigate to the location.
The script will be saved as a .xml file and .bat/.sh file.
If a file with the same name already exists in the specified location, both the .xml and .bat/.sh files will be overwritten.
- Enter the username and password for the user account which you want to use to perform the backup.
By default, the user account which you have used to login to CommCell console is used for performing the backup. However, if the user account does not have access to any application or database, click Use a different account.
- Click OK.
Once you have completed the command line operations, you can logout from the CommServe using the following command:
qlogout -cs commserve
For example, to log out from the CommServe 'Server1'.
qlogout -cs Server1