重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2107|回复: 0
打印 上一主题 下一主题

[Oracle] dg备库用户状态为OPEN,但登录报ORA-28000,账户被锁的错误

[复制链接]
跳转到指定楼层
楼主
发表于 2021-11-16 12:00:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 郑全 于 2021-11-16 12:06 编辑

主备库都是OPEN状态,但备库无法登录

原因是该用户修改了密码,但 备库有用户通过中间件连接,使用以前的密码在登录,导致该用户被锁,但备库是只读的,所以,在DBA_USERS里面看不到,但可以在  v_$RO_USER_ACCOUNT  中,看到 PASSW_LOCK_UNLIM=1


解决办法:
   主库解锁该用户,并切换同步到备库,备库重启一下即可。


附:
  参考文档: DG standby: account-status OPEN but login fails with "ORA-28000: the account is locked" (Doc ID 2718878.1)


DG standby: account-status OPEN but login fails with "ORA-28000: the account is locked" (Doc ID 2718878.1)

In this Document

Symptoms
Cause
Solution
References

APPLIES TO:Oracle Database - Enterprise Edition - Version 12.2.0.1 and later
Information in this document applies to any platform.
SYMPTOMSCustomer is getting ORA-28000: the account is locked in Active Data Guard
User DBSNMP or any user is locked on ADG Standby database (read only mode) and it is open in Primary database.


Problem Description
---------------------------------------------------
[oracle@xxxxxx bin]$ sqlplus dbsnmp@"(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xxxxxx-scan.xxx-xx.xxx.com)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XXXX)))"

SQL*Plus: Release 12.2.0.1.0 Production

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Enter password:
ERROR:
ORA-28000: the account is locked


But the user is not showing as locked, the account_status in dba_users show 'OPEN' in both primary and standby:

Primary database:

SQL> select account_status from dba_users where username='DBSNMP';

ACCOUNT_STATUS
--------------------------------
OPEN

Standby database:

SQL> select account_status from dba_users where username='DBSNMP';

ACCOUNT_STATUS
--------------------------------
OPEN




CAUSEDBSNMP or any other user is locked in Active Data Guard but OPEN in Primary DB.
On Standby DB, DBA_USERS will give ACCOUNT_STATUS as OPEN because it is synced from Primary.
But V_$RO_USER_ACCOUNT table in read-only standby DB show an entry if the account in STANDBY is LOCKED due to failed login attempts to standby:
SQL> select rua.con_id, du.username username, rua.userid, rua.PASSW_LOCKED, rua.PASSW_LOCK_UNLIM, to_char(rua.PASSW_LOCK_TIME,'DD-MON-YYYY HH24:MI:SS') locked_date
          from V$RO_USER_ACCOUNT rua, dba_users du
          where rua.userid=du.user_id and (rua.PASSW_LOCKED = 1 OR rua.PASSW_LOCK_UNLIM = 1);

This will show you when the account has been locked (locked_date column in above query).
SOLUTIONYou will not be able to unlock the user directly from Standby Database.

Please run the following steps from Primary database

1. SQL>alter user dbsnmp account unlock;

2. SQL>alter system switch logfile;

3. SQL>alter system archive log all;

4. Check the Standby alert log file and make sure the archive logs are applied in standby database.

5. Now the user will be open in standby
6. Test the user connection in standby
7. Run below command in STANDBY Database
     SQL>select * from v_$RO_USER_ACCOUNT where username='DBSNMP';
You will not see an entry means your account is unlocked in STANDBY Database.

Note:
Pre 12.1 version, all the user UNLOCK changes have to come from primary to Standby Active Data Guard database.
From 12.1.0.2 , we can directly UNLOCK the user from read only, Active Data Guard database.
SQL> alter user <username> account unlock;





分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-29 23:37 , Processed in 0.093566 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表