Skip to content

Commit

Permalink
fix: 修复restore database出现异常的问题 #7112
Browse files Browse the repository at this point in the history
  • Loading branch information
yksitu authored and iSecloud committed Sep 24, 2024
1 parent ba6dc16 commit 2993cb0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,12 @@ func (h *DbWorker) DBRestoreForFullBackup(dbname string, fullBakFile string, mov
var restoreSQL string
if move == "" {
restoreSQL = fmt.Sprintf(
"restore database %s from disk='%s' with file = 1, %s , NOUNLOAD, REPLACE, STATS = 5",
"restore database [%s] from disk='%s' with file = 1, %s , NOUNLOAD, REPLACE, STATS = 5",
dbname, fullBakFile, restoreMode,
)
} else {
restoreSQL = fmt.Sprintf(
"restore database %s from disk='%s' with file = 1, %s, %s, NOUNLOAD, REPLACE, STATS = 5",
"restore database [%s] from disk='%s' with file = 1, %s, %s, NOUNLOAD, REPLACE, STATS = 5",
dbname, fullBakFile, move, restoreMode,
)

Expand All @@ -352,12 +352,12 @@ func (h *DbWorker) DBRestoreForLogBackup(dbname string, logBakFile string, resto
var restoreSQL string
if restoreTime != "" {
restoreSQL = fmt.Sprintf(
"restore log %s from disk='%s' with file = 1, %s, STOPAT = N'%s'",
"restore log [%s] from disk='%s' with file = 1, %s, STOPAT = N'%s'",
dbname, logBakFile, restoreMode, restoreTime,
)
} else {
restoreSQL = fmt.Sprintf(
"restore log %s from disk='%s' with file = 1, %s",
"restore log [%s] from disk='%s' with file = 1, %s",
dbname, logBakFile, restoreMode,
)
}
Expand Down

0 comments on commit 2993cb0

Please sign in to comment.