Error on Migration: Invalid object name 'umbracoUser'
Hi there,
I am having some issues with a migration of an Umbraco based website. Basically we are moving over from a Windows 2003, IIS 6 with MS SQL 2005 to a Windows 2008, IIS7 and MS SQL 2008.
I have taken a ZIP copy of the website structure and have backed up the database to .bak file and uploaded the file structure from the old install to the new install. Then I have created a new database (unfortuantly I could not keep the same name for the database) and then performed a restore on top of the clean database.
I have then updated the web config to point to the correct SQL Server, and updated the logon details.
When I try to open up the site I am getting the following:
Server Error in '/' Application.
Invalid object name 'umbracoUser'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'umbracoUser'.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Umbraco
Exception (DataLayer): SQL helper exception in ExecuteReader at
umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText,
IParameter[] parameters) at
umbraco.BusinessLogic.User.setupUser(Int32 ID) at
umbraco.BusinessLogic.User..ctor(Int32 ID) at
umbraco.BusinessLogic.User.GetUser(Int32 id) at
umbraco.content.LoadContentFromDatabase() at
umbraco.content.LoadContent() at
umbraco.content.get_XmlContentInternal() at
umbraco.content.get_XmlContent() at
umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e) at
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
Object t, EventArgs e) at
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) at System.EventHandler.Invoke(Object sender,
EventArgs e) at System.Web.UI.Page.OnPreInit(EventArgs e) at
System.Web.UI.Page.PerformPreInit() at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 3.5.30729)
HTTP_X_REWRITE_URL
/default.aspx
Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET
Version:2.0.50727.4927
If someone could help me out I would be very grateful, if I go to /install I get the logon screen appear but when I enter my details I get the same screen again.
I am getting the same error on a new install. Windows XP, MS SQL 2008 Express. Found mixed answers elsewhere on the web. No luck. Any help would be appreciated.
Looks like there's a problem with the database. umbracoUser is a table in the umbraco-database. (and often being mistaken with the user that connects to the DB).
Check if your connection-string is correct and then check if the table actually exists in your DB.
Disregard the part of my last post about 'umbracoUser' created by the package. I'm on my fifth install now - all is working well and I've been able to use any name I wanted. Jay
I have download and installed the umbraco and getting the same error. well ofcourse there is umbrac_user us table in the database but I am not sure how do I get the database file.in the web.config file I have updated the connection string but there is no database in the so how its able to read this table?
anyhow could help me how do I installed the umbraco database on my sqlserver 08 ?
I am going thru the same problem, trying to install my live site to my local, importing database was sucessful now when i try accessing my site on localhost i get this error "Umbraco invalid object name UMBRACOUSER"
This one was driving me crazy, as well, but I believe I have found the solution (or at least I know I did in my case).
The problem is that depending on how Umbraco was installed on the remote server and/or how the db admin tool on that server assigns db users, you may find that the SQL Server 'owner' of your Umbraco tables is something other than "dbo". For instance, if you've created a db log-in called "acme", you may find that on looking at your Umbraco db you see that the table look like this:
Depending on which schemas are associated with the login you're using to give Umbraco access to this database, these objects may turn out to be effectively 'invisible' to the Umbraco application… and therefore the "invalid object name" error. (I.e., the object name is perfectly valid, just not under the schema you're currently working with.)
There are at least a couple of different approaches to resolving this, but to avoid surprises later, I decided to reset the owner of the tables to "dbo". To do so, I first ran this handy little snippet against the Umbraco db:
SELECT 'ALTER SCHEMA dbo TRANSFER ' + SCHEMA_NAME(schema_id) + '.' + name FROM sys.tables WHERE schema_id != SCHEMA_ID('dbo');
Which gives you a result set containing one row for each table in your database whose owner is not "dbo". Each row consists of a SQL statement which will reassign that table to the "dbo" schema:
ALTER SCHEMA dbo TRANSFER acme.cmsContent ALTER SCHEMA dbo TRANSFER acme.cmsContentType ALTER SCHEMA dbo TRANSFER acme.cmsContentTypeAllowedContentType ALTER SCHEMA dbo TRANSFER acme.cmsContentVersion etc.…
Copy this result, paste it into a new SQL query, run it, and voila…! your tables are once again visible to the Umbraco application.
(Please do remember to back your database up before running any administrative scripts on it!)
From what I can gather, when the Umbraco database is created, a new schema is created and all tables are created under this schema (eg. . rather than dbo.).
If you are using an existing database (eg. if you are copying a site), the credentials used to access the site are often changed, meaning the Umbraco data access layer may be trying to find oldUser.tables rather than newUser.tables.
I have found that changing the schema to dbo resolves this problem and can be achieved (as long as only the Umbraco tables for you website are contained in the database) with the following SQL script (this is a one line shorthand alternative to Richard Walter's post above):
exec sp_MSforeachtable 'ALTER SCHEMA dbo TRANSFER ?'
As Richard says, please backup the DB prior to running the above.
For more details, I have recently written an article on copying an Umbraco Website found at the following URL:
Error on Migration: Invalid object name 'umbracoUser'
Hi there,
I am having some issues with a migration of an Umbraco based website. Basically we are moving over from a Windows 2003, IIS 6 with MS SQL 2005 to a Windows 2008, IIS7 and MS SQL 2008.
I have taken a ZIP copy of the website structure and have backed up the database to .bak file and uploaded the file structure from the old install to the new install. Then I have created a new database (unfortuantly I could not keep the same name for the database) and then performed a restore on top of the clean database.
I have then updated the web config to point to the correct SQL Server, and updated the logon details.
When I try to open up the site I am getting the following:
Request Details
Trace Information
Umbraco Exception (DataLayer): SQL helper exception in ExecuteReader
at umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters)
at umbraco.BusinessLogic.User.setupUser(Int32 ID)
at umbraco.BusinessLogic.User..ctor(Int32 ID)
at umbraco.BusinessLogic.User.GetUser(Int32 id)
at umbraco.content.LoadContentFromDatabase()
at umbraco.content.LoadContent()
at umbraco.content.get_XmlContentInternal()
at umbraco.content.get_XmlContent()
at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnPreInit(EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Control Tree
Session State
Application State
Request Cookies Collection
Response Cookies Collection
Headers Collection
Response Headers Collection
Form Collection
Querystring Collection
Server Variables
If someone could help me out I would be very grateful, if I go to /install I get the logon screen appear but when I enter my details I get the same screen again.
Many thanks.
Stan Ferguson-Smith
Hi Stan
How did you do the database backup and how did you do the restore?
If I'm not mistaken there can be some issues when restoring a backup from MSSQL 2005 to 2008...
/Jan
I am getting the same error on a new install. Windows XP, MS SQL 2008 Express.
Found mixed answers elsewhere on the web. No luck.
Any help would be appreciated.
Is the umbracoUser mapped to the correct database?
/Jan
Looks like there's a problem with the database. umbracoUser is a table in the umbraco-database. (and often being mistaken with the user that connects to the DB).
Check if your connection-string is correct and then check if the table actually exists in your DB.
HTH,
Peter
... and check if your tables are created using the right db owner (dbo)
>Tommy
To get past this I finally deleted all and did a fresh install from WPI.
It looks like 'umbracoUser' was created in the db by the package,
once I used that name in step 2/5 (probably the step that builds web.config) all worked well.
Jay
Disregard the part of my last post about 'umbracoUser' created by the package. I'm on my fifth install now - all is working well and I've been able to use any name I wanted.
Jay
Hi there,
We did the back-up and restore using SQL Backup to a .BAK File.
One thing that has changed is the database name has changed from CMS_TEST to C001_ce would this be causing the issues?
I have download and installed the umbraco and getting the same error. well ofcourse there is umbrac_user us table in the database but I am not sure how do I get the database file.in the web.config file I have updated the connection string but there is no database in the so how its able to read this table?
anyhow could help me how do I installed the umbraco database on my sqlserver 08 ?
regards
I am going thru the same problem, trying to install my live site to my local, importing database was sucessful now when i try accessing my site on localhost i get this error "Umbraco invalid object name UMBRACOUSER"
Has anyone found solution to this??
Same problem for me. I use MySql. The solution for me was rename all the tables to upper case. Hope this helps.
Was this resolved for SQL Server? I'm having the same problem.
This one was driving me crazy, as well, but I believe I have found the solution (or at least I know I did in my case).
The problem is that depending on how Umbraco was installed on the remote server and/or how the db admin tool on that server assigns db users, you may find that the SQL Server 'owner' of your Umbraco tables is something other than "dbo". For instance, if you've created a db log-in called "acme", you may find that on looking at your Umbraco db you see that the table look like this:
acme.cmsContent
acme.cmsContentType
acme.cmsContentTypeAllowedContentType
acme.cmsContentVersion
etc.…
Depending on which schemas are associated with the login you're using to give Umbraco access to this database, these objects may turn out to be effectively 'invisible' to the Umbraco application… and therefore the "invalid object name" error. (I.e., the object name is perfectly valid, just not under the schema you're currently working with.)
There are at least a couple of different approaches to resolving this, but to avoid surprises later, I decided to reset the owner of the tables to "dbo". To do so, I first ran this handy little snippet against the Umbraco db:
Which gives you a result set containing one row for each table in your database whose owner is not "dbo". Each row consists of a SQL statement which will reassign that table to the "dbo" schema:
ALTER SCHEMA dbo TRANSFER acme.cmsContent
ALTER SCHEMA dbo TRANSFER acme.cmsContentType
ALTER SCHEMA dbo TRANSFER acme.cmsContentTypeAllowedContentType
ALTER SCHEMA dbo TRANSFER acme.cmsContentVersion
etc.…
Copy this result, paste it into a new SQL query, run it, and voila…! your tables are once again visible to the Umbraco application.
(Please do remember to back your database up before running any administrative scripts on it!)
Thanks richard,
This worked for me!!
L
Hi Sally,
From what I can gather, when the Umbraco database is created, a new schema is created and all tables are created under this schema (eg. . rather than dbo.).
If you are using an existing database (eg. if you are copying a site), the credentials used to access the site are often changed, meaning the Umbraco data access layer may be trying to find oldUser.tables rather than newUser.tables.
I have found that changing the schema to dbo resolves this problem and can be achieved (as long as only the Umbraco tables for you website are contained in the database) with the following SQL script (this is a one line shorthand alternative to Richard Walter's post above):
exec sp_MSforeachtable 'ALTER SCHEMA dbo TRANSFER ?'
As Richard says, please backup the DB prior to running the above.
For more details, I have recently written an article on copying an Umbraco Website found at the following URL:
http://www.carbonsoft.co.uk/articles/2012/06/copying-an-umbraco-instance.aspx
I hope this helps,
Richard
Thanks Richard,
Saved my day when copying the database for a new Azure install.
Ovidiu
is working on a reply...