2022:Backup and Restore Grooper Repository

From Grooper Wiki
Revision as of 14:50, 29 March 2022 by Dgreenwood (talk | contribs)

Let's say you need to copy a whole Grooper Repository from one server to another. You can do that by backing up the Grooper Database and File Store on the source server and restoring it on the target server.

The general steps are as follows:

  1. Backup the Grooper Database on the source server using SQL Server Management Studio.
  2. Restore the Grooper Database backup on the target server as a new database using SQL Server Management Studio.
  3. Copy the Grooper File Store from the source server to the target server.
  4. Change the Primary File Store's path to copied File Store's location by updating the File Store object in the Tree Node table in SQL Server Management Studio.
  5. Create a new Grooper Repository connection on the target server, connecting to the restored Grooper Database on the target server in Grooper Config.
  6. Verify objects and files are accessible in new Grooper Repository connection.

First, we're going to backup the Grooper Database on the source server.

FIRST AND FOREMOST! DO NOT CONTINUE UNTIL READING THE NEXT LINE

Ensure all Grooper services running on the source server are stopped and any Grooper applications (Grooper Design Studio, Grooper Config, etc) are closed.


On the source server, open Microsoft SQL Server Management Studio.

  1. Select the SQL Server hosting the Grooper Database.
  2. Select Connect.


  1. Expand the Databases folder.
  2. Right-click the Grooper Database you wish to back up.
    • In this case, the database I want to back up is named "2022DB". This is the name I gave when originally creating the Grooper Repository in Grooper Config.
  3. Select Tasks
  4. Select Back Up...


This will bring up the Back Up Database configuration window for the selected database.

  1. Ensure Back up to: Disk is selected.
  2. Select Add...

  1. In the following window, select the ellipsis button next to the file name property.


  1. Select which folder in which you want to save the backup file.
    • This will default to the "Backup" folder for wherever SQL is installed on your machine, but you can change it to whatever folder location you would like.
  2. Name the backup file whatever you like, but ensure you add .bak to the end of the filename.
    • We've named ours RepoBackup.bak
  3. Select OK when finished.


  1. In the following window select OK.


  1. You will see your .bak database backup file's location popup in the list.
  2. Select OK to backup the database.


Upon successful creation of the backup file, you will see the following success message.

  1. Click OK to continue.

You may close out of Microsoft SQL Server Management Studio at this point.

2. Restore Database

Next, we will take our database backup, copy it over to our target server and restore it to a new database.


  1. Copy the .bak backup file from the source server to the target server.
    • We've just placed ours at the root of the C Drive (C:) in our target server.


On the target server, open Microsoft SQL Server Management Studio.

  1. Select the destination SQL Server.
  2. Select Connect.


  1. Right-click the Databases folder.
  2. Select Restore Database...


This will bring up the Restore Database configuration window.

  1. Ensure Device is selected.
  2. Press the ellipsis button at the end of the Device property.


  1. On the following screen, select Add.


This will bring up a folder browser to find the database backup file you copied over.

  1. Use the left panel to navigate to the folder where the backup file is located.
  2. Use the right panel to select the backup file.
  3. Select OK when finished.


  1. You will see your backup file pop up in the "Backup media" list.
  2. Select OK to continue.


This will take you back to the Restore Database screen.

  1. Ensure your backup file appears in the "Backup sets to restore" list and the Restore column is checked.
  2. Select OK to restore the database.


Success! The database is now restored on the current server.

  1. Select OK in the success window to continue.

  1. Our source database has been restored to this server.
    • Effectively, we've copied a Grooper Repository's Database from one server to another.


We're half-way done with copying over the Grooper Repository. Remember, a Grooper Repository consists of two things:

  • A database
  • A file store

We've taken care of the database. Now, we need to take care of the file store.

3. Copy the File Store

This step should be fairly straightforward.

First, find the location of the source Grooper Repository's File Store on the source server.

  1. Make a copy of the Grooper Repository's File Store folder.


  1. Paste the copied File Store to a location on the target server.


The (somewhat) trickier part is informing the Grooper Database this is the location of the file store (and not whatever it was on the source server). Next, we're going to edit the File Store's location path in the Grooper database from Microsoft SQL Server Management Studio.

4. Change the File Store Path

Next, we're going to go into the Grooper Database's Tree Node table and manually edit the File Store object's location path. This will update the Grooper Database in such a way that it will use the copied File Store on the target server, instead of the original File Store on the source server.

Generally speaking, it is ill-advised to update Grooper object properties directly in the database tables.

The guidance we're about to give is a rare exception.


Open Microsoft SQL Management Studio.

  1. Expand the Databases folder.
  2. Select and expand the restored Grooper Database.
  3. Expand the Tables folder.
  4. Right-click the dbo.TreeNode table.
  5. Select Select Top 1000 Rows


  1. Add the following line to the end of the SELECT statement.
    • WHERE [TypeName] = 'Grooper.FileStore'
  2. Execute the query.
    • Press this button or hit F5 on your keyboard.
  3. This will bring up any File Store objects in the Results list.
    • Typically, you will only have one result, the "Primary" File Store. Atypically, you may have additional File Stores in your Grooper Repository, such as ones added for archival purposes. If that's the case, you'll need to copy over all File Stores and update their location paths.
  4. Select the value in the Properties column.
  5. Copy it.


Enter a couple blank lines at the end of the query.

  1. Type the following to the end of the query:

UPDATE [your database's name].[dbo].[TreeNode]
SET [Properties] = ''

  1. Paste the copied value in between the first ' and second '
    • The last line of the query should be as follows:
    • SET [Properties] = '{"StoragePath": "source storage path"}'
  2. Change the storage path from the original path to the target File Store's path.
    • After editing, the last line of the query will be as follows:
    • SET [Properties] = '{"StoragePath": "target storage path"}'


Please note any slash characters in the path must be escaped with a backslash.

  • So if your path is \\server_name\path you will enter \\\\server_name\\path
  • Furthermore, use ONLY fully qualified UNC paths.


  1. Enter the following line at the end of the query:
    • WHERE [TypeName] = 'Grooper.FileStore'
  2. Select the bottom three lines of the query.
    • From UPDATE to the end of the last WHERE clause.
  3. Execute the selected portion of the query.
    • Press this button or hit F5 on your keyboard.


  1. You should see the following message indicating "1 row affected". This means you successfully updated the File Store object's storage path.


At this point we've fully copied over the Grooper Database and File Store for the Grooper Repository from the source server. With a Grooper Database and File Store in place, this is effectively a Grooper Repository at this point. All we need to do now is establish a connection to it.

<tab name="5. Create a Grooper Repository Connection" style="margin:20px">

5. Create a Grooper Repository Connection

All that is left is to create a new Grooper Repository connection to the Grooper Database and File Store, just like we would connect to any other Grooper Repository using Grooper Config.


Open Grooper Config.

  1. Select the Repositories property.
  2. Press the ellipsis button at the end.


  1. Press the Add button to add a new Grooper Repository connection.
  2. Enter the Server Name.
    • In our case, the SQL instance on our local/target server.
  3. Enter the Database Name.
    • This is the name of the database we restored from the backup file.
  4. Press the Test Connection button.


If you restored the database correctly, you will see a "Connection Successful!" message appear.

  1. Click OK to continue.