-1

我使用此脚本为 oracle 数据库 19c 创建用户和角色并得到错误 ORA-01917


CREATE ROLE C##readonlyrole;

CREATE USER "C##lysjr_ro" IDENTIFIED BY "XXXXXXXPASWORD"  
DEFAULT TABLESPACE "XXX_TABLE_SPACE"
TEMPORARY TABLESPACE "XXX_TABLE_SPACE_TEMP";

GRANT CREATE SESSION to C##readonlyrole;

BEGIN
  FOR x IN (SELECT * FROM dba_tables WHERE owner='C##lysjr_ro')
  LOOP
    EXECUTE IMMEDIATE 'GRANT SELECT ON schema_name.' || x.table_name || 
                                  ' TO C##readonlyrole';
  END LOOP;
END;

GRANT C##readonlyrole TO C##lysjr_ro;

GRANT C##readonlyrole TO C##lysjr_ro;

显示带有结果的错误报告:

GRANT C##readonlyrole TO C##lysjr_ro
Error report -
ORA-01917: user or role 'C##lysjr_ro' does not exist
01917. 00000 -  "user or role '%s' does not exist"
*Cause:    There is not a user or role by that name.
*Action:   Re-specify the name.

现在我该怎么办?

4

1 回答 1

1

尽量不要在您的创建用户命令中使用引号:

CREATE USER C##lysjr_ro IDENTIFIED BY XXXXXXXPASWORD  
DEFAULT TABLESPACE XXX_TABLE_SPACE
TEMPORARY TABLESPACE XXX_TABLE_SPACE_TEMP;
于 2020-05-26T16:07:55.890 回答