Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
Strategies
»
Sharing data across multiple schemas
Sharing data across multiple schemas
Rate Topic
Display Mode
Topic Options
Author
Message
Brian McGee-355525
Brian McGee-355525
Posted Thursday, October 01, 2009 2:32 AM
Valued Member
Group: General Forum Members
Last Login: Tuesday, February 01, 2011 4:17 PM
Points: 56,
Visits: 173
I keep hitting this scenario, and would like to know what people think is the best approach.
I have a main database schema, containing about 1000 tables and 100 dictionary tables (lookup data which is not modified by sql code). I have about 10 other schemas, some of which require access to this lookup data.
The approach I have taken historically is to copy the dictionary tables on the basis that they are static anyway, however invariably they get out of synch. Yes I could add tighter controls to ensure people don't change one without changing another etc, however I am wondering is there a preferred technical solution to sharing dictionary data across multiple databases.
They will not all be on the same server. I had thought about creating a separate database just for the dictionary tables and putting one instance on each server, and using replication to keep them up to date from a 'master', but then I can't create foreign keys!
Ideas?
Post #796188
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
Posted Thursday, October 01, 2009 9:04 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 12:00 PM
Points: 2,988,
Visits: 4,412
Post suggests there are two different issues here.
1) "Sharing" a table in between different schemas or the same database.
2) "Sharing" a table in between different databases located in different servers.
In the first case, I can see no compelling reason to duplicate the "shared" table to every single schema. I would just access the main -unique- "shared" table just by fully qualifying it.
In the second case, I would go with replication.
_____________________________________
Pablo (Paul) Berzukov
Author of
Understanding Database Administration
available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Post #796403
Brian McGee-355525
Brian McGee-355525
Posted Thursday, October 01, 2009 9:12 AM
Valued Member
Group: General Forum Members
Last Login: Tuesday, February 01, 2011 4:17 PM
Points: 56,
Visits: 173
Thanks for your response.
Problem is foreign keys. I know I can't create FKs to values in other databases (whether on the same server or not), which is why I'm asking, what would be considered best practice for this scenario?
Replication will only help in so far as I can ensure the lookup data is the same on all servers, but.......I lose the ability to apply foreign keys.
Example:
Server1 : MainDB, two smaller DBs. All require same lookup data
Server2 : (Different instance of) MainDB, three smaller DBs. All require same lookup data as above
Currently the lookup data is in the "MainDB" schema. Unless I copy it to the other schema I can't apply foreign keys.
So what do other people do in these situations?
Brian
Post #796411
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
Posted Thursday, October 01, 2009 1:13 PM
SSCrazy
Group: General Forum Members
Last Login: Today @ 12:00 PM
Points: 2,988,
Visits: 4,412
Question would be... why you want to have FKs on those replicated tables pointing to a different server? Parent-Child relationships are already validated at the source
e.g. your "master" database.
Replication ensures data will be the same.
_____________________________________
Pablo (Paul) Berzukov
Author of
Understanding Database Administration
available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Post #796592
Brian McGee-355525
Brian McGee-355525
Posted Monday, October 05, 2009 3:07 AM
Valued Member
Group: General Forum Members
Last Login: Tuesday, February 01, 2011 4:17 PM
Points: 56,
Visits: 173
I can see I haven't explained it well enough
Database A, master schema, has dictionary tables such as 'ApplicationName' and 'CustomerType'.
Databases B, C and D are entirely different schemas, however also contain applications and customers of types which need to be validated against a master list.
If I create the 'ApplicationName' table in both databases, the data can get out of synch. I *do* need the tables in each of the A, B, C and D schemas to be validated against these master lists, and can't create FKs if 'ApplicationName' sits outside of these in its own schema, *or* if 'ApplicationName' exists in just one of the schemas.
Do you see?
Post #797724
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.