ORA-20000:架构“HR”不存在或权限不足

时间:2016-04-12 04:38:36

标签: oracle oracle11g

我使用Oracle 11g express。我尝试安装示例数据库HR。来自 cmd

sqlplus
system
123456

enter image description here

错误: enter image description here

Comment created.


Commit complete.

BEGIN dbms_stats.gather_schema_stats(          'HR'                            ,                granularity => 'ALL'            ,                cascade => TRUE                 ,                block_sample => TRUE            ); END;

*
ERROR at line 1:
ORA-20000: Schema "HR" does not exist or insufficient privileges
ORA-06512: at "SYS.DBMS_STATS", line 3701
ORA-06512: at "SYS.DBMS_STATS", line 24470
ORA-06512: at "SYS.DBMS_STATS", line 24435
ORA-06512: at line 1

我如何正确安装示例数据库HR?

3 个答案:

答案 0 :(得分:1)

问题在于

create user hr identified by 123456a@

由于未创建用户,因此您会收到其他错误。

要解决此问题,请执行以下任一操作

  • 从密码中删除特殊字符。或者在密码中使用下划线_

    create user hr identified by 123456a
    

  • 请尝试用双引号括起密码。 (我现在无法测试它。但是如果它不起作用,请尝试第一个选项。我引用了这个link

    create user hr identified by "123456a@"
    

答案 1 :(得分:0)

在执行脚本之前,以SYS用户身份导航到PDB容器

[oracle@af18354c958e /]$ sqlplus sys as sysdba
Enter password: password

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> alter session set container = ORCLPDB1
SQL> @hr_main.sql

specify password for HR as parameter 1:
Enter value for 1: hr

specify default tablespeace for HR as parameter 2:
Enter value for 2: users

specify temporary tablespace for HR as parameter 3:
Enter value for 3: temp

specify log path as parameter 4:
Enter value for 4: $ORACLE_HOME/demo/schema/log/

答案 2 :(得分:0)

显然,尽管没有停止执行hr_main.sql脚本,但是创建用户hr的语句并未正确执行。

这对我有用:

以sysdba身份登录

SQL> alter session set“ _ORACLE_SCRIPT” = true;      会话已更改。 SQL>创建由hr标识的用户hr;      用户创建。 SQL>删除用户hr级联;      用户掉线了。 SQL> @?/ demo / schema / human_resources / hr_main.sql ... 用户创建。 ...