A question for you DBA's

OK what I need to do is shut down an SQL database, backup the database file, and restart the SQL database. (Oh no. that’s so hard). OK the hard part is doing it in an automated batch file. Does anyone know how?

Also, could I do a hot backup (i.e. back up the file without stopping the database)?

It would probably help if you specified the environment and database server you’re using.

Assuming MS-SQL server 7 and NT, with root privileges, create a batch file with the following commands:

net stop “MSSQLServer”
copy database files
net start “MSSQLServer”

As for backing up without stopping the database, just use the SQL Backup wizard. Under “Management” select the “backup” icon. Right click on the window and choose: “New Backup Device” and write to a file/tape/whatever.

Wow… excellent… it is MS-SQL 7 and NT. Many thanks.

Wow… excellent… it is MS-SQL 7 and NT. Many thanks.