14.2. Backup with STSADM

The same tool as you have seen described several times in this book when discussing site templates and Web Parts can also be used for backup and restore procedures. It is a fast and "full-fidelity" procedure; that is, it will exactly restore the sites you backed up, including security settings and personal site views. This tool has some limitations and behaviors you must be aware of, such as:

  • It can back up and restore a complete farm, a single site collection, or a single site.

  • The result will be stored as a file. STSADM cannot write to other backup media.

  • It must be executed on the SharePoint server.

  • You must be a SharePoint server administrator to run STSADM.

  • This is a command-line tool. There is no graphical user interface included for this tool.

    NOTE

    There is a free graphical interface for STSADM 2007; see the section "Tools for STSADM" later in this chapter.

This is the premier tool for all backup scenarios in SharePoint 2007, for both WSS 3.0 and MOSS 2007 installations. You should invest some time learning how to use this tool and make sure that you understand how to both back up and restore data. Since it has more than 170 operations (or commands), it is almost impossible to remember all the arguments each operation requires, but the tool referred to above will make it much easier.

14.2.1. Preparing for STSADM

STSADM.EXE is stored away deep down in the file system, or to be exact in this folder:

C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN

As described in Chapter 2, you should add the file path to this folder to the system path variable to avoid having to type the long path above every time you need to run STSADM. This is how to add the path to STSADM to the PATH system variable:

Try It Out: Update the PATH System Variable

  1. Start Windows Explorer, and navigate to the path for the STSADM as given above. Right-click on the file path in the Address field, and select Copy.

  2. Click Start to see the Windows Start menu.

  3. Right-click on My Computer, and select Properties.

  4. Switch to the Advanced tab, and click on the Environment Variables button.

  5. In the lower pane named System Variables, locate PATH and click Edit.

  6. Go to the end of the current list in Variable value (use the END key or the right arrow on the keyboard). Type in a semicolon (;) as a separator, and paste the path you copied in step 1 above. Then click OK three times to save this modification and close all dialog boxes.

Test it by opening a command window (Start Run and type Cmd); type STSADM in this command window. If you get a long list of options, then you did it right. If not, repeat these steps and make sure to do it exactly as described.


14.2.2. Running the STSADM Backup

Remember that this tool can back up complete farms, single site collections, or single sites. Let us start with an example of how to back up the site collection for the IT department with the following URL to the top-level site: http://srv1/sites/it. You then follow the steps in the Try It Out.

Try It Out: Back Up Site Collections with STSADM

  1. Log on to the SharePoint server as the administrator.

  2. Locate a file folder where the backup file generated by STSADM will be stored; in this example, you use C:Bkup. Note that in a real-world scenario you would more likely save the backup files to another computer instead of the local disk, as in this example!

  3. Open a command window and run the following command; remember that the URL points to the top site of the IT site collection:

    Stsadm -o Backup -url http://srv1/sites/it -filename c:kupwss-back.bak

  4. When the backup is completed, you will find the file wss-back.bak in the folder C:kup.


14.2.3. Tools for STSADM

There is a great add-on for STSADM 2007 that gives a graphical user interface on top of STSADM, which will make it much easier to use it, especially for an inexperienced SharePoint administrator. The name of this tool is Stsadmwin.exe, and it is free. You can download a copy from this URL: http://blogs.msdn.com/ronalus/archive/2007/01/04/stsadmwin-has-an-2007-version.aspx. (Note that the download link is located at the end of the article.) Using the graphical Stsadmwin 2007 tool for doing the same type of backup as described above will look like the following figure. Just select the Backup operation and the list of command switches shows "URL," "Filename," and "Overwrite;" enter the values for the command switches, and click either Submit to execute this command or Compose to see the complete command string, as depicted in Figure 14-1.

Figure 14-1. Figure 14-1

This tool is also an excellent way of learning all the commands of STSADM; just select an Operation, and you will see its command switches. Play with this tool, and you will be surprised how much STSADM can do for you. In fact, all you can do with the SharePoint Administrative Tool can be done with STSADM; it even has some commands not available in SharePoint Central Administration, such as Backup and Restore, plus Export and Import! If you have been working with STSADM in SharePoint 2003, you will find that it now contains no less than 173 commands, as listed in the following table.

Command
activatefeature
activateformtemplate
addalternatedomain
addcontentdb
adddataconnectionfile
add-ecsfiletrustedlocation
add-ecssafedataprovider
?add-ecstrusteddataconnectionlibrary
add-ecsuserdefinedfunction
addexemptuseragent
addpath
addpermissionpolicy
addsolution
addtemplate
adduser
addwppack
addzoneurl
?allowuserformwebserviceproxy
allowwebserviceproxy
associatewebapp
authentication
backup
backuphistory
binddrservice
blockedfilelist
canceldeployment
changepermissionpolicy
copyappbincontent
createadminvs
createcmsmigrationprofile
creategroup
createsite
createsiteinnewdb
createssp
createweb
databaserepair
deactivatefeature
deactivateformtemplate
deleteadminvs
deletealternatedomain
deletecmsmigrationprofile
deleteconfigdb
deletecontentdb
deletegroup
deletepath
deletepermissionpolicy
deletesite
deletesolution
deletessp
deletessptimerjob
deletetemplate
deleteuser
deleteweb
deletewppack
deletezoneurl
deploywppack
deploysolution
disablessc
displaysolution
editcmsmigrationprofile
editcontentdeploymentpath
editssp
email
enablecmsurlredirect
enablessc
enumalternatedomains
enumcontentdbs
?enumdataconnectionfiledependants
enumdataconnectionfiles
enumdeployments
enumexemptuseragents
enumformtemplates
enumgroups
enumroles
enumservices
enumsites
enumsolutions
enumssp
enumssptimerjobs
enumsubwebs
enumtemplates
enumusers
enumwppacks
enumzoneurls
execadmsvcjobs
export
extendvs
extendvsinwebfarm
forcedeletelist
formtemplatequiescestatus
getadminport
?getdataconnectionfileproperty
getformsserviceproperty
getformtemplateproperty
getproperty
getsitedirectoryscanschedule
getsitelock
geturlzone
import
installfeature
listlogginglevels
?listregisteredsecuritytrimmers
localupgradestatus
managepermissionpolicylevel
migrateuser
osearch
osearchdiacriticsensitive
preparetomove
profilechangelog
profiledeletehandler
provisionservices
quiescefarm
quiescefarmstatus
quiesceformtemplate
reconvertallformtemplates
refreshdms
refreshsitedms
registersecuritytrimmer
registerwsswriter
removedataconnectionfile
removedrservice
?remove-ecsfiletrustedlocation
remove-ecssafedataprovider
?remove-ecstrusteddataconnectionlibrary
?remove-ecsuserdefinedfunction
removeexemptuseragent
removeformtemplate
removesolutiondeploymentlock
renameserver
renameweb
restore
restoressp
retractsolution
retractwppack
runcmsmigrationprofile
runcontentdeploymentjob
scanforfeatures
setadminport
setapppassword
?setbulkworkflowtaskprocessingschedule
setconfigdb
?setcontentdeploymentjobschedule
?setdataconnectionfileproperty
setdefaultssp
set-ecsexternaldata
set-ecsloadbalancing
set-ecsmemoryutilization
set-ecssecurity
set-ecssessionmanagement
set-ecsworkbookcache
setformsserviceproperty
setformtemplateproperty
setholdschedule
setlogginglevel
setpolicyschedule
setproperty
setrecordsrepositoryschedule
setsearchandprocessschedule
setsharedwebserviceauthn
setsitedirectoryscanschedule
setsitelock
setsspport
setworkflowconfig
siteowner
spsearch
spsearchdiacriticsensitive
sync
syncsolution
unextendvs
uninstallfeature
unquiescefarm
unquiesceformtemplate
unregistersecuritytrimmer
unregisterwsswriter
updateaccountpassword
updatealerttemplates
updatefarmcredentials
upgrade
upgradeformtemplate
upgradesolution
upgradetargetwebapplication
uploadformtemplate
userrole
verifyformtemplate

As you can see, STSADM is a very powerful tool that can assist you in most types of administrative tasks, not just backup and restore scenarios. To learn more about this tool, you can search www.microsoft.com for "stsadm 2007;" two good articles to start with are listed below:

And it does not stop here — you can actually create custom commands for STSADM 2007, since it is extensible! For example, you can add a custom command that enumerates all tasks in a Task list, or a command that lists all checked out documents in a document library. You must use Visual Studio .NET for developing these custom commands.

NOTE

A good article about creating custom commands is this: www.johnholliday.net/archive/2006/11/04/Extending-STSADM-with-Custom-Commands.aspx.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.134.107