My system is for development, and I run a local copy of sql server 2005. I want to move all the database files out of program files, and put in a better location on another partition. To do this would you simply detach all the databases in SSMS, move the .mdf and .ldf files with windows explorer, then reattach?
That should work.
http://support.microsoft.com/kb/224071
Yes, detach and re-attach them. If you are going to move the system databases also, that will take some special effort. Instructions for that can be found on MSDN.
http://msdn.microsoft.com/en-us/library/ms345408(SQL.90).aspx
Probably this is what you are looking for. I would want to write my answer here but I am too lazy to do that, but I am sending you to my blog post regarding Moving Data File in SQL Server;
http://dbalink.wordpress.com/2008/11/06/how-to-moving-data-files/
Related
I have .mdf files that are backups of several databases, and I would like to know if it is possible to attach these files at once.
If it is also possible, for example via PHP code, I also feel free to explore.
Our company has a SQL Server 2008 R2 database on one of our servers. We would like to be able to make a copy of this database and open it off of a local machine; however, the size is greater than 10GB so the Express version won't do it. Is there a way we can open this locally without paying for another full license, since we do have one for running the database itself?
There is no way to restore a DB over 4 gigs without a licence.
If we had more information about what you were trying to do with it, we might be able to suggest alternatives.
Is it for analysis? Perhaps you can come up with a SSIS package that copies over only the tables that you need.
Do you need it for backup? Perhaps there is another way to verify things.
Is it for testing? Well, you almost certainly need another licence in this case.
I'm using a C# application to Backup and Restore DBs on a remote server using the microsoft.sqlserver.smo.dll.
Testing with my local machine, I can browse backup files to select the backup to use. Can this be done through code for the remote SQL Server using the SQL credentials similar to the way MSSMS does it?
My backups are saved with a certain naming convention (ie. "Ebuy_full_2013_8_7_H13_M40.bak") and I would like to be able to show these in the application so a decision about which backup file to restore can be made.
Thanks,
Rick
SOLVED: Based on a comment for another question I ran SQL Profiler to determine what functions MSSMS was using, found it was using master.dbo.xp_dirtree, was able to duplicate this in my app.
In our company, we work under the Team Foundation server 2008. By default the databases destination is C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA.
The problem is that the C drive is small and we are always running out of space.
I am thinking to move the databases from the C drive to D drive, but I am not sure what are the consequences of such action.
Any help is very appreciated.
Moving the database to a different drive won't have any affect on how you access TFS through Visual Studio. You can simply detach and re-attach the database files in a different location. See these instructions for doing so.
Edit: Note that there are quite a few databases that need to be moved. Here's an additional resource that you'll want to refer to as well.
You should just be able to move them as you would move and other SQL database (probably best detaching, copying and re-attaching at their new location). I cannot think of any problems with moving them.
So here's the challenge. I need to use C# to back up a database locally from a remote database server and the only share we have is \\computer\c$.
If the answer is to back up to a location on the remote database server and then copy that local, assume there is not a share on the remote location. Just b/c I have access to the database does not mean I have access to the file system.
This Q/A looks close to what I want, but remember the regular account in the database will not have access to the network. Sample sql script to zip and transfer database backup file
With all of that in mind...anyone done something like this and care to share? Or have an idea of how to do this?
UPDATE: I was being vague on purpose. The context here is this:
I do not have access to files on the server where the database is.
I am running the C# from the client under the client's credentials, so I have full control of the client computer and can do anything in this domain.
I think I actually have figured out what we are going to do though:
Create a special folder in the AppData area of the current user.
Create a fileshare to that folder
Add rights to Everyone for that particular share and folder.
Process the backup based on that share.
Remove the share and reset the permissions.
In case anyone is curious what this question refers to: RoundhousE
Context? Oracle? MySQL? SQL Server? Db Size? Backup time? Availability requirements? Encryption requirements? Rowcount validation?
I'm guessing you're talking about SQL Server, based on the TSQL example- to which I'd recommend checking out DMO objects. Here's a primer- http://www.codersource.net/csharp_sqldmo_sqlserver.aspx.
Truthfully- the vague nature of your question- and the fact that it's context free gives me some heebie jeebies. Be sure to test in a test envrionment and not run on production data, ok?
The backup system of SQL Server runs the entire backup procedure on the server, which basically means that the file has to be put somewhere the database server can put it and has access to.
In other words, the file will be written from the server.
If you:
Cannot access files directly on the server, from the client, in any way
Cannot download files from the server, to the client, in any way
Cannot write files from the server, to a common place, that is reachable by the client in any way
Then you are left with one way: Reimplement backup.
If your actual question is this:
With all of that in mind...anyone done something like this and care to share?
Then I'm going to hazard a guess that the answer to this question is: No.
Are you sure you cannot change the problem to one that is solvable?
think I actually have figured out what we are going to do:
Create a special folder in the AppData area of the current user.
Create a fileshare to that folder
Add rights to Everyone for that particular share and folder.
Process the backup based on that share.
Remove the share and reset the permissions.
In case anyone is curious what this question refers to: RoundhousE
If you want/need to back up a database, then in general, for the purpose of guaranteed database consistency, the database server will need to be either completely shut down, or at least be completely in read-only mode.
Your question sounds like your "challengers" have taken you to task to back up a remote server while none of those conditions are satisfied. The only sensible answer to such a challenge is that it cannot be done.