Multiple Schemas means Multiple Users?

  • 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

  • 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[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • 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.

  • 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]

  • 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

  • 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]

  • 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

    [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