February 5, 2014 at 11:44 am
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
February 5, 2014 at 12:00 pm
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?
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[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
February 5, 2014 at 12:18 pm
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.
February 5, 2014 at 1:14 pm
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.
[font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]
February 5, 2014 at 1:32 pm
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
February 5, 2014 at 1:48 pm
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.
[font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]
February 5, 2014 at 3:55 pm
This question was also posted on the MSDN forums,
[font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply