SQL Server Error 990 occurs when a database is forced offline because the system cannot access the underlying files or the host environment has encountered a critical failure. To resolve this, you must identify the specific cause—usually disk failure, permission changes, or connectivity loss to a network share—and then bring the database back online using the ALTER DATABASE command or by resolving the hardware blockage. This error is critical because it renders the data inaccessible to all users and applications until the host state is corrected.
What You'll Need
- Administrative access to the SQL Server instance (sysadmin role).
- SQL Server Management Studio (SSMS) or a command-line tool like sqlcmd.
- Access to the Windows Event Viewer and SQL Server Error Logs.
- Administrative permissions on the operating system to check folder permissions and disk health.
Step-by-Step
- Identify the Affected Database: Open SQL Server Management Studio (SSMS) and connect to the instance. Look at the Object Explorer; the database affected by Error 990 will typically be marked as (Offline) or (Recovery Pending). Note the database ID mentioned in the error log to ensure you are targeting the correct entity.
- Analyze the SQL Server Error Log: Right-click the server name in Object Explorer, select Management, and then Error Logs. Look for entries immediately preceding Error 990. You are searching for messages regarding "Operating system error," "Access is denied," or "The system cannot find the file specified." These logs provide the exact reason why the host database was taken offline.
- Check Physical File Availability: Navigate to the file paths where the .mdf (primary data file) and .ldf (log file) are stored. If the files are on a local drive, ensure the drive is mounted and accessible. If the files are on a network share or a SAN (Storage Area Network), verify that the network connection is active and the share is reachable from the server's perspective.
- Verify Service Account Permissions: Ensure that the account running the SQL Server service has "Full Control" permissions over the folders containing the database files. If the service account was recently changed, it may no longer have access to the host directory, triggering the 990 error. Right-click the folder > Properties > Security to verify the service account is listed with appropriate rights.
- Check for Disk Corruption or Read-Only State: Check the Windows Event Viewer under System logs for Disk or NTFS errors. If a disk has entered a read-only mode due to hardware failure or a snapshot process, SQL Server cannot write to the log file and will take the database offline. Resolve any hardware alerts or clear any stuck snapshots.
- Attempt to Bring the Database Online: Once the underlying cause (permissions, connectivity, or disk health) is resolved, execute the following T-SQL command in a New Query window:
ALTER DATABASE [YourDatabaseName] SET ONLINE;
Replace [YourDatabaseName] with the actual name of your database. - Verify Database Status: Refresh the Object Explorer. The (Offline) tag should disappear. Run a simple query against a table in that database to ensure data is readable and writable.
Common Mistakes
One of the most frequent mistakes is attempting to force the database online using the ALTER DATABASE command before fixing the root cause. If the disk is still disconnected or permissions are still missing, the command will fail, and in some cases, it can lead to further corruption if the system attempts to recover a file that is partially unavailable. Always fix the host environment first.
Another common error is ignoring the SQL Server Error Log and relying solely on the 990 error code. Error 990 is a symptom, not the cause. The real cause is always documented in the lines preceding the error in the log. Skipping this analysis leads to "guessing" the fix, which can result in unnecessary server restarts or dangerous file movements.
Some administrators mistakenly try to detach and re-attach the database while it is in this state. If the host is offline due to a permission issue, the detach command may fail or leave the database in a "detached' but locked state, making recovery more complex. Stick to the SET ONLINE approach after verifying file access.
Tips
To prevent Error 990 in the future, implement a robust monitoring system that alerts you to disk latency or connectivity drops on your storage arrays. Since this error is almost always tied to the "host" (the storage layer), monitoring the health of the hardware is more effective than monitoring the SQL instance alone.
When using network shares for database files, always use a dedicated service account with static permissions rather than a local system account. This ensures that if the server is migrated or the service is restarted, the permissions remain consistent across the network.
Keep a current backup of your database. While Error 990 is usually a connectivity or permission issue, it can occasionally be triggered by severe file system corruption. Having a verified backup allows you to restore to a new location if the original host disk is permanently damaged.
Troubleshooting
If the database remains offline after running the SET ONLINE command, check if the database is in "Single User Mode." If another process has a lock on the database, the transition to online may hang. You can force all other connections closed by running ALTER DATABASE [YourDatabaseName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE and then attempting the ONLINE command again.
If you receive a "File not found" error despite the files being present, check for "ghost" files or hidden extensions. Ensure that no antivirus software has quarantined the .mdf or .ldf files. Some aggressive security software may flag SQL Server data files as suspicious if they are moved or modified by an external process, causing the host to report the file as missing.
In cases where the disk is physically failing, you may see the database fluctuate between online and offline. In this scenario, do not continue attempting to bring it online, as this can exacerbate head crashes or sector failure. Immediately perform a tail-log backup if possible, or restore from the last known good backup to a healthy disk.
Frequently Asked Questions
Does Error 990 mean my data is deleted?
No, Error 990 typically indicates a connectivity or access issue between the SQL Server engine and the host files. The data usually remains intact on the disk; the server simply cannot "reach" it to serve requests.
Can this error happen during a backup?
Yes, if the backup process triggers a snapshot or a disk lock that prevents the SQL Server service from accessing the files, the database may be taken offline to prevent data corruption.
Is a server restart the best way to fix this?
A restart is generally not recommended as the first step. If the issue is a permission or disk failure, a restart will not fix it and may actually make the database stay in a "Recovery Pending" state longer upon reboot.
Why does it say "Host Database" instead of just "Database"?
The term "host" refers to the environment where the database resides—the file system, the disk, or the network share. The error is signaling that the failure is happening at the host level, not necessarily within the SQL logic itself.
Can antivirus software cause Error 990?
Yes. If an antivirus scanner locks the .mdf or .ldf files for a deep scan, SQL Server may lose its exclusive lock on the files, leading the system to take the database offline to maintain integrity.
What is the difference between Error 990 and a Suspect database?
Error 990 is the action of taking the database offline due to a host failure. A "Suspect" status occurs when the database is online but the internal consistency checks fail, meaning the files are accessible but the data inside is corrupted.