1、sqlplus 用户名/密码@连接字符串
sqlplus scott/tiger@"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.168.177)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=chicago)))"
或者sqlplus scott/tiger@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.168.177)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=chicago)))"
eg:sqlplus scott/tiger@192.168.168.177:1521/boston.us.oracle.cn
2、sqlplus 用户名/密码@ip:port/service_name
sqlplus corer111/core@192.168.168.65:1521/oibs1
3、sqlplus 用户名/密码@net_service_name
sqlplus scott/tiger@boston177
4、本地验证sys用户登录,监听是否开启和以及数据库是否启动都不影响登录
1 | export ORACLE_SID=*** |
5、数据库用户登录,数据库要确保在启动状态,监听是否可用不影响
1 | sqlplus scott/tiger |
6、客户端使用external password store
6.1、客户端先创建wallet(D:\software\oracle\product\11.2.0\client_1\wallets为指定生成wallet的目录):
1 | mkstore -wrl D:\software\oracle\product\11.2.0\client_1\wallets -create |
6.2、在wallet里面创建数据库连接认证:
1 | mkstore -wrl wallet_location -createCredential db_connect_string username |
wallet_location:创建钱包的位置
db_connect_string :对应的tns中指定的网络服务名
username:连接数据库使用的用户名
eg:
1 | mkstore -wrl D:\software\oracle\product\11.2.0\client_1\wallets -createCredential boston177 scott |

6.3、修改sqlnet.ora配置文件,添加wallet相关参数:
1 | WALLET_LOCATION = |
测试是否能够正常连接:
1 | sqlplus /@boston177 |

6.4、如果后面用户名密码发生变更,直接修改外部钱包认证即可,应用端不需要做任何变更,修改数据库用户密码之后修改外部面认证:
查看有哪些外部密码认证:
1 | mkstore -wrl D:\software\oracle\product\11.2.0\client_1\wallets -listCredential |

修改外部密码认证:
1 | mkstore -wrl D:\software\oracle\product\11.2.0\client_1\wallets -modifyCredential boston177 scott |

6.5、删除外部密码认证:
1 | mkstore -wrl D:\software\oracle\product\11.2.0\client_1\wallets -deleteCredential boston177 |
