dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Test-DBADBOwner fails to return database ownership for non-accessible databases

Open joeywas opened this issue 8 years ago • 4 comments

Test-DBADBOwner fails to return database ownership where IsAccessible property -eq $false. example would be a mirror database that is in the restoring state.

Previously, it took a long time to respond when getting ownership for non-accessible database, however this may be resolved now.

Get-DBADatabase returns appropriate database ownership on these non-accessible databases just fine.

joeywas avatar Dec 03 '18 21:12 joeywas

@potatoqualitee advised this function should accept input from Get-DbaDatabase. Test-DBADbOwner still needs to be fixed so it doesn't filter out "not-accessible" databases.

I'll take a stab at it.

joeywas avatar Dec 05 '18 04:12 joeywas

Hey @joeywas - sorry I forgot to report here. Try now with the dev branch. I just merged some pipage ennoblement.

potatoqualitee avatar Dec 05 '18 17:12 potatoqualitee

Evening @potatoqualitee , thank you! I got latest from dev, tried out your changes. I did not know how to handle incoming object from the pipe, now I do.

Test-DbaDbOwner still filters out databases that are not accessible. I've removed the filter and tested against an instance with 200 dbs, 100 that were "non accessible" databases. Runtime difference between getting 100 accessible db and 200 (100 accessible+100 non accessible) is 1 second.

I'll submit a pull request with my changes, feel free to reject it if not appropriate!

joeywas avatar Dec 06 '18 07:12 joeywas

🕺

potatoqualitee avatar Dec 10 '18 11:12 potatoqualitee