Re-creating Lost Devices

    To re-create lost devices
  1. Start SQL Server in single-user mode. Type:

    where

    /c
    Starts SQL Server independent of the Windows NT Service Control Manager.
    /dmaster_device_ path
    Specifies a physical name for the MASTER database device. For example:
    /dc:\sql60\data\master.dat
    
    /m
    Specifies single-user mode.

    sqlservr /c /dmaster_device /m

    where

    /c
    Starts SQL Server independent of the Windows NT Service Control Manager.
    /dmaster_device_ path
    Specifies a physical name for the MASTER database device. For example:
    /dc:\sql60\data\master.dat
    
    /m
    Specifies single-user mode.
  2. Query and save information from the sysusages and sysdevices tables, so that you can later re-create the devices and databases with the proper sizes. Follow the instructions in, "Finding Information About Lost Devices and Databases." Finding Information About Lost Devices and Databases.
  3. Drop each database that has space allocated on a lost device by using the DBCC DBREPAIR statement. Type:

    DBCC DBREPAIR(database_name, DROPDB)

    where database_name specifies which database to drop.

    You can also drop databases using the sp_dbremove system procedure.

  4. Drop lost devices using the sp_dropdevice system procedure.
  5. Execute CHECKPOINT, shut down SQL Server, and then start it in normal mode.
  6. Re-create lost devices by executing the DISK INIT statement using the size of the original devices (as determined following the instructions in Finding Information About Lost Devices and Databases.

For information about using DISK INIT, DBCC DBREPAIR, sp_dbremove, and sp_dropdevice, see the Microsoft SQL Server Transact-SQL Reference.