title: Unlock HR user in Oracle 12C
body: <p>I'm trying to unlock HR user; I've tried all the possible way, but I'm not able to achieve it.</p>
  
  <p>Below are the steps I've followed in the attempt to achieve that:</p>
  
  <p><strong>Step 1</strong>: Updated my <code>tnsname.ora</code> file</p>
  
  <pre><code>PDBORCL =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (CONNECT_DATA =
        (SERVER = DEDICATED)
        (SERVICE_NAME = pdborcl)
      )
    )
  </code></pre>
  
  <p><strong>Step 2</strong>: Switch the container from <code>CBD$ROOT</code> to <code>PDBORCL</code></p>
  
  <p><strong>Step 3</strong>: <code>ALTER SESSION SET CONTAINER = pdborcl;</code></p>
  
  <p><strong>Step 4</strong>: <code>ALTER PLUGGABLE DATABASE open;</code></p>
  
  <p><strong>Step 5</strong>: <code>ALTER USER hr IDENTIFIED BY hr ACCOUNT unlock;</code></p>
  
  <p><strong>Step 6</strong>: <code>conn hr/hr @pdborcl;</code></p>
  
  <p>Up to step 5, I get everything working well as expected, but on step 6, I get this error:</p>
  
  <blockquote>
    <p>ORA-01045: hr user lacks create session privileges; logon denied</p>
  </blockquote>
  
  <p>I try to grant privileges by logging as below: </p>
  
  <pre><code>connect sys/password as sysdba;
  
  grant create session to hr
  </code></pre>
  
  <p>The result: <code>grant succeeded</code>.</p>
  
  <p>Now again when I try to connect to hr schema running</p>
  
  <pre><code>conn hr/hr @pdborcl;
  </code></pre>
  
  <p>I get the same previous error again.</p>
  
  <p>What can account for this?</p>
  
  <p>When I set <strong><code>SID = pdborcl</code></strong> from SQL Developer, I get this error:</p>
  
  <blockquote>
    <p>ORA-12505, TNS:listener does not currently know of SID given in connect descriptor</p>
  </blockquote>
  
  <p>What am I doing wrong and how can I resolve these errors?</p>