日期:2014-05-18  浏览次数:20496 次

关于tempdb的问题 小F来吖 来吖 来吖 我请你吃串串儿
name fileid filename filegroup size maxsize growth usage
tempdev 1 C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\tempdb.mdf PRIMARY 2304 KB Unlimited 1024 KB data only
templog 2 C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\templog.ldf NULL 768 KB Unlimited 10% log only
tempdev2 3 C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\tempdb2.mdf PRIMARY 3072 KB Unlimited 1024 KB data only


问题是这样的,今天查询一个很大的表2亿多记录的
出现这样的提示
消息 1105,级别 17,状态 2,第 2 行
Could not allocate space for object 'dbo.SORT temporary run storage: 140744494546944' in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
消息 9002,级别 17,状态 4,第 2 行
The transaction log for database 'tempdb' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases


于是各种寻找后,大概找了几种方法,大致都是通过增加TMEPDB来解决.
于是我有了最上面的解决方法,我直接新增一个tempdev2 这样可以解决上面的问题吗?
我查询过出现错误提示的时候 我的TEMPDB的大小固定在1732mb这个级别 然后就查询不了.
一般的表这个时候还是可以查询的,这个时候我发现有一个盘符的空间只有2MB可以用,
我想这个可能是之前的弄数据库的时候设置的某一个用来存放临时TEMPDB的盘.
我在想可以不可以增加这个盘的容量来达到解决这个问题的目的.
另外我的数据库是有文件分组的.

另外求方法:
如何指定另外盘符的新的一个tempdb来接替现在tempdb的工作,网上看了 各种不明白,

------解决方案--------------------
database 'tempdb' because the 'PRIMARY' filegroup is full.
我的TEMPDB的大小固定在1732mb这个级别


你把tempdb上限大小设置为没有上限不就行了吗?