Back up i SQL-express
7 svar · 759 visningar · startad av devotion
Google (schedule backup sql express) gav bland annat:
http://www.sqldbatips.com/showarticle.asp?ID=27
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... :)
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
"C:\Program\Microsoft SQL Server\90\Tools\Binn\SQLCMD.exe" -S .\SQLExpress -ic:\backup.sql
Tror jag det ska stå.
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.
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...
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