docker 环境下载
docker rm -f lhrora23ai
docker run -itd --name lhrora23ai -h lhrora23ai \
-p 1531:1521 -p 31389:3389 \
-v /sys/fs/cgroup:/sys/fs/cgroup \
--privileged=true lhrbest/oracle23ai:1.0 \
/usr/sbin/init
docker exec -it lhrora23ai bash
version: "3"
services:
lhrora23ai:
image: lhrbest/oracle23ai:1.0
container_name: lhrora23ai
hostname: lhrora23ai
restart: always
privileged: true
ports:
- "1531:1521"
- "31389:3389"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
command: ["/usr/sbin/init"]
启动数据库和监听
/etc/init.d/oracle-free-23ai status
/etc/init.d/oracle-free-23ai start
示例:
[root@lhrora23ai /]# /etc/init.d/oracle-free-23ai status
Status of the Oracle FREE 23ai service:
LISTENER status: STOPPED
FREE Database status: STOPPED
[root@lhrora23ai /]#
[root@lhrora23ai /]# /etc/init.d/oracle-free-23ai start
Starting Oracle Net Listener.
Oracle Net Listener started.
1tarting Oracle Database instance FREE.
Oracle Database instance FREE started.
[root@lhrora23ai /]# su - oracle
Last login: Wed May 8 10:27:01 CST 2024 on pts/1
[oracle@lhrora23ai ~]$
测试新特性
[oracle@lhrora23ai ~]$ sas
SQL*Plus: Release 23.0.0.0.0 - Production on Wed May 8 10:27:32 2024
Version 23.4.0.24.05
Copyright (c) 1982, 2024, Oracle. All rights reserved.
Connected to:
Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.4.0.24.05
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 FREEPDB1 READ WRITE NO
SQL> select 1;
1
----------
1
SQL> SELECT SYSDATE;
SYSDATE
---------
08-MAY-24
SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS';
Session altered.
SQL> SELECT SYSDATE;
SYSDATE
-------------------
2024-05-08 10:28:08
SQL>
客户端使用
使用 sqlplus 远程连接:
C:\Users\lhr>sqlplus sys/lhr@192.16.7.162:1531/FREE as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Wed May 8 10:29:37 2024
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.4.0.24.05
13SQL> show pdbs
14
15 CON_ID CON_NAME OPEN MODE RESTRICTED
16---------- ------------------------------ ---------- ----------
17 2 PDB$SEED READ ONLY NO
18 3 FREEPDB1 READ WRITE NO
19SQL> exit
20Disconnected from Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
21Version 23.4.0.24.05
22
23C:\Users\lhr>sqlplus sys/lhr@192.16.7.162:1531/freepdb1 as sysdba
24
25SQL*Plus: Release 21.0.0.0.0 - Production on Wed May 8 10:30:04 2024
26Version 21.3.0.0.0
27
28Copyright (c) 1982, 2021, Oracle. All rights reserved.
29
30
31Connected to:
32Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
33Version 23.4.0.24.05
34
35SQL> show pdbs
36
37 CON_ID CON_NAME OPEN MODE RESTRICTED
38---------- ------------------------------ ---------- ----------
39 3 FREEPDB1 READ WRITE NO
40SQL>
官方 docker 安装使用
参考:https://container-registry.oracle.com
1docker pull container-registry.oracle.com/database/free:latest
2
3
4docker run -itd --name ora23ai -h ora23ai \
5 -p 1521:1521 \
6 container-registry.oracle.com/database/free:latest
7
8
9
10docker exec -it ora23ai sqlplus / as sysdba
11
12SELECT BANNER_FULL FROM V$VERSION;
13
14
15sqlplus sys@localhost:1521/FREEPDB1 as sysdba
16
17sqlplus sys@localhost:1521/FREE as sysdba
总结
1、可以使用官方的 docker,也可以使用麦老师自己制作的 docker 镜像。
参考
https://xmmup.com/oracle-database-23cmianfeikaifazhebanjianjie.html
https://xmmup.com/zaidockerzhongkuaisutiyanoracle-23cmianfeikaifazheban.html
https://xmmup.com/oracle-database-23cmianfeikaifazhebandanjianzhuang.html
https://xmmup.com/dbbao37zaidockerzhongkuaisushiyonggegebanbencong10gdao19cdeoracleshu.html
https://www.xmmup.com/oracle-23aijieshao.html
正文完
发表至: 开源脚本
2024-05-13