Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

Changing recovery model on SQL Server 2000 DB

$
0
0

I'm trying to write a script that will be run as a scheduled task a couple times a week.  It will check the RecoveryModel property on the various databases, and set them to simple if they have changed to anything other than that. (a request from a coworker. I'm actually not a SQL guy.  Just a PS guy)

The problem seems to come from the fact that the server is SQL 2000.  I've read that you can use SMO with 2000, but I can't find anything definitive that says how to install it.  So I've been playing with the DMO com objects, and have been able to find the RecoveryModel property, but am not sure how to set it.  I get an exception that says, "[ODBC SQL Server Driver][SQL server]Option 'RECOVERY' cannot be set....PropertyAssignmentException", even though Get-Member reveals it to be a 'get,set' property. 

Info about setting the RecoveryModel with Sql 2000 seems difficult to find, so if anyone has any idea about how to either install SMO on a 2000 server,(I read one comment that said that the Management Objects for SQL 2005 will work with SQL 2000, but couldn't confirm it) or how to change the RecoveryModel property on a DB with DMO, I'd appreciate it.  

(Also, on a related side note, I can get the RecoveryModel property, but it's returned as a 0,1 or 2.  It looks like 0 is 'Simple' and 2 is 'Full', but if anyone can confirm that, I'd appreciate that too.

Thanks for the help


Viewing all articles
Browse latest Browse all 10624

Trending Articles