Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    101

    Unanswered: Recovery Question.

    Hi,
    We have two drives on our server - Drive D is for data files and E for log files.
    Due to because of hardware related issues Drive E is not accessible. What is the procedure to recover all databases?
    Thanks
    sskris

  2. #2
    Join Date
    Jun 2003
    Posts
    269

    Thumbs up

    that means ur .mdf file is safe.And ur all databses must be in suspect mode.
    u have to create log file for each db with
    DBCC REBUILD_LOG() in ur new driver.
    Code:
    use master
    go
    EXEC sp_configure 'allow updates', 1
    RECONFIGURE WITH OVERRIDE
    GO
    BEGIN TRAN
    UPDATE master..sysdatabases
    SET status = status | 32768
    WHERE name = 'urDbName'
    IF @@ROWCOUNT = 1
    BEGIN
       COMMIT TRAN
       RAISERROR('emergency mode set', 0, 1)
    END
    ELSE
    BEGIN
       ROLLBACK
       RAISERROR('unable to set emergency mode', 16, 1)
    END
    GO
    EXEC sp_configure 'allow updates', 0
    RECONFIGURE WITH OVERRIDE
    GO
     
     
     
    -- Restart SQL Server at this point.
    -- Delete or rename the log file
    -- START the SQL Server instance.
    
     
     
    DBCC REBUILD_LOG('urDbName','C:\Program Files\Microsoft SQL Server\MSSQL\data\urDbName_Log.LDF')
     
    /*Perform physical and logical integrity checks at this point.
    Bcp data out if your integrity checks demonstrate that problems exist.
    */
    ALTER DATABASE urDbName SET MULTI_USER
    GO
    -- Set database options and recovery model as desired.
    GO
    use urDbName
    Last edited by mallier; 02-03-06 at 09:37.
    I love cursor,though I never use it.Cos' I dont want to misuse it.
    ----------------------------------------------

    ----cheers
    ----http://mallier.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •