Skip to main content Skip to footer

How to change the owner of a SQL Server Express LocalDB database

Promodag Reports is installed with SQL Server Express LocalDB, a simplified version of SQL Express for creating a local SQL database. The application creates a local instance named \Promodag. However, access to the instance of LocalDB is limited to its owner.

This poses a problem if you've used your own account to create a LocalDB database and your scheduled import or report tasks are run by another account: in this case, you'll get an error message like “4060 - Cannot open database ‘<database name>’ requested by the login. The login failed.

Here's how to assign database ownership to the account dedicated to Promodag Reports.

Install SQL Server Management Studio

The first step is to download SQL Server Management Studio (SSMS) from Microsoft and install it.

Connect to local database instance

Then launch SSMS while logged in with the account that created the local database. The name if this instance is: (LocalDB)\Promodag.

Connect to the Promodag LocaDB instance

Create a login for the future owner account

  • In the Object Explorer, right-click on Security > Logins and create the login for the future LocalDB database owner account.
How to create a new login in SSMS
  • In the General section, search for and select the new owner. Make sure that the default database is set to master.
Create a new SQL login
  • In the Server Roles section, select public and sysadmin. Click OK.
Grant SQL sysadmin permissions to a new login

Assign local database authorizations

  • In the Report Explorer, Databases, locate your LocalDB database, right-click, Properties.
  • In the Files section, replace the current owner with the new login.
  • In the Report Explorer, Security > Login, select the LocalDB database and edit the new login. In the User Mapping section, locate your LocalDB database in the list and make sure that dbo is set in both User and Default Schema colums. 

Then quit SSMS.

Grant full access to database files to the new owner account

The final step is to locate the LocalDB .mdf (data) and .ldf (transaction) files on the Promodag console disk. By default, these files are located in the C:\Users\Public\Documents\Promodag\Databases\ directory.

  • Right-click on each of the two files, Properties and open the Security tab.
  • Click Edit and add the new database owner to the list of users with permissions on the file.
  • In the Allow column, select Full control and click OK.

Try Promodag Reports Free for 45 Days