次の方法で共有


Backing Up and Restoring https://Companyweb using the STSADM.exe command-line utility. KB829112

 

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.

clip_image002

 

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

  1. The STSADM.exe backup and restore method allows you to replace a site that has become corrupt, or that contains changes that need to be rolled back.
  2. You can then restore your site to either the same location or to a new location. (Do not confuse this with the migration of SharePoint sites. Smigrate is still the recommended tool for migration situations)
  3. The backup file for a top-level Web site includes any sub-sites of that site.
  4. This backup and restore method is not dependent on the type of database you are using.
      1. You can perform this backup and restore method even if you are running Microsoft SQL Server 2000 Desktop Engine (Windows) (WMSDE) instead of Microsoft SQL Server 2000 or SQL Server 2005.
  5. If you need to back up a specific site, rather than a whole installation of Windows SharePoint Services, you can do so by using the backup and restore operations with the Stsadm.exe command-line tool.
  6. You can automate the backup process by using a batch file, a script, or the Scheduled Tasks item on Microsoft Windows Control Panel.

 

Things to consider before starting/creating a backup job.

  1. STSADM backup and restore are not designed to be used when the server is under active load.
  2. The process of backing up and restoring sites takes up both memory and processing power on your server.
  3. If a site is in use when the backup operation is run, the data in that site may continue to change throughout the operation. The resulting backup file may be inconsistent with the actual state of the site and, if you restore this file, the restored site or database will be inconsistent as well.
  4. To avoid possible inconsistencies, lock the site collection prior to backing to starting the backup.
  5. After the backup is complete, set the lock back to "Not locked". For information about locking and unlocking a site collection, see the Managing Locks section of the Configuring Site Collection Quotas and Locks (Windows SharePoint Services 2.0) topic.
  6. The process of backing up and restoring sites takes up both memory and processing power on your server. In addition, if you have many sites, or a large amount of data in your sites, the backup process can take a long time, and might result in access errors for your users

 

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 https://companyweb -filename c:\backup\backup.dat -overwrite

clip_image004

 

5. Enter

clip_image006

6. Insure the backup has been created

clip_image008

 

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". https://www.microsoft.com/downloadS/details.aspx?familyid=3874527A-DE19-49BB-800F-352F3B6F2922&displaylang=en

 

Here's David's script:

Technorati Tags: Companyweb,sbs,backup,stsadm,stsadm.exe,restore,sharepoint,wss,windows sharepoint services

dim dayweek
dim strBackup
dayweek = datepart("w",(date))
strBackup = """C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN\stsadm""" + _
"-o backup -url https://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 https://companyweb

echo ===================================

cd \program files\common files\microsoft shared\web server extensions\60\bin

@echo off

stsadm.exe -o backup -url https://companyweb -filename c:\backup\backup.dat -overwrite

@echo off

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

clip_image010

5. Create a scheduled task to execute the backup script

6. Start\All Programs\Accessories\System Tools\Scheduled Tasks\Add Scheduled task

clip_image012

7. Next

8. Select Browse

clip_image014

9. Browse to \Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin\ CompanywebBackupScript.bat

clip_image016

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

clip_image018

15. Next – Finish

16. Test the Scheduled task

17. Rt-Click the newly created task – select run

clip_image020

18. Insure the backup was created – Review the backup folder

clip_image022

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 https://companyweb -filename c:\backup\backup.dat -overwrite

clip_image024

3. It should return that the "Operation completed successfully".

 

Thanks,

edwalt

Comments