Oracle 12c 中没有使用名 HR
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33731902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No usename HR in Oracle 12c
提问by pranphy
I have installed oracle 12c in my ubuntu. I use oracle through sqldeveloper and I can successfully connect to user sys
with my password. I want to be able to use all databases provided by oracle by default. When I try to connect with username hr
with the same password as in sys
I get error username not found.
我已经在我的 ubuntu 中安装了 oracle 12c。我通过 sqldeveloper 使用 oracle,我可以sys
使用我的密码成功连接到用户。我希望能够默认使用 oracle 提供的所有数据库。当我尝试使用hr
与 相同的密码连接用户名时,sys
我收到错误用户名未找到。
select * from all_users
doesn't list user hr
. So I assume the user is not created at all.
select * from all_users
不列出 user hr
。所以我假设用户根本没有创建。
- Should it not have been available by default, hr user?
- How can I configure such that I get the access to all `hr` databases?
- 默认情况下它不应该是可用的吗,hr 用户?
- 如何配置才能访问所有“hr”数据库?
回答by Lalit Kumar B
I have installed oracle 12c in my ubuntu. I assume the user is not created at all.
我已经在我的 ubuntu 中安装了 oracle 12c。我假设根本没有创建用户。
You have created the 12c databaseas a container. Now you might be connecting to the container databasewhile the sample schemasreside in the pluggable database.
您已将12c 数据库创建为容器。现在您可能正在连接到容器数据库,而示例模式驻留在可插拔数据库中。
Oracle 12c has introduced multi-tenant architecture. There are some mandatory post-installation steps. Please read Oracle 12c Post Installation Mandatory Steps.
Oracle 12c 引入了多租户架构。有一些强制性的安装后步骤。请阅读Oracle 12c 安装后强制步骤。
The most common misunderstanding is about “SQLPLUS / AS SYSDBA
” usage.
最常见的误解是关于“ SQLPLUS / AS SYSDBA
”的用法。
Since we have checked the option to create a single CDB, the “SQLPLUS / AS SYSDBA
” command will always log into CDB. Usually developers used to unlock the “SCOTT/HR
” account directly after logging as SYSDBA
. But here is the trick :
由于我们已选中创建单个 CDB 的选项,因此“ SQLPLUS / AS SYSDBA
”命令将始终登录CDB。通常开发者SCOTT/HR
在登录后直接解锁“ ”账号SYSDBA
。但这里有诀窍:
“SCOTT,HR” and other sample schemasare in the PDBand not in the CDB. So, you need to login as sysdba
into PDB.
“SCOTT,HR”和其他示例模式位于PDB而不是CDB 中。所以,你需要登录作为sysdba
进入PDB。
For example,
例如,
sqlplus SYS/password@PDBORCL AS SYSDBA
SQL> ALTER USER scott ACCOUNT UNLOCK IDENTIFIED BY tiger;
sqlplus scott/tiger@pdborcl
SQL> show user;
USER is "SCOTT"
UDPATESeems OP has not installed the sample schemas. It could be done manually or via DBCA.
UDPATE似乎 OP 尚未安装示例架构。它可以手动完成,也可以通过 DBCA 完成。
You need to run the hr_main.sqlscript. All scripts necessary to create the Human Resource (HR) schema reside in $ORACLE_HOME/demo/schema/human_resources
.
您需要运行hr_main.sql脚本。创建人力资源 (HR) 架构所需的所有脚本都驻留在in $ORACLE_HOME/demo/schema/human_resources
.
From documentation,
从文档,
Installing the HR Schema
All scripts necessary to create the Human Resource (HR) schema reside in $ORACLE_HOME/demo/schema/human_resources.
You need to call only one script, hr_main.sql, to create all the objects and load the data
Running hr_main.sqlaccomplishes the following tasks:
- Removes any previously installed HR schema
- Creates user HR and grants the necessary privileges
- Connects as HR
- Calls the scripts that create and populate the schema objects
安装 HR 模式
创建人力资源 (HR) 模式所需的所有脚本都位于 $ORACLE_HOME/demo/schema/human_resources 中。
您只需要调用一个脚本 hr_main.sql 即可创建所有对象并加载数据
运行hr_main.sql完成以下任务:
- 删除任何以前安装的 HR 模式
- 创建用户 HR 并授予必要的权限
- 作为 HR 连接
- 调用创建和填充架构对象的脚本
回答by Moudiz
回答by Bjarte Brandt
In order to install the sample schemas, you need to follow the instructions from https://github.com/oracle/db-sample-schemas.
为了安装示例模式,您需要按照https://github.com/oracle/db-sample-schemas 中的说明进行操作。
Anything from the original Oracle Database 12.1.0.2 demo-folder does not work properly.
原始 Oracle Database 12.1.0.2 演示文件夹中的任何内容都无法正常工作。