DB administrator认证方式(REMOTE_LOGIN_PASSWORDFILE)

Oracle数据库的REMOTE_LOGIN_PASSWORDFILE参数影响着管理员的认证方式。NONE模式下仅支持OS认证本地登录;EXCLUSIVE模式允许OS认证及密码文件中的用户登录,并可修改密码文件;SHARED模式为只读,适用于多数据库或RAC环境。启用OS认证需创建OS账户并加入OSDBA或OSOPER组,创建数据库用户时用户ID需与OS一致,同时设置REMOTE_OS_AUTHENT为TRUE和OS_AUTHENT_PREFIX为空。

先OS 认证+远程密码认证 
1.REMOTE_LOGIN_PASSWORDFILE =None (没密码文件,只能OS 认证本地登录)
NONE: Setting this parameter to NONE causes Oracle Database to behave as if the password file does not exist. That is, no privileged connections are allowed over nonsecure connections. Therefore, privileged users must be authenticated by the operating system.

2.REMOTE_LOGIN_PASSWORDFILE =EXCLUSIVE(有密码文件,能OS 认证本地登录,在密码文件中的用户也能登录, default)
EXCLUSIVE: (The default) An EXCLUSIVE password file can be used with only one instance of one database. Only an EXCLUSIVE file can be modified. Using an EXCLUSIVE password file enables you to add, modify, and delete users. It also enables you to change the SYS password with the ALTER USER command.

3.REMOTE_LOGIN_PASSWORDFILE =SHARED (只读模式的exclusive)

 A SHARED password file can be used by multiple databases running on the same server, or multiple instances of a RAC database. A SHARED password file cannot be modified. This means that you cannot add users to a SHARED password file. Any attempt to do so or to change the password of SYS or other users with the SYSDBA or SYSOPER privileges generates an error. All users needing SYSDBA or SYSOPER system privileges must be added to the password file when REMOTE_LOGIN_PASSWORDFILE is set to EXCLUSIVE. After all users are added, you can change REMOTE_LOGIN_PASSWORDFILE to SHARED, and then share the file. This option is useful if you are administering multiple databases or a RAC database.

PS.
1.If you want to use OS Authentication, you must enable operating system authentication of an administrative user:
Create an operating system account for the user.
Add the account to the OSDBA or OSOPER operating system defined groups.
The at the command line you can access the database as "CONNECT / AS SYSDBA"
2.If you want to create users in the database, that's a different story. The user id must be the same on the OS layer as it will be in the database. Then you connect to the database with the SYSDBA system privilege. but you must set REMOTE_OS_AUTHENT initialization parameter to TRUE and set OS_AUTHENT_PREFIX to "".

PS D:\a\b\PythonProject1> pytest -s ========================================================================= test session starts ========================================================================= platform win32 -- Python 3.11.9, pytest-7.4.0, pluggy-1.6.0 rootdir: D:\a\b\PythonProject1 configfile: pytest.ini testpaths: test_test/ plugins: metadata-3.1.1, parallel-0.1.1, repeat-0.9.4, testreport-1.1.6, xdist-3.8.0 collecting ... D:\a\b\PythonProject1 {'api_name': '用户登录', 'url': 'https://10.121.177.71/itf/session', 'method': 'post', 'verify': 'verify', 'headers': {'Content-Type': 'application/x-www-form-urlencoded'}} collected 3 items test_test\test_api.py 请求头参数: {'Content-Type': 'application/x-www-form-urlencoded'} 参数类型:data 请求参数:{"username": "admin", "password": "admin"} 接口返回值: { "ResidueDay": 255, "ok": 0, "privilege": 4, "user_id": 2, "extendedpriv": 383, "racsession_id": 39, "remote_addr": "10.121.178.218", "server_name": "10.1 21.177.71", "server_addr": "10.121.177.71", "HTTPSEnabled": 1, "CSRFToken": "4v2LJ2hq", "channel": 1, "passwordStatus": 0, "encrypt_flag": 0, "SelfSetPriv": 1, "InfoQue ryPriv": 1, "DebugPriv": 1, "PowerConPriv": 1, "SecuConPriv": 1, "RemoteMediaPriv": 1, "RemoteKVMPriv": 1, "CommConfigPriv": 1, "UserConfigPriv": 1, "group_name": "Administrator", "ChangePasswordAlert": 0 } 状态吗断言成功:接口实际返回状态码200 == 200 测试成功 . 请求头参数: {'Content-Type': 'application/x-www-form-urlencoded'} 参数类型:data 请求参数:{"username": "admin", "password": "admin"} 接口返回值: { "ResidueDay": 255, "ok": 0, "privilege": 4, "user_id": 2, "extendedpriv": 383, "racsession_id": 40, "remote_addr": "10.121.178.218", "server_name": "10.1 21.177.71", "server_addr": "10.121.177.71", "HTTPSEnabled": 1, "CSRFToken": "7uNNQwcF", "channel": 1, "passwordStatus": 0, "encrypt_flag": 0, "SelfSetPriv": 1, "InfoQue ryPriv": 1, "DebugPriv": 1, "PowerConPriv": 1, "SecuConPriv": 1, "RemoteMediaPriv": 1, "RemoteKVMPriv": 1, "CommConfigPriv": 1, "UserConfigPriv": 1, "group_name": "Administrator", "ChangePasswordAlert": 0 } 出现异常,--'NoneType' object is not iterable F 请求头参数: {'Content-Type': 'application/x-www-form-urlencoded'} 参数类型:data 请求参数:{"username": "admin", "password": "admin"} 接口返回值: { "ResidueDay": 255, "ok": 0, "privilege": 4, "user_id": 2, "extendedpriv": 383, "racsession_id": 41, "remote_addr": "10.121.178.218", "server_name": "10.1 21.177.71", "server_addr": "10.121.177.71", "HTTPSEnabled": 1, "CSRFToken": "M8ixsU33", "channel": 1, "passwordStatus": 0, "encrypt_flag": 0, "SelfSetPriv": 1, "InfoQue ryPriv": 1, "DebugPriv": 1, "PowerConPriv": 1, "SecuConPriv": 1, "RemoteMediaPriv": 1, "RemoteKVMPriv": 1, "CommConfigPriv": 1, "UserConfigPriv": 1, "group_name": "Administrator", "ChangePasswordAlert": 0 } 出现异常,--'NoneType' object is not iterable F ============================================================================== FAILURES =============================================================================== ________________________________________________________ TestLogin.test_login_module[api_info0-testcase0-2-3] _________________________________________________________ self = <test_test.test_api.TestLogin object at 0x000002063F269350> api_info = {'api_name': '用户登录', 'headers': {'Content-Type': 'application/x-www-form-urlencoded'}, 'method': 'post', 'url': 'https://10.121.177.71/itf/session', ...} testcase = {'data': {'password': 'admin', 'username': 'admin'}} @pytest.mark.passdef @pytest.mark.repeat(3) @pytest.mark.parametrize('api_info,testcase', YamlUtil().read_def_yaml('get_new.yaml')) def test_login_module(self, api_info, testcase): if 'case_name' not in testcase: testcase['case_name'] = f"默认用例_{id(testcase)}" # 用唯一标识避免重复 > RequestsBase().execute_test_cases(api_info, testcase) test_test\test_api.py:14: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ unit_tools\apiutils_single.py:121: in execute_test_cases raise e unit_tools\apiutils_single.py:117: in execute_test_cases self.asserts.assert_result(validation,response.json(),status_code) unit_tools\assertion_utils.py:124: in assert_result raise exceptions _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cls = <class 'unit_tools.assertion_utils.Assertions'>, expected_result = None response = {'CSRFToken': '7uNNQwcF', 'ChangePasswordAlert': 0, 'CommConfigPriv': 1, 'DebugPriv': 1, ...}, status_code = 200 @classmethod def assert_result(cls, expected_result, response, status_code): """ 断言主函数,通过all_flag标记,如all_flag == 0表示测试成功,否则为失败 :param expected_result: (list)yaml文件validation关键词下面的预期结果 :param response: (dict)接口的实际响应信息 :param status_code: (int)接口的实际响应状态码 :return: """ all_flag = 0 # 通过字典映射方式管理不同的断言方式 assert_methods = { 'code': cls.status_code_assert, 'contain': cls.contain_assert, 'eq': cls.equal_assert # 'ne': cls.not_equal_assert, } try: > for yq in expected_result: E TypeError: 'NoneType' object is not iterable unit_tools\assertion_utils.py:109: TypeError ________________________________________________________ TestLogin.test_login_module[api_info0-testcase0-3-3] _________________________________________________________ self = <test_test.test_api.TestLogin object at 0x000002063F268090> api_info = {'api_name': '用户登录', 'headers': {'Content-Type': 'application/x-www-form-urlencoded'}, 'method': 'post', 'url': 'https://10.121.177.71/itf/session', ...} testcase = {'data': {'password': 'admin', 'username': 'admin'}} @pytest.mark.passdef @pytest.mark.repeat(3) @pytest.mark.parametrize('api_info,testcase', YamlUtil().read_def_yaml('get_new.yaml')) def test_login_module(self, api_info, testcase): if 'case_name' not in testcase: testcase['case_name'] = f"默认用例_{id(testcase)}" # 用唯一标识避免重复 > RequestsBase().execute_test_cases(api_info, testcase) test_test\test_api.py:14: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ unit_tools\apiutils_single.py:121: in execute_test_cases raise e unit_tools\apiutils_single.py:117: in execute_test_cases self.asserts.assert_result(validation,response.json(),status_code) unit_tools\assertion_utils.py:124: in assert_result raise exceptions _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cls = <class 'unit_tools.assertion_utils.Assertions'>, expected_result = None response = {'CSRFToken': 'M8ixsU33', 'ChangePasswordAlert': 0, 'CommConfigPriv': 1, 'DebugPriv': 1, ...}, status_code = 200 @classmethod def assert_result(cls, expected_result, response, status_code): """ 断言主函数,通过all_flag标记,如all_flag == 0表示测试成功,否则为失败 :param expected_result: (list)yaml文件validation关键词下面的预期结果 :param response: (dict)接口的实际响应信息 :param status_code: (int)接口的实际响应状态码 :return: """ all_flag = 0 # 通过字典映射方式管理不同的断言方式 assert_methods = { 'code': cls.status_code_assert, 'contain': cls.contain_assert, 'eq': cls.equal_assert # 'ne': cls.not_equal_assert, } try: > for yq in expected_result: E TypeError: 'NoneType' object is not iterable unit_tools\assertion_utils.py:109: TypeError ========================================================================== warnings summary =========================================================================== test_test/test_api.py::TestLogin::test_login_module[api_info0-testcase0-1-3] test_test/test_api.py::TestLogin::test_login_module[api_info0-testcase0-2-3] test_test/test_api.py::TestLogin::test_login_module[api_info0-testcase0-3-3] D:\python\Lib\site-packages\urllib3\connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.121.177.71'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================================================================= short test summary info ======================================================================= FAILED test_test/test_api.py::TestLogin::test_login_module[api_info0-testcase0-2-3] - TypeError: 'NoneType' object is not iterable FAILED test_test/test_api.py::TestLogin::test_login_module[api_info0-testcase0-3-3] - TypeError: 'NoneType' object is not iterable =============================================================== 2 failed, 1 passed, 3 warnings in 2.09s ===============================================================
最新发布
08-06
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值