Complete each of the steps below in the order listed until the error is resolved:
  1. Grant the "Log On As" account for the SQL Server instance full control permissions to the database files. To find out the "Log On As" account for your SQL Server instance, use the following steps:
  • Click Start
  • Type services.msc and press Enter
  • In the window that opens, scroll down to locate the service titled SQL Server (INSTANCE NAME) 
  • Scroll to the right to find the name of the account listed under the column "Log On As" (see the screenshot below)
                          ​User-added image
      2. Confirm that you are selecting the correct SQL Server instance on the "Select Server" window. 
NOTE:  If you select a SQL Server instance that is for a lower version of SQL Server than what the database is already on, then it can cause this error.  (Example:  You select a SQL Server 2008 R2 SQL Server instance, but the database you are attempting to attach has already been upgraded and attached to a SQL Server 2012 instance previously.)
      3. Right-click on each of the database files and select Properties.  If the file is marked as Read-Only, then un-mark this box.
      4. Reboot the server.