Why Logical Name is different from .bak file in SQL Server

I am restoring a backup file and i encountered an error. It says something like

Use FileListOnly" to get logical name of file.

When I run this query,

restore filelistonly from disk='E:\MyDatabase.bak'

I found that the logical name is completely different from the .bak file. I did for other databases and found the same thing. The logical name is same for all databases on the server.

My Questing is, is there some sort of set up to do to set same logical name for all databases on server ?

Or How SQL Server set logical name for a database ?


Logical names are defined at database create time and will default to a certain pattern. They can be changed later via ALTER DATABASE

The values are stored in sys.database_files and also in sys.master_files (required for offline databases etc)

The BACKUP DATABASE command takes an arbitrary file name that often contains the type and datetime of the backup "MyDatabase_Full_20170330093654.bak" as well as server and instance name (if you use Ola Hallengran's scripts)

Why should the backup file name relate at all to the logical name defined at database create time?