Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

SQL Express Backup Expand / Collapse
Author
Message
Posted Tuesday, November 2, 2010 7:05 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, November 2, 2010 7:32 AM
Points: 3, Visits: 1
I'm new to SQL and we have an SQLExpress database that we need to backup on a nightly basis. Is there a backup process with SQLExpress or will the Windows Server Backup process include the database if we point it to SQL location..?? Thank you..!!
Post #1014439
Posted Tuesday, November 2, 2010 7:12 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 11:11 AM
Points: 4,373, Visits: 10,653
With SQLExpress you don't have SQLAgent to run backups. You have to manually set up a Windows Scheduled Task to run a backup command.
A simple filesystem backup won't help in case you need to restore a database: you have to backup the database, not its files.


--
Gianluca Sartori

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #1014445
Posted Tuesday, November 2, 2010 7:20 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, November 2, 2010 7:32 AM
Points: 3, Visits: 1
Do you mean like a Batch(.bat) file to run...??? Is there an example anywhere..?? Thank you..!
Post #1014453
Posted Tuesday, November 2, 2010 7:29 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 11:11 AM
Points: 4,373, Visits: 10,653
Take a look at this:
http://www.sqldbatips.com/showarticle.asp?ID=27


--
Gianluca Sartori

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #1014464
Posted Tuesday, November 2, 2010 7:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, November 2, 2010 7:32 AM
Points: 3, Visits: 1
Thanks so much...!! I deeply appreciate your help..!! Have a great day..!!
Post #1014467
Posted Tuesday, July 5, 2011 8:00 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, February 5, 2013 8:56 AM
Points: 17, Visits: 40
You can also try this GUI tool SQL Backup and FTP which lets you schedule your backups. It is very simple to use and it's free
Post #1136496
Posted Thursday, January 17, 2013 7:42 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 22, 2013 6:41 AM
Points: 4, Visits: 8
Another useful free tool is SQL Backup Master.

http://www.sqlbackupmaster.com/
Post #1408423
Posted Friday, January 18, 2013 6:54 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, October 16, 2014 3:51 PM
Points: 191, Visits: 899
Here is a simple example.

First file is the .sql script. It is invoked using SQLCMD in a batch file. Create one of these .sql files for each of the databases that you want to back up, including the system databases (master, model, msdb).

Then create a .bat file and have a line in it invoking SQLCMD for each of the database files that you want to run.


MyDatabase_backup_script.sql
==========================
DECLARE @fn nvarchar(256),
@dbname nvarchar(50),
@stmt nvarchar(4000),
@path nvarchar(4000)


SET @dbname = 'MyDatabase'
SET @path = 'c:\SQLBackups\' + @dbname + '\'


SET @fn = @path + @dbname + '_backup_' +
CONVERT(nchar(8),getdate(), 112) +
right(N'0' + rtrim(CONVERT
(nchar(2), datepart(hh, getdate()))), 2) +
right(N'0' + rtrim(CONVERT
(nchar(2), datepart(mi, getdate()))), 2) +
N'.bak'
--SELECT @fn
SET @stmt = 'BACKUP DATABASE '
+ QUOTENAME(@dbname, '[') + ' to disk
= ''' + @fn + ''''
--SELECT @stmt
EXEC (@stmt)





Database_backups.bat
==========================
sqlcmd -S (local)\SQLEXPRESS -E -i C:\SQLEE_Backups\MyDatabase_backup_script.sql -o C:\SQLBackupLogs\MyDatabase_backuplog.txt


Have one of these lines for each database to back up, then just schedule the .bat file to run every night, say at 1am.
The (local) part runs on the local machine, where the batch file is ran. This could be changed to the specific server or pc name if needed.
The -o text file is the output log file of the run. It will show any errors if it encounters any. I would keep the name in a format that will just overwrite itself so you don't have to worry about multiple versions to clean up. Note that this will be an issue with the database backups, since the script backs it up to a file name with a date stamp on it.


Here is an example of a .sql script to do a tranlog backup. Again, just have a .sql file for each database that you need to do tranlog backups for, and put them in a separate .bat file and set to run multiple times per day.

Tranlog backup script
==================================
DECLARE @fn nvarchar(256),
@dbname nvarchar(50),
@stmt nvarchar(4000),
@path nvarchar(4000)


SET @dbname = 'MyDatabase'
SET @path = 'c:\SQLBackups\' + @dbname + '\tlogs\'


SET @fn = @path + @dbname + '_backup_' +
CONVERT(nchar(8),getdate(), 112) +
right(N'0' + rtrim(CONVERT
(nchar(2), datepart(hh, getdate()))), 2) +
right(N'0' + rtrim(CONVERT
(nchar(2), datepart(mi, getdate()))), 2) +
N'.trn'
--SELECT @fn
SET @stmt = 'BACKUP LOG '
+ QUOTENAME(@dbname, '[') + ' to disk
= ''' + @fn + ''''
--SELECT @stmt
EXEC (@stmt)



Hope it helps.

Post #1408886
Posted Saturday, February 2, 2013 10:42 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 7, 2013 6:43 AM
Points: 5, Visits: 13
vikingDBA (1/18/2013)
Create one of these .sql files for each of the databases that you want to back up, including the system databases (master, model, msdb).

Why is there need to backup system DBs too?
Post #1414953
Posted Monday, February 4, 2013 2:51 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 11:11 AM
Points: 4,373, Visits: 10,653
System databases can get corrupted just as user databases.
In case of corruption, you'll need a backup copy if you don't want to install from scratch.


--
Gianluca Sartori

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #1415197
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse