SQL Server logical file names?

I am restoring a Bak file

RESTORE DATABASE WEbERP2 FROM DISK = 'c:\r\WEbERP_backup_201105210100.bak' WITH REPLACE , MOVE 'WEbERP' TO 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\WEbERP2.mdf', MOVE 'WEbERP_log' TO 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\WEbERP2_log.ldf',REPLACE 

Im restoring it AS WEbERP2 // 2 !!!

and it works.

Db opens as a new Db with the name: WEbERP2

But the logical name is still: WebErp.

I know the functionality is fine.

But still itโ€™s hard for me to understand his customs.

enter image description here

I know I can change it:

 ALTER DATABASE xxx MODIFY FILE (NAME=N... 

But I want to understand his customs and when it is important to change him.

+4
source share
1 answer

The logical file name is a unique database identifier for identifying database files in T-SQL operations. This is not important as such, and there is no important reason for changing it.

However, this allows you to find out which MDF and LDF file does not look up physical names or does not know the internal file identifier.

More importantly, when you add filegroups and files to separate indexes, data, or add partitions, then the ability to have "WebERP_Indexes" and other names becomes useful

+4
source

Source: https://habr.com/ru/post/1384909/


All Articles