June 24, 2010 at 9:28 am
I have a few disk space where the databases are saved.
I have to install another hard disk and I want to change the route of the databases.
I think that to do these I have to do this steps:
1. Stop the SQL Server
2. Copy the mdf and ldf files where I want to save now.
3. Start the SQL Server.
These are correct? If not what can I do to prevent that the sql hasn´t got an enough disk space?
Thanks for your help
Viky
June 24, 2010 at 9:31 am
Nope. Do that and your databases will come up RECOVERY_PENDING and unavailable after the restart of SQL.
The correct steps are:
Run ALTER DATABASE statements to change the location of the files that's stored in the metadata (see BoL for details)
Take the databases offline
Move the files
Bring the databases back online
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 29, 2010 at 11:23 am
You can also detach the dbs, and then restore a backup using the WITH MOVE option.
June 29, 2010 at 11:33 am
Steve Jones - Editor (6/29/2010)
You can also detach the dbs, and then restore a backup using the WITH MOVE option.
If you detach the DB, why not move the files and reattach?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 29, 2010 at 11:47 am
You can, some people find it easier to backup/restore. I don't think it much matters. Was just giving another option.
July 1, 2010 at 10:27 am
I do with detach_db , move the mdf and ldf files then I do attach_db
This worked perfectly.
Viky.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply