原文链接
首先配置离线yum源
由于无法联网,因此需要配置本地yum源,才能使用yum安装配置方法见链接CentOS 7 配置本地 YUM源
下载需要的安装包
preinstall
wget http://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
Oracle 的rpm 安装包
https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
安装
安装后默认有oracle用户
yum localinstall -y oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
yum localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm
安装结果如下:
yum install oracle-database-ee-19c-1.0-1.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining oracle-database-ee-19c-1.0-1.x86_64.rpm: oracle-database-ee-19c-1.0-1.x86_64
Marking oracle-database-ee-19c-1.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-ee-19c.x86_64 0:1.0-1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================================================================================
Installing:
oracle-database-ee-19c x86_64 1.0-1 /oracle-database-ee-19c-1.0-1.x86_64 6.9 G
Transaction Summary
==========================================================================================================================================================================================
Install 1 Package
Total size: 6.9 G
Installed size: 6.9 G
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : oracle-database-ee-19c-1.0-1.x86_64 1/1
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-19c configure
Verifying : oracle-database-ee-19c-1.0-1.x86_64 1/1
Installed:
oracle-database-ee-19c.x86_64 0:1.0-1
Complete!
配置
使用root用户编辑以下文件/etc/init.d/oracledb_ORCLCDB-19c修改内容如下:
以下是我修改的内容(只修改了sid和字符集,其他未做修改)
export ORACLE_SID=test
export CHARSET=ZHS16GBK
对应的要复制一参数文件
cd /etc/sysconfig/
cp oracledb_ORCLCDB-19c.conf oracledb_test-19c.conf
运行配置命令
/etc/init.d/oracledb_ORCLCDB-19c configure
等待Oracle数据库执行初始化操作即可
/etc/init.d/oracledb_ORCLCDB-19c configure
Configuring Oracle Database h4adb.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
修改oracle用户环境变量
切换oracle用户,增加环境变量处理,编辑.bash_profile
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export PATH=$PATH:/opt/oracle/product/19c/dbhome_1/bin
export ORACLE_SID=ORA19C
NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=american_america.ZHS16GBK; export NLS_LANG
使环境变量生效
source .bash_profile
使用Oracle登录进行相关的处理
sqlplus / as sysdba
查看pdb信息
show pdbs
创建自动启动pdb的触发器(不设置PDB的开机启动 很多程序无法连接上PDB, 建议使用show pdbs 查看状态, 手工启动也可以. 不能在CDB创建业务数据, 会提示创建的用户名不符合 c###的要求)
REATE TRIGGER open_all_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'alter pluggable database all open';
END open_all_pdbs;
/
重启linux服务器. 然后可以工具连接尝试连接该数据库.
文章评论
前来拜访技术大佬 :surprised: (ps:以后会常来的,可能不会评论哒。 因为咱整不明白这些技术的东西)
@小陆花 欢迎常来