TempDB mdf error

Hi Experts,
We are receiving this error to TEMPDB MDF :
SQL Server detected a logical consistency-based I/O error: incorrect checksum (expected: 0xcdda157a; actual: 0x7fec48fa). It occurred during a read of page (1:32448) in database ID 2 at offset 0x0000000fd80000 in file 'E:\Program Files\Microsoft SQL Server\MSSQL10_50.abcSSQL01\MSSQL\DATA\tempdb.mdf'. 
Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This
error can be caused by many factors; for more information, see SQL Server Books Online.
SQL Errorlog says:
DBCC CHECKDB (tempdb) executed by abc-usa\sqldba1 found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds and errors related to any drives in event log.
When we got his error few days back we RESTARTED SQL but again today it is appearing.
I googled for this, we get many solutions for all other databases except tempDB mdf file issue, can someone help me how to fix this issue as RESTARTING did not fix thought tempDB gets created every restart.
Thanks in advance.

You might want to delete those tempdb files after stopping the server
http://www.sqlsoldier.com/wp/sqlserver/day14of31daysofdisasterrecoveryfixingacorrupttempdb
The fix for tempdb corruption is simple. Shut down SQL Server, delete the tempdb files, and start SQL Server again. What I find instead is that many people
have come to believe that all they need to do is restart SQL Server and the tempdb files will be recreated new. This is the fault of Books Online. Books Online states that the tempdb files are recreated each time the SQL service starts. This is a myth that
was proven false by Jonathan Kehayias (blog|@SQ:Poolboy)
here: does-the-tempdb-log-file-get-zero-initialized-at-startup.aspx

Similar Messages

  • SharePoint TempDB.mdf growing too large? I have to restart SQL Server all the time. Please help

    Hi there,
    On our DEV SharePoint farm > SQL server
    The tempdb.mdf size grows too quickly and too much. I am tired of increasing the space and cannot do that anymore.
    All the time I have to reboot the SQL server to get tempdb to normal size.
    The Live farm is okay (with similar data) so it must be something wrong with our
    DEV environment.
    Any idea how to fix this please?
    Thanks so much.

    How do you get the tempdb to 'normal size'? How large is large and how small is normal.
    Have you put the databases in simple recovery mode? It's normal for dev environments to not have the required transaction log backups to keep the ldf files in check. That won't affect the tempdb but if you've got bigger issues then that might be a symptom.
    Have you turned off autogrowth for the temp DB?

  • I have a sql server 2008. What is the best placement for the tempdb.mdf?

    The sql server has three drives c, d and e. The c drive contains the program. The D drive contains the main db and the tempdb.mdf. The E drives contains all the logs. I've seen the disk queue for drive D spiked up to 50 sometimes. The majority of the read/writes
    came from maindb and the tempdb. I was wondering if it is a good idea to separate the tempdb from the maindb to another drive? Thanks.

     The E drives contains all the logs. I've seen the disk queue for drive D spiked up to 50 sometimes. The majority of the read/writes came from maindb and the tempdb. I was wondering if it is a good idea to separate the tempdb from the maindb to another
    drive? Thanks.
    Hello,
    Disk queue value you posted does not qualifies exactly which counter you are talking about.If you are getting instantaneous high value for Avg disk queue length it is not a issue but if this queue length is for long time and continues to be a straight line
    then it can be issue.Its always good practice to put tempdb on separate drive to gain performance.Please post the value which counter shows not the value shown by graph.Refer below link
    http://technet.microsoft.com/en-us/library/cc938625.aspx
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • High Write Stalls on Tempdb .mdf and .ndf

    Hi All,
    We are seeing quite slow writes to our tempdb database files.  The tempdb log file writes are under 8ms, which is good, but for whatever reason the database files are registering ~250 ms stalls.  According to people that know more than I do, these
    numbers are horrific.  But isn't the write speed to the .ldf far more important since it writes to the log immediately, and once it is written to the log the client gets the success response?  Or do writes to tempdb work differently?  Thanks
    a ton for any help!
    Tony
    physical_name
    name
    num_of_writes
    avg_write_stall_ms
    num_of_reads
    avg_read_stall_ms
    J:\Tempdb\tempdb.mdf
    tempdev
    351826
    240.42673935411254426
    398340
    9.02316362906060149
    J:\Tempdb\templog.ldf
    templog
    2392014
    7.60439989063609159
    2736
    0.34283625730994152
    J:\Tempdb\tempdev1.ndf
    tempdev1
    347635
    243.28483035367555050
    393229
    9.76155115721373550
    J:\Tempdb\tempdev2.ndf
    tempdev2
    351625
    239.84174049057945254
    397766
    9.59242368628791802
    J:\Tempdb\tempdev3.ndf
    tempdev3
    351211
    240.93940964263647778
    399849
    10.52353763545738516
    J:\Tempdb\tempdev4.ndf
    tempdev4
    351567
    241.28811577878469822
    399105
    11.09006652384710790
    J:\Tempdb\tempdev5.ndf
    tempdev5
    350992
    241.81277351050736199
    399188
    12.14670280669759612
    J:\Tempdb\tempdev6.ndf
    tempdev6
    351507
    240.76187387448898599
    397907
    11.66417781039288074
    J:\Tempdb\tempdev7.ndf
    tempdev7
    349810
    242.28378834224293187
    399124
    13.20970425231256451
    SELECT files.physical_name, files.name,
    stats.num_of_writes, (1.0 * stats.io_stall_write_ms / stats.num_of_writes) AS avg_write_stall_ms,
    stats.num_of_reads, (1.0 * stats.io_stall_read_ms / stats.num_of_reads) AS avg_read_stall_ms
    FROM sys.dm_io_virtual_file_stats(2, NULL) as stats
    INNER JOIN master.sys.master_files AS files
    ON stats.database_id = files.database_id
    AND stats.file_id = files.file_id

    Yes the numbers are terrible, anything over about 40ms is bad, and these days with people using SSDs for stuff you might be seeing more like 4ms or less.
    Are these on a SAN or local drives?
    Also check your disk queues, read and write queues.
    I have seen anomalies that I've never had explained, that suggest to me SQL Server may sometimes queue up a bunch of stuff all at once that then vanishes at full disk speed, leaving behind some bad statistics but no real bad news except that you're doing
    a lot of writes.  So as usual, it's never necessary to panic on just some single bad number that may be explained away, but take a look at your overall system performance, and if transactions are taking a lot longer in duration than their CPU times, *then*
    it may be time to panic.
    Simple disk contention can be the cause, but that should show quickly in the queues.  Are there other uses of the J: drive?  But then, your log is on J: as well and is not showing those delays.  Well then, is tempdb expanding?  The time
    to expand may load a huge delay in now and then that is then averaged down but is not really occurring with every write.
    Josh

  • If tempdb .mdf file out of disk space and we do nothing to fix, what could happen? Will anything crash?

    Will anything crash or stop working if tempdb .mdf file out of disk space?

    It might crash, sql server will stop responding or you may not able to perform any action until space allocated to tempdb.
    Running out of disk space in tempdb can cause significant disruptions in the SQL Server production environment and can prohibit applications that are running from completing operations.
    Refer below article to troubleshoot Temp db out of disk issue
    http://technet.microsoft.com/en-us/library/ms176029(v=sql.105).aspx
    Please click the Mark as answer button and vote as helpful if this reply solves your problem

  • TEMPDB.mdf out of control 30 GB

    Hello,
    I tried the three methods from
    http://support.microsoft.com/default.aspx?scid=kb;en-us;307487 to decrease the size of the TEMPDB files but they remain at the same size even saying 98% free space nothing is released...
    What could I do? Rebuild the TEMPDB ? Hopw?
    Thanks,
    Dom
    System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager

    Can you check what is causing the tempdb to grow by running the following queries? The queries below would give you an idea as to what is consuming the highest amount of space in tempdb.
    PRINT '-- sys.dm_db_file_space_used'
    select CONVERT (varchar(30), @runtime, 121) AS runtime, SUM (user_object_reserved_page_count)*8 as usr_obj_kb,
    SUM (internal_object_reserved_page_count)*8 as internal_obj_kb,
    SUM (version_store_reserved_page_count)*8 as version_store_kb,
    SUM (unallocated_extent_page_count)*8 as freespace_kb,
    SUM (mixed_extent_page_count)*8 as mixedextent_kb
    FROM sys.dm_db_file_space_usage
    PRINT '-- sys.dm_db_session_file_usage'
    select top 10 CONVERT (varchar(30), @runtime, 121) AS runtime, * FROM sys.dm_db_session_space_usage
    ORDER BY (user_objects_alloc_page_count + internal_objects_alloc_page_count) DESC
    PRINT '-- sys.dm_db_task_space_usage'
    SELECT top 10 CONVERT (varchar(30), @runtime, 121) AS runtime, * FROM sys.dm_db_task_space_usage
    ORDER BY (user_objects_alloc_page_count + internal_objects_alloc_page_count) DESC
    This posting is provided "AS IS" with no warranties, and confers no rights.
    My Blog: http://troubleshootingsql.com
    Twitter: @banerjeeamit
    SQL Server FAQ Blog on MSDN: http://blogs.msdn.com/sqlserverfaq

  • TEMPDB.mdf out of control 100 GB

    Hello,
    using my previous thread and the answers proposed:
    http://social.technet.microsoft.com/Forums/en-US/99f34dc7-93fc-4f8d-b72a-48096707169f/tempdbmdf-out-of-control-30-gb?forum=sqldatabaseengine
    session_id database_id user_objects_alloc_page_count user_objects_dealloc_page_count internal_objects_alloc_page_count internal_objects_dealloc_page_count
    119 2 0 363 12150896 12152552
    78 2 0 0 96 88
    84 2 0 0 48 88
    102 2 0 0 16 8
    57 2 10 0 0 0
    69 2 6 0 0 0
    66 2 4 0 0 0
    65 2 2 0 0 0
    67 2 2 0 0 0
    73 2 2 0 0 0
    I have identified the Session Id, user and database using the session 119 ...
    what should I do next:
    restart SQL Service for this instance?
    kill the session?
    Thanks,
    DOm
    System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager

    INSERT INTO [etlStaging].[clarity].[flowsheet] ([flo_meas_id] ,[recorded_time] ,[meas_value] ,[pat_id]) select [flo_meas_id] ,[recorded_time] ,[meas_value] ,[pat_id] from [syn_lsClarity_Flwsht]
    System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager
    This is a insert statement without a where clause so I guess amount of records will be huge.Seem like bulk insert to me
    If I were you I would have added a new log file for tempdb on some other drive and let operation to complete.After operation is completed I would shrink tempdb
    You can kill but on your own risk.But I dont see tempdb being utilized in SQL statement anywhere ? Is this really the statement filling tempdb
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers
    I shrunk tempdb, I restarted SQL Server Service on this instance and already I am getting 8 Gb in 15 minutes with the same insert...
    System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager

  • Optimal Locations for SQL 2005 TempDB & ReportServerTempDB MDF & LDF Files

    Hello.  I have SQL Server 2005 SP4 installed on Windows Server 2003 R2 Standard SP2. 
    The server has four CPU cores.  The server was configured with the following drive configuration.
    RAID 1 - System drive
    RAID 5 - SQL MDF files
    RAID 1 - SQL LDF files
    There is currently one of each of the following files on the server. 
    The MDF files are on the RAID 5 array, while the LDF files are on the RAID1 array for SQL LDF files.
    TempDB.mdf                                    
    ReportServerTempDB.mdf
    TempLog.ldf                                     
    ReportServerTempDB_log.ldf
    It is my understanding that having one TempDB per core is a best practice, so I should create three more TempDB’s. 
    Does that also apply to ReportServerTempDB?  Given the drive configuration of this server, where should all of the required MDF and LDF files for the TempDB’s and ReportServerTempDB’s be located?

    You cannot create more than 1 tempb in any SQL Instance. The recommendations are to have additional tempdb *data files* depending on cores upto a max of 8. Obviously this depends on every environment. This recommendation is only for tempdb. It is not
    for ReportServerTempDB’s. They are totally different and is not used similar to tempdb.
    http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-1230-tempdb-should-always-have-one-data-file-per-processor-core/
    http://blogs.msdn.com/b/cindygross/archive/2009/11/20/compilation-of-sql-server-tempdb-io-best-practices.aspx
    Now, it is good to keep tempdb in its own drive, but because you dont have one specific, you can just put tempdb data files in data files drive and log file in log files drive.
    You might want to consider moving them to a seperate disk if you see IO contention.
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 537, state 3, severity 16

    Hello,
    I've encountered issue during installation of SP1 to SQL Server 2012. After upgrade I'm getting this error in Event Log:
    Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 537, state 3, severity 16. This is a serious error condition which might interfere with regular operation and the database will be taken offline.
    If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script
    upgrade steps run to completion.
    Can someone point me direction how I can fix it? This is a production server and currently only way to make it working is to use T902 flag in SQL Server startup params. I've found some suggestions to check Data path if it exists but it does so this is not
    the issue here. Any ideas?
    I've found also here
    http://www.sqlservercentral.com/Forums/Topic1377073-1550-1.aspx#bm1378279
    suggestions for similar issue with SQL Server 2008 which that I should do:
    Via ssms:
    From msdb:
    Delete:
    dc_admin role
    Dc_operator role
    Dc_proxy role
    UlitityCMRReader role
    UtilityIMRReader role
    UtilityIMRWriter role
    but for not I didn't tried it yet. This is standalone SQL Server instance.
    Any help really appreciated.
    Regards

    Script returns the same error.
    System databases:
    1    1    760    -1    10    1048578    0    1    master        C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\master.mdf
    2    0    12768    -1    10    1048642    0    1    mastlog        C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
    1    1    1024    -1    10    1048578    0    2    tempdev        C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\tempdb.mdf
    2    0    64    -1    10    1048642    0    2    templog        C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\templog.ldf
    1    1    288    -1    128    2    0    3    modeldev    C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\model.mdf
    2    0    4464    -1    10    1048642    0    3    modellog    C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\modellog.ldf
    1    1    28936    -1    10    1048578    0    4    MSDBData    C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MSDBData.mdf
    2    0    3352    268435456    10    1048642    0    4    MSDBLog    C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MSDBLog.ldf
    are all in place where path shows.
    Before sending my message I've searched update script for "FROM master.sys.master_files" and I found script which you are showing me. I've made some digging and when I runned:
           SELECT physical_name
           FROM master.sys.master_files
           WHERE (name = N'master')
    it returned also path to one my customers database name which has filename set correctly but it's Logical DB name is master and mastlog. I'm running shared hosting company and I allow my customers to restore their DBs from .bak files but I have no idea why
    this customers logical name is set to master and mastlog. Probably when I change this names update script will work as it should. On the other hand in my opinion there should be some kind of fail safe mechanism for situations like this one.
    EDIT: After changing logical name for DB and log for mentioned DB your script runned fine so probably now when I remove T902 flag and restart my SQL Server update will run correctly. Big thanks for resolving this issue.

  • SQL 2012 Cluster- How to or Steps to Move Tempdb Files from Local drive to Shared volume

    Hi..
     I did Installation of SQL Server 2012 Cluster. During this setup I installed Tempdb Files on Local drive. Now I want to move this tempdb files from local drive to Shared Drive . When I am trying to move I am getting below error.
    Does any one can help me or provide the steps to move this tempdb files from local drive to Shared Drive ?
    Msg 5184, Level 16, State 1, Line 1
    Cannot use file 'Z:\Tempdb\tempdb.mdf' for clustered server. Only formatted files on which the cluster resource of the server has a dependency can be used. Either the disk resource containing the file is not present in the cluster group or the cluster resource
    of the Sql Server does not have a dependency on it.
    Thanks 
    Regards..
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach

    Hi,
    The error message may be thrown out when you attempt to create a database on another shared cluster drive when the SQL Server resource is not dependent on that disk.
    Check if you are in the scenario which mentioned in the following article:
    How to create databases or change disk file locations on a shared cluster drive on which SQL Server was not originally installed
    http://support.microsoft.com/kb/295732/en-nz
    Here is a thread with similar issue:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c9f80af7-5b51-4c43-a2a0-f9c7d97aa41d/sql-disk-dependency-problem-on-sql-2008-cluster-including-errors
    Hope it helps.
    Tracy Cai
    TechNet Community Support

  • SQL Server won't start - unhelpful error message in log

    I am running SQL Server 2008 on Windows Server 2008.  SQL server had been running using a netowrk account, which i then changed over to a dedicated Active Directory account, and I tried restarting the server.  It failed to restart, and produces a number of identical error messages in the event log.  The error message is below:
    initerrlog: Could not open error log file ''. Operating system error = 3(failed to retrieve text for this error.  Reason: 15105)
    I've searched the web and have not found a solution.  It appears to be a permissions problem (the "Reason: 15105" indicates such), but the permissions on all the data and log folders are correct.  The fact that it fails to list the error log file is the must frustrating of all since it gives me no indication of where to look for the problem.
    If I try switching the the SQL Server user back to the network account it gives the following error:
    WMI Provider Error [call to WMI Provider returned error code: 0x800742a2]

    Hi Guys,
    The solution of Tibork is the working one for me.
    What I did to get this error:
    I wanted to move my TempDB to another volume (e). I executed following query:
    USE master
    GO
    ALTER DATABASE tempdb
    MODIFY FILE (NAME = tempdb, FILENAME = 'E:\tempdb.mdf')
    GO
    ALTER DATABASE tempdb
    MODIFY FILE (NAME = templog, FILENAME = 'E:\templog.ldf')
    GO
    Stopped the SQL Server instance and moved the TempDB files from the original DATA folder.
    After that, when I restarted the server, it gave me the 1814 error. I tried to undo my actions with no luck.
    The working solution for the problem was indeed access rights. I know its not best practice, but since we are in a protected environment I choose to remedy the problem with Tibork's solution:
    Start > Control Panel > Adminsitrative Tools > Services
    Find the SQL Instance
    Right click and choose Properties
    Find the logon tab
    I changed the logon to "Local System Account"
    Worked like a charm. Thanks for the hint.

  • Tempdb file remove problem

    Hi All. I am trying to remove one of the tempdb logical file
    alter database tempdb remove file tempdev2
    and have the following error:
    The file "H:\tempdb2.mdf" has been modified in the system catalog. The new path will be used the next time the database is started.
    Msg 5042, Level 16, State 1, Line 1
    The file 'tempdev2' cannot be removed because it is not empty.
    then i run
    USE tempdb;
    GO
    DBCC SHRINKFILE('tempdev2', EMPTYFILE)
    and another error comes up:
    Msg 8985, Level 16, State 1, Line 1
    Could not locate file 'tempdev2' for database 'tempdb' in sys.database_files. The file either does not exist, or was dropped.
    then I see in sys.database_files ,, I see
    file_id file_guid type type_desc data_space_id name physical_name state state_desc size max_size growth is_media_read_only is_read_only is_sparse is_percent_growth is_name_reserved create_lsn drop_lsn read_only_lsn read_write_lsn differential_base_lsn differential_base_guid differential_base_time redo_start_lsn redo_start_fork_guid redo_target_lsn redo_target_fork_guid backup_lsn
    1 NULL 0 ROWS 1 tempdev d:\databases\tempdb\tempdb.mdf 0 ONLINE 52008 -1 10 0 0 0 1 0 NULL NULL NULL NULL 27000000012600037 245940A4-BFC3-4F98-98B8-E56FFD49AE02 2014-07-12
    14:00:05.247 NULL NULL NULL NULL NULL
    2 NULL 1 LOG 0 templog d:\databases\tempdb\tempdb.ldf 0 ONLINE 3688 -1 10 0 0 0 1 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
    3 997529E5-AD3D-4605-9CC0-5DAB53C91DFD 0 ROWS 1 tempdev2 H:\tempdb2.mdf 0 ONLINE 1748360 -1 128 0 0 0 0 0 3515000000034000001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
    any one can help? am I afraid next time DB restart, the DB instance can't be start up.

    First step you might have tried Empty the file, then remove the file...
    -- First empty the data fileUSE tempdb
    GO
    DBCC SHRINKFILE (tempdev2, EMPTYFILE); -- to empty "tempdev12" data file
    GOIf nothing is working then you have to restart the instance and try.. If you restart then you will come to how many files are there and then you can follow the corrects steps and then you can fix the issue.
    Note : Also we no need to restart the MS SQL Services after adding a new file to tempdb.but we have to restart after removing the tempdb files, Because tempdb space addition of removeal of the files comes under tempdb reconfig that requires
    a service restart.
    Raju Rasagounder Sr MSSQL DBA

  • The operating system returned error 21(failed to retrieve text for this error. Reason: 15105

    Hello everybody, 
    I have a huge database over windows 2003 server and sql server 2008 r2, all of them with all update, no firewall, no antivirus, no any server feature/role installed. 
    Over the last 2 months I suddently start getting the following error:
    The operating system returned error 21(failed to retrieve text for this error. Reason: 15105) to SQL Server during a read at offset 0x000000000da000 in file 'S:\TempDB\tempdb.mdf'. Additional
    messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB).
    This error can be caused by many factors; for more information, see SQL Server Books Online.
     I have the TEMP database split over 5 partitions on 5 different SAN disk.  beggining size of each partition fix to 20 GB with autogrow 10%.  Single Instance, around 15 DB. 
    The space on each hard disk does not reach 60%. 
    I got the above error when all temp files reach 27 GB approx. 
    I already ran a check disk, checkDB and everything says no error found, but I still got same error. 
    Does anyone know what could cause something like this?
    note, when getting the above error, the only way to fix it, because I cannot do any select on any DB is to restart the service, so each temp file start again at 20 GB and everythign seems to be fine until reach the size again. 
    Gilberto H.

    The operating system returned error 21(failed to retrieve text for this error. Reason: 15105
    Hello Gilberto,
    See System Error Codes (0-499) for error code 21:
    ERROR_NOT_READY
    21 (0x15)
    The device is not ready.
    Could be an issue with your storage system
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Can't perform emptyfile operation on .mdf?

    Hi all, 
    I'm trying to move data from the original .mdf for a database into 8 new db files which I have already created as primary. 
    USE [db_qr2]
    GO
    DBCC SHRINKFILE (N'db_qr2_data' , EMPTYFILE)
    The problem is that every time I try to do this I get the following error message:
    Msg 2555, Level 16, State 2, Line 1
    Cannot move all contents of file "db_qr2_data" to other places to complete the EMPTYFILE operation.
    Not sure why it won't let me. Ideally I want to empty the file to delete it and have it replaced by the 8 new .mdf files. 
    How can I get this to empty properly for deletion?

    Yes, you can remove the old MDF, but you have to create a new one first by changing the name firstThe
    ALTER
    DATABASE[tempdb]MODIFYFILE(
    NAME=N'tempdev',
    NEWNAME =N'tempdev_1',
    FILENAME=N'V:\Instance
    7\tempdb_1.mdf',
    SIZE=100MB,
    FILEGROWTH=0%);
    This changes the focus away from the original file  'tempdb.mdf' by rename it logically and physically to 'tempdb_1' as the syntax show.. NOW the original file can be deleted from the disk for it is unlocked
    Next you want to bring the MDF file back up to a usable level like 1000 or 10K GB ...
    ALTER
    DATABASE[tempdb]MODIFYFILE(
    NAME=N'tempdev_1',
    SIZE=10000MB,
    FILEGROWTH=0%);
    Lastly, here is a copy of post about dealing with the NDF files where you want to add and drop them, which I have tested and it works... You should perform your own test as well.
    Thanks for the post
    1. You cannot put the Tempdb in Single user mode, which is logical since it is a system database or sorts
    2. The Restarting of your SQL Server instance prior to the execution of the REMOVE FILE command is essential
    3. Here is my post from a TEST where I had added an NDF file..
    Warning the TempDEV_2 file declaration got lost somehow in this process and the system thinks it is still there, which it is not.. So be careful and test your syntax on test server instance before you do what you need on a production server..
    — my syntax
    use tempdb
    go
    sp_helpfile
    ALTER DATABASE [tempdb] ADD FILE ( NAME = N’tempdev_4′, FILENAME = N’V:\Instance 7\tempdb_4.ndf’, SIZE = 100MB, FILEGROWTH = 0% ) TO FILEGROUP [PRIMARY];
    GO
    DBCC SHRINKFILE (N’tempdev_4′ , 0) –shrink to 000 MB
    GO
    ALTER DATABASE [tempdb] MODIFY FILE ( NAME = N’tempdev_4′, SIZE = 0KB, FILEGROWTH = 0% );
    GO
    — The SQL Server Instance MAY have to be Restarted to clear all system usage pointers into the Tempdb database
    — before this command can be performed
    ALTER DATABASE [tempdb] REMOVE FILE [tempdev_4];
    GO
    sp_helpfile
    [email protected]
    end…
    FHankFreeman

  • Split TempDb in SharePoint 2010 Sql Server DB

    Hi ,
    We have envirenment of sharepoint farm,one Database server.We have plan to split tempDb acording microsoft best practices.
    By the time of we have the largest content database is 260 in size and SQL Server has a 2-core processor.
    So the tempdb would be split in two files with 40 GB per .mdf file.
    Kinldy suiggest hopw to split TempDb.
    Hasan Jamal Siddiqui(MCTS,MCPD,ITIL@V3),Sharepoint and EPM Consultant,TCS
    |
    | Twitter

    Hi Shanky,
    We are not facing any issue,But we had take Micorosft RaaS services,Microsoft Consutlatan suggest thet we should break oure TempDb
    RaaS   ISSUE/RISK
    Initial Size of Temp DB is too   small
    TempDB database Size may be too   small.
    SQL Server instance has only one   tempdb data file while there are more than one scheduler in use
    One or more user database files   are placed on same disk volume along with TempDB database files
    REMEDIATION   COMMENTS
    The size   and physical placement of the tempdb database can affect the performance of a   SharePoint farm. For example, if the size that is defined for tempdb
    is too   small, part of the system-processing load may be taken up with autogrowing   tempdb to the size required to support the workload every time you restart   the instance of SQL Server. You can avoid this overhead by increasing the  
    sizes of the tempdb data and log files.
    Currently   .mdf and .ldf files are in the D volume along with all other SharePoint   databases and there is just one tempdb .mdf file.
    More information:
    http://technet.microsoft.com/en-us/library/ms175527(v=SQL.105).aspx
    ACTION   PLAN
    Set the   recovery model of tempdb to SIMPLE recovery model.
    Create   as many files as needed to maximize disk bandwidth. Using multiple files   reduces tempdb storage contention and yields significantly better   scalability. However,
    do not create too many files because this can reduce   performance and increase management overhead. As a general guideline, use
    # of TempDB Files = # of Processors Cores   / 4 and then adjust the number of files up or down as necessary.
    Preallocate   space for all tempdb files by setting the file size to a value large enough   to accommodate the typical workload in the environment. You can go by a rule  
    of thumb that the size should be 25% of the largest SharePoint content   database.
    Important: Make each TEMPDB   data file the same size.
    Allow   your TEMPDB files to grow automatically and monitor the disk free space, set   the file growth in fix size and not in percentage. We recommend the following  
    general guidelines for setting the FILEGROWTH increment for tempdb files:
    tempdb   file size from 0 to 100 MB - FILEGROWTH increment in 10 MB
    tempdb   file size from 100 to 200 MB - FILEGROWTH increment in 20 MB
    tempdb   file size from 200 MB or more - FILEGROWTH increment in 10%*
    * The FILEGROWTH increment should be   set to a maximum of 6 GB, regardless of the tempdb file size.
    Put the   tempdb database on a fast I/O subsystem. Use disk striping if there are many   directly attached disks.
    Put the   tempdb database on disks that differ from those that are used by SharePoint.
    Important: This action plan requires a downtime   of your SharePoint
    farm as you will have to stop SQL Server services to move   data and transaction log files to different disks.
    By the time of this remediation the   largest content database is 300 in size and SQL Server has a 2-core   processor. So the tempdb would be
    split in two files with 40 GB per .mdf   file.
    STATUS
    SharePoint administrators will work   on the action plan.
    Downtime required for to apply this   action plan? YES
    Hasan Jamal Siddiqui(MCTS,MCPD,ITIL@V3),Sharepoint and EPM Consultant,TCS
    |
    | Twitter

Maybe you are looking for

  • Ifolder

    I'm trying to set up ifolder, I've built the dependencies from AUR just fine (libfaim, pkgversion and 2 others) trying to build it using aur. So far I get past the "libfaim" error (which can be solved by performing PKG_CONFIG_PATH=/usr/lib64/pkgconfi

  • DBMS_XMLSTORE parsing with other ROWSET tag

    Hi, I've got XML content stored in a CLOB which I want to store in a relational format. I use the DBMS_XMLSTORE package to do this job. This works as long as my ROWSET tag is <ROWSET>. I wonder if there is a possibility to allow another tag like <USE

  • How to cleanup the mess?

    OK, PC users since the days of the original real IBM PC...over the last six months or so our household has drunk the cool-aid, as they say: two iPhones, two iPod touch and two nicely-loaded Mac Pro's. We are not abandoning PC's, just adding on Macs t

  • EMails not addressed to me

    I receive a lot of junk eMails that are not exactly addressed to me. They are close to correct and are the correct domain. I receive approximately 20 to 25 a day. I am using Apple Mail 2.1.1. If I check my mail on yahoo they are not there....

  • DynaForm Validation issue

    i used dyna validator form with dispatch action, it gives me an exception that says Servlet action is not available(HTTP 404 not found).....Can anybody help me in this???