Question

I hosted my ASP.NET 4.5 application on a 1and1 (https://www.1and1.com) server (shared hosting) and I use SQL Server session state as loadbalancer/webFarm involved. But I am facing issues when I tried to install the session DB on their DB Server. Being it a shared hosting I have limited access to the web server.

I tried executing InstallSqlStateTemplate.sql/InstallSqlState.sql (copied from my machine) on the 1and1 db server but it failed.

I dont have permission to create a new DB via script there, so I tried to modify an existing DB using InstallSqlStateTemplate.sql - it throws folloing error:

The EXECUTE permission was denied on the object 'sp_delete_job', database 'msdb', schema 'dbo'.

Anybody have similar experience?

Was it helpful?

Solution

It's quite common for shared hosting that you don't have enough permissions to create databases via SQL.

The usual solution (which you already tried) would be to create the database in the admin screen provided to you by your hoster, and then execute the rest of the SQL script, of course omitting the CREATE DATABASE part at the beginning.

The problem is that the script does additional stuff besides creating the database, and you don't have enough permissions for that additional stuff.

The error message says that you don't have sufficient permissions to execute the stored procedure sp_delete_job in the msdb database, which deletes SQL Server Agent jobs.

So apparently ASP.NET's SQL Server session state includes some SQL Server Agent jobs, probably for regular database maintenance or something like that (I'm familiar with SQL Server, but not really with ASP.NET Session State).
The script probably tries to delete the jobs first if they are already there (and then re-creates them), hence the usage of sp_delete_job.

Possible solution:

If you are able to create SQL Server Agent jobs via your provider's admin screen, you need to do this:

  • execute only the part of the SQL Script that creates tables and stuff in the actual session database
  • don't execute the part of the script that creates the SQL Server Agent jobs
  • instead, manually create the SQL Server Agent jobs via your provider's admin screen

(if you aren't able to figure out which part of the SQL scripts creates the database and which part creates the jobs, you need to post the script here or give me a link to it, if it's available online somewhere)


In case you aren't able to create SQL Server Agent jobs via your admin screen (or if you're using SQL Server Express, which doesn't have SQL Server Agent!), you're out of luck.

Maybe you can get away without the jobs, it depends on what they're doing:
If they only do maintenance on the database, maybe you can periodically execute the necessary SQL (that the jobs are supposed to execute) by yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top