Rename physical name

  • Hi all,

    I would like to know if it's possible to change the physical name to database.

    Could be possible through master..sysdatabases?

  • sp_renamedb

  • Thanks, but with sp_renamedb only I can change the db logical name.

    I refered to physical name (file name)

    For example, the db name is db1 as logical name but the db files name are D:\Program Files\Microsoft SQL Server\MSSQL\data\db2.MDF and D:\Program Files\Microsoft SQL Server\MSSQL\data\db2.LDF

    Weeks ago I renamed the db2 database to db1 database and now I want to create a new db with the name db2. I was doing DTS between databases.

    Now, I can't do to create it because this file name exist in the master..sysdatabases tablechange.

    Thanks again

  • alter database with MODIFY FILE option.

    Check BOL for detail syntax.

  • alter database modify file to change physical name only works on tempdb.

    For others database detach and attach is a option.

    sp_detach_db

    rename the physical file

    sp_attachdb with physical file specified.

     

  • Thanks wz700,

    the method was right

  • Yes, thanks!  this works... just what I needed, too!

    Thank-you,
    David Russell
    Any Cloud, Any Database, Oracle since 1982

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply