Restores the device entries to the system tables when a device exists (the file is present) and the entry in the sysdevices table no longer exists. This occurs after a damaged master database is restored and the master database is incomplete (databases and devices were added or altered since the last backup of the master database). This is the first step for restoring access to user databases. The DISK REFIT statement completes the recovery.
DISK REINIT
NAME = 'logical_name',
PHYSNAME = 'physical_name',
VDEVNO = virtual_device_number,
SIZE = number_of_2K_blocks
[, VSTART = virtual_address]
where
Note NAME, PHYSNAME, and VDEVNO do not have to be identical to the device as it was originally created; however, the SIZE parameter must match.
DISK REINIT is very similar to DISK INIT but does not initialize the disk space.
Caution If you give DISK REINIT incorrect information about sizes and attempt to run update operations, you can permanently corrupt your data. SQL Server warns you of potential problems if it can, but be sure to run the suggested checks after issuing DISK REINIT and DISK REFIT.
If problems occur, you probably did not run DISK REINIT or ran it with inaccurate information. If you recognize discrepancies in the sysusages table, correct them. Correct the sysdevices table by rerunning DISK REINIT and then reissuing DISK REFIT. The system administrator must be in the master database to use DISK REINIT.
For more information about using DISK REINIT, see the Microsoft SQL Server Administrator's Companion.
DISK REINIT permission defaults to the system administrator and is not transferable.
DISK REINIT must be run for each device of the database prior to running DISK REFIT.
DISK REINIT NAME = 'DEVICE5', PHYSNAME = 'c:\sqldata\device5.dat', VDEVNO = 5, SIZE = 25600 DISK REINIT NAME = 'DEVICE6', PHYSNAME = 'd:\sqldata\device6.dat', VDEVNO = 6, SIZE = 25600
Once all devices have been created, run DISK REFIT.
DISK REFIT
ALTER DATABASE | DISK INIT |
CREATE DATABASE | DISK REFIT |
DBCC | sp_helpdevice |