Backup Site DB
It’s always better and a preventive thought
to Back-up your Daily SCCM CB Backup, (keeping a daily copy on the server
and copying the backups to an alternate location). Because if your SCCM server
falls down you still have a back-up!
In the process of SCCM’s daily backup (visible in smsbkup.log),
there’s an ‘AfterBackup.bat‘ file used to perform post-backup
actions automatically after the Backup Site Server maintenance task runs
successfully. By default, the AfterBackup.bat batch file does not exist. You have to create and
place it manually.
Starting with version 1806, install an additional site
server in passive mode. The site server in passive mode is in addition
to your existing site server in active mode. A site server in passive
mode is available for immediate use, when needed
Activating site backup
ConfigMgr console > Administration tab > Site
settings > Site maintainance > Backup site server:
Edit and fill out the needed values.
You can set a local or remote UNC backup path and the
scheduling options. Whatever you decide you can use the AfterBackup.bat to move
or archive it afterwards.
The computer account of the ConfigMgr server has to
have been granted full control permissions on the remote backup location.
Creating the AfterBackup.bat file
Here is a simple script for ‘AfterBackup.bat’, which
saves 7 days backup to a folder named after the first 3 letters of the day of
the week, and also deletes/overwrites the older ones.
***********************************************************************************
REM @echo off
setlocal enabledelayedexpansion
set target=\\Destination_Server\E$\AfterBackup\%date:~0,3%
If not exist %target% goto datacopy
RD %target% /s /q
:datacopy
xcopy “\\Source_Server\*” “%target%\” /E /-Y
***********************************************************************************
where, “Source_Server” is the Primary
Server from which the backup has to be copied,
and “Destination_Server” is the Remote
Server where you want to copy the Site Backup.
Source_Server (This is the UNC path specified in
ConfigMgr)
\\SCCM2012\sccm$\_Backup
Destination_Server (This is where we store the backup)
\\FILE01\SCCM$\SCCM_Backup
Although the intended use of AfterBackup.bat is to
archive SCCM backup snapshots, you can use that file for other tasks that you
need to perform at the end of every back up operation, such as:
- Run a SQL Server DBCC test to verify that there are no integrity problems with the SCCM Site database.
- Run a site health tool, or other health tools.
Putting the AfterBackup.bat to work
ConfigMgr has the ability to run an after backup batch
file which you can use to perform archiving and other administrative functions.
Start by creating the AfterBackup.bat and copy it to
the location below.
{ConfigMgrInstallPath}\inboxes\smsbkup.box\AfterBackup.bat
Once it’s in place ConfigMgr will automatically
execute its contents at the end of a sms_site_backup task. It runs as
the computer system account.
ConfigMgr overwrites each backup when it runs the site
backup task. You must use the AfterBackup.bat or manual copy to archive more
than one backup.
Starting a backup outside of the schedule
You can start a backup at any time by going into the
service manager which can be launched through the console.
Monitoring tab > System
Status > Component State > Ribbon > Start > Configuration Manager
Service Manager
Once in service manager, locate the SMS_SITE_BACKUP service and right click start. A backup will now
start.
Another option is to go to Windows Services.msc and
start the SMS_SITE_BACKUP service.
After a successful backup you will see this in your logs:
And the backup is copied over to your alternate backup location!
Recover a Site Database
When recovering a site database in ConfigMgr 2012 and later, use the
setup from the installation media. If you’d launch setup from the site
server, the option to Recover a site is greyed out. Since we’re
recovering a corrupted site database, it’s necessary that we detach that
corrupted database from the SQL Server first. Otherwise the recovery
process would fail if we tried to recover a site database that already exists
on the SQL Server.
1. Launch splash.hta from the ConfigMgr installation media
and click on Install.
2. Select Recover a site and click Next.
2. Select Recover a site and click Next.
3. Select Recovery the site database using the backup set at the
following location.
Aucun commentaire:
Enregistrer un commentaire