Showing posts with label app. Show all posts
Showing posts with label app. Show all posts

Sunday, March 25, 2012

Backup Error: 18210, Severity: 16, State: 1

Getting errors on my backups, SQL 2005 SP2. Backups do complete successfully
however I'm getting errors in my App logs on my SQL Server.
During the snapshot part of the backups, these for lines appear in my SQL
Logs:
03/17/2008 11:36:49,spid75,Unknown,Error: 18210<c/> Severity: 16<c/> State: 1.
03/17/2008 11:36:49,spid75,Unknown,BackupVirtualDeviceFile::P repareToFreeze:
failure on backup device '{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'.
Operating system error 995(The I/O operation has been aborted because of
either a thread exit or an application request.).
03/17/2008 11:36:49,Backup,Unknown,Error: 3041<c/> Severity: 16<c/> State: 1.
03/17/2008 11:36:49,Backup,Unknown,BACKUP failed to complete the command
BACKUP DATABASE SMS_DA1. Check the backup application log for detailed
messages.
These corresponding events appeared in the App log on the server:
Type:Error
Source:SQLVDI
Event ID:1
Event Time:3/17/2008 11:36:49 AM
User:n/a
Computer:SERVERNAME
Description:
SQLVDI: Loc=WaitForResource. Desc=Partner process aborted. ErrorCode=(0).
Process=2288. Thread=4324. Server. Instance=MSSQLSERVER.
VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
Type:Error
Source:SQLVDI
Event ID:1
Event Time:3/17/2008 11:36:49 AM
User:n/a
Computer:SERVERNAME
Description:
SQLVDI: Loc=TriggerAbort. Desc=invoked. ErrorCode=(0). Process=2288.
Thread=4324. Server. Instance=MSSQLSERVER.
VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
Type:Error
Source:MSSQLSERVER
Event ID:18210
Event Time:3/17/2008 11:36:49 AM
User:NT AUTHORITY\SYSTEM
Computer:SERVERNAME
Description:
BackupVirtualDeviceFile::PrepareToFreeze: failure on backup device
'{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'. Operating system error 995(The I/O
operation has been aborted because of either a thread exit or an application
request.).
Type:Error
Source:MSSQLSERVER
Event ID:3041
Event Time:3/17/2008 11:36:49 AM
User:NT AUTHORITY\SYSTEM
Computer:SERVERNAME
Description:
BACKUP failed to complete the command BACKUP DATABASE SMS_DA1. Check the
backup application log for detailed messages.
Type:Error
Source:SQLWRITER
Event ID:24583
Event Time:3/17/2008 11:36:49 AM
User:n/a
Computer:SERVERNAME
Description:
Sqllib error: OLEDB Error encountered calling ICommandText::Execute. hr =
0x80040e14.
SQLSTATE: 42000, Native Error: 3013
Error state: 1, Severity: 16
Source: Microsoft SQL Native Client
Error message: BACKUP DATABASE is terminating abnormally.
SQLSTATE: 42000, Native Error: 3271
Error state: 1, Severity: 16
Source: Microsoft SQL Native Client
Error message: A nonrecoverable I/O error occurred on file
"{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1:" 995(The I/O operation has been
aborted because of either a thread exit or an application request.).
Type:Error
Source:SQLVDI
Event ID:1
Event Time:3/17/2008 11:36:49 AM
User:n/a
Computer:SERVERNAME
Description:
SQLVDI: Loc=SignalAbort. Desc=Client initiates abort. ErrorCode=(0).
Process=2876. Thread=29988. Client. Instance=.
VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
Should I be concerned with these errors?
Sandy Wood
Orange County District Attorney
Is there any info in the event log that would give you any more info?
Did you have this issue prior to SP2?
Have you recently made any changes to the databases?
Are you using any 3rd party backup tools?
~lb
"Sandy Wood" wrote:

> Getting errors on my backups, SQL 2005 SP2. Backups do complete successfully
> however I'm getting errors in my App logs on my SQL Server.
> During the snapshot part of the backups, these for lines appear in my SQL
> Logs:
> 03/17/2008 11:36:49,spid75,Unknown,Error: 18210<c/> Severity: 16<c/> State: 1.
> 03/17/2008 11:36:49,spid75,Unknown,BackupVirtualDeviceFile::P repareToFreeze:
> failure on backup device '{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'.
> Operating system error 995(The I/O operation has been aborted because of
> either a thread exit or an application request.).
> 03/17/2008 11:36:49,Backup,Unknown,Error: 3041<c/> Severity: 16<c/> State: 1.
> 03/17/2008 11:36:49,Backup,Unknown,BACKUP failed to complete the command
> BACKUP DATABASE SMS_DA1. Check the backup application log for detailed
> messages.
> These corresponding events appeared in the App log on the server:
> Type:Error
> Source:SQLVDI
> Event ID:1
> Event Time:3/17/2008 11:36:49 AM
> User:n/a
> Computer:SERVERNAME
> Description:
> SQLVDI: Loc=WaitForResource. Desc=Partner process aborted. ErrorCode=(0).
> Process=2288. Thread=4324. Server. Instance=MSSQLSERVER.
> VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
> Type:Error
> Source:SQLVDI
> Event ID:1
> Event Time:3/17/2008 11:36:49 AM
> User:n/a
> Computer:SERVERNAME
> Description:
> SQLVDI: Loc=TriggerAbort. Desc=invoked. ErrorCode=(0). Process=2288.
> Thread=4324. Server. Instance=MSSQLSERVER.
> VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
> Type:Error
> Source:MSSQLSERVER
> Event ID:18210
> Event Time:3/17/2008 11:36:49 AM
> User:NT AUTHORITY\SYSTEM
> Computer:SERVERNAME
> Description:
> BackupVirtualDeviceFile::PrepareToFreeze: failure on backup device
> '{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'. Operating system error 995(The I/O
> operation has been aborted because of either a thread exit or an application
> request.).
> Type:Error
> Source:MSSQLSERVER
> Event ID:3041
> Event Time:3/17/2008 11:36:49 AM
> User:NT AUTHORITY\SYSTEM
> Computer:SERVERNAME
> Description:
> BACKUP failed to complete the command BACKUP DATABASE SMS_DA1. Check the
> backup application log for detailed messages.
> Type:Error
> Source:SQLWRITER
> Event ID:24583
> Event Time:3/17/2008 11:36:49 AM
> User:n/a
> Computer:SERVERNAME
> Description:
> Sqllib error: OLEDB Error encountered calling ICommandText::Execute. hr =
> 0x80040e14.
> SQLSTATE: 42000, Native Error: 3013
> Error state: 1, Severity: 16
> Source: Microsoft SQL Native Client
> Error message: BACKUP DATABASE is terminating abnormally.
> SQLSTATE: 42000, Native Error: 3271
> Error state: 1, Severity: 16
> Source: Microsoft SQL Native Client
> Error message: A nonrecoverable I/O error occurred on file
> "{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1:" 995(The I/O operation has been
> aborted because of either a thread exit or an application request.).
> Type:Error
> Source:SQLVDI
> Event ID:1
> Event Time:3/17/2008 11:36:49 AM
> User:n/a
> Computer:SERVERNAME
> Description:
> SQLVDI: Loc=SignalAbort. Desc=Client initiates abort. ErrorCode=(0).
> Process=2876. Thread=29988. Client. Instance=.
> VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
> Should I be concerned with these errors?
> --
> Sandy Wood
> Orange County District Attorney
|||The event log information is in my previous post. The backup is being
controlled by my Microsoft System Center Configuration Manager 2007
installation. It has a built-in Task that runs the backup. I've not had this
problem until I upgraded my SMS 2003 installation to System Center
Configuration Manager 2007 which uses VSS for backups now. Something in how
VSS behaves that's causing the problems. Funny thing, the backups are
sucessfull and my data is there. It's just disconcerting to see all the
warnings and errors everyday.
Sandy Wood
Orange County District Attorney
"lonnye" wrote:
[vbcol=seagreen]
> Is there any info in the event log that would give you any more info?
> Did you have this issue prior to SP2?
> Have you recently made any changes to the databases?
> Are you using any 3rd party backup tools?
> --
> ~lb
>
> "Sandy Wood" wrote:
sql

Backup Error: 18210, Severity: 16, State: 1

Getting errors on my backups, SQL 2005 SP2. Backups do complete successfully
however I'm getting errors in my App logs on my SQL Server.
During the snapshot part of the backups, these for lines appear in my SQL
Logs:
03/17/2008 11:36:49,spid75,Unknown,Error: 18210<c/> Severity: 16<c/> State: 1.
03/17/2008 11:36:49,spid75,Unknown,BackupVirtualDeviceFile::PrepareToFreeze:
failure on backup device '{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'.
Operating system error 995(The I/O operation has been aborted because of
either a thread exit or an application request.).
03/17/2008 11:36:49,Backup,Unknown,Error: 3041<c/> Severity: 16<c/> State: 1.
03/17/2008 11:36:49,Backup,Unknown,BACKUP failed to complete the command
BACKUP DATABASE SMS_DA1. Check the backup application log for detailed
messages.
These corresponding events appeared in the App log on the server:
Type: Error
Source: SQLVDI
Event ID: 1
Event Time: 3/17/2008 11:36:49 AM
User: n/a
Computer: SERVERNAME
Description:
SQLVDI: Loc=WaitForResource. Desc=Partner process aborted. ErrorCode=(0).
Process=2288. Thread=4324. Server. Instance=MSSQLSERVER.
VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
Type: Error
Source: SQLVDI
Event ID: 1
Event Time: 3/17/2008 11:36:49 AM
User: n/a
Computer: SERVERNAME
Description:
SQLVDI: Loc=TriggerAbort. Desc=invoked. ErrorCode=(0). Process=2288.
Thread=4324. Server. Instance=MSSQLSERVER.
VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
Type: Error
Source: MSSQLSERVER
Event ID: 18210
Event Time: 3/17/2008 11:36:49 AM
User: NT AUTHORITY\SYSTEM
Computer: SERVERNAME
Description:
BackupVirtualDeviceFile::PrepareToFreeze: failure on backup device
'{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'. Operating system error 995(The I/O
operation has been aborted because of either a thread exit or an application
request.).
Type: Error
Source: MSSQLSERVER
Event ID: 3041
Event Time: 3/17/2008 11:36:49 AM
User: NT AUTHORITY\SYSTEM
Computer: SERVERNAME
Description:
BACKUP failed to complete the command BACKUP DATABASE SMS_DA1. Check the
backup application log for detailed messages.
Type: Error
Source: SQLWRITER
Event ID: 24583
Event Time: 3/17/2008 11:36:49 AM
User: n/a
Computer: SERVERNAME
Description:
Sqllib error: OLEDB Error encountered calling ICommandText::Execute. hr = 0x80040e14.
SQLSTATE: 42000, Native Error: 3013
Error state: 1, Severity: 16
Source: Microsoft SQL Native Client
Error message: BACKUP DATABASE is terminating abnormally.
SQLSTATE: 42000, Native Error: 3271
Error state: 1, Severity: 16
Source: Microsoft SQL Native Client
Error message: A nonrecoverable I/O error occurred on file
"{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1:" 995(The I/O operation has been
aborted because of either a thread exit or an application request.).
Type: Error
Source: SQLVDI
Event ID: 1
Event Time: 3/17/2008 11:36:49 AM
User: n/a
Computer: SERVERNAME
Description:
SQLVDI: Loc=SignalAbort. Desc=Client initiates abort. ErrorCode=(0).
Process=2876. Thread=29988. Client. Instance=.
VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
Should I be concerned with these errors?
--
Sandy Wood
Orange County District AttorneyIs there any info in the event log that would give you any more info?
Did you have this issue prior to SP2?
Have you recently made any changes to the databases?
Are you using any 3rd party backup tools?
--
~lb
"Sandy Wood" wrote:
> Getting errors on my backups, SQL 2005 SP2. Backups do complete successfully
> however I'm getting errors in my App logs on my SQL Server.
> During the snapshot part of the backups, these for lines appear in my SQL
> Logs:
> 03/17/2008 11:36:49,spid75,Unknown,Error: 18210<c/> Severity: 16<c/> State: 1.
> 03/17/2008 11:36:49,spid75,Unknown,BackupVirtualDeviceFile::PrepareToFreeze:
> failure on backup device '{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'.
> Operating system error 995(The I/O operation has been aborted because of
> either a thread exit or an application request.).
> 03/17/2008 11:36:49,Backup,Unknown,Error: 3041<c/> Severity: 16<c/> State: 1.
> 03/17/2008 11:36:49,Backup,Unknown,BACKUP failed to complete the command
> BACKUP DATABASE SMS_DA1. Check the backup application log for detailed
> messages.
> These corresponding events appeared in the App log on the server:
> Type: Error
> Source: SQLVDI
> Event ID: 1
> Event Time: 3/17/2008 11:36:49 AM
> User: n/a
> Computer: SERVERNAME
> Description:
> SQLVDI: Loc=WaitForResource. Desc=Partner process aborted. ErrorCode=(0).
> Process=2288. Thread=4324. Server. Instance=MSSQLSERVER.
> VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
> Type: Error
> Source: SQLVDI
> Event ID: 1
> Event Time: 3/17/2008 11:36:49 AM
> User: n/a
> Computer: SERVERNAME
> Description:
> SQLVDI: Loc=TriggerAbort. Desc=invoked. ErrorCode=(0). Process=2288.
> Thread=4324. Server. Instance=MSSQLSERVER.
> VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
> Type: Error
> Source: MSSQLSERVER
> Event ID: 18210
> Event Time: 3/17/2008 11:36:49 AM
> User: NT AUTHORITY\SYSTEM
> Computer: SERVERNAME
> Description:
> BackupVirtualDeviceFile::PrepareToFreeze: failure on backup device
> '{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'. Operating system error 995(The I/O
> operation has been aborted because of either a thread exit or an application
> request.).
> Type: Error
> Source: MSSQLSERVER
> Event ID: 3041
> Event Time: 3/17/2008 11:36:49 AM
> User: NT AUTHORITY\SYSTEM
> Computer: SERVERNAME
> Description:
> BACKUP failed to complete the command BACKUP DATABASE SMS_DA1. Check the
> backup application log for detailed messages.
> Type: Error
> Source: SQLWRITER
> Event ID: 24583
> Event Time: 3/17/2008 11:36:49 AM
> User: n/a
> Computer: SERVERNAME
> Description:
> Sqllib error: OLEDB Error encountered calling ICommandText::Execute. hr => 0x80040e14.
> SQLSTATE: 42000, Native Error: 3013
> Error state: 1, Severity: 16
> Source: Microsoft SQL Native Client
> Error message: BACKUP DATABASE is terminating abnormally.
> SQLSTATE: 42000, Native Error: 3271
> Error state: 1, Severity: 16
> Source: Microsoft SQL Native Client
> Error message: A nonrecoverable I/O error occurred on file
> "{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1:" 995(The I/O operation has been
> aborted because of either a thread exit or an application request.).
> Type: Error
> Source: SQLVDI
> Event ID: 1
> Event Time: 3/17/2008 11:36:49 AM
> User: n/a
> Computer: SERVERNAME
> Description:
> SQLVDI: Loc=SignalAbort. Desc=Client initiates abort. ErrorCode=(0).
> Process=2876. Thread=29988. Client. Instance=.
> VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
> Should I be concerned with these errors?
> --
> Sandy Wood
> Orange County District Attorney|||The event log information is in my previous post. The backup is being
controlled by my Microsoft System Center Configuration Manager 2007
installation. It has a built-in Task that runs the backup. I've not had this
problem until I upgraded my SMS 2003 installation to System Center
Configuration Manager 2007 which uses VSS for backups now. Something in how
VSS behaves that's causing the problems. Funny thing, the backups are
sucessfull and my data is there. It's just disconcerting to see all the
warnings and errors everyday.
--
Sandy Wood
Orange County District Attorney
"lonnye" wrote:
> Is there any info in the event log that would give you any more info?
> Did you have this issue prior to SP2?
> Have you recently made any changes to the databases?
> Are you using any 3rd party backup tools?
> --
> ~lb
>
> "Sandy Wood" wrote:
> > Getting errors on my backups, SQL 2005 SP2. Backups do complete successfully
> > however I'm getting errors in my App logs on my SQL Server.
> >
> > During the snapshot part of the backups, these for lines appear in my SQL
> > Logs:
> >
> > 03/17/2008 11:36:49,spid75,Unknown,Error: 18210<c/> Severity: 16<c/> State: 1.
> > 03/17/2008 11:36:49,spid75,Unknown,BackupVirtualDeviceFile::PrepareToFreeze:
> > failure on backup device '{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'.
> > Operating system error 995(The I/O operation has been aborted because of
> > either a thread exit or an application request.).
> > 03/17/2008 11:36:49,Backup,Unknown,Error: 3041<c/> Severity: 16<c/> State: 1.
> > 03/17/2008 11:36:49,Backup,Unknown,BACKUP failed to complete the command
> > BACKUP DATABASE SMS_DA1. Check the backup application log for detailed
> > messages.
> >
> > These corresponding events appeared in the App log on the server:
> >
> > Type: Error
> > Source: SQLVDI
> > Event ID: 1
> > Event Time: 3/17/2008 11:36:49 AM
> > User: n/a
> > Computer: SERVERNAME
> > Description:
> > SQLVDI: Loc=WaitForResource. Desc=Partner process aborted. ErrorCode=(0).
> > Process=2288. Thread=4324. Server. Instance=MSSQLSERVER.
> > VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
> >
> > Type: Error
> > Source: SQLVDI
> > Event ID: 1
> > Event Time: 3/17/2008 11:36:49 AM
> > User: n/a
> > Computer: SERVERNAME
> > Description:
> > SQLVDI: Loc=TriggerAbort. Desc=invoked. ErrorCode=(0). Process=2288.
> > Thread=4324. Server. Instance=MSSQLSERVER.
> > VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
> >
> > Type: Error
> > Source: MSSQLSERVER
> > Event ID: 18210
> > Event Time: 3/17/2008 11:36:49 AM
> > User: NT AUTHORITY\SYSTEM
> > Computer: SERVERNAME
> > Description:
> > BackupVirtualDeviceFile::PrepareToFreeze: failure on backup device
> > '{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1'. Operating system error 995(The I/O
> > operation has been aborted because of either a thread exit or an application
> > request.).
> >
> > Type: Error
> > Source: MSSQLSERVER
> > Event ID: 3041
> > Event Time: 3/17/2008 11:36:49 AM
> > User: NT AUTHORITY\SYSTEM
> > Computer: SERVERNAME
> > Description:
> > BACKUP failed to complete the command BACKUP DATABASE SMS_DA1. Check the
> > backup application log for detailed messages.
> >
> > Type: Error
> > Source: SQLWRITER
> > Event ID: 24583
> > Event Time: 3/17/2008 11:36:49 AM
> > User: n/a
> > Computer: SERVERNAME
> > Description:
> > Sqllib error: OLEDB Error encountered calling ICommandText::Execute. hr => > 0x80040e14.
> > SQLSTATE: 42000, Native Error: 3013
> > Error state: 1, Severity: 16
> > Source: Microsoft SQL Native Client
> > Error message: BACKUP DATABASE is terminating abnormally.
> > SQLSTATE: 42000, Native Error: 3271
> > Error state: 1, Severity: 16
> > Source: Microsoft SQL Native Client
> > Error message: A nonrecoverable I/O error occurred on file
> > "{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1:" 995(The I/O operation has been
> > aborted because of either a thread exit or an application request.).
> >
> > Type: Error
> > Source: SQLVDI
> > Event ID: 1
> > Event Time: 3/17/2008 11:36:49 AM
> > User: n/a
> > Computer: SERVERNAME
> > Description:
> > SQLVDI: Loc=SignalAbort. Desc=Client initiates abort. ErrorCode=(0).
> > Process=2876. Thread=29988. Client. Instance=.
> > VD=Global\{7EDC34FF-1A81-4635-8D71-99A7FCFA8CA8}1_SQLVDIMemoryName_0.
> >
> > Should I be concerned with these errors?
> >
> > --
> > Sandy Wood
> > Orange County District Attorney

Friday, February 10, 2012

Backing up through VS2005

Hi, not sure I have should ask this in here or in the VS forums - but here goes anyway!

My vb app is written using VS2005 with an SQL database. I'm now distributing this to users to use with SQL Express.

It's hard enough explaining to them how to attach the database without going into the backup routines etc!

So what I'd like to do is to have a "backup" button in my app, that backsup the database, trancates the log files & then shrinks the files.

Is this possible?

This shouldn't be too hard. You can just call the backup command from your application.

Regards,

Matt Hollingsworth

Program Manager

Microsoft SQL Server

|||

Matt Hollingsworth wrote:

This shouldn't be too hard. You can just call the backup command from your application.

Regards,

Matt Hollingsworth

Program Manager

Microsoft SQL Server

Could someone give me some pointers to a basic script pls

|||

Create a stored procedure that executes these:

BACKUP LOG databasename WITH TRUNCATE_ONLY - this backups the active portion of the log in your database file

BACKUP DATABASE databasename TO DISK = 'K:\yourpath\yourbackup.bak'

I don't recommend shrinking the database nor the transaction log files as this will affect your database performance

|||

Please avoid the use of TRUNCATE_ONLY or NO_LOG backups.

They discard portions of your log which may not have been backed up, and could break your log chain. If you are doing regular log backups, or are in simple recovery mode, there should never be a reason to use these commands.

The SP approach is a good one though. If your app has a connection to the database, you should be able to issue a BACKUP DATABASE command in exactly the same way as you issue a SELECT statement.

Kevin

|||I agree Kevin, I just answered the question, though, did not explain further Smile|||

Is it possible to do this through VS2005 without adding a sp to the database. I have a few copies of the database "out there" & if possible just want to update the vs application itself, without asking users to amend the database?

Sorry if I'm being a bit thick!

|||

Sure.

As I said, if you have a connection that can issue a SELECT, it should be able to issue a BACKUP DATABASE (provided you have sufficient privs, of course). Just look up the syntax for BACKUP DATABASE in Books Online to determine how to get the backups that you need.

|||

I guess I'm a bit thick here - I can find plenty info on doing it through SQL, but nothing on the syntax to do it via my VB application...

Help!

|||

OK.

I'll take a step back here.

If what you are trying to accomplish is to use your application to direct SQL to back itself up to a file, you would use the same mechanisms you are using in your app to access the SQL data (ODBC etc), but instead of issuing 'SELECT foo FROM bar WHERE x = y', you would issue 'BACKUP DATABASE bar TO DISK='Q:\Backups\FooBackup.bck'

If you want your app to receive the backup stream and do something with it, you should read this documentation:

http://www.microsoft.com/downloads/details.aspx?FamilyID=416f8a51-65a3-4e8e-a4c8-adfe15e850fc&DisplayLang=en

|||

Sample command in VB

Dim query as String= "BACKUP DATABASE databasename TO DISK='Q:\backups\databasename.bak'"

Dim command As New SqlCommand(query, connection)
command.Connection.Open()
command.ExecuteNonQuery()

Just change the query to the queries specified above

|||

Hi, making progress!

I have the VS part working now, but a few questions regarding the backup commands.

1. If I use a new filename for the backup I get "path not found", is there a "new backup" command, or do I need to create the file first?

EDIT: A bit of stupidity here! I was using a directory on the client machine & of course it's the SQL machine that matters!

2. A few people have said don't truncate etc, I don't understand this as if I don't truncate the log file it will surely just grow and grow? Do I backup the database and the log seperately?

EDIT: I'm doing the following:

BACKUP database TO DISK = "D:\backups....."

BACKUP LOG database TO DISK = "D:\backups..."

Working fine except that (because I haven't backed up for a while), the log file was 1GB and I got: "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."

I have now backed up the log file & reduced the space - but how do I increse the timeout?

|||

Think of SQL log files as a circular buffer.

In normal operations, as soon as all of the records in a section of the log are unused, that section ("VLF") can be reused.

In Simple recovery mode as soon as there are no open transactions referencing the are of the log, they are free. In Full recovery mode, log records are free after they are backed up in a Log Backup (if there are no transactions using them).

So, in normal operations, the log file is never truncated, but it is internally reused so that it doesn't just grow without bounds.

Even if you manually shrink the file, it will just re-grow until it has the space it needs to satisfy the conditions above.

If the log file is constantly too big, you should look for:

Simple Recovery: Look for long-running transactions that could keep the log file from being reused, and try to break them into multiple smaller transactions.

Full Recovery: Schedule your log backups more frequently.

TRUNCATE_ONLY just removes all records not currently in use by a transaction, so that you cannot perform a point-in-time restore, as there will be a gap in the log backups. You then need to do a new Full backup in order to re-start the log chain.

Backing up through VS2005

Hi, not sure I have should ask this in here or in the VS forums - but here goes anyway!

My vb app is written using VS2005 with an SQL database. I'm now distributing this to users to use with SQL Express.

It's hard enough explaining to them how to attach the database without going into the backup routines etc!

So what I'd like to do is to have a "backup" button in my app, that backsup the database, trancates the log files & then shrinks the files.

Is this possible?

This shouldn't be too hard. You can just call the backup command from your application.

Regards,

Matt Hollingsworth

Program Manager

Microsoft SQL Server

|||

Matt Hollingsworth wrote:

This shouldn't be too hard. You can just call the backup command from your application.

Regards,

Matt Hollingsworth

Program Manager

Microsoft SQL Server

Could someone give me some pointers to a basic script pls

|||

Create a stored procedure that executes these:

BACKUP LOG databasename WITH TRUNCATE_ONLY - this backups the active portion of the log in your database file

BACKUP DATABASE databasename TO DISK = 'K:\yourpath\yourbackup.bak'

I don't recommend shrinking the database nor the transaction log files as this will affect your database performance

|||

Please avoid the use of TRUNCATE_ONLY or NO_LOG backups.

They discard portions of your log which may not have been backed up, and could break your log chain. If you are doing regular log backups, or are in simple recovery mode, there should never be a reason to use these commands.

The SP approach is a good one though. If your app has a connection to the database, you should be able to issue a BACKUP DATABASE command in exactly the same way as you issue a SELECT statement.

Kevin

|||I agree Kevin, I just answered the question, though, did not explain further Smile|||

Is it possible to do this through VS2005 without adding a sp to the database. I have a few copies of the database "out there" & if possible just want to update the vs application itself, without asking users to amend the database?

Sorry if I'm being a bit thick!

|||

Sure.

As I said, if you have a connection that can issue a SELECT, it should be able to issue a BACKUP DATABASE (provided you have sufficient privs, of course). Just look up the syntax for BACKUP DATABASE in Books Online to determine how to get the backups that you need.

|||

I guess I'm a bit thick here - I can find plenty info on doing it through SQL, but nothing on the syntax to do it via my VB application...

Help!

|||

OK.

I'll take a step back here.

If what you are trying to accomplish is to use your application to direct SQL to back itself up to a file, you would use the same mechanisms you are using in your app to access the SQL data (ODBC etc), but instead of issuing 'SELECT foo FROM bar WHERE x = y', you would issue 'BACKUP DATABASE bar TO DISK='Q:\Backups\FooBackup.bck'

If you want your app to receive the backup stream and do something with it, you should read this documentation:

http://www.microsoft.com/downloads/details.aspx?FamilyID=416f8a51-65a3-4e8e-a4c8-adfe15e850fc&DisplayLang=en

|||

Sample command in VB

Dim query as String= "BACKUP DATABASE databasename TO DISK='Q:\backups\databasename.bak'"

Dim command As New SqlCommand(query, connection)
command.Connection.Open()
command.ExecuteNonQuery()

Just change the query to the queries specified above

|||

Hi, making progress!

I have the VS part working now, but a few questions regarding the backup commands.

1. If I use a new filename for the backup I get "path not found", is there a "new backup" command, or do I need to create the file first?

EDIT: A bit of stupidity here! I was using a directory on the client machine & of course it's the SQL machine that matters!

2. A few people have said don't truncate etc, I don't understand this as if I don't truncate the log file it will surely just grow and grow? Do I backup the database and the log seperately?

EDIT: I'm doing the following:

BACKUP database TO DISK = "D:\backups....."

BACKUP LOG database TO DISK = "D:\backups..."

Working fine except that (because I haven't backed up for a while), the log file was 1GB and I got: "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."

I have now backed up the log file & reduced the space - but how do I increse the timeout?

|||

Think of SQL log files as a circular buffer.

In normal operations, as soon as all of the records in a section of the log are unused, that section ("VLF") can be reused.

In Simple recovery mode as soon as there are no open transactions referencing the are of the log, they are free. In Full recovery mode, log records are free after they are backed up in a Log Backup (if there are no transactions using them).

So, in normal operations, the log file is never truncated, but it is internally reused so that it doesn't just grow without bounds.

Even if you manually shrink the file, it will just re-grow until it has the space it needs to satisfy the conditions above.

If the log file is constantly too big, you should look for:

Simple Recovery: Look for long-running transactions that could keep the log file from being reused, and try to break them into multiple smaller transactions.

Full Recovery: Schedule your log backups more frequently.

TRUNCATE_ONLY just removes all records not currently in use by a transaction, so that you cannot perform a point-in-time restore, as there will be a gap in the log backups. You then need to do a new Full backup in order to re-start the log chain.