• San-847017 (10/15/2009)


    Tara-1044200 (10/15/2009)


    1. how do i rename mdf and ldf file names of a database without restoring or creating new database and move the data ?

    Take the database OFFLINE. Go and change the MDF & LDF files name in it's locations and the take the DB online.

    for db names is there a way we can list out mdf or ldf file names ? [/quote]

    make sure you use alter database modify file command between offline and online so SQL knows the new name of the file. Otherwise database won't come back online.

    no 2,

    select d.name,f.name as logical_name,f.physical_name from sys.master_files f join sys.databases d on f.database_id = d.database_id

    ---------------------------------------------------------------------