Move Database to archive Database

Warning

Make sure the script version matches your version. If not data loss will occur.

Prerequisites

  • Archive database already created

    Tip

    You can copy the database to already have all the data in the archive.

Introduction

This script will move all data from the current database to the archive database.

Then it will cleanup the current database, with records older then the retention.

Run Move to Archive (PowerShell)

  1. Request the "executeMoveandDelete" script from the support desk

  2. Login to a machine that can access the database.

  3. Open the "executeMoveandDelete" script.

  4. Change the variables:

    1. $connectionStringProd = Connectionstring of the current database.
    2. $connectionStringArchive = Connectionstring of the archive database.
  5. Change the Parameter:

    1. $moveRecords = Should be $true, so the items are copied to the archive database.
    2. (optional) $deleteOldRecords = Optional can be $true, so the items in the production database are removed.
    3. (optional) $daysRetention = The number of days you would like to keep data in the current database.
  6. Execute the script in PowerShell.