Invalid object name 'umbracoDomains' resolved

Invalid object name 'umbracoDomains' resolved

What causes the "Invalid object name 'umbracoDomains'." error

In order to allow multiple Umbraco sites to co-exist in a single database, a new DB schema is created using the name of the installing user.  All tables are then created under this schema (eg. <SchemaName>.<TableName>). 

 

If a user other than the creator of the Umbraco installation is then used to access the Umbraco database, Umbraco will throw an "Invalid object name 'umbracoDomains'." error when trying to access the Umbraco DB.

 

How to resolve the "Invalid object name 'umbracoDomains'." error

If only one Umbraco instance exists in the Umbraco database, the "Invalid object name 'umbracoDomains'" error can be resolved by setting the Schema of each table to 'dbo'.

This can be achieved by using the following SQL command against the restored Umbraco database:

 

exec sp_MSforeachtable 'ALTER SCHEMA dbo TRANSFER ?'


Be careful as this will iterate through all tables in the target Umbraco database, so can cause problems if used for anything other than one instance of Umbraco.  Even if running on an Umbraco database with only one Umbraco instance, it is always a good idea to backup your DB prior to running such commands.

 

Prior to altering the schema, the tables will look as follows:

 

Umbraco DB Before Schema

 

 

Once the SQL command is applies to the Umbraco DB, the tables will look as follows:

 

Umbraco DB After Schema

Written by Richard Bowers at 20:05
Tags :

0 Comments :

Comment

Comments closed

Try our Umbraco Hosting free for 3 months