Re: Backup Question



ExcelMan (sfarkas@xxxxxxxxx) writes:
So I have solved one problem -- elimination of extraneous files -- but
I still have file names that are not what I want. Is there now a way
to rename the data and log files to the original names
(DatabaseName_Data.MDF and DatabaseName_Log.LDF) and get everything
back the way it was?

Do this:

1) ALTER DATABASE db MODIFY FILE
(NAME = 'DatabaseName',
FILENAME = 'C:\Program Files\...\DatabaseName_Data.MDF)
2) Same operation for the log file.
3) Stop SQL Server.
4) Rename files on disk.
5) Start SQL Server.

To know what to put in the NAME field, run sp_helpdb and get the names
from the second column.

Then again, I could really care less what the physical names of my
database files are.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Renaming DB
    ... file must reside in the server in which SQL Server is installed. ... log files should not be placed on compressed file systems. ... If the file is on a raw partition, ... Is there a way to rename those files too? ...
    (microsoft.public.sqlserver.setup)
  • Re: alter table query not working after working at least once. MS SQL 2000
    ... it works the first time. ... apparently you forgot to rename the primary key when you renamed the ... Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books ... ...
    (comp.databases.ms-sqlserver)
  • RE: error 0x2B33
    ... when i go to download it it wont install it and the error is 0x2B33. ... You can search the system for log files, maybe the log file gives some ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.security)
  • Re: SQL Express - How do I view SQL Server Log Files
    ... or at least I have not found how to view the log files using ... I'm having a hard time believing they didn't ... I much prefer to access the SQL Server error log directly ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: alter table query not working after working at least once. MS SQL 2000
    ... it works the first time. ... apparently you forgot to rename the primary key when you renamed the ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)

Quantcast