Database migration
| ID: 17091402 Languages: EN, DE  Components: Database (SQL Server 2005 and higher), EgoSecure Server Operating system: Windows | 
Task
Database migration to another server or reinstallation on the same server.
In case of an additional migration of the  EgoSecure Server, perform the following task after the database migration:  EgoSecure Server migration  (please perform the database migration first).
If you migrate the EgoSecure database to a later version of Microsoft SQL Server or if you want to upgrade from Microsoft SQL, pay attention to the following information before moving the database: 
Adjusting the compatibility level of the database  :  ALTER DATABASE - Compatibility Level -Microsoft Docs
Upgrading Microsoft SQL Server  :  Upgrading MS SQL Server - Microsoft Docs  
Requirements
Installed  Microsoft SQL Server Management Studio  component.
Solution
Saving a database
1. Stop the  EgoSecure Server  service. 
This is especially important if you are using the Simple recovery model for your database to avoid losing records.
This is especially important if you are using the Simple recovery model for your database to avoid losing records.
- The Full recovery model allows a database to be restored to any point in time. Not just to the time of the last backup.
- The Simple recovery model allows a database to be restored to the last backup and then have the state that existed during the last backup.
2. Open Microsoft SQL Server Management Studio. 
3. If you also want to include the transaction logs of the database in the backup:
 
a. Right-click the EgoSecure database and select Properties from the context menu.b. In the Database properties dialog, click Options in the navigation area.c. In the Recovery model drop-down menu, select Full and confirm with OK.When using the Full recovery model, you will not only need significantly more storage space for the backups, but also on the SQL Server, because the transaction log will grow until you perform another backup.
For the database migration or the precautionary backup of the database before an update of the EgoSecure Server, the Simple recovery model is sufficient.
4. Right-click the  EgoSecure  database and select  Tasks  »    Back Up...  from the context menu.

5. In the  Back Up Database  dialog, select  Full  from the  Backup type  drop-down menu.
 

6. If needed, adjust the path for saving the database file in the  Destination  section.
7. Click  OK  to confirm.
⇒ The backup file  [Database name].bak  is stored in the specified location. A dialog that informs about the successful back up appears. You can now connect to the  EgoSecure  database on the new database server.
Creating a database on a new database server
1. Open the  Microsoft SQL Server Management Studio  on the new server.
2. Right-click  Databases  and select  Restore Database  from the context menu.

3. In the  Source  section of the  Restore Database  dialog,  select the  Device  option and click on the button  ...  .
4. In the  Select backup devices  dialog, click  Add  .
 
 5. In the  Locate backup file  dialog, select the  bak  file.
6. Click  OK  to confirm.
⇒ The dialog that informs that the database is restored successfully appears.
7. Open the  EgoSecure AdminTool  and enter the IP adress or the name of the new database server respectively and confirm with  Ok  .
⇒ The  EgoSecure Server  is restarted automatically and connects with the database on the new database server.