rebuildm is a utility that you can use to rebuild system databases, including the master, msdb, and model databases, that are shipped with SQL Server 2000.

The syntax is as follows:



rebuildm needs to be used with extreme caution because it essentially copies the original versions of these databases over the copies that you have in your database. After rebuildm has been run, all of the information that you had in these databases prior to running rebuildm (including user database information, scheduled tasks, and default database settings) will be gone.

The rebuildm utility is typically used if the following situations exist:

  • A current backup of the master database is unavailable. If the backup were available, the server would need to be started in single user mode first.

  • Microsoft SQL Server 2000 cannot start because the master database is severely damaged.

If you have one of these situations and you need to run the utility, then these are the basic steps involved:

  1. Run the rebuildm.exe from the SQL Server 2000 installation disk or network share.

  2. Re-create any backup devices.

  3. Set up security including logins.

  4. Restore or attach the msdb, model, and distribution databases.

  5. Restore or attach any user databases.


The Northwind and Pubs databases are also restored when rebuildm is run. An alternative to running the rebuildm utility to rebuild these databases is to copy the database files (*.mdf and *.ldf) directly from the data directory located on the installation disk or network drive where you ran your install. Before doing this, you need to detach the database that you want to rebuild using Enterprise Manager; just right-click on the database and select the Detach option. After detaching the database, you can move or delete the relative database files in the DATA directory on your database server. You can then copy the files for the database that you want to rebuild from the installation disc to the DATA directory on the database server. The files are read only by default, so you must change the file properties so that they are not read only. The last step is to use Enterprise Manager to attach the database files that you have just copied.

The rebuildm.exe file is located, by default, with the SQL Server tools in Microsoft SQL Server\80\Tools\Binn\.

    Part III: SQL Server Administration
    Part IV: Transact-SQL
    Part V: SQL Server Internals and Performance Tuning
    Part VI: Additional SQL Server Features