How to unlock Sample HR database in oracle

For working with tutorial of oracle Introduaction to oracle/sql you need to work on the tables which is locked in oracle. for Unlocking these tables you have to follow these steps

1. Login in sqlplus or sqlplus or isqlplus as a user “system” with respective password.

2. Execute the following command

ALTER USER HR IDENTIFIED BY password ACCOUNT UNLOCK;

here password is your passord which you want to use for your account remember this password for further use.

3. Login in with user HR with password specified above

Now you can use all tables specified in tutorial.

Please leave your comment If you encounter any problem…

About these ads

101 thoughts on “How to unlock Sample HR database in oracle

  1. Thanks a lot.I was trying for nearly half a day on unlocking the HR schema.
    It is only from your website i got the answer.
    Thanks a lot.

  2. I still cant unlock HR user help! i am 3 weeks in to my SQL class and just got it installed. Had a hard time with me wind 7 64 bit so i installed it on my old pc. i have been altering hr account all night and nothing.

  3. hello , i am using oracle 10g (10.2 version) and when i used ur theory it shows error
    ORA-01918: user ‘HR’ does not exist

  4. Thanks very much. I was trying to unlock it using the database homepage which i couldn’t see, and was literally struggling since a day. This is the simplest i could get.

  5. Thanks a lot Satyendra Kumar. This really helped me unlock the HR user schema and able to see tables & related records.

    –Bhaskar

  6. hi all
    whenever i try to login to isqlplus environment i.e http://localhost:5560/isqlplus/ .it throws me error ‘page cannot be displayed’.not sure why but it was working fine for couple of days..but from today morning i am facing this issue.can anybody help ?

    thanks
    satya

  7. user ‘HR’ does not exist. Is the error coming to me after typing the command…..help me please its urgent

    • Hi,
      To unlock sample schema HR you should have pre installed Sample schemas in database.Oracle Universal installer asks to install Sample Schemas or Not while configuration of new oracle database instance. By default it is selected to install sample schemas .In case if you missed the installation of HR Schema please refer to following page and follow the instruction and Run the given scripts to create the same sample HR Schema.

      http://docs.oracle.com/cd/B10501_01/server.920/a96539/scripts.htm

      Hope it may help…

      • At the time of installation Oracle11gR2 in step of password management
        worngly i lock the scott user. So i failt on trouble to get connected to user scott……………..but ur query really works…………………….
        ……………………………….
        thanku sir………..

  8. hi, I tried to use the code given about but unfortunately im getting following error message ,
    ERROR at line 1
    ORA-01918: user ‘HR’ does not exist

    Can u plz help me with this ?

  9. Hi sir,

    I’m trying to unlock hr but, I’m getting an error pointing “alter and it says oracle not available the error code is Ora-01034

    Thanks in adv

    • Hi ,
      As per mentioned error it seems your database is not up …
      First try to start database correctly then you can unlock HR User.
      Please follow the cause and solutions for ORA-01034 first .You can find lot of hint by searching “ORA-01034″ on google..

  10. Ty sir…. figured out that problem…. Now I have another problem…. I have unlocked hr user but unable to view the practise tables and My Firefox is not not responding either…. Ps let me what am I missing here.. Ty

  11. Hi, when I used this ALTER command the message “user altered” appears. But I am still unable to login using HR. When I attempt a login “Your username and/or password are invalid.” appears. But I know HR user exists in th user table that I have seen from system. What is the problem??????????

  12. i successfully altered hr in the sql*plus but when i log in with it it says i should give privilege first and i guess what i created is a normal account and not the hr …. what am i missing? thanks in advance

    • Hi,

      Login as system user try these steps
      1.Select * from all_users
      check weather hr user is exists or not

      2.if user is exists then
      select * from DBA_ROLE_PRIVs where grantee=’HR’

      will give the assigned roles to HR user . To normally connect and working with HR user there should be two roles CONNECT, RESOURCE assigned to that schema.

      if those two roles does not exists in that table then assign those roles to HR using following command

      Grant connect,resource to hr

      and try to connect again

      3. if HR user does not exist in ALL_USERS then you have to create HR schema manually .To create HR schema you can follow the answer given to other people in abover reply given by me.

  13. with alter user command i’m able to connect to HR…but when i’m trying to use oracle application express my browser, it says …. Invalid Login Credentials!!
    what may be the problem?
    thnx in advance.

    • Hi,
      I never used oracle application express but the problem may be in connect string assuming you are specifying correct username and password.
      First try to connect to HR schema using single line credential in sqlplus i.e HR/HR@ORCL where assuming “ORCL” is your connect string for database. If it is connecting then
      1.Open registry
      2.Go to ORACLE_HOME
      3.Create a new string value
      4.Rename it to Local
      5.Double click and provide value ORCL.

      This registry setting is very use full sometime for Oracle Forms Development.Else you have to search Oracle Application Express resources to connect the database step bye step.

    • Please check previous reply by me in which i provided link for the script of HR Module in case if you missed to install sample HR schema.

    • First connect Using HR schema then go to object navigator explore HR Connection .You can see all type of objects there..

  14. Hi Kumar,
    I run the line, and it responds: “ORA-01031: insufficient privileges”.
    I am using oracle express 11g. Do you know how can I unlock it with Oracle Express 11g Edition? Thanks

  15. hello sir… actually m a fresher in learning oracle nd i have visited ur site for the first time nd cleared my doubts ….. thanks a lot… it was glad for me to see your posts….
    plz keep replying to the visitors…..

    i would like to ask you that how can i install oracle 10g in my pc having redhat(linux) operating system.
    starting from the first step…. that which package i must download ……upto the installation of the same..
    thankyou in advance…

    • you can go to cmd and type sqlplus and perform the steps. Alternatvely you can use sql developer also just login as system user and perform steps..

  16. Wow 6 years after this post was made and people are still finding this information useful! It helped me, spent 4 hours searching the web trying to figure out why I still couldn’t get a successful connection.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s