PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > begin and end transaction and transaction log
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
begin and end transaction and transaction log

Réponse
 
LinkBack Outils de la discussion
Vieux 12/12/2007, 04h26   #1
Kruton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut begin and end transaction and transaction log

Hello everyone,
This is more of an architectural question about SQL Server. Can
someone please explain why when I perform a query such as the one
below that updates a table using begin and end transaction I am unable
to programmatically truncate the transaction log. The only way I have
found to truncate the transaction log is to stop and start the SQL
Server Service. Does this transaction use the tempdb? Is that why I
am unable to truncate the transaction log? Is there a better way to
do this?

Begin trans T1

Update sometable
Set random_row = 'blah'

End trans T1

Thanks!
  Réponse avec citation
Vieux 12/12/2007, 22h18   #2
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: begin and end transaction and transaction log

Kruton (wmlyerly@gmail.com) writes:
> This is more of an architectural question about SQL Server. Can
> someone please explain why when I perform a query such as the one
> below that updates a table using begin and end transaction I am unable
> to programmatically truncate the transaction log. The only way I have
> found to truncate the transaction log is to stop and start the SQL
> Server Service. Does this transaction use the tempdb? Is that why I
> am unable to truncate the transaction log? Is there a better way to
> do this?
>
> Begin trans T1
>
> Update sometable
> Set random_row = 'blah'
>
> End trans T1


Why would you truncate the transaction log in the first place?

If you run with full recovery and want to be table to restore to a point
in time, the you should backup your transaction log regularly.

If you don't care about the point-in-time restores but are content with
restoring from a full backup in case of a failure, you should set the
database in simple recovery.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
  Réponse avec citation
Vieux 12/12/2007, 22h48   #3
Kruton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: begin and end transaction and transaction log

Hi Erlang,
This is part of a large OLAP process that runs many times a day. I do
not want to / need to restore to a particular time. I have a dba that
does full backups on a regular basis. I would agree with you to a
certain extent if this were OLTP but it is not.

Thanks.

On Dec 12, 2:18 pm, Erland Sommarskog <esq...@sommarskog.se> wrote:
> Kruton (wmlye...@gmail.com) writes:
> > This is more of an architectural question about SQL Server. Can
> > someone please explain why when I perform a query such as the one
> > below that updates a table using begin and end transaction I am unable
> > to programmatically truncate the transaction log. The only way I have
> > found to truncate the transaction log is to stop and start the SQL
> > Server Service. Does this transaction use the tempdb? Is that why I
> > am unable to truncate the transaction log? Is there a better way to
> > do this?

>
> > Begin trans T1

>
> > Update sometable
> > Set random_row = 'blah'

>
> > End trans T1

>
> Why would you truncate the transaction log in the first place?
>
> If you run with full recovery and want to be table to restore to a point
> in time, the you should backup your transaction log regularly.
>
> If you don't care about the point-in-time restores but are content with
> restoring from a full backup in case of a failure, you should set the
> database in simple recovery.
>
> --
> Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
>
> Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx- Hide quoted text -
>
> - Show quoted text -


  Réponse avec citation
Vieux 13/12/2007, 00h34   #4
Greg D. Moore \(Strider\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: begin and end transaction and transaction log

"Kruton" <wmlyerly@gmail.com> wrote in message
news:a8d08495-59a1-4090-8906-2a9ff8b01945@o42g2000hsc.googlegroups.com...
> Hi Erlang,
> This is part of a large OLAP process that runs many times a day. I do
> not want to / need to restore to a particular time. I have a dba that
> does full backups on a regular basis. I would agree with you to a
> certain extent if this were OLTP but it is not.


Then your DBA needs to set the DBA to simple recovery.


>
> Thanks.
>
> On Dec 12, 2:18 pm, Erland Sommarskog <esq...@sommarskog.se> wrote:
>> Kruton (wmlye...@gmail.com) writes:
>> > This is more of an architectural question about SQL Server. Can
>> > someone please explain why when I perform a query such as the one
>> > below that updates a table using begin and end transaction I am unable
>> > to programmatically truncate the transaction log. The only way I have
>> > found to truncate the transaction log is to stop and start the SQL
>> > Server Service. Does this transaction use the tempdb? Is that why I
>> > am unable to truncate the transaction log? Is there a better way to
>> > do this?

>>
>> > Begin trans T1

>>
>> > Update sometable
>> > Set random_row = 'blah'

>>
>> > End trans T1

>>
>> Why would you truncate the transaction log in the first place?
>>
>> If you run with full recovery and want to be table to restore to a point
>> in time, the you should backup your transaction log regularly.
>>
>> If you don't care about the point-in-time restores but are content with
>> restoring from a full backup in case of a failure, you should set the
>> database in simple recovery.
>>
>> --
>> Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
>>
>> Books Online for SQL Server 2005
>> athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
>> Books Online for SQL Server 2000
>> athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx- Hide
>> quoted text -
>>
>> - Show quoted text -

>




--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html


  Réponse avec citation
Vieux 13/12/2007, 08h21   #5
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: begin and end transaction and transaction log

Kruton (wmlyerly@gmail.com) writes:
> This is part of a large OLAP process that runs many times a day. I do
> not want to / need to restore to a particular time. I have a dba that
> does full backups on a regular basis. I would agree with you to a
> certain extent if this were OLTP but it is not.


Then you need simple recovery. What I failed to say is that with simple
recovery, SQL Server will regularly truncate the transaction log, and thus
keep it in check. The one thing to keep in mind is that truncation never
goes past the open transaction, so if you have a long-running transaction
the log can grow never the less.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
  Réponse avec citation
Vieux 13/12/2007, 16h57   #6
Kruton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: begin and end transaction and transaction log

Hi Erland,
This sounds like it could be it. I will give it a try. Thanks


On Dec 13, 12:21 am, Erland Sommarskog <esq...@sommarskog.se> wrote:
> Kruton (wmlye...@gmail.com) writes:
> > This is part of a large OLAP process that runs many times a day. I do
> > not want to / need to restore to a particular time. I have a dba that
> > does full backups on a regular basis. I would agree with you to a
> > certain extent if this were OLTP but it is not.

>
> Then you need simple recovery. What I failed to say is that with simple
> recovery, SQL Server will regularly truncate the transaction log, and thus
> keep it in check. The one thing to keep in mind is that truncation never
> goes past the open transaction, so if you have a long-running transaction
> the log can grow never the less.
>
> --
> Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
>
> Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 04h05.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,17783 seconds with 14 queries