前言
centos8安装部署Oracle Database Free
安装部署
服务器安装
- 下载centos8镜像(选择镜像:CentOS-Stream-8-20230523.0-x86_64-dvd1.iso)并安装系统,具体细节不再赘述
- 关闭centos8服务器的防火墙与selinux,并配置ip
部署oracle
- 注:先下载文件Oracle Linux==>oracle-database-free-23c-1.0-1.el8.x86_64.rpm并放置到服务器的家目录下
[root@localhost ~]# cd ~
[root@localhost ~]# sudo -s
[root@localhost ~]# curl -L -o oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL8/developer/x86_64/getPackage/oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm
[root@localhost ~]# dnf -y localinstall oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm
[root@localhost ~]# dnf -y localinstall oracle-database-free*
[root@localhost ~]# /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: devops
Confirm the password: Data2023Configuring 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: localhost.localdomain/FREEPDB1Multitenant container database: localhost.localdomain
设置 Oracle 数据库自由环境变量
[root@localhost /]#export ORACLE_SID=FREE
[root@localhost /]#export ORAENV_ASK=NO
[root@localhost /]#. /opt/oracle/product/23c/dbhomeFree/bin/oraenv
The Oracle base has been set to /opt/oracle
连接oracle数据库
使用操作系统身份验证在本地连接
[root@localhost /]# cd /opt/oracle/product/23c/dbhomeFree/bin/
[root@localhost bin]# ./sqlplus / as sysdbaSQL*Plus: Release 23.0.0.0.0 - Developer-Release on Sat Jun 3 12:13:57 2023
Version 23.2.0.0.0Copyright (c) 1982, 2023, Oracle. All rights reserved.ERROR:
ORA-01017: invalid credential or not authorized; logon deniedEnter user-name: SYSTEM # 输入账户
Enter password: # 输入密码
Last Successful login time: Sat Jun 03 2023 11:45:39 +08:00Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
- 注:类似于以上内容的输出确认您现在已连接到数据库
使用账户登录本地数据库
[root@localhost bin]# export ORACLE_SID=FREE
[root@localhost bin]# export ORAENV_ASK=NO
[root@localhost bin]# . /opt/oracle/product/23c/dbhomeFree/bin/oraenv
The Oracle base has been set to /opt/oracle
[root@localhost bin]# ./sqlplus system@127.0.0.1:1521/FREEPDB1SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Sat Jun 3 12:24:06 2023
Version 23.2.0.0.0Copyright (c) 1982, 2023, Oracle. All rights reserved.Enter password:
Last Successful login time: Sat Jun 03 2023 12:14:56 +08:00Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
oracle服务设置开机自启动
[root@localhost /]# systemctl daemon-reload
[root@localhost /]# systemctl enable oracle-free-23c
oracle-free-23c.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable oracle-free-23c
[root@localhost /]# systemctl start oracle-free-23c
[root@localhost /]# systemctl status oracle-free-23c
● oracle-free-23c.service - SYSV: This script is responsible for taking care of configuring the RPM Oracle FREE Database and its associated services.Loaded: loaded (/etc/rc.d/init.d/oracle-free-23c; generated)Active: active (exited) since Sat 2023-06-03 12:28:09 CST; 2s agoDocs: man:systemd-sysv-generator(8)Process: 8178 ExecStart=/etc/rc.d/init.d/oracle-free-23c start (code=exited, status=0/SUCCESS)Jun 03 12:28:09 localhost.localdomain systemd[1]: Starting SYSV: This script is responsible for taking care of configuring the RPM Oracle FREE Database and its associated services....
Jun 03 12:28:09 localhost.localdomain oracle-free-23c[8178]: The Oracle Database instance FREE is already started.
Jun 03 12:28:09 localhost.localdomain systemd[1]: Started SYSV: This script is responsible for taking care of configuring the RPM Oracle FREE Database and its associated services..
结语
Oracle Database 23c 免费版——开发者版
Oracle Database Free Download
Python python-oracledb Driver