How can I set up an automatic backup with SQL Server Express?
Thankyou in advance.
FM
--
Ekrem Önsoy
"Fabio Martins" <support.m...@fabiomartins.net> wrote in message
news:Ou3wNFzb...@TK2MSFTNGP06.phx.gbl...
Thankyou!
FM
"Ekrem Önsoy" <ek...@compecta.com> escreveu na mensagem
news:A8732FAA-8541-4F79...@microsoft.com...
BACKUP:
http://msdn.microsoft.com/en-us/library/ms186865(SQL.90).aspx
SQLCMD:
http://msdn.microsoft.com/en-us/library/ms162773.aspx
I have an article about this subject but it's in Turkish. If you are
interested:
http://www.ekremonsoy.net/makaleler/sql/express_edition_yedek/express_edition_otoyedek.aspx
Example to BACKUP Command (assume you saved the following line to a file
called AutoBackup.sql):
BACKUP DATABASE [test_2005] TO DISK = N'c:\test\test.bak'
Example to SQLCMD to run the BACKUP script:
SQLCMD -S [Ekrem-PC\SQLEXPRESS] -E -i C:\Test\AutoBackup.sql
For example the -S switch stands for Server Name, -E means this is going to
be a Trusted Connection and -i is to define the script file. See the links
above for more information about these commands... And ask if you have any
further questions in case you can't find the answer from those links.
--
Ekrem Önsoy
"Fabio Martins" <support.m...@fabiomartins.net> wrote in message
news:OdeTNpzb...@TK2MSFTNGP06.phx.gbl...
A simple procedure to backup the database, change the backup path.
You can start this procedure with sqlcmd.
Regards,
Daniel
CREATE PROCEDURE [dbo].[backup_db]
@db varchar(50),
@backup_path varchar(254) = 'D:\SQL_BACKUP\'
AS
------------------------------------------------------------------------------------------
DECLARE @backup_device nvarchar(1024);
DECLARE @backup_name nvarchar(127);
DECLARE @device_type nvarchar(50);
------------------------------------------------------------------------------------------
SET @backup_device = @backup_path + @db + '_db.bak';
SET @backup_name = @db +'-Full Database Backup';
SET @device_type = 'disk';
EXEC master.dbo.sp_addumpdevice
@devtype = @device_type,
@logicalname = @db,
@physicalname = @backup_device;
BACKUP DATABASE @db TO @db WITH NOFORMAT, INIT,
NAME = @backup_name , SKIP, NOREWIND, NOUNLOAD, STATS = 10;
EXEC sp_dropdevice @db;
Go
"Fabio Martins" <support.m...@fabiomartins.net> a écrit dans le
message de news:Ou3wNFzb...@TK2MSFTNGP06.phx.gbl...
The SQL command ran OK in Management Studio Express.
But after the SQLCMD command I got the message:
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
establishing a connection to the server. When connecting to SQL Server 2005,
this failure 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.
How can I fix that?
FM
"Ekrem Önsoy" <ek...@compecta.com> escreveu na mensagem
news:AF722068-3A80-4E07...@microsoft.com...
Also, ensure that your SQL Server service is running.
--
Ekrem Önsoy
"Fabio Martins" <support.m...@fabiomartins.net> wrote in message
news:O1oQRtDc...@TK2MSFTNGP04.phx.gbl...