MSDB – What is msdb database?

MSDB is an important system database in Microsoft SQL server. The msdb database is used mainly by the SQL Server Agent to store system activities like sql server jobs, mail, service broker, maintenance plans, user and system database backup history, etc..It is also used by database engine and management studio.

Just like the user databases, we have to maintain and backup this database for the proper functioning of SQL Server Agent components.

There are certain DML and DDL operations which cannot be performed in the msdb database like:

  1. We cannot drop tables from this database.
  2. We cannot drop this database.
  3. We cannot make this system database to go off-line.
  4. We cannot do database mirroring on this database.
  5. We cannot rename this database name. etc…

Location of msdb database

If you open SQL Server Management Studio, you can see the msdb database under the System Databases.

SQL-Server-MSDB-Database

The database files will be in the default data file location with the file names as MSDBData.mdf and MSDBLog.ldf. The logical file names will be MSDBData and MSDBLog.

MSDB Database Location

Best practices to maintain msdb database:

  1. Set this database to full recovery model instead of it’s default simple recovery model.
  2. It is a good practice to take a regular backup of this database.
  3. Do not create user tables or any other user objects in this database.
  4. Do not modify any data in this database manually.
  5. Do not create any triggers for the system tables in this database.
  6. Delete backup history using sp_delete_backuphistory at least once in a month.

Related Articles

Reference

 


Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.