| Microsoft SQL Server RDBMS (Relational Database | | | | Msg 945, Level 14, State 2, Line 1 |
| Management System) enables you to take your | | | | Database 'mydb' cannot be opened due to |
| database online and offline as per your requirements. | | | | inaccessible files or insufficient memory or disk space. |
| You can set your database either online or offline | | | | See the SQL Server errorlog for details. |
| easily using the 'Alter Database' command. If MDF | | | | Msg 5069, Level 16, State 1, Line 1 |
| (Master Database File) of your SQL Server is online, all | | | | ALTER DATABASE statement failed. |
| the connected users can access it, modify it, perform | | | | After the above behavior, database can not be set |
| other operations, depending upon the privileges | | | | online and it remains inaccessible. To sort out the |
| assigned to them. However, in some situations, you | | | | problem, you need to identify causes of this issue and |
| may face critical database corruption problems, while | | | | then perform SQL Server recovery by fixing it. |
| trying to set an MS SQL Server database online. This | | | | Cause: |
| behavior leads to significant data loss situations and | | | | This behavior of Microsoft SQL occurs if the MDF or |
| needs SQL database recovery to be sorted out. | | | | Master Database File is damaged and it is unreadable. |
| As a practical example of the above problem, you | | | | SQL Server is unable to recognize the file and access |
| may come across the underwritten error messages | | | | its contents. Corruption may occur due to virus |
| when you try to set your MS SQL Server database | | | | infection, improper system shutdown, and application |
| online using 'ALTER DATABASE mydb SET online' | | | | malfunction like situations. |
| command: | | | | Solution: |
| Msg 5171, Level 16, State 1, Line 1 | | | | In order to recover SQL database in such situations, |
| E:\Data\mydb_log.ldf is not a primary database file. | | | | you are recommended to run DBCC CHECKDB utility. |
| Msg 5171, Level 16, State 2, Line 1 | | | | You can also try restoring the database from update |
| E:\Data\mydb.mdf is not a primary database file. | | | | backup. If both of the methods fail to work, repair and |
| File activation failure. The physical file name | | | | restore the database using third-party applications. |
| "E:\Data\mydb.mdf" may be incorrect. | | | | |