Error: Could not open FCB for invalid file...

  • Hi,

    I'm trying to recover data from a corrupted database.

    I was able to put that database into "emergency mode" but when I try to rebuild the log file (using dbcc rebuild_log('TMOTOR',´E:\Tecno\TMOTORLog.ldf´) , Query Analyzer reports the following error:

    Error: 5180, Severity: 22, State: 1

    Could not open FCB for invalid file ID 0 in database 'TMOTOR'.

    and then I can't go on with recovery.

    Is there a way to correct that error and go on with the recovery process?

    Thank you, regards.

    Roberto

  • dbcc rebuild_log is used to build the log file if you lost the log file and db marked suspect...

    What is the reason for your db suspect..

    If you can put the db in emegnecy mode, take out all the data using dts or bcp...

    Check system log for any disk errors also...

    MohammedU
    Microsoft SQL Server MVP

  • You posted this on SQL 2005... Is your server 2005?

    dbcc rebuild_log command retired in 2005...

     

     

    MohammedU
    Microsoft SQL Server MVP

  • Yes...you are right, this is the SQL 2005 section but I have the SQL 2000.

    I didn't pay attention to the proper section due to the "rush" to write this thread.

    By the way, can you explane me how to recover data through DTS or BCP? I'm pretty new with SQL Server.

    Thank you,

    Bob

  • create a new database first to copy the data...

    If you can get the db into emegency recovery mode...if you can query the data use dts/bcp to new database..and you can delete the suspected after data is out..

     

    MohammedU
    Microsoft SQL Server MVP

  • you need to run following

    DBCC DROPCLEANBUFFERS

    DBCC FREEPROCCACHE

    this will fix the issue.

    :crazy: :alien:

    Umar Iqbal

  • Hi masters,

    In my case , i have the same problem (suspect database).

    I received the datafile and log file, from the production server.

    When i trie to put the DB in emergency mode it gives me a status of (suspect\emergency).

    I have executed the folowing steps:

    1) created a database with the exact same size as my suspect database.

    2) reconfiexec sp_configure 'allow updates',1

    reconfigure with override

    go

    3) update master.dbo.sysdatabases

    set status =32768 where name ='test'

    go

    exec sp_configure 'allow updates',0

    reconfigure with override

    go

    then , the status is (suspect\emergency mode)

    then i trie to execute the command :

    dbcc REBUILD_LOG ('test','c:\test_log.ldf') and i receive the error:

    Could not open FCB for invalid file ID 0 in database 'test'

    can someone please help?

    tks,

    Pedro

  • pedro.ribeiro (3/2/2009)


    In my case , i have the same problem (suspect database).

    Please post your problem in a new thread in the appropriate forum (SQL 2000 is this is a SQl 2000 server, which it sounds like). Include any errors that you're getting as well as any messages in the SQL error log that relate to this database. Also check the windows event log for errors.

    Oh, and note that rebuild log is a last resort and should never be the first thing tried.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • As GilaMonster said, you should NEVER use DBCC REBUILD_LOG. Do you have any backups? How old are they?

    See also http://sqlskills.com/BLOGS/PAUL/category/CHECKDB-From-Every-Angle.aspx

  • Well, saying NEVER is too strong. There's a place for using DBCC REBUILD_LOG if there's no other alternative and you have a damaged log on SQL 2000.

    Also - posting a link to the very large CHECKDB category on my blog isn't really helpful for a targetted emergency such as this. What's much better is to post a link to the relevant blog posts - such as Corruption: Last resorts that people try first.... You should also see my SQL Q&A column from the February 2009 TechNet Magazine where I discuss whether it's ever safe to rebuild a transaction log - see TechNet Magazine: February 2009 SQL Q&A column

    Thanks

    Paul Randal
    CEO, SQLskills.com: Check out SQLskills online training!
    Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
    SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
    Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005

  • dmoldovan (3/3/2009)


    As GilaMonster said, you should NEVER use DBCC REBUILD_LOG.

    Actually I said it should never be the first thing tried.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Not you Gail, dmoldovan.

    Paul Randal
    CEO, SQLskills.com: Check out SQLskills online training!
    Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
    SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
    Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005

  • Paul, Gail: I'm sorry. I should have been more specific (links...) and less cautious ("never"...). I feel really sorry about this.

  • It's no big deal - just be wary of making sweeping assertions/generalizations. Cheers

    Paul Randal
    CEO, SQLskills.com: Check out SQLskills online training!
    Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
    SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
    Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005

  • Paul Randal (3/3/2009)


    Not you Gail, dmoldovan.

    Yup. I realised that. Just noticed that he'd misquoted me and wanted to set the record straight.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 15 posts - 1 through 15 (of 16 total)

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