Link to home
Start Free TrialLog in
Avatar of wannabecraig
wannabecraigFlag for Ireland

asked on

Sharepoint Automated Backup Restore Process Verification

Hi All,

I automated the following powershell backup in a scheduled task we are running Sharepoint foundation 2010.

https://gallery.technet.microsoft.com/scriptcenter/9b99c435-8831-4c9e-a70b-1f13158ef22a - Here is the script.

https://mycentraladmin.wordpress.com/2011/07/14/how-to-set-up-a-scheduled-task-to-backup-your-sharepoint-farm/ - This is how i setup the scheduled task to run this.

In the backupdir location I am getting a folder with 10 or 20 bak files.

This is the last lines of the SPBACKUP.LOG


[25/03/2015 16:10:01] Finished with 0 warnings.
[25/03/2015 16:10:01] Finished with 0 errors.
[25/03/2015 16:10:01] Backup completed successfully.
[25/03/2015 16:10:01] -------------------------------------------------


Questions I have.
1. How do i restore all of these bak files?
2. How do i verify this is a good backup?

EDIT - I have looked in the backup directory I have one folder and one xml file, within the folder there are 29 files 27 are bak files. The total size of this folder is 225KB which makes me think something is wrong here.
Avatar of Walter Curtis
Walter Curtis
Flag of United States of America image

You do not need to individually restore each file. Use the restore cmdlet and just reference the first file name, and the others are included automatically.
Avatar of wannabecraig

ASKER

Hi Sneekco,

Are you farmiliar with this script?

Does it sound like it is working correctly?

Is there any way I can verify the backup is working correctly?

If I do a backup manually from Sharepoint Central Admin the outputted file is 20MB in size so I do not see how this backup is actually working properly.

Thanks for the quick response.
Yes, something does not sound correct. Check the size again. You will get a successful message, but the backup continues to run and the size of the folder will increase. Depending upon the size of the farm, the folder will grow until the process is actually finished.
Does the account running this task require access within SQL over the instance?

In the Requirements it doesnt seem to say it requires anything but add-spshelladmin which I have granted.

I get these errors in the logs.

[25/03/2015 16:41:47] Verbose: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] SQL Server Connection String: Data Source=SERVERNAME(edit)\Sharepoint;Initial Catalog=SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42;Integrated Security=True;Enlist=False;Connect Timeout=15.
[25/03/2015 16:41:47] Verbose: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] SQL command started at: 25/03/2015 16:41:47. This command may take a while to complete and without notification.
[25/03/2015 16:41:47] Verbose: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] SQL Server Command: BACKUP DATABASE [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] TO DISK=@db_loc WITH NAME=@db_name, STATS=5, NOINIT, NOSKIP, NOFORMAT, NOREWIND
      @db_name=SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42, @db_loc=\\backupdir$(edit)\spbr0000\00000043.bak
[25/03/2015 16:41:47] Verbose: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] SQL command timeout is set to 1.00 hours.
[25/03/2015 16:41:47] Warning: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] Cannot open backup device '\\backupdir$(edit)\spbr0000\00000043.bak'. Operating system error 5(failed to retrieve text for this error. Reason: 15105).
BACKUP DATABASE is terminating abnormally.
Here are the requirements for this script. We are on Sharepoint Foundation 2010  

Included below is an entry in the windows app log event viewer.



 REQUIRED: the account serving as the identity of the Scheduled Task must have the  
 following permissons on that server:
  - WSS or MOSS:  
      - DB_CREATOR and SECURITYADMIN roles in the SQL instance hosting  
        the farm's SharePoint databases
      - local administrator rights on the server
      - DB_OWNER rights on the farm's SharePoint databases
      - Read, Write, and Update rights in the shared directory where backups  
        are created
  - SharePoint Foundation 2010 or SharePoint Server 2010
      - It must be granted the SHAREPOINT_SHELL_ACCESS role via the  
        Add-SPShellAdmin CMDLET - DONE
      - Full Control of the shared directory where backups are created - DONE
      - The account that runs the SharePoint 2010 Timer Job (SPTimerV4.exe) service,
        and the SQL Server instance's SQL Service account must have Full Control
        of the shared backup storage directory - THis was not done Network Service was not added but now is.

Update - Checked the windows app log filled with errors like this Log Name:      Application
Source:        MSSQL$SHAREPOINT
Date:          25/03/2015 16:52:50
Event ID:      3041
Task Category: Backup
Level:         Error
Keywords:      Classic
User:          
Computer:      
Description:
BACKUP failed to complete the command BACKUP DATABASE SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42. Check the backup application log for detailed messages.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="MSSQL$SHAREPOINT" />
    <EventID Qualifiers="49152">3041</EventID>
    <Level>2</Level>
    <Task>6</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2015-03-25T16:52:50.000000000Z" />
    <EventRecordID>46670</EventRecordID>
    <Channel>Application</Channel>
    <Computer></Computer>
    <Security UserID="S-1-5-21-1728536662-146330824-3268609631-2660" />
  </System>
  <EventData>
    <Data>BACKUP DATABASE SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42</Data>
    <Binary>E10B0000100000001400000049004E005400520041004E00450054005C005300480041005200450050004F0049004E005400000000000000</Binary>
  </EventData>
</Event>
You are receiving an access denied error. In the scheduled task manager you can set which account the task should run as. That would be the access with access to the database.
Do we need to grant privileges within SQL and to that SQL instance for the account that runs the task?

Presently it does not have any SQL access.
ASKER CERTIFIED SOLUTION
Avatar of Walter Curtis
Walter Curtis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cheers will give it a shot.
Ok working now with the permissions one of the reasons I hadn't added them is in the requirements above it looks like its asking to add them only in WSS or MOSS which we are not using. Its actually asking to add all in 2010 Foundation too.

Im backing up 500MB roughly now with no errors in the logs so im happy enough with this now.

Thanks Sneekco
Glad that is working for you.

Have fun!
The issue fyi was caused by 2 things.

1. No SQL access on DB.
2. This access denied error was a windows permissions error on the output dir.