Solved

SQL 2005 Express backup

Posted on 2007-03-26
10
593 Views
Last Modified: 2008-06-01
Hi,
      I need to backup an SQL express database. I know that Express 2005 does not allow for back ups. I was trying to use the Operating Systems Task Manager.

Server 2003
my script to backup is called Showgobackup.sql
exec expressmaint
   @database      = 'ALL_USER',
   @optype        = 'DB',
   @backupfldr    = 'c:\backups',
   @reportfldr    = 'c:\reports',
   @verify        = 1,
   @dbretainunit  = 'days',
   @dbretainval   = 1,
   @rptretainunit = 'weeks',
   @rptretainval  = 1,
   @report        = 1

Then I use the Scheduled task manager to use the SQLCMD.exe
in the run text box I append
                 -S .\SQLExpress -i"c:\backup scripts\ShowGoBackup.sql"

But the database never runs - am I missing a step? Where do you edit a created Scheduled task?

Thanks, Missymadi
0
Comment
Question by:missymadi
  • 5
  • 5
10 Comments
 
LVL 29

Expert Comment

by:QPR
ID: 18795491
Can you not back up using Management Studio (free tool)?
http://www.microsoft.com/technet/prodtechnol/sql/2005/mgsqlexpwssmse.mspx
0
 

Author Comment

by:missymadi
ID: 18795609
THanks!

I am going to use the automated backup solution.

I am creating the first part - an SQL script :

osql -U sa

1>Use Showgo
2>Backup Showgo to disk="C:\Showgo.bak"
1>Go

I am getting an error "ms102, level 15, state1, server showgo-VM\SQLEXPRESS Line 1 incorrect syntax.
what am I doing wrong?
Thanks for your help
0
 
LVL 29

Expert Comment

by:QPR
ID: 18795654
should there be a "go" after showgo?
0
 

Author Comment

by:missymadi
ID: 18795700
yes, it is a software package for trade shows.
0
 
LVL 29

Expert Comment

by:QPR
ID: 18795721
:)
I meant should it not be

1>Use Showgo
2>Go
3>Backup Showgo to disk="C:\Showgo.bak"
4>Go
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:missymadi
ID: 18795762
Oh, sorry! :) Yes I did use Go after both commands.
0
 

Author Comment

by:missymadi
ID: 18795916
Got it!
Use Showgo
Go
Backup Database Showgo to disk=’C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL.1\MSSQL\BACKUP\SHOWGO.BAK

But my next challenge -- how do I use the sqlcmd to execute the script by passing the script to SQLCMD?
0
 
LVL 29

Expert Comment

by:QPR
ID: 18796862
sqlcmd -i nameofscript.sql

more examples
http://msdn2.microsoft.com/en-us/library/ms165702.aspx
0
 

Author Comment

by:missymadi
ID: 18799648
I tried to use my script above

osql -U sa
password
Use Showgo
Backup database showgo to disk="C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\Showgo.bak

This works from the command prompt. How do I use this in an SQL query? What is the syntax? I tried the link from msdn2 but it didn't work?
Thanks for your help!
0
 
LVL 29

Accepted Solution

by:
QPR earned 75 total points
ID: 18804095
How do you mean do in a query?
You want the syntax to back up a database?

An example from one of mine...
EXECUTE master.dbo.xp_sqlmaint N'-D "ShowGo" -Rpt "c:\Microsoft SQL Server\SQLDB\MSSQL\LOG\ShowGo Data Backup.txt" -DelTxtRpt 4WEEKS -WriteHistory  -VrfyBackup -BkUpMedia DISK -BkUpDB "c:\Microsoft SQL Server\SQLBkup" -DelBkUps 3DAYS -CrBkSubDir -BkExt "BAK"'

Change the paths to suit.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now