Microsoft SQL

Listing Microsoft SQL Server instances

  • Listing Microsoft SQL Server instances on the local machine.

    acrocmd list mssql_instances
  • Listing instances of Microsoft SQL Server 2005 that are located on a remote machine and whose names contain the fragment "WEB".

    acrocmd list mssql_instances --host=192.168.1.2 --credentials=user1,pass1 --filter_edition=2005 --filter_name=WEB

Listing Microsoft SQL databases

  • Listing databases of a Microsoft SQL Server instance located on a remote machine. Since the --credentials parameter is not specified after the --instance parameter, the software will use Windows Authentication (the credentials specified after the --host parameter) to connect to the specified instance.

    acrocmd list mssql_databases --host=192.168.1.2 --credentials=user1,pass1 --instance=WEBSERVER
  • Listing only those databases of the "NEWSERVER" instance whose names contain the fragment "account". Since the --credentials parameter is specified after the --instance parameter, the software will use SQL Server Authentication to connect to the instance.

    acrocmd list mssql_databases --instance=NEWSERVER --credentials="SQL user",pass --filter_name=account

Backing up Microsoft SQL databases

  • Backing up two Microsoft SQL databases to a network folder.

    acrocmd backup mssql_database --host=srv2 --credentials="srv1/AMS User",pass1 --sql_credentials="INSTANCE\Administrator",sqlpass --loc=\\srv1\backups --arc=sql1 --instance_name=instance1 --database_name=db1,db2 --backuptype=full --truncate_mssql_log

Recovering Microsoft SQL databases

  • Recovering a database from the latest backup of an archive. Since the --target parameter is not specified, the database will be recovered to the original instance. The user who runs the command must be a member of the sysadmin role on this instance. If a database with the same name exists in this instance, it will be overwritten. The database will be recovered in the norecovery state so that you can recover additional transaction logs from the native Microsoft SQL backups.

    acrocmd recover mssql_database --loc=\\srv1\backups --credentials=netuser1,pass1 --arc=machine1_app --items=WEBSERVER/Accountants --overwrite --database_state=norecovery
  • Extracting all databases of an instance from the specified backup. The database files along with the transaction log files will be saved to a network folder.

    acrocmd recover mssql_database --loc=\\srv1\backups --credentials=netuser1,pass1 --arc=machine1_app --backup=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX --items=NEWSERVER --target=disk --disk_location=\\host\share --credentials=netuser,pass
  • Recovering two databases from the specified backup. The databases will be recovered to another instance. If a database with the same name exists in the that instance, the recovered database will be renamed. Since the --database_state parameter is not specified, the databases will be recovered in the recovery state and will be ready for use.

    acrocmd recover mssql_database --loc=\\bkpsrv\backups --credentials=netuser,pass --arc=my_archive_app --backup=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX --items=WEBSERVER/Accountants,NEWSERVER/Anna --target=another_instance --destination_instance=SUPERVISION --credentials="SQL user",pass2 --database_location=D:\databases --autorename

    If the user who runs the command is a member of the sysadmin role on the destination instance, the --credentials parameter is not needed after the --destination_instance parameter. Otherwise, you need to specify the sysadmin credentials.