title: The database [dbName] is not accessible. (ObjectExplorer)
body: <p>I have an issue in regards to using SQL Server 2008 R2. </p>
  
  <p>I recently had an issue with my computer and therefore I had to reboot windows and had to grant permission from one user to another user (using the security feature in the properties). When giving permission initially though, it through a "Access Denied" message.</p>
  
  <p>After much research, it stopped producing this error (the user which I needed to grant permission too wasn't available), which then caused another issue to occur, but this time within SQL Server. It produces this message; </p>
  
  <blockquote>
    <p>The database [dbName] is not accessible. (ObjectExplorer) </p>
  </blockquote>
  
  <p>This error occurs when I try to select the drop down option to see the list of tables and stored procedures of the database within SQL Server. I found an explanation for this on the following link;</p>
  
  <p><a href="http://www.microsoft.com/products/ee/transform.aspx?ProdName=Microsoft+SQL+Server&amp;ProdVer=10.50.1617&amp;EvtSrc=MSSQLServer&amp;EvtID=916">http://www.microsoft.com/products/ee/transform.aspx?ProdName=Microsoft+SQL+Server&amp;ProdVer=10.50.1617&amp;EvtSrc=MSSQLServer&amp;EvtID=916</a></p>
  
  <p>And I then tried to implement like so;</p>
  
  <pre><code> USE msdb;
   GO
   GRANT CONNECT TO [DBName\MyName] ;
  
   CREATE DATABASE [DBNAME] ON PRIMARY
  </code></pre>
  
  <p>Using a script I created (luckily before this problem occurred) it through a whole lot of messages;</p>
  
  <blockquote>
    <p><em>Msg 15151, Level 16, State 1, Line 1<br>
    Cannot find the user 'DBName\MyName', because it does not exist or you do not have permission.<br>
    Msg 262, Level 14, State 1, Line 2<br>
    CREATE DATABASE permission denied in database 'master'.<br>
    Msg 5011, Level 14, State 9, Line 1<br>
    User does not have permission to alter database 'DBName', the database does not   exist, or the database is not in a state that allows access checks.<br>
    Msg 5069, Level 16, State 1, Line 1 ...</em></p>
  </blockquote>
  
  <p>After this bunch of errors, I have become unstuck and therefore would much be grateful if anyone could give me some feedback in regards to what I could do to resolve this issue. Cheers.</p>