Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Multiple Schemas means Multiple Users?


Multiple Schemas means Multiple Users?

Author
Message
Kuzey
Kuzey
SSC Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 Visits: 519
Hello All,

I have db consolidation task in hand.
We have a one parent db and 10 child dbs. I want to create 10 schemas with the same names as child databases, and move all tables from child dbs to their matching schemas under the parent db.

Question is how to handle db connections without code changes.

We have one db login and the same user for all databases.
We are currently using a static db table(App_Id column, DB_Name column) to store application id and their db names for the app to create connection strings.
We are currently not specifying schema names(dbo), and plan to keep it that way after the consolidation.
We want zero changes on app code.

Do I have to create separate db users for each schema (and make the related schema as its default) so that the app does not need to use schema names?
Ideally, I just want to add a schema name column to the static table (App_Id column, DB_Name column, Schema column).

Please let me know what you think?

Thanks,

Kuzey
Evil Kraig F
Evil Kraig F
SSCertifiable
SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)

Group: General Forum Members
Points: 5689 Visits: 7660
Kuzey (2/5/2014)

Do I have to create separate db users for each schema (and make the related schema as its default) so that the app does not need to use schema names?


Yes.

And beware, if that user used to call the same named object from the two sources originally, they'll now see their schema's item twice, as it used to be database controlled.

Out of curiousity, what's driving this decision?

DB shells control security and recovery. What's driving you to merge them? Single code base that you're rolling out multiple times, just different user tables?


- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Kuzey
Kuzey
SSC Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 Visits: 519
The actual goal is to reduce the total number of databases. Each client has their own parent dbs + one db for each project. Schemas are identical, and one user is enough per client.
Erland Sommarskog
Erland Sommarskog
SSC Eights!
SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)

Group: General Forum Members
Points: 931 Visits: 866
So these 10 databases have the same set of tables, with each database serving a specific client?

I am not sure that I think it is a wise move to put all eggs into the same basket. Maybe if you had settled on actually merging all tables and rerwritten the application to use row-level security, but you say that you don't want to change the application.

Having separate databases means that you have to backup, reindex etc them individually. But it also means that you can restore the databases individually. If one client make something really stupid and scratch their data, you can restore that database without affecting other clients.

What database sizes are we talking about? Since you seem to be hosting a client application, moving the databases to the cloud may become of interest to you if it not already is. Currently, the maximum database size in Windows Azure SQL Database is 150 GB.

Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Kuzey
Kuzey
SSC Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 Visits: 519
Erland Sommarskog (2/5/2014)
So these 10 databases have the same set of tables, with each database serving a specific client?

I am not sure that I think it is a wise move to put all eggs into the same basket. Maybe if you had settled on actually merging all tables and rerwritten the application to use row-level security, but you say that you don't want to change the application.

Having separate databases means that you have to backup, reindex etc them individually. But it also means that you can restore the databases individually. If one client make something really stupid and scratch their data, you can restore that database without affecting other clients.

What database sizes are we talking about? Since you seem to be hosting a client application, moving the databases to the cloud may become of interest to you if it not already is. Currently, the maximum database size in Windows Azure SQL Database is 150 GB.


Erland,

We have one parent db per client + 5 to 30 project(child) dbs, and we have hundreds of clients. The project dbs will go under the parents as schemas.
The db sizes are less than 150GB but Azure does not accept more than 200 dbs as I remember.

Thanks,

Kuzey
Erland Sommarskog
Erland Sommarskog
SSC Eights!
SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)

Group: General Forum Members
Points: 931 Visits: 866
So all these child databases are all for the same client, and you have set of such databases per client? In that case, it certainly makes more sense.

But the child databases are per "project" and they all have the same schema? I might be tempted to shove all data into the same tables, and then have views in the schemas for the projects if I don't want to change the client.

Mind you, I know just as little abour your application as you have told me here, so I may be perfectly wrong.

Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Erland Sommarskog
Erland Sommarskog
SSC Eights!
SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)SSC Eights! (931 reputation)

Group: General Forum Members
Points: 931 Visits: 866
This question was also posted on the MSDN forums,
http://social.Msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/dac19eb7-fa4e-434c-82ef-3457a733403c#dac19eb7-fa4e-434c-82ef-3457a733403c

Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search