rename mdf and ldf

Posted on 2006-05-01
Last Modified: 2012-05-05
I restored a DB from a backup of a different DB (same structure just the name is different e.g. MyDB and MyDBTest).
Usually I do this via a script but I got lazy and used the EM GUI.
All works well but the mdf and ldf are called MyDB_data.mdf and MyDB_log.ldf
How can I rename them to MyDBTest_data.mdf and MyDBTest_log.ldf

This is a test area at the moment so I have no issues with stopping services, kicking people out etc.
Question by:QPR
    LVL 29

    Author Comment

    Panic over. The mdf and ldf in the file system were named correctly.
    I just had to use:
    alter database myDB
    MODIFY FILE (NAME = MyDB_data, NEWNAME = MyDBTest_data)


    Accepted Solution

    Closed, 250 points refunded.
    The Experts Exchange
    Community Support Moderator of all Ages

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    This is my first ever Article on EE or elsewhere; therefore, please bear with me if I have some discrepancies in my writing. I read many articles and questions related to "how to pass values to SSIS packages at run-time?"  Hence, this common ques…
    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now