edwalt's - Things I Wish I'd known about SBS 2003....
How do I backup Companyweb if I do not have a full version of SQL installed?
When dealing with Companyweb database issues, this is a very common question. Unfortunately the conversation usually takes place after replacement SharePoint databases cannot be accessed or the data found in these databases is missing or corrupt. Often the only type of “backup” a customer may have are copies of the Companyweb databases that have been saved either through NTBackup or some other backup application. In cases that deal with corrupt databases, having copies of these databases is better than nothing, however backing up SharePoint databases should not be considered a “Best Practice” when considering a backup solution for Companyweb data.
What is STSADM.exe
The STSADM.exe tool is specifically designed to backup and restore SharePoint websites and their sub-sites among other things. This tool provides a method for performing SharePoint administration tasks at the command line or by using batch files or scripts. This command-line tool allows you to perform the same tasks found in the Central Administration website, along with other operations and certain parameters that are only available by using the Stsadm command-line tool (these options will not be covered in this particular blog).
Before we Proceed:
If you are using a full version of SQL Server 2000 or SQL Server 2005, using the stsadm.exe utility as the primary backup and restore solution for Windows SharePoint Services is not recommended. Instead, it is recommended that you use the backup tools included with SQL Server for your SharePoint backups.
STSADM.exe – using the Backup and Restore function:
1. The STSADM.exe utility, gives the Administrator the ability to back up and restore individual Web sites hosted on Small Business Server 2003.
2. The tool is used/executed through the command-line and can be found in the \Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin (%COMMONPROGRAMFILES%\microsoft shared\web server extensions\60\bin).
3. You must be a member of the server computer's administrators group or a member of the SharePoint administrators group to be able to back up or restore a site.
What does STSADM.exe backup?
1. The content database for the site.
2. All pages in the site.
3. Files in document libraries or lists.
4. Security and permission settings.
5. Feature settings.
Benefits of STSADM.exe
Things to consider before starting/creating a backup job.
Creating a “Manual” backup using STSadm.exe:
1. Create the folder or share where you would like to store the Sharepoint Backups
2. Start\Run\Cmd.exe
3. From a command prompt navigate to the \Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin (%COMMONPROGRAMFILES%\microsoft shared\web server extensions\60\bin folder
4. Enter the command stsadm.exe -o backup -url http://companyweb -filename c:\backup\backup.dat -overwrite
5. Enter
6. Insure the backup has been created
Creating a “Scheduled” backup using STSadm.exe with a .vbs script - KB829112:
Here is the .vbs script found in KB829112. The script was written by David Copeland, who also wrote the "Small Business Server Best Practices Analyzer". If your not using this already, "Shame on You" :). This utility can cut down on hours of Troubleshooting, and should be in every Small Business Server consultants "toolbox". http://www.microsoft.com/downloadS/details.aspx?familyid=3874527A-DE19-49BB-800F-352F3B6F2922&displaylang=en
Here's David's script:
dim dayweekdim strBackup dayweek = datepart("w",(date)) strBackup = """C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN\stsadm""" + _"-o backup -url http://companyweb -filename x:\backups\companyweb" + cstr(dayweek) + ".dat -overwrite" Set WshShell = WScript.CreateObject("WScript.Shell") Return = WshShell.Run(strBackup, 0, true) Set WshShell = Nothing
Creating a “Scheduled” backup using a batch file:
1. Create a new .txt file in the \Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin path
2. Copy the script below into the .txt file - DOS Script
If you are not as familiar with .vbs scripting as you would like to be, here is a DOS script that will help you create the backup as well.
@echo off
echo ===================================
echo Backup Script For Http://companyweb
cd \program files\common files\microsoft shared\web server extensions\60\bin
stsadm.exe -o backup -url http://companyweb -filename c:\backup\backup.dat -overwrite
echo completed
3. If using the DOS script, save the .txt file as CompanywebBackupScript.bat. If using David's script please save it with a .vbs extension.
4. Verify the CompanywebBackupScript.bat file is in the \Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin folder
5. Create a scheduled task to execute the backup script
6. Start\All Programs\Accessories\System Tools\Scheduled Tasks\Add Scheduled task
7. Next
8. Select Browse
9. Browse to \Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin\ CompanywebBackupScript.bat
10. Select Open
11. Type a name for the task.
12. Select the frequency you would like the task to run - Next
13. Select Start time and Start date – Next
14. Enter in an account that the process can run under – preferably an administrator account if possible
15. Next – Finish
16. Test the Scheduled task
17. Rt-Click the newly created task – select run
18. Insure the backup was created – Review the backup folder
19. Insure the Backup.dat file is created successfully at the next scheduled execution time.
How do I restore an STSADM.exe backup
1. Move the \Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin folder
2. Enter the following command: stsadm.exe -o backup -url http://companyweb -filename c:\backup\backup.dat -overwrite
3. It should return that the "Operation completed successfully".
Thanks,
edwalt
Very useful, going to add this script to my customers servers who are actively using WSS.
Thanks for sharing
PingBack from http://ben.hamilton.id.au/microsoft/when-sharepoint-barfs