Looking for help?
< All Topics

MsSQL database update

This article describes the LeanCOST database update procedure that has to be done in the MsSQL instance where the database is stored.

Database backup

First of all it is necessary to backup the database that is in use.
Log-in the instance where the “LeanCOSTDB” database is stored and open the “Databases” node. In the databases tree, select the database named “LeanCOSTDB” and right click on it: in the context menu that will appear, select the voice “Tasks” and, then, in the second menu which will open after this selection, choose “Back Up”.

The “Back Up Database” window will open, here:

  1. Choose “Full” as”Backup Type”
  2. Click the “Remove” button to delete the default destination folder
  3. Click “Add…” to choose where to save the new file.

Press the “….” button in the next window, to choose the destination path where the backup file will be saved.

After choosing the path, type the new file name, followed by the “.bak” extension.

You’ll be redirected to the backup window: here press “Ok” and the backup will start.

Once the backup is done, you’ll recieve this message.

Database restore

Once you backed up the current database, it’s possible to update it by restoring the “.bak” file sent by Hyperlean support.

Log-in the instance where the “LeanCOSTDB” database is stored and open the “Databases” node. In the databases tree, select the database named “LeanCOSTDB” and right click on it then select “Tasks” -> “Restore” -> “Database…” in the context menus.

The “Restore Database” window wil open: here follow the steps shown in the next picture.

Once pressed “OK” at step 6 of the previous image, the path of the file “LeanCOSTDB.bak” to restore will appear in the “Select backup devides” window: here press “OK” to go on with the restoration.

After having pressed “OK” you’ll be redirected to the “Restore database” window.
If you want to change the path where the data and log files will be savedelect “Files” in the left menu, check “Relocate all files to folder” and type the desired path in the “Data file folder” and “Log file folder” textboxes.
Make sure the paths are correct in the “Restore As” column.

Now, select “Options” in left menu and select “Overwrite the existing database (WITH REPLACE)” option and, finally, press “OK” button to start the restoration.

Once the restoration procedure has been completed, you’ll recieve this message meaning that the database was updated.

Setting the “db_owner” user

To let LeanCOST open successfully with the updated database, it is necessary to check that the user created for the LeanCOST database (usually named “leanuser”) is “db_owner” of the “LeanCOSTDB” database.

Open “Security” node in the SQL instance where the LeanCOST database is stored. Open the subnode named “Logins”: here there will be the user created for LeanCOST database (suggested name = “leanuser”).
Select the user created for LeanCOST database, right click on it and select “Properties” voice in the context menu.

The “Login Properties” window will appear: select “User Mapping” on the left.
Then, select “LeanCOSTDB” database under the “User mapped to this login” table. Finally, check that “db_owner” is flagged. If it is not, select it and press “OK”.

You can now test the login in LeanCOST.

If you run into any problems, contact support@hyperlean.eu.

Table of Contents