简体   繁体   中英

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

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.

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

-- This may help

ALTER USER hr IDENTIFIED BY hr ACCOUNT UNLOCK;

GRANT CONNECT, RESOURCE to hr;

ALTER USER oe IDENTIFIED BY OE ACCOUNT UNLOCK;

GRANT CONNECT, RESOURCE to OE;

Does it exist? Try

select username,account_status from dba_users where username='SCOTT';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM