• .NET 通过entity framework报数据库连接错误:ORA-01017: invalid username/password; logon denied


    如题,答案为:【ORA-01017】.NET程序连接数据库失败


     转载文章内容如下:

    遇到问题

    使用 C#/.NET 开发的一个客户端程序,需要连接 ORACLE 数据库,使用 Oracle.ManagedDataAccess 配合上 PetaPoco 可以大大简化数据库的操作。

    一次偶然的事件,遇到了以下错误:

    ORA-01017: invalid username/password; logon denied     在 OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, CriteriaCtx criteriaCtx, String affinityInstanceName, Boolean bForceMatch)
       在 OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, CriteriaCtx criteriaCtx, String affinityInstanceName, Boolean bForceMatch)
       在 OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword, CriteriaCtx criteriaCtx)
       在 Oracle.ManagedDataAccess.Client.OracleConnection.Open()
    

    程序无法正常连接数据库,但是使用 PL/SQL 依旧可以正常连接。

    解决问题

    根据主要错误信息百度 ORA-01017: invalid username/password; logon denied ,从大量结果中得到以下可能:

    1. 密码确实有误:可修改密码 alter user 用户名 identified by 新密码;
    2. 密码大小写问题:可执行 alter system set sec_case_sensitive_logon = FALSE;
    3. 账户被锁定:可执行 alter user 用户名 account unlock;
    4. 无权限:可执行 grant connect, resource, dba to 用户名;

    还有其他修改 java.security 等无意义的解决方法。然而尝试了上面全部的方法都未能解决问题,.NET程序还是报同样的错误 ORA-01017: invalid username/password; logon denied

    完美解决

    经过大量的查阅资料,最终发现问题在是 FIPS 兼容性问题。

    FIPS:全称是 Federal Information Processing Standard ,中文名叫联邦信息处理标准,FIPS 是由两个政府主体开发的标准。一个是美国国家标准和在美国境内的技术。另一种是通信安全机构,在加拿大。FIPS 是建议或要求使用 (美国或加拿大) 的联邦政府操作 IT 系统中的标准。

    .NET 程序可以通过再其 .config文件中添加以下配置来关闭 FIPS 校验:

    <configuration>  
        <runtime>  
            <enforceFIPSPolicy enabled="false"/>  
        </runtime>  
    </configuration>  
    

    同样可以通过修改注册表的方式关闭 FIPS 校验,修改
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsaFipsAlgorithmPolicyEnabled 值为 0

    经验证修改注册表,然后重启有效。

    作者:rochy_he
    链接:https://www.jianshu.com/p/c301b062237b
    來源:简书
    简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
  • 相关阅读:
    把信贷风险管理浓缩为50个要点(赶紧收藏吧)!
    AjaxControlToolkit没有通过WebResource.axd加载css导致ajaxToolkit:TabPanel无法显示正确的样式
    启动vmware中的虚拟机的时候,提示Failed to lock the file
    linq to xml There are multiple root elements.
    How to create a List of ValueTuple?
    SET IDENTITY_INSERT 和 DBCC CHECKIDENT
    NOT IN clause and NULL values
    ASP.NET Session and Forms Authentication and Session Fixation
    asp.net下的cookieName
    flywaydb and sql server
  • 原文地址:https://www.cnblogs.com/senyier/p/9607577.html
Copyright © 2020-2023  润新知