:: 数据库备份文件放置跟路径
@set backupPath=C:\test\sqldb@set cacheDatasFileName=cacheDatas_sqldb_2011-11-26.bak
@set powerDBFileName=powerDB_sqldb_2011-11-26.bak
@set bamdbFileName=bamdb_sqldb_2011-11-26.bak
@set cy_cacheDatasFileName=cy_cacheDatas_sqldb_2011-11-26.bak
@set cy_powerDBFileName=cy_powerDB_sqldb_2011-11-26.bak
@set cy_bamdbFileName=cy_bamdb_sqldb_2011-11-26.bak
:: 需要恢复的数据库文件名
:: set backFiles=cacheDatas_sqldb_2011-11-26.bak powerDB_sqldb_2011-11-26.bak
:: for %%a in (%backFiles%) do (
@osql -s localhost -d master -E -Q "restore database cacheDatas from disk = '%backupPath%\%cacheDatasFileName%' WITH REPLACE,NORECOVERY"
@osql -s localhost -d master -E -Q "restore database cacheDatas from disk = '%backupPath%\%cy_cacheDatasFileName%' WITH REPLACE,RECOVERY"
@osql -s localhost -d master -E -Q "restore database powerDB from disk = '%backupPath%\%powerDBFileName%' WITH REPLACE,NORECOVERY"
@osql -s localhost -d master -E -Q "restore database powerDB from disk = '%backupPath%\%cy_powerDBFileName%' WITH REPLACE,RECOVERY"
@osql -s localhost -d master -E -Q "restore database bamdb from disk = '%backupPath%\%bamdbFileName%' WITH REPLACE,NORECOVERY"
@osql -s localhost -d master -E -Q "restore database bamdb from disk = '%backupPath%\%cy_bamdbFileName%' WITH REPLACE,RECOVERY"
:: )
@echo 完整数据库以及差异数据库备份恢复完成!!!!
pause