1.场景
主从同步经常遇到主库的sys密码修改,导致从库不同步。并且出现如下报错
Error 1017 received logging on to the standby
------------------------------------------------------------
Check that the primary and standby are using a password file
and remote_login_passwordfile is set to SHARED or EXCLUSIVE,
and that the SYS password is same in the password files.
returning error ORA-16191
------------------------------------------------------------
FAL[client, USER]: Error 16191 connecting to COREDB for fetching gap sequence
Mon Jan 01 07:33:53 2024
2.原因
虽然oracle可以通过主备同步来同步sys用户的密码,但是主从同步是通过密码文件验证,所以如果主库修改了sys的密码,那么从库的密码文件也应该相应的同步。
有两种方式可以实现主备的密码相同:
(1)将主库的密码拷贝到从库。
(2)在从库创建一个密码文件,密码和主库sys的密码相同。
orapwd file=orapwchachdg password=sys#2020Focus entries=10
例如实例名称为:hachdg 密码为:sys#2020Focus ,我们可以利用上面的语句创建一个密码文件。
同时可以使用md5sum 命名验证密码是否相同,如果密码相同,则md5码相同。
[oracle@bj-hujiaozhongxin-11g-dg-20230803 dbs]$ md5sum orapwchachjdg2
6a153d54ee13618ee6f285e2d803c2f9 orapwchachjdg2
3.总结
从库sys用户的密码必须和主库相同,且有两种方式创建从库的密码文件。