Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Tlog Getting full While executing update statement

Author  Topic 

aswindba1
Yak Posting Veteran

62 Posts

Posted - 2012-08-19 : 14:23:39
Hi All,

Could you please assist on tlog space issues. I am trying to execute the query have update statement like
''update tblGatewayPersons SET ImportDataXML_NT = ImportDataXML_NT''

tlog space getting full in a few minutes and the query is through the follwing error
''The transaction log for database 'Perspective' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases''.

Please advise me.

Thanks
Ashwin

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-19 : 14:26:21
whats the size of table? try doing it in small batches

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

aswindba1
Yak Posting Veteran

62 Posts

Posted - 2012-08-19 : 14:41:21
Hi Vishal,

Thanks for your prompt reply, Actullay I am executing the the query by bacthes itself. But the error coming when executing that single update statement.
''update tblGatewayPersons SET ImportDataXML_NT = ImportDataXML_NT''.

Table space is

filesizeMB UsedSpaceMB UnusedSpaceMB Type DBFileName
-------------------------------------------------------------
995.00 11.81 983.19 Log Perspective_Log

9000.00 6697.25 2302.75 Data Perspective_Data

6500.00 6318.88 181.13 Data Perspective_Data2

2643.00 2117.44 525.56 Data Perspective_Data3

19138.00 15145.38 3992.63 *** Total for all files ***
Go to Top of Page

aswindba1
Yak Posting Veteran

62 Posts

Posted - 2012-08-19 : 15:37:32
Hello, Could anybody help me out from that query.
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-08-19 : 18:42:03
What is that update statement intented for?It seems like it is setting a column to ITSELF. I was hoping that the query optimizer would see that and generate a trivial execution plan. Since it does not, and since there are no where clauses to limit the number of rows it will update the whole table. If it is an XML column, depending the size of the XML data, it can be resource intensive.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-19 : 21:30:44
quote:
Originally posted by aswindba1

Hi Vishal,

Thanks for your prompt reply, Actullay I am executing the the query by bacthes itself. But the error coming when executing that single update statement.
''update tblGatewayPersons SET ImportDataXML_NT = ImportDataXML_NT''.

Table space is

filesizeMB UsedSpaceMB UnusedSpaceMB Type DBFileName
-------------------------------------------------------------
995.00 11.81 983.19 Log Perspective_Log

9000.00 6697.25 2302.75 Data Perspective_Data

6500.00 6318.88 181.13 Data Perspective_Data2

2643.00 2117.44 525.56 Data Perspective_Data3

19138.00 15145.38 3992.63 *** Total for all files ***


this is not batch update
the above update fires over entire table in one shot.

My suggestion was to do it in batches by iterating through a loop taking a definite amount of records and processing them each time

also i see the above update is trivial ie setting same column to itself. whats the purpose of this?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

aswindba1
Yak Posting Veteran

62 Posts

Posted - 2012-08-19 : 21:44:10
Thanks alot sunitabeck...I got an idea of it
Thank you soo much
Go to Top of Page
   

- Advertisement -