收藏 | 超详细的Oracle19c安装步骤-CentOS Linux
收藏 | 超详细的Oracle19c安装步骤
【微思网络】IT培训-思科/华为/红帽/ORACLE...
2 人赞同了该文章
DBA数据库管理必备认证:ORACLE OCP 19C(最新版本)
ORACLE OCP 19C官方教材下载:https://download.csdn.net/download/XMWS_IT/19927549
1.安装前环境配置
基本信息
OS | DB | hostname | DB name | IP |
Redhat7.6 | Oracle 19C | Oracle19C | weisi | 192.168.2.100 |
配置/etc/hosts
[root@ocp /]#
echo '192.168.2.100 Oracle19C' >> /etc/hosts
关闭防火墙和Selinux
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
配置系统参数
echo kernel.shmmni=4096 >> /etc/sysctl.conf
echo kernel.sem=250 32000 100 128 >> /etc/sysctl.conf
echo fs.file-max=6815744 >> /etc/sysctl.conf
echo fs.aio-max-nr=1048576 >> /etc/sysctl.conf
echo net.ipv4.ip_local_port_range=9000 65500 >> /etc/sysctl.conf
echo net.core.rmem_default=262144 >> /etc/sysctl.conf
echo net.core.rmem_max=4194304 >> /etc/sysctl.conf
echo net.core.wmem_default=262144 >> /etc/sysctl.conf
echo net.core.wmem_max=1048576 >> /etc/sysctl.conf
echo kernel.shmmax=2023478784 >> /etc/sysctl.conf
echo kernel.shmall=52780232 >> /etc/sysctl.conf
echo 'session required /lib64/security/pam_limits.so' >>/etc/pam.d/login
echo 'session required pam_limits.so' >>/etc/pam.d/login
echo 'oracle soft nproc 2047' >> /etc/security/limits.conf
echo 'oracle hard nproc 16384' >> /etc/security/limits.conf
echo 'oracle soft nofile 1024' >> /etc/security/limits.conf
echo 'oracle hard nofile 65536' >> /etc/security/limits.conf
echo 'oracle soft stack 10240' >> /etc/security/limits.conf
echo 'oracle hard stack 32768' >> /etc/security/limits.conf
[root@ocp /]#sysctl -p
创建用户oracle用户和组
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
echo "1qaz2wsx." | passwd --stdin oracle
创建安装目录
mkdir -p /u01/app
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/product/19.3/dbhome_1
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app
配置本地yum
[root@ocp /]# cd /etc/yum.repos.d
[root@ocp /]#rm -f /etc/yum.repos.d/*.repo
echo [Local] >>Local.repo
echo name=Local Yum >>Local.repo
echo baseurl=file:///tmp/redhat7iso >>Local.repo
echo gpgcheck=0 >>Local.repo
echo enabled=1 >>Local.repo
echo gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release >>Local.repo
[root@ocp /]#yum clean all
[root@ocp /]#yum list
配置oracle 用户环境变量
[root@ocp yum.repos.d]# su – oracle
echo umask 022 >>/home/oracle/.bash_profile
echo ORACLE_BASE=/u01/app/oracle >>/home/oracle/.bash_profile
echo 'ORACLE_HOME=/u01/app/oracle/product/19.3/dbhome_1' >>/home/oracle/.bash_profile
echo ORACLE_SID=weisi >>/home/oracle/.bash_profile
echo 'PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin' >>/home/oracle/.bash_profile
echo 'export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID' >>/home/oracle/.bash_profile
[oracle@ocp ~]$ source /home/oracle/.bash_profile
2.安装数据库软件
[oracle@OracleTraining ~]$ mkdir /u01/app/soft
数据库软件已经上传到/u01/app/soft 并解压到当前目录
[oracle@Oracle19C ~]$ su – root
[root@Oracle19C ~]# chown oracle:oinstall /u01/app/soft/LINUX.X64_193000_db_home.zip
[oracle@Oracle19C ~]$ su – oracle
[oracle@ocp ~]$ cd /u01/app/soft
[oracle@ocp]$ unzip LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3/dbhome_1
[oracle@ocp]$cd /u01/app/oracle/product/19.3/dbhome_1
[oracle@ocp database]$export DISPLAY=192.168.1.20:0.0
[oracle@ocp database]$export
[oracle@ocp database]$./runInstaller
root用户,使用yum 工具安装缺少的包
[root@ocp Packages]# cd /tmp/redhat7iso/Packages
yum -y install compat-libcap1-1*
yum -y install compat-libstdc++
yum -y install libstdc++-devel.x86_64
yum -y install gcc-c++*
yum -y install ksh
yum -y install libaio-devel
将compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm 上传到/tmp 目录
cd /tmp
rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
3.创建数据库
[oracle@ocp ~]$export DISPLAY=192.168.1.2:0.0
[oracle@ocp ~]$ dbca
4.基础命令
登入数据库: sqlplus / as sysdba
查看当前数据库show con_name
查看PDB信息
col pdb_name format a20
col status format a20
select pdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;
或者 show pdbs
查看当前环境
SELECT SYS_CONTEXT('USERENV','CON_NAME') FROM dual;
容器切换
alter session set container=weisipdb;
alter session set container=CDB$ROOT;
关闭数据库
Shutdown immediate;
启动数据库
startup
5.完全卸载oracle
rm -f /etc/oratab
rm -f /etc/oraInst.loc
rm -rf $ORACLE_BASE
rm -rf /u01/app/oraInventory
end