--Sometimes you may require a bat file to backup your ms sql server database.
@echo off
echo "Please press a key to backup you sql database.."
pause
echo "Backup process has started....This will take few minutes"
osql -U yourSqlUserName -P yourSqlPassword -Q "BACKUP DATABASE DatabaseName TO DISK = '%CD%\DatabaseName.BAK'"
pause
echo "You have Successfully Backup Up ... press a key to quit"
pause
--You might also want to restore your ms sql server database.
@echo off
echo "First Dropping your database if it exist... press a key"
pause
osql -U yourSqlUserName -P yourSqlPassword -Q "Drop Database DatabaseName"
echo "Restoring database ... press a key"
pause
osql -U yourSqlUserName -P yourSqlPassword -Q "RESTORE DATABASE DatabaseName FROM DISK = '%CD%\DatabaseName.BAK'"
echo "Restoring done ... press a key to quit"
pause
No comments:
Post a Comment