0

I am in need of logical backup device option for SQL Server, but not for disk files, but Windows directories. Is there anything like this available or how can I achieve that? Even from 3rd parties?

I have different folders on different machines and I need one logical name for them both, sure one on each server.

I need to create one logical directory in several servers with the same name, but their paths in actuality are different. So I can create a logical backup device with a path, which is like this c:/myfolder/backup.bak and all the backups initiated to this device will be appended in the same file. But I need to create it for the c:/myfolder directory (aka folder) without specifying the file backup.bak. so it will reference to a folder and not to a file, so I can create different backups in the folder with different names and separate files.

11
  • 1
    What do you mean by logical device option? Could you explain the use case a bit more?
    – Ronaldo
    Mar 30, 2021 at 10:30
  • Yes, sure @Ronaldo. I mean logical backup devices which exist for disk files, but not directories learn.microsoft.com/en-us/sql/relational-databases/…
    – igelr
    Mar 30, 2021 at 10:40
  • BACKUP DATABASE xxxyyy TO DISK? Mar 30, 2021 at 11:36
  • What do you mean for "Windows directories"?...what does that have to do with SQL Server? Could you please provide a little more specifics? SQL backups have to do with SQL Server and it's database files, not a Windows directory, what is the root problem you're trying to solve?
    – J.D.
    Mar 30, 2021 at 12:13
  • 1
    How about a mapped drive? Requires a "real" account for the SQL Server service and that you login as that account and do the drive mapping. That would be one way to do redirection. I've used environment variables myself, in order to have the same job in an MSX environment backing up to different local folders. We used Ola Hallengrens script which back then used CmdExec with SQLCMD.EXE instead of T-SQL and we called SQLCMD using CALL to make it replace the env variable. Mar 30, 2021 at 12:53

2 Answers 2

2

I have different folders on different machines and I need one logical name for them both, sure one on each server.

If you have different folders on different servers and you need them to be presented with the same name you could use mklink to create a directory symbolic link.

1
  • 1
    Thanks you. This is what I needed
    – igelr
    Mar 31, 2021 at 7:44
3

In addition to mklink, using SSMS you can change the default backup location for each instance to the desired local folder, then backups to a disk location without a drive or path specified will go there. Eg

backup database adventureworks2017 to disk='aw.bak'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.