SMO를 사용하여 SQL Server 데이터베이스를 백업하는 데 다음 기능을 사용하고 있습니다.하지만 백업이 실패합니다 ... 나는 그다지 실패하지 않습니다 ... 어떤 도움을 받으셨습니까?SMO 데이터베이스 백업
Private Sub BackupSqlDatabase()
Dim conn As New ServerConnection("MONO-PC\SQLEXPRESS") ' -- set SQL server connection given the server name, user name and password
Dim oSQLServer As New Server(conn) '--create the SMO server object using connection
Dim OrigBackupPath As String = oSQLServer.Information.MasterDBPath.Replace("\DATA", "C:\Backup\DB_BACKUP_NAME.BAK") ' -- set the path where backup file will be stored
Dim bkDevItem As New BackupDeviceItem(OrigBackupPath, DeviceType.File) ' -- create SMO.Backupdevice object
With oBackup ' Set the backup object property
.Action = BackupActionType.Database
.Database = "LIC.MDF"
.Devices.Add(bkDevItem)
.Initialize = True
.Checksum = True
.ContinueAfterError = True
.Incremental = False
.LogTruncation = BackupTruncateLogType.Truncate
.SqlBackup(oSQLServer) ' backup SQL database
End With
End Sub
오류가 발생 했습니까? – JNK
backup failed..thats ... 내 PC에 관리 스튜디오가 설치되어 있지 않습니다 ... 그 백업 실패 이유는 무엇입니까 ??? –
연결을 다음과 같이 설정하지 않아도됩니까? Dim conn As 새 ServerConnection ("MONO-PC \\ SQLEXPRESS")'(두 개의 백 슬래시) ?? –