Oracle Database 23c免费开发者版单机安装
使用rpm包快速安装Oracle 23c免费开发者版
熟悉Oralce的朋友可能会发现,从19c开始,提供了非常简洁的数据库安装与创建方法,大大降低了Oracle数据库的使用门槛,因为对于初学者来说,首先要有一套可用的环境,才能为后续的学习做好准备。
安装
本次主机环境为Oracle Linux Server 8.7,下载及安装:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | docker rm -f lhroel87 docker run -itd --name lhroel87 -h lhroel87 \ -p 1521:1521 -p 38389:3389 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true oraclelinux:8.7 \ /usr/sbin/init docker exec -it lhroel87 bash curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo dnf install -y openssh openssh-clients openssh-server \ initscripts net-tools telnet which wget passwd lrzsz sudo unzip \ tree traceroute lsof file tar systemd sysstat curl \ strace less bash bash-completion sed zip \ yum-utils ethtool iputils screen dnf -y groupinstall "Development tools" wget https://yum.oracle.com/repo/OracleLinux/OL8/developer/x86_64/getPackage/oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm wget https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23c-1.0-1.el8.x86_64.rpm yum -y install oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm yum -y install oracle-database-free-23c-1.0-1.el8.x86_64.rpm |
至此,Oracle Database 23c软件安装完毕。
创建数据库
接下来可以按照提示,创建数据库,您可以修改数据库创建脚本,也可以使用默认值。
配置文件:
1 | /etc/sysconfig/oracle-free-23c.conf |
可配置项很少:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | [root@lhroel87 soft]# cat /etc/sysconfig/oracle-free-23c.conf #This is a configuration file to setup the Oracle Database. #It is used when running '/etc/init.d/oracle-free-23c configure'. # LISTENER PORT used Database listener, Leave empty for automatic port assignment LISTENER_PORT= # Character set of the database CHARSET=AL32UTF8 # Database file directory # If not specified, database files are stored under Oracle base/oradata DBFILE_DEST= # DB Domain name DB_DOMAIN= # SKIP Validations, memory, space SKIP_VALIDATIONS=false |
为了方便,直接使用默认脚本。使用root用户执行如下脚本:
1 2 | /etc/init.d/oracle-free-23c configure /etc/init.d/oracle-free-23c status |
在数据库创建完成后,数据库实例和监听器都已经启动。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | [root@lhroel87 soft]# /etc/init.d/oracle-free-23c configure Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts: Confirm the password: Configuring Oracle Listener. Listener configuration succeeded. Configuring Oracle Database FREE. Enter SYS user password: **** Enter SYSTEM user password: ***** Enter PDBADMIN User Password: ** Prepare for db operation 7% complete Copying database files 29% complete Creating and starting Oracle instance 30% complete 33% complete 36% complete 39% complete 43% complete Completing Database Creation 47% complete 49% complete 50% complete Creating Pluggable Databases 54% complete 71% complete Executing Post Configuration Actions 93% complete Running Custom Scripts 100% complete Database creation complete. For details check the logfiles at: /opt/oracle/cfgtoollogs/dbca/FREE. Database Information: Global Database Name:FREE System Identifier(SID):FREE Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details. Connect to Oracle Database using one of the connect strings: Pluggable database: lhroel87/FREEPDB1 Multitenant container database: lhroel87 [root@lhroel87 soft]# |
配置环境变量
在配置oracle环境变量之后,即可连接数据库并体验23c带给您的方便与快捷了。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | cat >> /home/oracle/.bash_profile <<"EOF" # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs export ORACLE_HOME=/opt/oracle/product/23c/dbhomeFree export ORACLE_SID=FREE export PATH=$PATH:$ORACLE_HOME/bin alias sqlplus='rlwrap sqlplus' alias sas='sqlplus / as sysdba' EOF source /home/oracle/.bash_profile |
示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | [oracle@lhroel87 ~]$ lsnrctl status LSNRCTL for Linux: Version 23.0.0.0.0 - Developer-Release on 07-APR-2023 02:43:17 Copyright (c) 1991, 2023, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=lhroel87)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 23.0.0.0.0 - Developer-Release Start Date 07-APR-2023 02:36:40 Uptime 0 days 0 hr. 6 min. 37 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Default Service FREE Listener Parameter File /opt/oracle/product/23c/dbhomeFree/network/admin/listener.ora Listener Log File /opt/oracle/diag/tnslsnr/lhroel87/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lhroel87)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "FREE" has 1 instance(s). Instance "FREE", status READY, has 1 handler(s) for this service... Service "FREEXDB" has 1 instance(s). Instance "FREE", status READY, has 1 handler(s) for this service... Service "f8b6f5a0fb7e7ce8e0531e0047acac98" has 1 instance(s). Instance "FREE", status READY, has 1 handler(s) for this service... Service "freepdb1" has 1 instance(s). Instance "FREE", status READY, has 1 handler(s) for this service... The command completed successfully [oracle@lhroel87 ~]$ ps -ef|grep pmon oracle 31732 0 0 02:41 ? 00:00:00 db_pmon_FREE oracle 32373 32342 0 02:43 pts/1 00:00:00 grep --color=auto pmon [oracle@lhroel87 ~]$ [oracle@lhroel87 ~]$ source .bash_profile |
如果您使用SQL Developer进行连接,可以如下图所示连接数据库。在service name中填入freepdb1。
Docker环境
我自己的docker环境
请参考:https://www.xmmup.com/zaidockerzhongkuaisutiyanoracle-23cmianfeikaifazheban.html
官方docker安装使用
请参考:https://www.xmmup.com/zaidockerzhongkuaisutiyanoracle-23cmianfeikaifazheban.html
新特性简单测试
请参考:https://www.xmmup.com/zaidockerzhongkuaisutiyanoracle-23cmianfeikaifazheban.html