Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Multiple Schemas means Multiple Users? Expand / Collapse
Author
Message
Posted Wednesday, February 5, 2014 11:44 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 7:15 AM
Points: 30, Visits: 410
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
Post #1538316
Posted Wednesday, February 5, 2014 12:00 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 3:09 PM
Points: 6,251, Visits: 7,411
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
Post #1538321
Posted Wednesday, February 5, 2014 12:18 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 7:15 AM
Points: 30, Visits: 410
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.
Post #1538328
Posted Wednesday, February 5, 2014 1:14 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, August 21, 2014 3:04 PM
Points: 801, Visits: 715
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
Post #1538350
Posted Wednesday, February 5, 2014 1:32 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 7:15 AM
Points: 30, Visits: 410
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
Post #1538358
Posted Wednesday, February 5, 2014 1:48 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, August 21, 2014 3:04 PM
Points: 801, Visits: 715
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
Post #1538363
Posted Wednesday, February 5, 2014 3:55 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, August 21, 2014 3:04 PM
Points: 801, Visits: 715
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
Post #1538402
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse