Before you begin, log onto the server that running SQL Server and check that ‘SQL Server VSS Writer‘ service is started and the startup type is set to ‘Automatic‘ as this is a requirement. Also, you will need to create a shared directory for the backup and set the required share permissions. In this example I’ve created BACKUPDIR on server BACKUPSVR.

Let’s use the ‘Stsadm‘ tool. To use the tool go to the executable directory:

cd %COMMONPROGRAMFILES%\Microsoft shared\Web server extensions\12\Bin

For a full server backup enter:

stsadm -o  backup -directory \\BACKUPSVR\BACKUPDIR -backupmethod full

And hopefully this should be your output:

Completed with 0 warnings.
Completed with 0 errors.
Backup completed successfully.
---------------------------------------------------------
Operation completed successfully.

If this is the case, then congratulations you have completed the backup procedure but if not then your going to need to do some problem solving.

Resolving Backup Issues

In the directory where you sent your SharePoint backup files, there will be a spbackup.log file. This is where you will find all the errors that occurred during the backup process.
Here is a sample output of a failed backup:

Completed with 0 warnings.
Completed with 4 errors.
Error: Backup failed for Object SharePoint_AdminContent_XxXxXxXx-XxX
xX-XxX failed in event OnBackup. For more information, see the error
log located in the backup directory.
-------------------------------------------------
The backup job failed. For more information, see the error log
that is located in the backup directory.

Below is an exert from the spbackup.log file.

[10/15/2009 10:29:16 AM]: Verbose: Starting object: SharePoint_AdminContent_XxXxXxXx-XxX.
[10/15/2009 10:29:16 AM]: Verbose: Saving SPPersistedObject State
[10/15/2009 10:29:16 AM]: Verbose: Starting OnBackup event.
[15/10/2009 10:29:16]: Verbose: Starting object: Farm.
[15/10/2009 10:29:16]: Progress: [Farm] 50 percent complete.
[15/10/2009 10:29:16]: Verbose: Starting object: SharePoint_Config.
[15/10/2009 10:29:16]: Verbose: [SharePoint_Config] SQL Server Connection String: Data Source=BACKUPSVR;Initial Catalog=SharePoint_Config;Integrated Security=True;Enlist=False.
[15/10/2009 10:29:16]: Verbose: [SharePoint_Config] SQL command started at: 15/10/2009 10:29:16. This command may take a while to complete and without notification.
[15/10/2009 10:29:16]: Verbose: [SharePoint_Config] SQL Server Command: BACKUP DATABASE [SharePoint_Config] TO DISK=@db_loc WITH NAME=@db_name, STATS=5, NOINIT, NOSKIP, NOFORMAT, NOREWIND
	@db_name=SharePoint_Config, @db_loc=\\BACKUPSVR\BACKUPDIR\spbr0000\0000000A.bak
[15/10/2009 10:29:16]: Verbose: [SharePoint_Config] SQL command timeout is set to 1.00 hours.
[15/10/2009 10:29:16]: Error: Object SharePoint_Config failed in event OnBackup. For more information, see the error log located in the backup directory.
	SqlException: Cannot open backup device '\\BACKUPSVR\BACKUPDIR\spbr0000\0000000A.bak'. Operating system error 3(error not found).
BACKUP DATABASE is terminating abnormally.

As you can see from line 12 the backup cannot access the backup share which it has been pointed too. In this case you should check the share is accessible and that the required permissions have been set. That resolved the issue in this scenario.

Automate the Backup

To make this an automated process, first you will have to create a script like the one below:.

@echo off
echo d0tk0m O_o
echo.
cd %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\12\BIN
stsadm.exe -o backup -directory "\\BACKUP-SVR\BACKUPDIR" -backupmethod full
echo completed

Now you will need to add the Script to ‘Task Scheduler’ and set the required times and dates of execution, just make sure that you run the script under the correct credentials otherwise it will FAIL :roll: