Powered by Syntax Highlighter scripts!

Backup and Restore Site Collections in MOSS 2007

The stsadm command can be very helpful in getting the backup of a site and restoring it back to the same server or to another server. It can be used to take 2 types of Backups.
The regular backups which are termed as "Site Collection Backup/Restore" and the second type called "Catastrophic Backup/Restore" for backup or restore across MOSS installations.

Syntax for BACKUP
For site collection backup:

stsadm.exe -o backup
-url
-filename
[-overwrite]

For catastrophic backup:
stsadm.exe -o backup
-directory
-backupmethod
[-item ]
[-percentage ]
[-backupthreads ]
[-showtree]
[-quiet]

Syntax for RESTORE
For site collection restore:
stsadm.exe -o restore
-url
-filename
[-hostheaderwebapplicationurl ]
[-overwrite]
For catastrophic restore:
stsadm.exe -o restore
-directory
-restoremethod
[-backupid ]
[-item ]
[-percentage ]
[-showtree]
[-suppressprompt]
[-username ]
[-password ]
[-newdatabaseserver ]
[-quiet]

Following stsadm commands should be executed from the path"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>"
Taking the version backup of a site collection:
stsadm.exe -o backup -url "http://localhost:5815/" -filename "D:\Sharepoint Backups\Naga5815_5Feb2008\backup.dat" -backupmethod full
In this case the url of the site collection is given.

Restoring the version backup of a site collection:
The web application should be present and running for restoring the site collection.
stsadm.exe -o restore -url "http://localhost:5815/" -filename "D:\Sharepoint Backups\Naga5815_5Feb2008\backup.dat" -restoremethod overwrite

Taking Catastrophic Backup of a site collection
stsadm.exe -o backup -directory "D:\Sharepoint Backups\Naga5815_5Feb2008" -backupmethod full -item "Farm\Windows SharePoint Services Web Application\Naga - 5815"

Restoring the Catastrophic Restore of a site collection
stsadm.exe -o restore -directory "D:\Sharepoint Backups\Naga5815_5Feb2008" -restoremethod overwrite -item "Farm\Windows SharePoint Services Web Application\Naga - 5815"