Comments
 
posted on March 8th 2011, at 10:24
by lunarg
It's possible to rename the logical names of MS-SQL databases through the SQL-prompt (osql.exe).

Log in to your database using osql:

> osql -S SERVERINSTANCE -d MyDB -U sa

First, query the current logical names; you will need them in order to rename them.

1> SELECT * FROM sysfiles2> GOfileid groupid size maxsize growth status perf name filename1 1 106224 -1 10 1048578 0 OldName_Data D:\SQL2000\Data\MyDB_Data.mdf2 0 128 -1 10 1048642 0 OldName_Log D:\SQL2000\Data\MyDB_Log.ldf

The name column specifies the logical names. Use the following SQL statement to rename them.

1> ALTER DATABASE [MyDB] MODIFY FILE (NAME = 'OldName_Data', NEWNAME = 'NewName_Data'  ...
Add a new comment
 
Your name:
Your e-mail:
Your comment:
 
Basic BBcode is supported.
Captcha:
Type the letters and numbers as shown.
/get/captcha/1713553886
Not readable? Get another.
 
 
 
 
« April 2024»
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930    
 
Links
 
Quote
« If the batteries of a TV remote run out, why do we press the buttons so much harder? »