microsoft / microsoft/sqlmanagementobjects

Backup Path in SMO?

Open
#121 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
143
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Did we miss any sort of property or method that would show the Path in the Backup History? We ended up using a bunch of T-SQL in Get-DbaBackupHistory as seen in the Path (mediafamily.physical_device_name) property seen below.

ComputerName          : sqlcs
InstanceName          : MSSQLSERVER
SqlInstance           : sqlcs
AvailabilityGroupName :
Database              : model
DatabaseId            : 3
UserName              : sqladmin
Start                 : 01/19/2022 1:15:33 PM
End                   : 01/19/2022 1:15:33 PM
Duration              : 00:00:00
Path                  : {C:\temp\model-Full-202201192215.bak}
TotalSize             : 2.83 MB
CompressedBackupSize  : 475.72 KB
CompressionRatio      : 6.09
Type                  : Full
BackupSetId           : 1
DeviceType            : Disk
Software              : Microsoft SQL Server
FullName              : {C:\temp\model-Full-202201192215.bak}
FileList              : {@{FileType=D; LogicalName=modeldev;
                        PhysicalName=C:\MSSQL\MSSQL15.MSSQLSERVER\MSSQL\DATA\model.mdf}, @{FileType=L;
                        LogicalName=modellog;
                        PhysicalName=C:\MSSQL\MSSQL15.MSSQLSERVER\MSSQL\DATA\modellog.ldf}}
Position              : 1
FirstLsn              : 36000000136600001
DatabaseBackupLsn     : 0
CheckpointLsn         : 36000000136600001
LastLsn               : 36000000136900001
SoftwareVersionMajor  : 15
IsCopyOnly            : False
LastRecoveryForkGUID  : 90d16058-f1d1-4e96-8ec6-8d7bfda42f15
RecoveryModel         : FULL
KeyAlgorithm          :
EncryptorThumbprint   :
EncryptorType         :

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the SMO backup-history APIs and the Get-DbaBackupHistory usage described in the issue, especially the T-SQL value from mediafamily.physical_device_name. Determine whether an existing property or method exposes the backup path, and consider the work complete when the path can be retrieved through SMO without that query.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.