I tray shrink database but i have error 8985

  • I try to shrink my database by this command

    DBCC SHRINKFILE(QSM_Log,2,TRUNCATEONLY)

    but I have the following error:

    Server: Msg 8985, Level 16, State 1, Line 4

    Could not locate file 'QSM_Log' in sysfiles.

    DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    I checked the sysfiles:

    select name, fileid from sysfiles

    QSM_Data         1

    QSM_Log           2

    Do you have any idea?

    Thanks

  • what does sp_helpfile reveal?

    Are you connected to the database your trying to shrink the file on?

    use Northwind

    DBCC SHRINKFILE(pubs_log,TRUNCATEONLY)

    -- Results

    -- Could not locate file 'pubs_log' in sysfiles.

    -- DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    use Pubs

    DBCC SHRINKFILE(pubs_log,TRUNCATEONLY)

    -- Results

    -- DbId,FileId,CurrentSize,MinimumSize,UsedPages,EstimatedPages

    -- 5,2,63,63,56,56

  • Thanks for your answer.

    Yes, I'm connected to my database.

    The sp_helpfile gives this answer:

    QSM_Data  1  C:\Datawatch\DBBPS\QSM_CRIPT_Data.MDF  PRIMARY 102400 KB Unlimited 10% data only

    QSM_Log    2  C:\Datawatch\DBBPS\QSM_CRIPT_Log.LDF    NULL 1451456 KB Unlimited 10% log only

    If I run the command:

    use QSM

    DBCC SHRINKFILE(QSM_log,TRUNCATEONLY)

    I have the error 8985 Culd not locate file 'QSM_Log' in sysfile.......

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply