---
title: "Back up i SQL-express"
type: "forum-thread"
url: "https://www.webforum.nu/amne/databaser-sql/164308-back-up-i-sql-express"
topic: "Databaser & SQL"
topic_url: "https://www.webforum.nu/amne/databaser-sql"
author: "devotion"
published: "2007-09-09T12:10:50.000Z"
updated: "2007-09-09T18:35:56.000Z"
replies: 7
views: 759
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/databaser-sql/164308-back-up-i-sql-express"
---

# Back up i SQL-express

## #1 — devotion, 2007-09-09T12:10Z

Hepp! :)  

Finns det något sätt att schemalägga Back-up i SQL-express?

Mvh
Henrik

Permalänk: https://www.webforum.nu/p/164308

## #2 — Zaiman, 2007-09-09T12:36Z

Google (schedule backup sql express) gav bland annat:
<http://www.sqldbatips.com/showarticle.asp?ID=27>

Permalänk: https://www.webforum.nu/p/2026707

## #3 — devotion, 2007-09-09T12:46Z

> **Zaiman skrev:**
>
> Google (schedule backup sql express) gav bland annat:
> <http://www.sqldbatips.com/showarticle.asp?ID=27>

Jag sökte också... och hittade samma sak... Sitter och testar... :)

Permalänk: https://www.webforum.nu/p/2026710

## #4 — devotion, 2007-09-09T18:03Z

Det verkar ju fungera fint...

MEN!

Jag kan iunte få till det schemalagt...

Vad gör jag för fel..???

Man ska göra så här:

> The simplest way to pass our parameters to sqlcmd is to simply save the call to the stored procedure in a file. For example, we could copy the code from the Full Database Backup of all user databases example above (Example 1) and save it to c:\\backup scripts\\userfullbackup.sql. The walk through below assumes you have a named instance called SQLExpress.
> 
> Double-click Add Scheduled Task to start the Scheduled Task Wizard, and then click Next in the first dialog box 
> Click Browse, browse to SQLCMD.exe (by default it can be found in C:\\Program Files\\Microsoft SQL Server\\90\\Tools\\binn), and then click Open. 
> Type a name for the task e.g DAILY FULL BACKUP and then choose Daily from the scheduling options 
> Click Next, specify the information about the time to run the task e.g. 00:00, and then click Next 
> Type the name and password of the account that will execute this task. Make sure that you choose an account that is a syadmin for your instance 
> Click Next, select the checkbox to Open the Advanced Properties for this task and then click Finish 
> In the Run text box append the following to the contents: -S .\\SQLExpress -i"c:\\backup.sql" (You must leave a space after the existing contents) 
> Click OK. If prompted, supply the password for the account again

I min schemaläggning ser det ut så här under "Starta i:"

> "C:\\Program\\Microsoft SQL Server\\90\\Tools\\Binn -S .\\SQLExpress -ic:\\backup.sql"

Jag kan inte få till det med citationstecknena... :( 

Mvh
Henrik

Permalänk: https://www.webforum.nu/p/2026803

## #5 — Zaiman, 2007-09-09T18:09Z

```
"C:\Program\Microsoft SQL Server\90\Tools\Binn\SQLCMD.exe" -S .\SQLExpress -ic:\backup.sql
```

Tror jag det ska stå.

Permalänk: https://www.webforum.nu/p/2026806

## #6 — Zaiman, 2007-09-09T18:12Z

Jag har däremot gjort en batchfil istället som jag schemalägger.

```
SQLCMD -S . -i C:\Batch\Backupscript.sql
```

Och sett till att sökvägen till SQLCMD finns med i PATH på maskinen.

Permalänk: https://www.webforum.nu/p/2026809

## #7 — devotion, 2007-09-09T18:28Z

Fick detta felet:

```
C:\Documents and Settings\hl>SQLCMD -S . -i C:\Backup.sql
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establi
shing a connection to the server. When connecting to SQL Server 2005, this failu
re may be caused by the fact that under the default settings SQL Server does not
 allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

C:\Documents and Settings\hl>
```

Inställningarna är gjorda för remote connections...

Permalänk: https://www.webforum.nu/p/2026819

## #8 — devotion, 2007-09-09T18:35Z

Hmmm

Skrev fel i \*.bat-filen...

```
sqlcmd -S.\SQLExpress -i"c:\backup.sql"
```

Ska det vara...

Då funkar det finfint!

Konstigt bara att jag inte fick det första sättet att fungera.. Det spelade ingen roll hur jag angav citastionstecknena.. De togs bort när jag klickade på "verkställ"

Men, det är väl ingen nackdel att köra en batch-fil?

Mvh
Henrik

Permalänk: https://www.webforum.nu/p/2026825

---

Tråden på webben: https://www.webforum.nu/amne/databaser-sql/164308-back-up-i-sql-express
