声明:本文乃“运维家”原创,转载请注明出处,更多内容请关注公众号“运维家”。
主旨
oracle作为主流数据库之一,身为IT人员,怎么能不会搭建呢?我不允许哈,下来看看如何一步一步的搭建起来吧。建议收藏,不然一会儿就找不见了,哈哈哈。
环境
linux环境
oracle软件
根目录下磁盘空间最少4G
软件下载
官网下载太慢,而且需要注册,这里直接从公众号 “运维家” 后台回复 “oracle” 即可获取软件包,即取即用。准备
# 关闭防火墙
[yunweijia@localhost ~]$ sudo systemctl stop firewalld.service
[yunweijia@localhost ~]$ sudo systemctl disable firewalld.service
# 关闭selinux
[yunweijia@localhost ~]$ sudo getenforce 0
Disabled
[yunweijia@localhost ~]$ sudo vim /etc/selinux/config
SELINUX=disabled
[yunweijia@localhost ~]$
上传文件
我们从上面提供的地址,下载完文件之后,上传到服务器上;[yunweijia@localhost ~]$ mkdir -pv oracle/RJ
mkdir: 已创建目录 "oracle"
mkdir: 已创建目录 "oracle/RJ"
[yunweijia@localhost RJ]$ pwd
/home/yunweijia/oracle/RJ
[yunweijia@localhost RJ]$ ls
oracle19.zip
[yunweijia@localhost RJ]$ unzip oracle19.zip
Archive: oracle19.zip
creating: 19cc/
inflating: 19cc/base.zip
inflating: 19cc/krb5-1.15.1-50.el7.src.rpm
inflating: 19cc/oracle-database-ee-19c-1.0-1.x86_64.rpm
inflating: 19cc/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
[yunweijia@localhost RJ]$ mv 19cc/* .
[yunweijia@localhost RJ]$ rm -rf 19cc oracle19.zip
[yunweijia@localhost RJ]$ unzip base.zip
[yunweijia@localhost RJ]$ rm -f base.zip
[yunweijia@localhost RJ]$ ls
base krb5-1.15.1-50.el7.src.rpm oracle-database-ee-19c-1.0-1.x86_64.rpm oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
[yunweijia@localhost RJ]$
创建离线yum源
[yunweijia@localhost ~]$ cd /etc/yum.repos.d/
[yunweijia@localhost yum.repos.d]$ sudo mkdir bf
[yunweijia@localhost yum.repos.d]$ sudo mv *.repo bf/
[yunweijia@localhost yum.repos.d]$ sudo vim local.repo
[local]
name=local
enable=1
baseurl=file:///home/yunweijia/oracle/RJ/base
gpgcheck=0
[yunweijia@localhost yum.repos.d]$ yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源:local
Cleaning up everything
Maybe you want: rm -rf /var/tmp/yum-yunweijia-lZ5kh0, to also free up space taken by orphaned data from disabled or removed repos
[yunweijia@localhost yum.repos.d]$
安装oracle
出现如下图,安装完成;[yunweijia@localhost RJ]$ pwd
/home/yunweijia/oracle/RJ
[yunweijia@localhost RJ]$
[yunweijia@localhost RJ]$ sudo yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
[yunweijia@localhost RJ]$ sudo yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm
[yunweijia@localhost RJ]$
初始化
[yunweijia@localhost RJ]$ sudo /etc/init.d/oracledb_ORCLCDB-19c configure
此步骤较慢,具体根据个人服务器性能来看,成功之后如下图; 环境变量
[yunweijia@localhost RJ]$ sudo su - oracle
[oracle@localhost ~]$ vim .bash_profile
# 在文件末尾添加以下3行
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export PATH=$PATH:/opt/oracle/product/19c/dbhome_1/bin
export ORACLE_SID=ORCLCDB
[oracle@localhost ~]$
[oracle@localhost ~]$ source .bash_profile
[oracle@localhost ~]$
登录
使用客户端工具navicat连接,操作如下:[as sysdba ]$ sqlplus /
SQL> alter user system identified by 123456;
SQL> exit
[ ]$
此文结束,下一篇将介绍oracle的重启、新建用户、数据库、基本命令等操作。欢迎各位老板关注。
本文使用 文章同步助手 同步