Thor Logo dbatools

Orphan

Find-DbaOrphanedFile

Sander Stad (@sqlstad), sqlstad.nl

Find-DbaOrphanedFile View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Identifies database files on disk that are not attached to any SQL Server database instance Description Scans filesystem directories for database files (.mdf, .ldf, .ndf) that exist on disk but are not currently attached to the SQL Server instance. This is essential for cleanup operations after database drops, detaches, or failed restores that leave behind orphaned files consuming disk space.

Read more

Get-DbaDbOrphanUser

Claudio Silva (@ClaudioESSilva) | Garry Bargsley (@gbargsley) | Simone Bizzotto (@niphlod)

Get-DbaDbOrphanUser View Source Claudio Silva (@ClaudioESSilva) , Garry Bargsley (@gbargsley) , Simone Bizzotto (@niphlod) Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Get orphaned users. Description An orphan user is defined by a user that does not have their matching login. (Login property = “”). Syntax Get-DbaDbOrphanUser [-SqlInstance] <DbaInstanceParameter[]> [[-SqlCredential] <PSCredential>] [[-Database] <Object[]>] [[-ExcludeDatabase] <Object[]>] [-EnableException] [<CommonParameters>] Examples Example: 1 PS C:\> Get-DbaDbOrphanUser -SqlInstance localhost\sql2016 Finds all orphan users without matching Logins in all databases present on server ’localhost\sql2016’.

Read more

Remove-DbaDbOrphanUser

Claudio Silva (@ClaudioESSilva) | Simone Bizzotto (@niphlod)

Remove-DbaDbOrphanUser View Source Claudio Silva (@ClaudioESSilva) , Simone Bizzotto (@niphlod) Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Removes orphaned database users that no longer have corresponding SQL Server logins Description Removes orphaned database users from one or more databases, handling schema ownership transfers automatically to prevent dependency issues. Orphaned users occur when a database user exists but its corresponding login in the master database has been deleted or doesn’t exist on the current server.

Read more

Repair-DbaDbOrphanUser

Claudio Silva (@ClaudioESSilva) | Simone Bizzotto (@niphlod)

Repair-DbaDbOrphanUser View Source Claudio Silva (@ClaudioESSilva) , Simone Bizzotto (@niphlod) Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Repairs orphaned database users by remapping them to matching server logins or optionally removing them. Description Identifies and repairs orphaned database users - users that exist in a database but are no longer associated with a server login. This commonly occurs after database restores, migrations, or when logins are recreated.

Read more