Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
lufueury
Starting Member
1 Post |
Posted - 2006-06-09 : 09:50:24
|
Can anyone enlighten me on using smo backup with sqlexpress?I have compiled an exe using vbc running the folloing codeImports SystemImports Microsoft.SqlServer.Management.SmoImports Microsoft.SqlServer.Management.CommonImports System.IOModule SMOtestSub Main()TryKill(System.Environment.GetFolderPath Environment.SpecialFolder.ProgramFiles) & "\test\SMO_BACKUP")CatchEnd TryTrySystem.Threading.Thread.Sleep(500)Dim bkpfileName As String = System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\test\SMO_BACKUP"Dim backDeviceItem As New BackupDeviceItem(bkpfileName, DeviceType.File)Dim db As String = "test" ' Define and set dbDim bck As New Backup() ' Instantiate a Backup objectbck.Action = BackupActionType.Database ' Set Actionbck.BackupSetName = db & "_BackupSet" ' Set Backupbck.Database = db ' Set Database name propertybck.Devices.Add(backDeviceItem)Dim srv As New Server() ' Instantiate a Server objectbck.SqlBackup(srv) ' Invoke Backup object's SqlBackup methodCatchEnd TryEnd SubEnd ModuleThis works fine on a win2k dev system though when moving to another win2k system the code will error on non system databases. If db= model,master,tempdb etc it executes fine. When I try to backup a created db (any) I get an error stating the name is not found in sysdatabases.SELECT name FROM master..sysdatabaseswhere name not in ('master','tempdb')shows all the created databases including "test" in this casekeep in mind many recompiles using different db's work fine on one system and not the other. Even restored "test" from a backup from the system with no problems only to have a 3041 error consistently on the other. System databases work fine for all attempts on the offending system.Any ideas? (the offending system is a SAT raid which has been evil from the get go) corruption seems to be the only conclusion I can reach |
|
|
|
|