Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

MSSQL Backup Script

$
0
0

Hi all

I've been getting my head around SQL backup scripts, and have nabbed one from spiceworks own code snippets. I plan to use this on SQL 2005 pro (10 databases), and SQL 2012 express (1 database) servers. I wondered if the script is still valid (seems to run ok). I have also added a restoreverify & checksum command in there too.

Also, whenever I try to backup to a UNC ie. \\server\sqlbackup it failes. Only seems to like mapped drives?

Ta!



DECLARE @name VARCHAR(50) -- database name
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name
SET @path = 'F:\SQLBackups\'
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
DECLARE db_cursor CURSOR FOR

SELECT name
FROM master.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb') --...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>