From gustav at cactus.dk Wed Apr 1 08:12:45 2015 From: gustav at cactus.dk (Gustav Brock) Date: Wed, 1 Apr 2015 13:12:45 +0000 Subject: [dba-SQLServer] Moving database (was: Schemas for separation of clients?) Message-ID: Hi Mark In SSMS the full version number is also displayed when the connect to the server instance: The AWS server is not 2014 but 10.50..4297 My in-house server is 10.50.2550 It brings some kind of relief and helps not to lose ones self-esteem to learn, that I'm not the first to find this process to be overly complicated: http://stackoverflow.com/questions/2043726/best-way-to-copy-a-database-sql-server-2008 but that and this: https://msdn.microsoft.com/en-us/library/ms190447.aspx pushed me in "a" direction that turned into success: So what I did was these three steps: - create a full backup of the database on the local server - on the AWS machine, copy this file from the RDP connected drive from my LAN to the backup folder on the AWS machine - run this script in SSMS 2008 R2 on the AWS machine: RESTORE database MyDatabaseName FROM disk = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\ MyDatabaseName.bak' with recovery, move 'MyDatabaseName ' to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\ MyDatabaseName.mdf', move 'MyDatabaseName_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\MyDatabaseName_log.ldf' The first step is fast, the third step is very fast, while the second step takes some time determined by your upload speed. With no further actions I could relink my tables to the database running on the AWS instance. However, I would still like to learn of any simpler method. /gustav -----Oprindelig meddelelse----- Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Mark Breen Sendt: 30. marts 2015 20:44 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] Schemas for separation of clients? Hello Gustav definitely not. That is a real hassle and you are never sure you have 100% of what you had previously. 1) check your db version again "Select @@Version" 2) check your compatibility mode on your two machines 3) spin up another amazon box and see can you restore to 2014 and work down from there it will work On 31 March 2015 at 01:40, Gustav Brock wrote: > Hi Mark > > That's what I thought. But the straight backup complains that it is > restoring to a different server (which is correct), then stops - and > another method claims that it cannot restore to a 2005 or newer(!) > version, which is nonsense but I binged that to be a way of telling > you, that it will not backup data from a Standard version to an Express version. > > I can copy the data, but then all indexes and relations are lost. > > A third method (can't recall which at this confusing moment) stops > because it cannot write the timestamps to read-only fields. > > Do I really need to fire up the data migration Tool? > > /gustav > > ________________________________________ > Fra: dba-SQLServer p? > vegne af Mark Breen > Sendt: 30. marts 2015 20:28 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > Hello Gustav, > > if your db is really the same version, it will simply restore a > backup. I am 100 % sure about that. SQL standard to sql express is perfectly fine. > I have done it many times. As you probably know, you cannot restore a > newer version to an older version. > > Can you try the backup and restore using standard sql server backup. > > > > On 31 March 2015 at 00:21, Gustav Brock wrote: > > > Hi Mark > > > > How do you copy a database from an in-house SQL Server 2008 Standard > > to the hosted SQL Server 2008 Express? > > I can copy and create the schema, but have had no luck finding a method to > > copy either the data to the created schema or the complete database. > > > > I have used both SSMS 2008 on the AWS machine as well as SSMS 2012/2014 on > > my own machines. > > > > There has to be a simple and proven method. > > > > /gustav From jwcolby at gmail.com Wed Apr 1 09:03:33 2015 From: jwcolby at gmail.com (John W. Colby) Date: Wed, 01 Apr 2015 10:03:33 -0400 Subject: [dba-SQLServer] Moving database (was: Schemas for separation of clients?) In-Reply-To: References: Message-ID: <551BFAB5.9010608@gmail.com> Gustav, Not sure how you are going to get simpler. What exactly do the two moves do? John W. Colby On 4/1/2015 9:12 AM, Gustav Brock wrote: > Hi Mark > > In SSMS the full version number is also displayed when the connect to the server instance: > > The AWS server is not 2014 but 10.50..4297 > My in-house server is 10.50.2550 > > It brings some kind of relief and helps not to lose ones self-esteem to learn, that I'm not the first to find this process to be overly complicated: > > http://stackoverflow.com/questions/2043726/best-way-to-copy-a-database-sql-server-2008 > > but that and this: > > https://msdn.microsoft.com/en-us/library/ms190447.aspx > > pushed me in "a" direction that turned into success: > > So what I did was these three steps: > - create a full backup of the database on the local server > - on the AWS machine, copy this file from the RDP connected drive from my LAN to the backup folder on the AWS machine > - run this script in SSMS 2008 R2 on the AWS machine: > > RESTORE database MyDatabaseName FROM disk = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\ MyDatabaseName.bak' > with recovery, > move 'MyDatabaseName ' to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\ MyDatabaseName.mdf', > move 'MyDatabaseName_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\MyDatabaseName_log.ldf' > > The first step is fast, the third step is very fast, while the second step takes some time determined by your upload speed. > > With no further actions I could relink my tables to the database running on the AWS instance. > > However, I would still like to learn of any simpler method. > > /gustav > > > -----Oprindelig meddelelse----- > Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Mark Breen > Sendt: 30. marts 2015 20:44 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > Hello Gustav > > definitely not. That is a real hassle and you are never sure you have 100% of what you had previously. > > 1) check your db version again "Select @@Version" > 2) check your compatibility mode on your two machines > 3) spin up another amazon box and see can you restore to 2014 and work down from there > > it will work > > > > On 31 March 2015 at 01:40, Gustav Brock wrote: > >> Hi Mark >> >> That's what I thought. But the straight backup complains that it is >> restoring to a different server (which is correct), then stops - and >> another method claims that it cannot restore to a 2005 or newer(!) >> version, which is nonsense but I binged that to be a way of telling >> you, that it will not backup data from a Standard version to an Express version. >> >> I can copy the data, but then all indexes and relations are lost. >> >> A third method (can't recall which at this confusing moment) stops >> because it cannot write the timestamps to read-only fields. >> >> Do I really need to fire up the data migration Tool? >> >> /gustav >> >> ________________________________________ >> Fra: dba-SQLServer p? >> vegne af Mark Breen >> Sendt: 30. marts 2015 20:28 >> Til: Discussion concerning MS SQL Server >> Emne: Re: [dba-SQLServer] Schemas for separation of clients? >> >> Hello Gustav, >> >> if your db is really the same version, it will simply restore a >> backup. I am 100 % sure about that. SQL standard to sql express is perfectly fine. >> I have done it many times. As you probably know, you cannot restore a >> newer version to an older version. >> >> Can you try the backup and restore using standard sql server backup. >> >> >> >> On 31 March 2015 at 00:21, Gustav Brock wrote: >> >>> Hi Mark >>> >>> How do you copy a database from an in-house SQL Server 2008 Standard >>> to the hosted SQL Server 2008 Express? >>> I can copy and create the schema, but have had no luck finding a method to >>> copy either the data to the created schema or the complete database. >>> >>> I have used both SSMS 2008 on the AWS machine as well as SSMS 2012/2014 on >>> my own machines. >>> >>> There has to be a simple and proven method. >>> >>> /gustav > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From gustav at cactus.dk Wed Apr 1 09:11:40 2015 From: gustav at cactus.dk (Gustav Brock) Date: Wed, 1 Apr 2015 14:11:40 +0000 Subject: [dba-SQLServer] Moving database (was: Schemas for separation of clients?) Message-ID: Hi John I think they define the physical location (local path) and file names of the mdf and ldf files. If moving/copying a database from one server to another, the path may very well be different. If copying a database to a new on the same server, either the path(s) or the filename(s) has to be different. /gustav -----Oprindelig meddelelse----- Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af John W. Colby Sendt: 1. april 2015 16:04 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] Moving database (was: Schemas for separation of clients?) Gustav, Not sure how you are going to get simpler. What exactly do the two moves do? John W. Colby On 4/1/2015 9:12 AM, Gustav Brock wrote: > Hi Mark > > In SSMS the full version number is also displayed when the connect to the server instance: > > The AWS server is not 2014 but 10.50..4297 > My in-house server is 10.50.2550 > > It brings some kind of relief and helps not to lose ones self-esteem to learn, that I'm not the first to find this process to be overly complicated: > > > http://stackoverflow.com/questions/2043726/best-way-to-copy-a-database > -sql-server-2008 > > but that and this: > > https://msdn.microsoft.com/en-us/library/ms190447.aspx > > pushed me in "a" direction that turned into success: > > So what I did was these three steps: > - create a full backup of the database on the local server > - on the AWS machine, copy this file from the RDP connected drive from my LAN to the backup folder on the AWS machine > - run this script in SSMS 2008 R2 on the AWS machine: > > RESTORE database MyDatabaseName FROM disk = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\ MyDatabaseName.bak' > with recovery, > move 'MyDatabaseName ' to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\ MyDatabaseName.mdf', > move 'MyDatabaseName_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\MyDatabaseName_log.ldf' > > The first step is fast, the third step is very fast, while the second step takes some time determined by your upload speed. > > With no further actions I could relink my tables to the database running on the AWS instance. > > However, I would still like to learn of any simpler method. > > /gustav > > > -----Oprindelig meddelelse----- > Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] > P? vegne af Mark Breen > Sendt: 30. marts 2015 20:44 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > Hello Gustav > > definitely not. That is a real hassle and you are never sure you have 100% of what you had previously. > > 1) check your db version again "Select @@Version" > 2) check your compatibility mode on your two machines > 3) spin up another amazon box and see can you restore to 2014 and work > down from there > > it will work > > > > On 31 March 2015 at 01:40, Gustav Brock wrote: > >> Hi Mark >> >> That's what I thought. But the straight backup complains that it is >> restoring to a different server (which is correct), then stops - and >> another method claims that it cannot restore to a 2005 or newer(!) >> version, which is nonsense but I binged that to be a way of telling >> you, that it will not backup data from a Standard version to an Express version. >> >> I can copy the data, but then all indexes and relations are lost. >> >> A third method (can't recall which at this confusing moment) stops >> because it cannot write the timestamps to read-only fields. >> >> Do I really need to fire up the data migration Tool? >> >> /gustav >> >> ________________________________________ >> Fra: dba-SQLServer p? >> vegne af Mark Breen >> Sendt: 30. marts 2015 20:28 >> Til: Discussion concerning MS SQL Server >> Emne: Re: [dba-SQLServer] Schemas for separation of clients? >> >> Hello Gustav, >> >> if your db is really the same version, it will simply restore a >> backup. I am 100 % sure about that. SQL standard to sql express is perfectly fine. >> I have done it many times. As you probably know, you cannot restore >> a newer version to an older version. >> >> Can you try the backup and restore using standard sql server backup. >> >> >> >> On 31 March 2015 at 00:21, Gustav Brock wrote: >> >>> Hi Mark >>> >>> How do you copy a database from an in-house SQL Server 2008 Standard >>> to the hosted SQL Server 2008 Express? >>> I can copy and create the schema, but have had no luck finding a >>> method to copy either the data to the created schema or the complete database. >>> >>> I have used both SSMS 2008 on the AWS machine as well as SSMS >>> 2012/2014 on my own machines. >>> >>> There has to be a simple and proven method. >>> >>> /gustav From marklbreen at gmail.com Wed Apr 1 09:57:29 2015 From: marklbreen at gmail.com (Mark Breen) Date: Wed, 1 Apr 2015 21:57:29 +0700 Subject: [dba-SQLServer] Moving database (was: Schemas for separation of clients?) In-Reply-To: References: Message-ID: Hello Gustav Sorry if this is an annoying question. Did you use the GUI in ssms to do the restore. I only ever have to play with the file names if I am restoring a backup onto the machine I just did the back on, eg restoring mydb to mydb20150401 Anyway question is does the GUI take care of the restore. Mark On 1 Apr 2015 20:13, "Gustav Brock" wrote: > Hi Mark > > In SSMS the full version number is also displayed when the connect to the > server instance: > > The AWS server is not 2014 but 10.50..4297 > My in-house server is 10.50.2550 > > It brings some kind of relief and helps not to lose ones self-esteem to > learn, that I'm not the first to find this process to be overly complicated: > > > http://stackoverflow.com/questions/2043726/best-way-to-copy-a-database-sql-server-2008 > > but that and this: > > https://msdn.microsoft.com/en-us/library/ms190447.aspx > > pushed me in "a" direction that turned into success: > > So what I did was these three steps: > - create a full backup of the database on the local server > - on the AWS machine, copy this file from the RDP connected drive from my > LAN to the backup folder on the AWS machine > - run this script in SSMS 2008 R2 on the AWS machine: > > RESTORE database MyDatabaseName FROM disk = N'C:\Program > Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\ > MyDatabaseName.bak' > with recovery, > move 'MyDatabaseName ' to 'C:\Program Files\Microsoft SQL > Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\ MyDatabaseName.mdf', > move 'MyDatabaseName_log' to 'C:\Program Files\Microsoft SQL > Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\MyDatabaseName_log.ldf' > > The first step is fast, the third step is very fast, while the second step > takes some time determined by your upload speed. > > With no further actions I could relink my tables to the database running > on the AWS instance. > > However, I would still like to learn of any simpler method. > > /gustav > > > -----Oprindelig meddelelse----- > Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? > vegne af Mark Breen > Sendt: 30. marts 2015 20:44 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > Hello Gustav > > definitely not. That is a real hassle and you are never sure you have > 100% of what you had previously. > > 1) check your db version again "Select @@Version" > 2) check your compatibility mode on your two machines > 3) spin up another amazon box and see can you restore to 2014 and work > down from there > > it will work > > > > On 31 March 2015 at 01:40, Gustav Brock wrote: > > > Hi Mark > > > > That's what I thought. But the straight backup complains that it is > > restoring to a different server (which is correct), then stops - and > > another method claims that it cannot restore to a 2005 or newer(!) > > version, which is nonsense but I binged that to be a way of telling > > you, that it will not backup data from a Standard version to an Express > version. > > > > I can copy the data, but then all indexes and relations are lost. > > > > A third method (can't recall which at this confusing moment) stops > > because it cannot write the timestamps to read-only fields. > > > > Do I really need to fire up the data migration Tool? > > > > /gustav > > > > ________________________________________ > > Fra: dba-SQLServer p? > > vegne af Mark Breen > > Sendt: 30. marts 2015 20:28 > > Til: Discussion concerning MS SQL Server > > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > > > Hello Gustav, > > > > if your db is really the same version, it will simply restore a > > backup. I am 100 % sure about that. SQL standard to sql express is > perfectly fine. > > I have done it many times. As you probably know, you cannot restore a > > newer version to an older version. > > > > Can you try the backup and restore using standard sql server backup. > > > > > > > > On 31 March 2015 at 00:21, Gustav Brock wrote: > > > > > Hi Mark > > > > > > How do you copy a database from an in-house SQL Server 2008 Standard > > > to the hosted SQL Server 2008 Express? > > > I can copy and create the schema, but have had no luck finding a > method to > > > copy either the data to the created schema or the complete database. > > > > > > I have used both SSMS 2008 on the AWS machine as well as SSMS > 2012/2014 on > > > my own machines. > > > > > > There has to be a simple and proven method. > > > > > > /gustav > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From gustav at cactus.dk Wed Apr 1 10:05:54 2015 From: gustav at cactus.dk (Gustav Brock) Date: Wed, 1 Apr 2015 15:05:54 +0000 Subject: [dba-SQLServer] Moving database (was: Schemas for separation of clients?) Message-ID: Hi Mark I believe I tried, but at the restore it claimed, that the server restoring to was not the same as that of the backup, which of course is true. I cannot rule out that I've missed something, though. /gustav -----Oprindelig meddelelse----- Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Mark Breen Sendt: 1. april 2015 16:57 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] Moving database (was: Schemas for separation of clients?) Hello Gustav Sorry if this is an annoying question. Did you use the GUI in ssms to do the restore. I only ever have to play with the file names if I am restoring a backup onto the machine I just did the back on, eg restoring mydb to mydb20150401 Anyway question is does the GUI take care of the restore. Mark On 1 Apr 2015 20:13, "Gustav Brock" wrote: > Hi Mark > > In SSMS the full version number is also displayed when the connect to > the server instance: > > The AWS server is not 2014 but 10.50..4297 > My in-house server is 10.50.2550 > > It brings some kind of relief and helps not to lose ones self-esteem > to learn, that I'm not the first to find this process to be overly complicated: > > > http://stackoverflow.com/questions/2043726/best-way-to-copy-a-database > -sql-server-2008 > > but that and this: > > https://msdn.microsoft.com/en-us/library/ms190447.aspx > > pushed me in "a" direction that turned into success: > > So what I did was these three steps: > - create a full backup of the database on the local server > - on the AWS machine, copy this file from the RDP connected drive > from my LAN to the backup folder on the AWS machine > - run this script in SSMS 2008 R2 on the AWS machine: > > RESTORE database MyDatabaseName FROM disk = N'C:\Program > Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\ > MyDatabaseName.bak' > with recovery, > move 'MyDatabaseName ' to 'C:\Program Files\Microsoft SQL > Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\ MyDatabaseName.mdf', > move 'MyDatabaseName_log' to 'C:\Program Files\Microsoft SQL > Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\MyDatabaseName_log.ldf' > > The first step is fast, the third step is very fast, while the second > step takes some time determined by your upload speed. > > With no further actions I could relink my tables to the database > running on the AWS instance. > > However, I would still like to learn of any simpler method. > > /gustav > > > -----Oprindelig meddelelse----- > Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] > P? vegne af Mark Breen > Sendt: 30. marts 2015 20:44 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > Hello Gustav > > definitely not. That is a real hassle and you are never sure you have > 100% of what you had previously. > > 1) check your db version again "Select @@Version" > 2) check your compatibility mode on your two machines > 3) spin up another amazon box and see can you restore to 2014 and work > down from there > > it will work From accessd at shaw.ca Thu Apr 2 11:13:29 2015 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 2 Apr 2015 10:13:29 -0600 (MDT) Subject: [dba-SQLServer] Interest in using and getting the most out of AWS In-Reply-To: <551BFAB5.9010608@gmail.com> Message-ID: <339014247.38280370.1427991209051.JavaMail.root@shaw.ca> Hi All: Just a thought...for those of you who want to get the most out of AWS there are a number of courses available for quite reasonable: https://linuxacademy.com/amazon-web-services Jim From fhtapia at gmail.com Thu Apr 2 11:26:36 2015 From: fhtapia at gmail.com (fhtapia at gmail.com) Date: Thu, 02 Apr 2015 16:26:36 +0000 Subject: [dba-SQLServer] Schemas for separation of clients? In-Reply-To: <551AA9BD.4090504@gmail.com> References: <1427625637241.81245@cactus.dk> <1427643672337.64096@cactus.dk> <551AA9BD.4090504@gmail.com> Message-ID: John, (sorry for the late reply) In the past Schemas and Users were one in the same. Today you can generate a Schema as a container. This can offer benefits in security, and data segregation. It is entirely possible for you to generate a full container for client data as if it was the model database. core functionality can be maintained because default Views and Procedures can be written where you do not explicitly describe the default_schema and the container for these would be an app schema . That means that a select statement in your view/sproc would look like: --- Select * From AppName.vw_Clients --- within that view [AppName].[vw_Clients] it would read as: select * from tblMyClientTable which is interpreted if my schema my user was assigned to was Client100 as: SELECT * FROM Client100.tblMyClientTable if the table is not found in the default schema such as ClientID.tblMyClientTable then it will revert back to dbo.tblMyClientTable if I want the same TABLE setup for all clients, I would need to script my table changes and write a UPDATE statement that would loop through all client tables that needed to be updated. Yes, that's not ideal but that's why you don't develop in production, you MUST and I can't stress this enough MUST have a development environment where you can unit test you changes. Such as a local copy on your own computer vs on another server. There is no reason to create procedures and views in the default client schema outside of dbo unless you want specific functionality for that client schema. the issues in your database from hell scenario can be problematic because you DO NOT login with different schemas, The idea for a schema with users is that they login and the data is auto-segregated because of their relationship to the schema and the objects it owns and this allows you to simplify your coding by writing views and stored procedures that can be found for all clients. one possible work-around for your dbhell scenario is for you to create a reporting user that you can login with and have initialization logic that you provide it a schema_name and it would move your user into that schema to simplify reporting for that client. (just a thought). Maintenance: adding new objects (Tables and changes to Tables) does require that your create new schema for client logic always includes all objects for your model schema. Regards, Francisco On Tue, Mar 31, 2015 at 7:06 AM John W. Colby wrote: > Francisco, thanks for replying to this discussion. I worked at IBM in > large databases. The way they used schemas was that the schema allowed > creating anything you wanted (tables, views, SPs etc) which were > assigned to a specific schema. The result was a horrendous mess simply > because inside each database was a ton of stuff for each schema. > Imagine in this case that you want identical stuff for each client, same > tables, same views etc. and that there are 500 items total (tables / > views / SPs etc). Each client would have their own COPY of each item. > If you fix one, you ONLY fix the item for that schema. If you have 100 > clients..... imagine the quantity of items in the database container. > > Understand that I did not get into the hows and whys, just the results. > The result was a mess. At IBM, schemas appeared to be used to group > what various employees could see, not what clients could see. Since the > quantity of employee "groups" was quantifiable, the result did kind of > work, though it was still messy. IIRC, the schemas could be assigned to > login groups to limit ACCESS to various items. It was all rather > confusing to me but I was not tasked with understanding and implementing > it. > > I do not understand how a schema could be used in the context of an > infinite (or at least ever expanding) number of clients. > > I certainly don't have an answer for this problem but I am not > convinced, given my run-in with schemas that they are that answer. > > You are the guru here though so I am interested in your take. > > John W. Colby > > On 3/31/2015 9:42 AM, fhtapia at gmail.com wrote: > > Hello Mark, > > If the intent is to provide a segregated security space for multiple > > users, then Schema's offers a huge advantage. They are simply containers > > to an entire database set per grouping. > > > > It is much simpler to set security based on the schema, than to focus on > > the individual db Table. not to mention, the peril of accidentally > > returning data back to a customer that is not their own because the > > query/sproc had access to any data in the table. > > > > more solid points: > > > > http://blog.sqlauthority.com/2009/09/07/sql-server-importanc > e-of-database-schemas-in-sql-server/ > > > > -- > > Francisco > > > From fhtapia at gmail.com Thu Apr 2 11:29:27 2015 From: fhtapia at gmail.com (fhtapia at gmail.com) Date: Thu, 02 Apr 2015 16:29:27 +0000 Subject: [dba-SQLServer] Schemas for separation of clients? In-Reply-To: References: Message-ID: Are you referring to the dataset just for a schema? one method would be to do it via using MSSMS and scripting out both the schema and data: http://stackoverflow.com/questions/2254878/is-there-a-way-to-export-an-entire-sql-server-database-schema-and-data-to-te On Tue, Mar 31, 2015 at 10:23 AM Gustav Brock wrote: > Thanks Francisco, I'll mark that. > > Next question is if you can manage backup and restore of individual > schemas - if perhaps not easily then, at least, reliably? > > /gustav > > -----Oprindelig meddelelse----- > Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? > vegne af fhtapia at gmail.com > Sendt: 31. marts 2015 15:42 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > Hello Mark, > If the intent is to provide a segregated security space for multiple > users, then Schema's offers a huge advantage. They are simply containers > to an entire database set per grouping. > > It is much simpler to set security based on the schema, than to focus on > the individual db Table. not to mention, the peril of accidentally > returning data back to a customer that is not their own because the > query/sproc had access to any data in the table. > > more solid points: > > http://blog.sqlauthority.com/2009/09/07/sql-server-importance-of-database- > schemas-in-sql-server/ > > -- > Francisco > > On Sun, Mar 29, 2015 at 10:59 AM Mark Breen wrote: > > > Hello Gustav > > > > I would not take this approach for a few reasons. > > > > Before I start however, I see no technical reason why you cannot do > > it. In fact you could even keep one schema and just set permission s > > at dB table level. I only used multiple schemas one time and found it a > pita. > > > > 1 reason is such complexity for small financial benefit. You are > > going against the normal use and it will be a struggle sooner or later. > > > > 2 security will sooner or later leak across the tables. You goal is > > segregation but you are putting everything in one dB and hoping nobody > > makes a mistake in a year or two. > > > > 3 financially, the gain is not sufficient to justify the hoops you > > have to jump through. Unless the customer is paying pennies. If the > > budget is so low to force this approach then reconsider and use a > > cloud VM and install SQL express and have separate dB's for everyone. > > > > With aws and azure so cheap I would avoid the unconventional dB > > storage if possible. > > > > Hth > > > > Mark > > On 29 Mar 2015 22:42, "Gustav Brock" wrote: > > > > > Hi Arthur > > > > > > The main reason is, that at Azure you don't pay by the instance but by > the > > > database. The cheapest is B Basic at about USD 5 per month which is > not bad > > > but, obviously, if that can serve perhaps 50 clients' data it's even > > > better. An even better deal - given low usage - is the S0 Standard > level at > > > about USD 14 per month for 250 GB database Space. > > > > > > As for the linking it should be quite easy; by default, a > > > dbo.mytable is linked as dbo_mytable which you normally rename > > > locally to mytable. So, when linking, you should link to > > > client1.mytable, which will be given the name client1_mytable, which > > > you rename to mytable. From that on, your application knows > > > absolutely nothing about the tables of schema client2 etc. > > > > > > I cannot see why it shouldn't work, but I'm not a dba, indeed not > > > regarding Azure SQL, so I'm looking for possible pitfalls. > > > > > > /gustav > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From gustav at cactus.dk Thu Apr 2 12:00:43 2015 From: gustav at cactus.dk (Gustav Brock) Date: Thu, 2 Apr 2015 17:00:43 +0000 Subject: [dba-SQLServer] Schemas for separation of clients? In-Reply-To: References: , Message-ID: <1427994043009.15446@cactus.dk> Thanks Francisco, that seems to be exactly what I was wondering about. /gustav ________________________________________ Fra: dba-SQLServer p? vegne af fhtapia at gmail.com Sendt: 2. april 2015 18:29 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] Schemas for separation of clients? Are you referring to the dataset just for a schema? one method would be to do it via using MSSMS and scripting out both the schema and data: http://stackoverflow.com/questions/2254878/is-there-a-way-to-export-an-entire-sql-server-database-schema-and-data-to-te On Tue, Mar 31, 2015 at 10:23 AM Gustav Brock wrote: > Thanks Francisco, I'll mark that. > > Next question is if you can manage backup and restore of individual > schemas - if perhaps not easily then, at least, reliably? > > /gustav > > -----Oprindelig meddelelse----- > Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? > vegne af fhtapia at gmail.com > Sendt: 31. marts 2015 15:42 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > Hello Mark, > If the intent is to provide a segregated security space for multiple > users, then Schema's offers a huge advantage. They are simply containers > to an entire database set per grouping. > > It is much simpler to set security based on the schema, than to focus on > the individual db Table. not to mention, the peril of accidentally > returning data back to a customer that is not their own because the > query/sproc had access to any data in the table. > > more solid points: > > http://blog.sqlauthority.com/2009/09/07/sql-server-importance-of-database- > schemas-in-sql-server/ > > -- > Francisco From fuller.artful at gmail.com Fri Apr 10 16:46:37 2015 From: fuller.artful at gmail.com (Arthur Fuller) Date: Fri, 10 Apr 2015 17:46:37 -0400 Subject: [dba-SQLServer] Michael Stonebraker on the obsolescence of Oracle, DB2 and SQL Server Message-ID: Database legend Michael Stonebraker explains why these databases are obsolete , and also the enormous challenge facing Facebook. -- Arthur From fhtapia at gmail.com Sat Apr 11 09:47:10 2015 From: fhtapia at gmail.com (fhtapia at gmail.com) Date: Sat, 11 Apr 2015 14:47:10 +0000 Subject: [dba-SQLServer] Michael Stonebraker on the obsolescence of Oracle, DB2 and SQL Server In-Reply-To: References: Message-ID: Fantastic article Arthur, thanks for linking to it! On Fri, Apr 10, 2015 at 2:47 PM Arthur Fuller wrote: > Database legend Michael Stonebraker explains why these databases are > obsolete > < > http://blogs.barrons.com/techtraderdaily/2015/03/30/michael-stonebraker-describes-oracles-obsolescence-facebooks-enormous-challenge/?utm_source=dbweekly&utm_medium=email > >, > and also the enormous challenge facing Facebook. > > -- > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Sat Apr 11 10:56:49 2015 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sat, 11 Apr 2015 11:56:49 -0400 Subject: [dba-SQLServer] Michael Stonebraker on the obsolescence of Oracle, DB2 and SQL Server In-Reply-To: References: Message-ID: Francisco, I thought so, too, and hence the post. After reading it, I read up on VoltDB and then downloaded the community edition. Dr. Stonebraker as been right so many times that I'm going to skip the NoSQL stage ad dive right into Volt. Arthur On Sat, Apr 11, 2015 at 10:47 AM, wrote: > Fantastic article Arthur, thanks for linking to it! > > From darryl at whittleconsulting.com.au Sun Apr 12 23:30:27 2015 From: darryl at whittleconsulting.com.au (Darryl Collins) Date: Mon, 13 Apr 2015 04:30:27 +0000 Subject: [dba-SQLServer] Michael Stonebraker on the obsolescence of Oracle, DB2 and SQL Server In-Reply-To: References: Message-ID: Thanks Arthur. A good read. Cheers Darryl -----Original Message----- From: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Saturday, 11 April 2015 7:47 AM To: Discussion concerning MS SQL Server Subject: [dba-SQLServer] Michael Stonebraker on the obsolescence of Oracle, DB2 and SQL Server Database legend Michael Stonebraker explains why these databases are obsolete , and also the enormous challenge facing Facebook. -- Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From fhtapia at gmail.com Thu Apr 16 09:07:54 2015 From: fhtapia at gmail.com (fhtapia at gmail.com) Date: Thu, 16 Apr 2015 14:07:54 +0000 Subject: [dba-SQLServer] Schemas for separation of clients? In-Reply-To: <1427994043009.15446@cactus.dk> References: <1427994043009.15446@cactus.dk> Message-ID: since we were on this topic recently, some of you may be interested in reading this very interesting article on Schemas :) (Yes, I said Schemas and interesting in the same sentence). https://www.simple-talk.com/sql/sql-training/schema-based-access-control-for-sql-server-databases/ On Thu, Apr 2, 2015 at 10:01 AM Gustav Brock wrote: > Thanks Francisco, that seems to be exactly what I was wondering about. > > /gustav > > ________________________________________ > Fra: dba-SQLServer p? vegne > af fhtapia at gmail.com > Sendt: 2. april 2015 18:29 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > Are you referring to the dataset just for a schema? > > one method would be to do it via using MSSMS and scripting out both the > schema and data: > > http://stackoverflow.com/questions/2254878/is-there-a-way-to-export-an-entire-sql-server-database-schema-and-data-to-te > > On Tue, Mar 31, 2015 at 10:23 AM Gustav Brock wrote: > > > Thanks Francisco, I'll mark that. > > > > Next question is if you can manage backup and restore of individual > > schemas - if perhaps not easily then, at least, reliably? > > > > /gustav > > > > -----Oprindelig meddelelse----- > > Fra: dba-SQLServer [mailto:dba-sqlserver-bounces at databaseadvisors.com] > P? > > vegne af fhtapia at gmail.com > > Sendt: 31. marts 2015 15:42 > > Til: Discussion concerning MS SQL Server > > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > > > Hello Mark, > > If the intent is to provide a segregated security space for multiple > > users, then Schema's offers a huge advantage. They are simply containers > > to an entire database set per grouping. > > > > It is much simpler to set security based on the schema, than to focus on > > the individual db Table. not to mention, the peril of accidentally > > returning data back to a customer that is not their own because the > > query/sproc had access to any data in the table. > > > > more solid points: > > > > > http://blog.sqlauthority.com/2009/09/07/sql-server-importance-of-database- > > schemas-in-sql-server/ > > > > -- > > Francisco > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From davidmcafee at gmail.com Thu Apr 16 11:52:03 2015 From: davidmcafee at gmail.com (David McAfee) Date: Thu, 16 Apr 2015 09:52:03 -0700 Subject: [dba-SQLServer] Schemas for separation of clients? In-Reply-To: References: <1427994043009.15446@cactus.dk> Message-ID: Francisco is one of the few people that I know that can take a thick technical/ programming manual and read it cover to cover like it's a Robert Ludlum / Bourne Identity novel. ;) D On Thu, Apr 16, 2015 at 7:07 AM, wrote: > since we were on this topic recently, some of you may be interested in > reading this very interesting article on Schemas :) (Yes, I said Schemas > and interesting in the same sentence). > > > https://www.simple-talk.com/sql/sql-training/schema-based-access-control-for-sql-server-databases/ > > From fhtapia at gmail.com Thu Apr 16 12:48:20 2015 From: fhtapia at gmail.com (fhtapia at gmail.com) Date: Thu, 16 Apr 2015 17:48:20 +0000 Subject: [dba-SQLServer] Schemas for separation of clients? In-Reply-To: References: <1427994043009.15446@cactus.dk> Message-ID: Thanks Dave! I Try On Thu, Apr 16, 2015 at 9:52 AM David McAfee wrote: > Francisco is one of the few people that I know that can take a thick > technical/ programming manual and read it cover to cover like it's a > Robert Ludlum / Bourne Identity novel. > > ;) > > D > > On Thu, Apr 16, 2015 at 7:07 AM, wrote: > > > since we were on this topic recently, some of you may be interested in > > reading this very interesting article on Schemas :) (Yes, I said Schemas > > and interesting in the same sentence). > > > > > > > https://www.simple-talk.com/sql/sql-training/schema-based-access-control-for-sql-server-databases/ > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From gustav at cactus.dk Thu Apr 16 15:31:08 2015 From: gustav at cactus.dk (Gustav Brock) Date: Thu, 16 Apr 2015 20:31:08 +0000 Subject: [dba-SQLServer] Schemas for separation of clients? In-Reply-To: References: <1427994043009.15446@cactus.dk>, Message-ID: <1429216267381.84542@cactus.dk> Hi Francisco Perfect timing! That article is spot on and seems to cover every aspect. Thanks! /gustav ________________________________________ Fra: dba-SQLServer p? vegne af fhtapia at gmail.com Sendt: 16. april 2015 16:07 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] Schemas for separation of clients? since we were on this topic recently, some of you may be interested in reading this very interesting article on Schemas :) (Yes, I said Schemas and interesting in the same sentence). https://www.simple-talk.com/sql/sql-training/schema-based-access-control-for-sql-server-databases/ On Thu, Apr 2, 2015 at 10:01 AM Gustav Brock wrote: > Thanks Francisco, that seems to be exactly what I was wondering about. > > /gustav > > ________________________________________ > Fra: dba-SQLServer p? vegne > af fhtapia at gmail.com > Sendt: 2. april 2015 18:29 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Schemas for separation of clients? > > Are you referring to the dataset just for a schema? > > one method would be to do it via using MSSMS and scripting out both the > schema and data: > > http://stackoverflow.com/questions/2254878/is-there-a-way-to-export-an-entire-sql-server-database-schema-and-data-to-te > > On Tue, Mar 31, 2015 at 10:23 AM Gustav Brock wrote: > > > Thanks Francisco, I'll mark that. > > > > Next question is if you can manage backup and restore of individual > > schemas - if perhaps not easily then, at least, reliably? > > > > /gustav From davidmcafee at gmail.com Wed Apr 22 16:36:36 2015 From: davidmcafee at gmail.com (David McAfee) Date: Wed, 22 Apr 2015 14:36:36 -0700 Subject: [dba-SQLServer] Fwd: Database of databases (Field Types) In-Reply-To: References: Message-ID: Sorry for the cross posts, I just wanted to get as many possible opinions as possible... I have a database that I use for my SSIS procedure where we import records from various Access DBs into a SQL Server "mini data warehouse" I'm trying to compare fields for such conditions such as "added", "removed", "type change" or "size increase", so I can flag the field and trap for it at import time. Over the years, some of the tables have had fields added to them and some removed. When removed, I currently leave them in the SQL version, and bring them in as null. I don't know whether or not I should add a boolean "DontUse" field as I do for theMDBs for fields in the new tables that I am adding. I am also not sure if I should do it in tblFields or tblfieldsInTable (See below). Another idea that I am playing with is to add a "DateRemoved" column instead of a boolean, then I kind of have a historical record of when it was added and when it was removed. If I use this dateRemoved approach, should I re-add the field if it ever gets added back (should never happen)? I was also thinking of adding another table to deal with field status (added/removed), but I think that is over complicating things. With this design, I will have duplicate field names if it increases in size. Let's say ClientName_First is a text (35) and down the road it changes to a text (50) then later on maybe shortened to a text(25). I will only have the records for text (35) and text (50). I will always group and grab max size when comparing, so I will always look for ClientName_First with a text(>50) or of a different type. I could further normalize table Fields and break out the size and type to a different table, but again, I'm not sure if the added complication is worth it. Any thoughts/comments? I have the following tables: tblMDBs (a table of the source databases that are imported) MDBID (PK) MDBPath MDBName DateModified Version DoNotImportToSQL entryDate tbltables (a table of Tables) tblID tblName entryDate tblMDBTableJunct 9Junction table to match the tables to databases) JunctPKID, MDBID, tblID The new fields & tables that I am adding are: tblFields (Field names and types) FieldID FieldName FieldType FieldSize tblfieldsInTable (a junction table that links the field to the table (and database)) FITPKID (PK) JunctPKID (FK) FieldID (FK) ErrorFlagID (FK) entryDate tblErrorFlags ErrorFlagID ErrorFlagDescription these are the error flags: ErrorFlagID ErrorDescription 1 Field type has changed 2 Field size is larger 3 The field has been removed 4 A new field has been added