Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unlocking account in Oracle 11g R2

I know this question has been asked many times, but this problem is confusing me a lot. I just installed Oracle 11g R2. And I was trying to unlock Scott/Tiger account so that I can use them to make a SQL Developer connection. I was trying to do something like below- And I always get user SCOTT does not exist? Why is it so? Is there anything wrong I am doing?

SQL> conn system/abcdef1234
Connected.
SQL> alter user scott account unlock;
alter user scott account unlock
           *
ERROR at line 1:
ORA-01918: user 'SCOTT' does not exist

Any thoughts will be appreciated.

Updates:-

SQL> select username,account_status from dba_users where username='SCOTT'; 
no rows selected
like image 881
arsenal Avatar asked Aug 13 '12 21:08

arsenal


2 Answers

During the installation process, one of the questions that is asked is whether you want to install the sample schemas (SCOTT, HR, etc.). If the SCOTT user doesn't exist, it would appear that you chose not to install the sample schemas.

You can create a new user, grant appropriate privileges to that user, and then build tables to work with. For example

CREATE USER rjchar 
  IDENTIFIED BY rjchar
  DEFAULT TABLESPACE users
  TEMPORARY TABLESPACE temp;

GRANT create session,
      create table,
      create view,
      create procedure,
      create trigger
   TO rjchar;

You can then log in as the user rjchar from SQL Developer and can start building your schema. Alternately, you can manually install the sample schemas using the scripts that were installed on your server.

like image 65
Justin Cave Avatar answered Sep 24 '22 22:09

Justin Cave


In SQL DEVELOPER

Default connection for oracle 11g

go to connection>New Connection

Connection Name = HR or Use any name

User name = hr

Password = Your Password (This is the password that you selected during the installation of the of Oracle 11g)

Check the "Save" option

role: default

port 1521

SID : orcl

If you want to create the SYSDBA Account ( Administrator account)

Connection Name = admin ORCL or Use any name

User name = sys

Password = Your Password (This is the password that you selected during the installation of the of Oracle 11g)

role: sysdba( from the drop down)

port 1521

SID : orcl

TEST and Save Connect

Just in case if your HR account is locked because you have connected multiple number of times than you can fix this by logging into your SYS DBA account

In the objects list on your list go to the OTHER USERS and

GO to HR Account > RT Click

EDIT USER

Choose the password youlike

and UN CHECK The account locked and Uncheck the Password Expired options if they are checked in

like image 38
Avi Avatar answered Sep 23 '22 22:09

Avi