oracle 在oracle 12c 数据库中解锁一个帐户

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22666676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:18:01  来源:igfitidea点击:

Unlock an account in oracle 12c database

oracleoracle-sqldevelopersqlplus

提问by 31222546

I tried to run a spring mvc code and got a jdbc connection error: cannot open connection. I tried to connect the database in sqldeveloper but my account was locked.

我试图运行一个 spring mvc 代码并得到一个 jdbc 连接错误:无法打开连接。我试图在 sqldeveloper 中连接数据库,但我的帐户被锁定。

So I tried using sqlplus in command prompt. Since I am having multiple db_homes, and oracle home was not set it throwed an error sqlplus is not an internal command. I have fixed it by checking the db_home path and fixed and after that I gave the command "alter user system account unlock" it altered.

所以我尝试在命令提示符下使用 sqlplus。由于我有多个 db_home,并且没有设置 oracle home,所以它抛出了一个错误 sqlplus 不是内部命令。我已经通过检查 db_home 路径修复了它并修复了它,然后我给了命令“alter user system account unlock”它改变了。

Then I tried to connect the database in sql developer with the user name and password but still its locked. Is that anyother thing, I need to do to unlock the account? Please need suggestion on this. It was working earlier.

然后我尝试使用用户名和密码连接 sql developer 中的数据库,但仍然被锁定。那是什么其他事情,我需要做些什么来解锁帐户?请对此提出建议。它更早工作。

回答by Guna Sekaran

sqlplus "/ as sysdba"

sqlplus "/ as sysdba"

Once logged in as SYSDBA, you need to unlock the SCOTT account

以 SYSDBA 身份登录后,您需要解锁 SCOTT 帐户

SQL> alter user scott account unlock;

SQL> 更改用户 scott 帐户解锁;

SQL> grant connect, resource to scott;

SQL> 授予连接,资源给 scott;

回答by Srikant Patra

You can use below steps to account unlock

您可以使用以下步骤解锁帐户

SQL> select USERNAME,ACCOUNT_STATUS from dba_users where username='MITO_UAT';

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
MITO_UAT                       LOCKED

SQL> alter user MITO_UAT account unlock;

User altered.

SQL> select USERNAME,ACCOUNT_STATUS from dba_users where username='MITO_UAT';

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
MITO_UAT                       OPEN

SQL> conn MITO_UAT/MITO_UAT
Connected.
SQL>