[英]Cannot connect to new user just created on oracle on docker (ORA-01017)
I'm trying to use Oracle 12c on Ubuntu 18 to study for my work.我正在尝试在 Ubuntu 18 上使用 Oracle 12c 来学习我的工作。
For it, I'm using docker-compose file I used to create in other PCs.为此,我正在使用我曾经在其他 PC 上创建的 docker-compose 文件。
version: '2'
services:
database:
image: store/oracle/database-enterprise:12.2.0.1
volumes:
- ./data:/ORCL # persistent oracle database data.
ports:
- 1529:1521
- 8082:8080
- 5500:5500
After install, I can login as sysadmin and I enter those codes below to create a user.安装后,我可以以系统管理员身份登录,然后在下面输入这些代码以创建用户。
ALTER SESSION SET CONTAINER = ORCLPDB1;
CREATE USER BUS IDENTIFIED BY DEMO_PASS;
GRANT CONNECT TO BUS;
and then, I try to connect to it.然后,我尝试连接到它。
sqlplus BUS/DEMO_PASS@localhost:1529/ORCLCDB.localdomain
I want to login as could in other PCs but instead of this, I'm getting this error.我想像在其他 PC 上一样登录,但不是这样,我收到了这个错误。
ORA-01017: invalid username/password; logon denied
You have to create user for connection.您必须为连接创建用户。
Look my sample here:在这里查看我的示例:
docker container run -d -h localdomain --name odbc2 -p 1521:1521 -p 5500:5500 -e DB_SID=ORCLCDB -e DB_PDB=ORCLPDB1 -e DB_DOMAIN=localdomain store/oracle/database-enterprise:12.2.0.1-slim
docker exec -it odbc2 bash -c "source /home/oracle/.bashrc; sqlplus /nolog"
connect sys as sysdba;
-- password 'Oradoc_db1'
alter session set "_ORACLE_SCRIPT"=true;
create user dummy identified by dummy;
GRANT CONNECT, RESOURCE, DBA TO dummy;
create table Docker (id int,name varchar2(20));
Connection info:连接信息:
SID:ORCLCDB
PORT:1521
username: dummy
password: dummy
url: jdbc:oracle:thin:@localhost:1521:ORCLCDB
You're connecting to the wrong database - ORCLDB.localdomain is the service for the CONTAINER database.您连接到错误的数据库 - ORCLDB.localdomain 是 CONTAINER 数据库的服务。
You did a, alter session set container = ORCLPDB1 => that is the database you want to connect to, so try你做了一个,alter session set container = ORCLPDB1 => 那是你想要连接的数据库,所以试试
sqlplus BUS/DEMO_PASS@localhost:1529/ORCLPDB1
Also if you're looking for a more user friendly CLI for Oracle, we build SQLcl .此外,如果您正在为 Oracle 寻找更用户友好的 CLI,我们会构建SQLcl 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.