在 AlmaLinux 9.2 上安装Oracle Database 23c
- 1. 安装 Oracle Database 23c
- 2. 连接 Oracle Database 23c
- 3. 重启启动后,手动启动数据库
- 4. 重启启动后,手动启动 Listener
- 5. 手动启动 Pluggable Database
- 6. 自动启动 Pluggable Database
- 7. 设置开机启动数据库
- 7-1. 修改 /etc/oratab
- 7-2. 修改 /etc/rc.d/rc.local
- 8. (谨慎)卸载 Oracle Database 23c
- 9. Oracle Database 23c 安装文件下载
1. 安装 Oracle Database 23c
创建安装目录,
mkdir -p /u01/app/oracle/product/23.4.0/dbhome_1
chown -R oracle:oracle /u01
chmod -R 775 /u01
配置环境变量,
vi ~/.bashrc
--- add
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/23.4.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
---
source ~/.bashrc
创建目录,
mkdir -p $ORACLE_HOME
解压文件,
cd $ORACLE_HOME
unzip oracle23c.zip
运行下面命令进行安装,
./runInstaller
按默认选项,单击 “Next”,
按默认选项,单击 “Next”,
输入各个项目,单击 “Next”,
按默认选项,单击 “Next”,
按默认选项,单击 “Next”,
单击 “Fix & Check Again”,
拷贝 “Fixup Script” 脚本,
执行 “Fixup Script” 脚本,
/tmp/InstallActions2023-12-01_09-22-30AM/CVU_23_oracle_2023-12-01_09-22-33_9158/runfixup.sh
执行 “Check Again”,准备修复 Packages 问题,
安装必须的 Packages,
sudo dnf install sysstat ksh nfs-utils -y
执行 “Check Again”,忽略 “Swap Size” 问题,单击 “Next”,
单击 “Install”,
执行 “Configuration Scripts”,
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/23.4.0/dbhome_1/root.sh
安装完成后,单击 “Close”,
2. 连接 Oracle Database 23c
命令行连接,给 pdbadmin 赋予 dba 权限,
sqlplus / as sysdba
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SQL> alter session set container=pdb1;
Session altered.
SQL> grant dba to pdbadmin;
Grant succeeded.
Oracle SQL Developer 连接,
3. 重启启动后,手动启动数据库
sqlplus / as sysdba
SQL> startup
4. 重启启动后,手动启动 Listener
lsnrctl start
sqlplus / as sysdba
SQL> show parameter service
SQL> alter system register;
SQL> quit
lsnrctl status
5. 手动启动 Pluggable Database
sqlplus / as sysdba
SQL> show pdbs
SQL> alter pluggable database pdb1 open;
SQL> show pdbs
6. 自动启动 Pluggable Database
sqlplus / as sysdba
SQL> show pdbs
SQL> alter pluggable database pdb1 open;
SQL> show pdbs
SQL> alter pluggable database all save state;
7. 设置开机启动数据库
7-1. 修改 /etc/oratab
vi /etc/oratab
--- modify
# orcl:/u01/app/oracle/product/23.4.0/dbhome_1:N
orcl:/u01/app/oracle/product/23.4.0/dbhome_1:Y
---
7-2. 修改 /etc/rc.d/rc.local
echo $ORACLE_HOME
--- output
/u01/app/oracle/product/23.4.0/dbhome_1
---
vi /etc/rc.d/rc.local
--- add
su - oracle -lc "/u01/app/oracle/product/23.4.0/dbhome_1/bin/lsnrctl start"
su - oracle -lc "/u01/app/oracle/product/23.4.0/dbhome_1/bin/dbstart /u01/app/oracle/product/23.4.0/dbhome_1"
---
sudo chmod +x /etc/rc.d/rc.local
8. (谨慎)卸载 Oracle Database 23c
cd $ORACLE_HOME/deinstall/
./deinstall
rm -r /etc/oraInst.loc
rm -r /opt/ORCLfmap
rm -r /etc/oratab
9. Oracle Database 23c 安装文件下载
版权问题,下载地址请等待 Oracle 官方公开
完结!