connect实际上是oracle数据库中的一种角色,他包含了create session等权限。

SYS@PRODCDB>select role,con_id from cdb_roles where role='CONNECT';

ROLE                CON_ID
--------------- ----------
CONNECT                  3
CONNECT                  1
CONNECT                  4

SYS@PRODCDB>select role,privilege from role_sys_Privs where role='CONNECT';

ROLE            PRIVILEGE
--------------- ----------------------------------------
CONNECT         SET CONTAINER
CONNECT         CREATE SESSION

创建用户并授予connect权限

SYS@PRODCDB>create user oracle identified by oracle;

User created.

SYS@PRODCDB>grant connect to oracle;

Grant succeeded.

SYS@PRODCDB>select grantee,granted_role,con_id from cdb_role_privs where grantee='ORACLE';

GRANTEE                      GRANTED_     CON_ID
---------------------------- -------- ----------
ORACLE                       CONNECT           1

授予用户create session权限

SYS@PRODCDB>grant create session to oracle;

Grant succeeded.

SYS@PRODCDB>select grantee,privilege,con_id from cdb_sys_privs where grantee='ORACLE';

GRANTEE                      PRIVILEGE                                    CON_ID
---------------------------- ---------------------------------------- ----------
ORACLE                       CREATE SESSION                                    1

SYS@PRODCDB>

更多推荐