I'm working on a project in Visual Studio, and I want to create a local database file (.mdf) within the project directory so that it can be checked into SubVersion and have configuration management. Unfortunately, trying to create/attach a database on a network share leads to an error.
All of the resources I have found to enable NAS functionality are SQL Server 2000 based and do not work for 2005/2008.
I don't care about the performance issues surrounding storing a database non-locally and I can guarantee 100% up-time and connectivity to the file server during the periods that I have the database attached. I do care about having my database files stored with the project.
To clarify, my working set from SubVersion is on the NAS. Corporate mobility means I might be at a different workstation later and I'll need access to my working set.
Also, I don't want any answers telling me that I shouldn't do this... I know its strongly recommended against. However, in the case of some sort of database corruption I can always just revert back to the repository version.
Everyone (including Microsoft) can, should, and will tell you that this is not necessarily a good idea. Be that as it may, MS did provide a way to do this in SQL 2005 (and maybe earlier and maybe later): trace flag 1807. See the MS KB article 304261 for details. (I don't know if it's still valid for 2008.)
Jeff Atwood hat written an article about this topic
Check out his blog entry "Get Your Database Under Version Control" with links to the topic and this blog entry. Also look at the comments
Here are some tools for versioning Databases
I'm pretty sure that you cannot do this with a local mdf. You need to run an instance of SQL Server (even if its express). When you install the instance, you tell the installer package where to store its data and log files. At this point, tell SQL to keep its data and logs on the NAS.
Related
My boss tasked me with doing research on migrating sql server 2005 to 2014.
my first question is, is it really as easy as restoring into an old backup?
No thing needs to be changed in terms of processes that load to the databases or components that look at the databases?
I'm completely new to this, obviously. I use SQL server management studio almost every day, yet I am still not familiar with anything else besides running a few simple queries.
I've looked at this site here that finds all permissions/access for all users in a database. I've also run sp_who2 and:
SELECT *
FROM
Master..sysprocesses
order by spid
just to get an idea of all the processes going on. How would I see the websites that are pulling from the databases? I know we have a DB loader, how can I see that process?
I can't quite get a grasp of the scope of this project.
It can be as simple as backup and restore or an in-place upgrade, but there are subtle changes with each new edition that mean there's no way to be sure that it will be without thorough testing. There's hundreds of things that may catch you up caused by 10 years and 4 different revisions. Some might be as simple needing to fix SQL Users and SQL Login mapping, to changes to the SQL client causing incompatibility, to functions or methods that simply no longer work or work differently. It's impossible to tell without knowing your data and your database. The first step should be getting the documentation from your application vendor, assuming it's an application with support.
I strongly recommend that you start reading the MSDN doc on installing and upgrading SQL Server 2014, and you may need to read the 2008, 2008 R2, and 2012 doc as well to look for changes that might impact you. I'd strongly recommend setting up a testing environment to make sure that your application will even work.
Bottom line is that you should not assume that it will work without thorough investigation, planning, and testing.
I am completely ignorant in relation to databases and servers etc. Please bear with me.
I am trying to install a program called RealProspect 2009 which allows both local and remote sql database installation. Both types are done using the program installation .exe.
I have an azure account on which I have set up a server, and a database. During the program installation I am asked to provide the SQL server address, SQL server name, SQL username and SQL password. Using the information provided in the Azure online tools, I input all of this information into the fields and the program commences installing the database on the remote location. If I use incorrect information in these fields the installation returns an error and tells me it cannot log in, or the IP is not allowed etc., so I know it's actually attempting to connect and verifying the connection credentials.
When I use the correct server and login information the program proceeds. It spends several minutes "Creating the Tables". When it finishes doing that it attempts to begin "Installing Default Data (Categories)". At this point the program stops and I get the error in the subject line of this post "Invalid Object name 'Categories' "
I don't know enough to tell you what I don't know about this process.
I just signed up for Azure specifically because hosting the database with Azure is like $5-10 per month and I want myself and several other participants to be able to use the software with a common database. I created the server and database using the gui "tools/how to" from within the online Azure portal and I have never written a script, or accessed the server/database using anything other than the online GUI.
Thank you in advance for any help you may be able to provide. I hope i'm not too much of a speed bump to your day.
P.S. - For what it's worth you can download a free trial of the software from realinvestorsoftware.com and see if you could install it on a remote server. Maybe you can better see what I see and tell me how to do it on my own?
SQL Azure is VERY similar to SQL Server but there are a few features that SQL Azure doesn't support. That said, I'd be surprised if the app's installer is using any of the features that are unsupported by SQL Azure. My guess is that there's a bug in their installation scripts that might fail on more modern versions of SQL Server (note, their app installs on SQL Express 2005 which is no longer in mainstream support).
Just a couple of other thoughts for you: You get keys to install the app on two machines but:
"If you would like to install on more than two computers, then after you order your copy of RealProspect you can login to your customer account on this website and order additional activation keys for only $97 each."
Because you're going to be paying several hundred dollars anyway, and because (you yourself admit) you're not a database expert, it may be less cost, stress and hard-work to use their $27 per month database hosting service. That way you can concentrate on building your business while they take care of the technology.
[Update: 3/27/2013 # 23:05]
Another option Chris presented was to install the app and database locally and then migrate the database to Azure.
While this is potentially feasible, it requires some finesse to execute.
Microsoft provides a DB migration guide presenting several (pretty manual) options.
You might also want to read this thread which discusses how to migrate your DB via a DACPack.
Another option is to download and use the SQL Azure Migration Wizard which should do most of the heavy-lifting for you and make your DB migration simpler.
However, note that it is possible that the DB the app uses may use features of SQL Server that are not supported on SQL Azure. Hopefully this isn't the case, but be aware that this may be an issue.
Good luck :)
Chris,
I think SQL Database Migration Wizard v3.9.10 & v4.0.13 will solve your problem, I have used this tool several time to migrate db from local machine to sql azure, the most beauty of this tool it also highlights the error or sql which couldn't be migrated to Azure, so we can easily find alternate syntax of such sql queries
I got a .db database file which one of my friend created through PowerBuilder 6 in Win98. Later I wanted to test that database file, but was not able to view or open it in any of common db viewer and not able to get any data out of it.
please help..
I am using Win7 and do have xp(virtual).
The problem with your description is that PowerBuilder is database-agnostic, so it could be any type of database if it was being used with a PowerBuilder application. However, if you want to go with probabilities (and I'm not sure this is how PB is used most; at one point the most popular database used by PowerBuilder was Oracle), PowerBuilder shipped with a run time license for SQL Anywhere, a database that was originally Watcom, acquired by Powersoft, which was acquired by Sybase, which was acquired by SAP.
Supposing the database you have in hand is SQL Anywhere, you need to get a SQL Anywhere engine. Probably the first thing I'd try is downloading the Developer version of SQL Anywhere and just try to open up a copy with that, see if the software will migrate it to the current version. (My bet is that it will, or will at least provide you with a means.) Another way to get a current version of SQL Anywhere (I think; I haven't tried this in ages) is to download a trial version of PowerBuilder 12.5, which I think comes with SQL Anywhere (the paid version does). If you get that up and running, then you can use a pipeline object in PowerBuilder to pretty easily move data from one database to another. And, for kicks, you can migrate up your PB6 app to see if it still runs. (My bet is that it will take a few tweaks, but fewer than you're probably imagining.)
Good luck,
Terry.
Your .db file is probably a Sybase SQL-Anywhere database. You need to know which version of the engine was used to create the database and then you need the ODBC driver to access that database.
For testing purposes I would like to reset a complete database to a certain state (data and structure). I would like to do this automated. Preferably a command line instruction before I start my tests.
After some searching I discovered that SQL Server offers an great solution for this. Snapshots. After writing a test query I discovered that the standard edition of SQL Server does NOT support this. :-(
Given the fact that I want this to be automated: what are my options? Overwriting the data files immediately doesn't sound like a good option to me...
Some other information:
Windows 7
Microsoft SQL Server Standard Edition (64-bit), 10.50.1600.1
Database size is app. 1 gigabyte
This is only meant for testing. So the database is NOT used by other users when I'm returning to my 'snapshot'.
More information about snapshots:
http://msdn.microsoft.com/en-us/library/ms190677.aspx
This page also states that the standard edition does not support this. :-(
Thank you in advance!
Detach the MDF file, copy it somewhere, re-attach it.
When you want to reset the database, detatch the MDF, copy the old one over the top, and re-attach it.
Alternatively backup and restore.
If you're doing this for testing purposes, you can use Developer Edition:
SQL Server 2008 Developer includes all of the functionality of Enterprise Edition, but is licensed only for development, test, and demo use.
I homebrewed a solution like this because I wasn't happy with the way replication was running (and I was also using standard edition) - maybe my solution will lead you in the right direction:
http://trycatchfinally.net/2009/09/moving-a-sql-server-database-to-another-server-on-a-schedule-without-using-replication/
Basically, it takes a periodic backup, zips it, FTPs it somewhere, and the remote server checks for new files, extracts them, restores them, and then emails you to let you know a new replica has been restored.
For testing, you can use Developers Edition, which has snapshots and is quite cheap. However, we prefer to build a new test database from scripts in source control - that allows us to easily determine the changes, quickly roll out a testing system on any box, and saves us a lot of time.
I'd like to have all DB DDL code under CVS.
We are using Subversion for our .NET code but all database code remains still unversioned.
All we know is how important DB logic can be. I've googled but I've found only few (expensive tools). I believe there exists other (cheaper) solution(s).
What approach do you advise to follow? What tools are most appropriate?
SQL Server 2005, VS 2008 TS, TSVN
UPDATE
Our coding scenario is that developers cannot access to PROD DB directly. It is changed only by scripts (so this is not a problem)
I'm mostly interested in the DEV environment where all of developers have full access.
So it happens that a developer overwrite USP previously changed by another.
I'd like to have the possibility to restore lost version / compare USPs revisions etc.
UPDATE-2
To create deployment script we are using Red-Gate SQL Compare.
Works perfectly - so deployment scripts are not a case.
If you haven't already read it, Martin Fowler's article Evolutionary Database Design is a great place to start.
The article is hard to summarize, but it describes how his team dealt with database versioning in a rapidly changing development process. They created their own tools to facilitate things: scripts to bring users up to the current master, to copy any version of the schema so users could debug one another's working copies, etc..
For a solid low-tech solution, I've found it helpful to keep two kinds of DDL scripts in source control:
A master version that can create the database objects from scratch.
'Version upgrade' scripts for each development iteration.
They're redundant to a degree, but extremely useful (particularly when it comes to deployment).
If you haven't already looked at the Visual Studio Database Edition GDR (a.k.a. "Data Dude"), you should definitely download it and try it out:
http://www.microsoft.com/downloads/details.aspx?FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed&displaylang=en
Among other things, the GDR will facilitate team development by making it easy for each developer to maintain their own local copy of a database, version scripts, create deployment scripts to move a database schema to a new version, and even support database rollback.
It's free if you are using team system developer edition. Check it out.
If you are using Visual Studio Team Suite or Visual Studio Developer Edition, you are entitled to a copy of Visual Studio Database Professional. This is designed to do exactly what you describe, and much more. We use it to manage our database schema (code).
Randy
We use Subversion for all our database code as well. Since nothing is allowed to go to Prod unless it is in a script, there seems to be no porblem with getting people to put all the scripts into subversion. We tend to write alter table scripts to change tables with existing data and then recreate the whole table structure in case we need to create a new database from scratch (we often have the same database structure on multiple servers as some of our clients are very large and do not want their data accidentally available to the competition and so pay for separate servers and therefore may need to create the whole database again with no data.) For objects that don't directly store data we drop the orginal object and recreate it with a create statement. Each project has it's own home inthe repository and each database does too, so the script may be in more than one place to facilitate deployment.
But the real key is that no one can load to Prod without a script. We don't give our devs direct rights to prod, so they have no problem doing things in scripts as opposed to using SSMS.
I wrote SMOscript which generates a CREATE script for each object in a database.
Use this tool to generate into a directory covered by CVS, and update your repository.
Finally I found this tool and approach extremely useful and very easy to introduce
(at least at the beginning - where no versioning solution on the place):
http://www.codeproject.com/KB/database/SQLScripter.aspx
You can run it out of the box.
For final solution I'd incline to GDR.
This also sounds interesting:
Freeware:
http://dbsourcetools.codeplex.com/
http://www.codeproject.com/KB/database/ScriptDB4Svn.aspx
http://www.codeproject.com/KB/database/SQLScripter.aspx
http://blog.boxedbits.com/archives/133
Commercial:
http://www.nobhillsoft.com/Randolph.aspx
You should use Management Studio (SSMS) and place the .sql under source control, possibly separate schema objects under folders.
Hope this helps
See if Wizardby fits your needs.