# Platform backup and recovery

## Overview

This section outlines the steps required to provide Disaster Recovery (DR) capabilities for Adaptiva OneSite. In general, just like installation and operation, Adaptiva OneSite is very straight-forward to backup and restore. Guidance and examples are given as appropriate but many of these tasks can be performed in a variety of ways based upon the environment where OneSite is installed. Review this entire document before implementing a solution.

## Prerequisites (ConfigMgr)

Ensure there is a complete and successful backup of the ConfigMgr environment. Without this, OneSite can be restored and will function properly, but its main purpose to support, extend and supplement ConfigMgr, will not be satisfied.

The following Microsoft articles provide guidance on the backup and recovery for Configuration Manager.

Backup and Recovery for ConfigMgr Current Branch:

<https://docs.microsoft.com/en-us/sccm/core/servers/manage/backup-and-recovery>

Backup and Recovery for ConfigMgr 2012:

<https://docs.microsoft.com/en-us/previous-versions/system-center/system-center-2012-R2/gg712697(v=technet.10)>

## Scenarios

The following scenarios are supported for backup and recovery.

* **Disaster Recovery / Hardware Migration** - Adaptiva Server is restored on a server with the same name, SQL server, instance name, and database name.
* **Adaptiva or ConfigMgr Database Migration** - Adaptiva or ConfigMgr server name remains unchanged, but the SQL server name, instance name, (and/or) database name is changed.

## Backup

To recover an Adaptiva OneSite instance and associated data, a successful backup must be completed. It is best practice to backup OneSite data to an alternate location, and not on the system hosting OneSite itself. The exact procedure for doing this is dependent on the backup solution(s) in use. Similar to ConfigMgr, the files and data could be copied to a specific folder and configure the backup solution to backup that location.

The following table describes the components on the Adaptiva Server which should be backed up.

| Component                                                     | Details                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ***Required***                                                |                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Adaptiva SQL Database                                         | Full SQL database backup.                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Adaptiva Install Folder                                       | `<AdaptivaServerInstallPath>`\AdaptivaServer                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Adaptiva Driver                                               | %systemroot%\system32\drivers\adaptivaservertransport\*.sys                                                                                                                                                                                                                                                                                                                                                                                                     |
| Adaptiva Server Registry Information                          | <p>HKLM\SOFTWARE\Adaptiva\server<br><em>Prior to version 5.5: HKLM\Software\javasoft\prefs\Adaptiva\server</em></p>                                                                                                                                                                                                                                                                                                                                             |
| Adaptiva Service Properties                                   | <p>Name: AdaptivaServer<br>Description: The Adaptiva Server service. Provides server side support for Adaptiva products.<br>DisplayName: Adaptiva<br>ServerName: AdaptivaServer<br>PathName: "<code>\<InstallPath></code>\Adaptiva\AdaptivaServer\bin\AdaptivaServerService.exe"<br>ServiceType: Own Process<br>StartName: LocalSystem<br>Caption: AdaptivaServer</p>                                                                                           |
| ***Optional***                                                |                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Custom Adaptiva Reports in ConfigMgr Reporting Services Point | In the case where any custom reports were created that are not included as part of the Adaptiva Server installation, those report RDL files should be downloaded. If there are subscriptions or schedules for those reports, the Reporting Services database should be backed up.                                                                                                                                                                               |
| Adaptiva Content Library                                      | <p>This is only applicable if the Content Library has been moved from the default location. The default location is:<br><code>\<InstallPath></code>\Adaptiva\AdaptivaServerInstallPath>\AdaptivaServer\data\ContentLibrary<br>If the above location is missing or there are no files within the ContentLibrary folder, check this registry key to determine if it has been moved:<br>HKLM\Software\Adaptiva\adaptiva\server\contentsystem.lib\_folder\_path</p> |

### Backup Procedure and Sample Commands

The following steps and commands can be used to complete the required set of backup steps listed in the table above. Replace all sections in <> brackets with correct entries for the environment.

> NOTE: The example command-lines referenced below assume the following:
>
> The Adaptiva Server and SQL Server are installed on the same machine.
>
> The Adaptiva database name is adaptiva.
>
> The account used to execute these commands has sufficient privileges to perform these actions.

1. Stop the AdaptivaServer Service.

```cmd
net stop AdaptivaServer
```

1. Setup some variable.

```cmd
REM Setup some Variables

set SERVERNAME=ENTER DB SERVER NAME

set DATABASENAME=adaptiva

set BACKUPLOC=DRIVE:\Backup\ServerBackup
```

1. Backup Adaptiva SQL Server database.

```cmd
REM Backup Adaptiva SQL Server database.

set DATESTAMP=%DATE:~-4%.%DATE:~7,2%.%DATE:~4,2%

set BACKUPFILENAME=%BACKUPLOC%\%DATABASENAME%-%DATESTAMP%.bak

REM May need to enter sqlcmd path. Default path to sqlcmd: C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\

REM Remove/Update Named Instance \ADAPTIVASQL

"[PATH TO\]sqlcmd" -E -S %SERVERNAME%[\ADAPTIVASQL] -d master -Q "BACKUP DATABASE %DATABASENAME% TO DISK = N'%BACKUPFILENAME%'"
```

1. Backup Adaptiva Install Folder using a command prompt.

```cmd
REM Backup Adaptiva Install Folder using a command prompt.

md %BACKUPLOC%\AdaptivaServer

xcopy.exe "%ADAPTIVASERVER%" %BACKUPLOC%\AdaptivaServer /v /e /r /k /h /o /x /y
```

1. Backup the Adaptive Protocol Driver using a command prompt.

```cmd
REM Backup the Adaptive Protocol Driver using a command prompt.

md %BACKUPLOC%\AdaptivaDriver

xcopy.exe %systemroot%\system32\drivers\adaptivaservertransport\*.sys %BACKUPLOC%\AdaptivaDriver /v /e /r /k /h /o /x /y
```

1. Backup the Adaptiva Server and driver registry keys.

```cmd
REM Backup the Adaptiva Server and driver registry keys.

REM --Version 5.5 and up

reg.exe export HKLM\SOFTWARE\Adaptiva\server %BACKUPLOC%\AdaptivaServer.reg /y

reg.exe export HKLM\\SYSTEM\CurrentControlSet\services\AdaptiveProtocolServer %BACKUPLOC%\AdaptivaDriver.reg /y

REM --Adaptiva Versions prior to 5.5

REM reg.exe export HKLM\SOFTWARE\javasoft\prefs\Adaptiva\server %BACKUPLOC%\AdaptivaServer.reg /y
```

1. Backup the Adaptiva Content Library folder if it has been moved to a non-default location.

```cmd
REM Backup the Adaptiva Content Library folder if it has been moved to a non-default location.

REM Remove the REM and enter the Content Library Location if it was moved from the default location

REM xcopy.exe <ContentLibraryLocation> %BACKUPLOC%\ContentLibrary /v /e /r /k /h /o /x /y
```

1. Record the configuration information for the AdaptivaServer service.

```cmd
REM Record the configuration information for the AdaptivaServer service.

wmic service where caption='AdaptivaServer' get caption, Description, DisplayName, Name, PathName, ServiceType, StartName /VALUE > %BACKUPLOC%\AdativaServerServiceInfo.txt
```

1. Restart the AdaptivaServer service.

```cmd
REM Restart the AdaptivaServer service.

REM DO NOT RESTART if moving Adaptiva to a new server

net start AdaptivaServer
```

The above commands can easily be customized for any environment and combined into a single batch file for scheduled execution. Using the built-in capabilities of ConfigMgr backup, these commands can be automatically triggered by ConfigMgr itself after the ConfigMgr Backup maintenance task runs. To do this, simply insert the customized form of the above commands into a batch file called AfterBackup.bat and place the batch file in the `<ConfigMgrInstallPath>`\inboxes\smsbkup.box folder. More details on this feature of ConfigMgr can be found at <https://docs.microsoft.com/en-us/configmgr/core/servers/manage/backup-and-recovery#using-the-afterbackupbat-file>.

## Restore

The following list of tasks outlines what must be done to restore OneSite. These tasks, similar to restoring ConfigMgr itself, assume a system with the same machine name, domain status, and drive letters as the original system and also depend on the complete and successful backup of a previously working OneSite installation using the steps outlined above. They also assume the existence of the files created by the backup tasks above.

### Restore Procedure and Sample Commands

Command-line examples are also given similar to those above in the Backup section; however, with restoration, these are typically not automated and thus using the Windows GUI to perform these processes may be easier.

1. Setup some variable.

```cmd
REM Setup some Variables

set SERVERNAME=ENTER DB SERVER NAME

set DATABASENAME=adaptiva

set BACKUPLOC=DRIVE:\Backup\ServerBackup

set ADAPTIVASERVER=<path to AdaptivaServer i.e. d:\program files\adaptiva\adaptivaserver>
```

1. Restore the Adaptiva SQL Server DB.

```cmd
REM Restore the Adaptiva SQL Server DB.

set BACKUPFILENAME=%BACKUPLOC%\adaptiva-yyyy.mm.dd.bak

set BACKUPLOC=c:\users\adaadmin\downloads\ServerBackup\ServerBackup

REM Default path to sqlcmd: C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\

REM Remove/Update Named Instance \ADAPTIVASQL

"[PATH TO\]sqlcmd" -E -S %SERVERNAME%\[\ADAPTIVASQL] -d master -Q "RESTORE DATABASE [%DATABASENAME%] FROM DISK = '%BACKUPFILENAME%'"
```

1. Restore the Adaptiva Server registry key.

```cmd
REM Restore the Adaptiva Server registry key.

reg.exe import %BACKUPLOC%\AdaptivaServer.reg
```

1. Restore the Adaptiva Server installation folder and Adaptive Protocol Driver file.

```cmd
REM Restore the Adaptiva Server installation folder and Adaptive Protocol Driver file.

xcopy.exe %BACKUPLOC%\AdaptivaServer "%ADAPTIVASERVER%" /v /e /r /k /h /o /x /y

xcopy.exe %BACKUPLOC%\AdaptivaDriver %systemroot%\system32\drivers /v /e /r /k /h /o /x /y
```

1. If the ContentLibrary folder had been moved to a non-default location, then it must also be restored.

```cmd
REM If the ContentLibrary folder had been moved to a non-default location, then it must also be restored.

REM Remove the REM and enter the Content Library Location if it was moved from the default location

REM xcopy.exe %BACKUPLOC%\ContentLibrary <ContentLibraryLocation> /v /e /r /k /h /o /x /y
```

1. Create the AdaptivaServer service using the service information recorded in AdaptivaServiceInfo.txt.

```cmd
REM Create the AdaptivaServer service using the service information recorded in AdaptivaServiceInfo.txt.

sc create AdaptivaServer type=own start=auto DisplayName=AdaptivaServer binPath="%ADAPTIVASERVER%\bin\AdaptivaServerService.exe"
```

1. Restore the Adaptive Protocol Driver registry information.

```cmd
REM Restore the Adaptive Protocol Driver registry information.

reg.exe import %BACKUPLOC%\AdaptivaDriver.reg
```

1. Create the AdaptiveProtocolServer service.

```cmd
REM Create the AdaptiveProtocolServer service.

>c create AdaptiveProtocolServer binPath=%systemroot%\system32\drivers type=kernel start=demand DisplayName=AdaptiveProtocolServer
```

1. If the Restore process was run on a different server with a different server name review the **Database Restoration Scenarios** below
2. At this point, in the process, the Adaptiva Server should be able to function, but in case there was something missed, the same version of **AdaptivaServerSetup.exe** as the restored Adaptiva Server should be run. When navigating through the installation wizard, no values should need to be modified as it will use the previous configuration as what is in the registry. See **Running Setup** below.

> IMPORTANT: If the Adaptiva database was moved to a database server different from the CM database, be sure to follow the steps in Appendix B before running AdaptivaServerSetup. Select Kerberos when prompted by AdaptivaServerSetup.

### Database Restoration Scenarios

If the Adaptiva or ConfigMgr databases need to be moved or restored to another SQL server, the Adaptiva Server Installer will allow for modifications of the SQL Server Machine Name, SQL encryption settings, and SQL Login information. If making changes to the Adaptiva / ConfigMgr database names, instance names, or ports, use the following table to modify the appropriate registry values before running **AdaptivaServerSetup.exe**.

**Registry Location:** 5.5 and Above: `HKLM\Software\Adaptiva\server` Prior to 5.5: `HKLM\Software\javasoft\prefs\Adaptiva\server`

Adaptiva Database Machine Name: `setup.adaptiva_db_machine_name` Adaptiva Database Name: `setup.adaptiva_db_name` Adaptiva Database SQL Port: `setup.adaptiva_db_port` Adaptiva Database SQL Instance: `setup.adaptiva_db_sql_named_instance` Adaptiva Server name: `setup.customer_name` ConfigMgr Database Machine Name: `setup.site_db_machine_name` ConfigMgr Database Name: `setup.site_db_name` ConfigMgr Database SQL Port: `setup.db_port` ConfigMgr Database SQL Instance: `setup.site_db_sql_named_instance` ConfigMgr Site Server Name: `setup.site_server_machine_name`

### Running Setup

1. Run **AdaptivaServerSetup.exe** and at the **License Agreement** screen, click **Accept**.
2. At the **Status** screen, the Adaptiva configuration will be listed which includes the Adaptiva Server version, installation folder, Adaptiva database server, database name, etc. Click **Upgrade** to start.
3. In the installer fields for the ConfigMgr server and database server can be changed/updated, but if the Adaptiva database names, instances, or ports were modified, they should be modified in the registry before running setup.
4. Once complete, verify the AdaptivaServer service started correctly by reviewing adaptiva.log in the `<AdaptivaServerInstallPath>`\AdaptivaServer\logs folder for errors or anomalies.
5. Reinstall the Adaptiva Client when prompted.
6. Reinstall the Adaptiva Workbench from the installation source (if desired). Ensure the same version of the workbench is being used as that of the AdaptivaServer that was just restored.

### Reporting

If the Adaptiva database was moved to a different SQL Server be sure to update the database connection in SQL Server Reporting Services for the ConfigMgr Reports

1. Browse to http\://`<ReportingServer>`/ConfigMgr\_`<sitecode>`/reports
2. Scroll to the bottom of the list and click on Adaptiva
3. Change the connection string to:
4. Datasource=new adaptivaserver fqdn;initial catalog=adaptiva
5. It should be using specific Credentials -- the CM Reporting Services Point account. Make sure this account has `db_datareader` permissions on the Adaptiva database on the new server


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.adaptiva.com/platform-install/additional-configuration/platform-backup-recovery.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
