SET dbName = "MySQLServerDB" SET odbcDSN = "MySQLServerDB_Offsite" LOG "rename_restore_db.log" /append /maxsize=1000 IFNUM!= %event_renameresult 0 GOTO done SETRIGHT last8 = %event_renamelocalfile 8 IFNSTRCMPI last8 ".partial" GOTO done DBUSE odbcDSN /odbc SET sSQL = "USE master" DBQUERY sSQL SET sSQL = "ALTER DATABASE [" + dbName + "] SET SINGLE_USER WITH ROLLBACK IMMEDIATE" DBQUERY sSQL SET StandbyUndoFile = %installdir + "\" + dbName + "_undo.bak" SET sSQL = "RoboRestore '" + dbName + "', '" + %event_renamenewlocalpath + "', '" + StandbyUndoFile + "'" DISPLAY sSQL DBQUERY sSQL PAUSE /for=1 DBGETRESULTS * expecting: CHECKDB found 0 allocation errors and 0 consistency errors in database ... DISPLAY %db_MessageText SET sSQL = "ALTER DATABASE [" + dbName + "] SET MULTI_USER" DBQUERY sSQL DBCLOSE SET ArchDir = %event_logonhome + "\archive" MAKEDIR ArchDir SET ZName = ArchDir + "\" + %event_renamenewlocalfile + ".done.zip" ZIP ZName %event_renamenewlocalpath /create DELETE %event_renamenewlocalpath :done DISPLAY