Scenario:
While trying to back up my site collection using stsadm command
stsadm -o backup -url http://localhost -filename "newbackup.bak" -overwrite
I got the following error.
Error : This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products and Technologies Configuration Wizard, located on the Start menu in Administrative Tools.
Solution:
This is indirectly saying that you have been Access Denied to the farm.
1. Make sure that you are running this command from one of the machine which is part of the sharepoint farm
2. You should be a Farm Administrator
3. Sometime step 2 is not enough and you might again get Access Denied on the Content Database. You need to be site collection administrator.
4. If still you are facing issue, make sure to add your self to the appropriate content database.
Showing posts with label Backup. Show all posts
Showing posts with label Backup. Show all posts
Wednesday, October 7, 2009
Tuesday, November 4, 2008
Scenario:
You want to backup site collection.
Solution:
You can use Powershell script as an option
Code:
###########################################################Article:
# Script to add function to properly backup site collections
#
# SYNTAX:
# Backup-SPSite
# -url <Site Collection URL>
# -path <path to backup file>
# -lock <"noadditions", "noaccess", "readonly"> #state for backup
# -AdditionalCommands [additional commands for Backup]
# Restore-SPSite
# -url <site collection restore url>
# -path <path to backup file>
# -force
#
# EXAMPLE:
# backup-spsite -url "http://localhost" -path "C:\zbackuptest.bak" -AdditionalCommands "-overwrite"
###########################################################
function global:Backup-SPSite($url,$path,$lock="noaccess",$additionalcommands){
$stsadm = "$env:programfiles\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE"
#Check Required Vars
If($url -eq "" -or $url -eq $null ){ Write-Host -ForegroundColor "Red" "URL is required"; return; }
If(!($lock -like "none" -or $lock -like "noadditions" -or $lock -like "noaccess" -or $lock -like "readonly" )){ Write-Host -ForegroundColor "Red" "Lock must be 'none', 'readonly', 'noaccess', or 'noadditions'"; return; }
#Setup Variable Defaults
#LOCK SITE
Write-Progress -Activity "Backup SPSite" -PercentComplete 25 -Status "Locking Site"
$oldlockstate = [xml](&stsadm -o getsitelock -url $url)
$void = &stsadm -o setsitelock -url $url -lock $lock
#BACKUP
Write-Progress -Activity "Backup SPSite" -PercentComplete 50 -Status "Backing up Site ($url)"
$sTemp = &stsadm -o Backup -url $url -filename $path $AdditionalCommands
if(!($sTemp -like "*Operation completed successfully*")){ Write-Host -ForegroundColor "red" -BackgroundColor "white" "Backup of site '$url' Failed! `n $stemp"}
#RESET LOCK STATE
Write-Progress -Activity "Backup SPSite" -PercentComplete 75 -Status "Resetting Site Lock"
$void = &stsadm -o setsitelock -url $url -lock ($oldlockstate.SiteLock.Lock.ToString())
Write-Progress -Activity "Backup SPSite" -PercentComplete 100 -Status "Complete"
}
Tags:
Backup,
Powershell
Subscribe to:
Posts (Atom)