Issue in Kentico v7 site configuration and database file on local machine

Rahul Raghuvanshi asked on September 4, 2014 17:08

Hello,

I am configuring Kentico 7 site and database file on my local machine from live server. I have whole Kentico 7 site application packages that I have configured in my IIS though virtual directory and restored my database file into SQL server.

I facing main issue is that in database there are two database user exist one is default "dbo" and other is user created "mondelioDBuser" and having two copies of all the objects like tables, stored procedures and view etc. like "dbo.CMS_User", "dbo.CMS_Site" and "mondelioDBuser.CMS_User", "mondelioDBuser.CMS_Site".

I have explored for "orphaned user" and refereed following article to set "orphaned user" into SQL servers tables, view and stored procedures and applied some query on SQL server to set orphan user into Master database table.

http://www.mssqltips.com/sqlservertip/1590/understanding-and-dealing-with-orphaned-users-in-a-sql-server-database/

Please have a look above link to understand my explanation more.

I am facing main issue is that when I am trying to login on CMS Site manager or CMS Desk via credentials, by default it is referring all the object that have prefix "dbo". while my whole site is under the "mondelioDBuser" prefix objects.

Please help me or guide me for setting or changing Database user from "dbo" to other DB user that is "mondelioDBuser" for accessing all objects that has prefix "mondelioDBuser" instead of "dbo" from Kentico site.

Thanks in advance.

Regards Rahul

Recent Answers


Charles Matvchuk answered on September 4, 2014 17:26

In SQL Server go into security under the username that you connect with and that Kentico uses to connect to the db with and make sure it owns the db_owner and/or dbo schema, remove any additional schemas it owns.

You will then need to run some sql to drop the tables that you do not need and then use the SQL AlterSchema command to change the db owner. By running the below script you will get the results of all the tables, just copy and paste that into a sql window and execute it. (replace 'Charles' with the schema owner you want to change).

SELECT 'ALTER SCHEMA dbo TRANSFER ' + s.Name + '.' + o.Name 
FROM sys.Objects o 
INNER JOIN sys.Schemas s on o.schema_id = s.schema_id 
WHERE s.Name = 'Charles'
And (o.Type = 'U' Or o.Type = 'P' Or o.Type = 'V')
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.