Search

2012 SP1, SMO: Database.SetOffline() doesn't allow termination options by Brandon.Tucker

Closed
as Won't Fix Help for as Won't Fix

2
0
Sign in
to vote
Type: Suggestion
ID: 779824
Opened: 2/22/2013 10:48:02 AM
Access Restriction: Public
1
Workaround(s)

When calling the Database.SetOffline() method, no termination options are included, nor is there the ability to specify one. For methods such as this with termination options in T-SQL, being able to specify a ROLLBACK IMMEDIATE or a NO_WAIT would be incredibly helpful.
Details (expand)

Product Language

English

Category

Developer Tools (SSDT, BIDS, etc.)

Proposed Solution


Overload the SetOffline method to allow for an enumeration parameter to be passed in, specifying a termination option.

Primary Benefit

Improved Administration

Other Benefits


Allows SMO to get closer to T-SQL.

Virtualization

 
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 3/20/2013 at 7:33 PM
Hello

We took a look at this DCR along with several others. Unfortunately triaging it against other critical DCRs I do not think we would get to investigate and implement this in the near future, so we decided not to proceed with this DCR in the next SQL Server release.
However, we have taken note of this internally, and when we revisit this functionality in the future, we will try and get this implemented.

Thanks for writing to Microsoft.
Alex Grach (MSFT)
Sign in to post a workaround.
Posted by Brandon.Tucker on 2/22/2013 at 11:13 AM
Takes a little bit of extra work, but setting the UserAccess first to severe connections will get around this:

$db.UserAccess = [Microsoft.SqlServer.Management.Smo.DatabaseUserAccess]::Restricted
$db.Alter([Microsoft.SqlServer.Management.Smo.TerminationClause]::RollbackTransactionsImmediately)
$db.SetOnline()