docker-compose.yml
version: '3' services: oracle: image: registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c container_name: oracle19c privileged: true environment: TZ: Asia/Shanghai ORACLE_SID: ORCL ORACLE_PDB: ORCLPDB1 ORACLE_PWD: nV1SupBTqqfINz ORACLE_EDITION: standard ORACLE_CHARACTERSET: AL32UTF8 volumes: - ./oradata:/opt/oracle/oradata ports: - "1521:1521" - "18080:8080" - "15313:5500"
mkdir oradata chmod -R 777 oradata/
Check the log to get the password:
ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: JKF+Zf3e6YM=1
change Password
docker exec oracle19c ./setPassword.sh oracle
To use Navicat Premium to log in to sys as sysdba, you need to pay attention to the user name to fill in sys, and then select the role in the advanced.
Navicat Premium connects to sqlserver without filling in the port
CDB/PDB
ORCLCDB
ORCLPDB1
query PDB
SELECT con_id, dbid, NAME, OPEN_MODE FROM v$pdbs;
ALTER SESSION SET container = ORCLPDB1;
create tablespace
CREATE tablespace acgist datafile '/opt/oracle/oradata/ORCLCDB/acgist.dbf' SIZE 1024M autoextend ON NEXT 128M;
create user
CREATE USER user IDENTIFIED BY 123456 DEFAULT tablespace acgist;
authorized
GRANT CONNECT, RESOURCE TO user;
GRANT CREATE ANY sequence TO user;
GRANT CREATE ANY TABLE TO user;
GRANT DELETE ANY TABLE TO user;
GRANT INSERT ANY TABLE TO user;
GRANT SELECT ANY TABLE TO user;
GRANT UPDATE ANY TABLE TO user;
GRANT CREATE ANY VIEW TO user;
GRANT unlimited tablespace TO user;
GRANT execute ANY PROCEDURE TO user;
GRANT dba TO user;
delete
-- DROP tablespace acgist;
-- DROP tablespace acgist including contents and datafiles;
-- DROP user name;
Linux connection Oracle19c problem
Caused by: oracle.net.ns.NetException: Got minus one from a read call
at oracle.net.ns.NSProtocolNIO.doSocketRead(NSProtocolNIO.java:557)
at oracle.net.ns.NIOPacket.readHeader(NIOPacket.java:258)
at oracle.net.ns.NIOPacket.readPacketFromSocketChannel(NIOPacket.java:190)
at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:132)
at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:105)
at oracle.net.ns.NIONSDataChannel.readDataFromSocketChannel(NIONSDataChannel.java:91)
at oracle.net.ano.AnoCommNIO.p(Unknown Source)
at oracle.net.ano.AnoCommNIO.e(Unknown Source)
at oracle.net.ano.AnoComm.readUB4(Unknown Source)
at oracle.net.ano.Ano.c(Unknown Source)
at oracle.net.ano.Ano.negotiation(Unknown Source)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:368)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1600)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:592)
... 39 common frames omitted
This problem is very strange. There is no problem on the window, but there is a problem on linux. The solution is to modify the connection:
# 错误连接
url: jdbc:oracle:thin:@192.168.1.100:1521/acgist
# 正确连接
url: jdbc:oracle:thin:@tcp://192.168.1.100:1521/acgist?oracle.net.disableOob=true
data import
Use sqlplus to connect to the database, and then use to @/sql.sql
execute the import.
If the prompt Enter value for
statement contains escape characters, turn off the escape characters set define off
.
sqlplus connection commandsqlplus username/password@host:port/服务名称
Important: don't forget to commit when you're done
gibberish
select userenv('language') from dual;
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8