数据库“我的数据库”的事务日志已满。要找出无法重用日志中的空间的原因,请参阅sys.databases中的log_reuse_wait_desc列。 [英] The transaction log for database 'My DB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

查看:245
本文介绍了数据库“我的数据库”的事务日志已满。要找出无法重用日志中的空间的原因,请参阅sys.databases中的log_reuse_wait_desc列。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据库我的数据库的事务日志已满。要找出日志中的空间无法重用的原因,请参阅sys.databases中的log_reuse_wait_desc列



我创建了一个spring批处理应用程序,它将读取一些crore来自文本文件的行并在将所有数据读入登台表之后的某个固定时间间隔内将其更新到登台表(Tblm My table)我的存储过程将执行它将从我的主表中删除旧记录并从登台表插入数据批量处理主表但是它没有成功我的数据库'我的数据库'的事务日志已满。错误



我的管理员没有增加他要求的磁盘空间至于更改我的存储过程以使用简单的插入查询来执行批量插入Iam以将数据从一个表插入到另一个表中



SP

  IF   @ BenefitYear  =  2013   BEGIN  

INSERT INTO mainTable

(userid,username,addr,ucost,unitcost90 ,Benefityear,datecreated,createduser)

SELECT userid,username,addr,ucost,unitcost90, @BenefitYear current_timestamp @ BatchUser

stagingTable

END

解决方案

使用以下查询进行批量复制 -



  BULK   INSERT  pubs..publishers2  FROM  '  c:\ newpubs.dat' 
WITH
DATAFILETYPE = ' char'
FIELDTERMINATOR = ' , '
ROWTERMINATOR = ' \ n'


The transaction log for database 'My DB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

I have created an spring batch application ,it will read some crore of rows from a text file and update it in to staging Table(Tblm My table) in some regular interval of time after reading all data to staging table my stored procedure will execute it will delete old record from my main table and insert data from staging table to main table in bulk but its is not success am getting The transaction log for database 'My DB' is full.error

My Admin is not increasing disk space he ask as to change my stored procedure to do bulk insert Iam using simple insert query to insert data from one table to another

SP Below

IF @BenefitYear = 2013 BEGIN

INSERT INTO mainTable

   (userid,username,addr,ucost,unitcost90,benefityear,datecreated,createduser) 

SELECT userid,username,addr,ucost,unitcost90,@BenefitYear, current_timestamp,@BatchUser

From stagingTable

END

解决方案

Use the below query for Bulk copying -

BULK INSERT pubs..publishers2 FROM 'c:\newpubs.dat'
WITH (
   DATAFILETYPE = 'char',
   FIELDTERMINATOR = ',',
   ROWTERMINATOR = '\n'
)


这篇关于数据库“我的数据库”的事务日志已满。要找出无法重用日志中的空间的原因,请参阅sys.databases中的log_reuse_wait_desc列。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆