Centos 7.9安装Oracle19c步骤亲测可用有视频

视频介绍了在虚拟机安装centos 7.9并安装数据库软件的全过程

视频链接:https://www.zhihu.com/zvideo/1721267375351996416

下面的文字描述是安装数据库的部分介绍

一.安装环境准备

链接:https://pan.baidu.com/s/1Ogn47UZQ2w7iiHAiVdWDSQ 
提取码:3369

下载完成后上传到虚拟机:

主机和虚拟机共享文件设置-CSDN博客https://blog.csdn.net/u010184335/article/details/135114551?spm=1001.2014.3001.5502

预安装:

cp oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm.rpm /root/
mv oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm.rpm oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

## 本地安装
yum localinstall -y /root/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

如果yum报错:Another app is currently holding the yum lock; waiting for it to exit...

执行删除命令:rm -rf /var/run/yum.pid

安装依赖包:

yum install -y bc gcc gcc-c++ binutils compat-libcap1 compat-libstdc++ dtrace-modules dtrace-modules-headers dtrace-modules-provider-headers dtrace-utils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libdtrace-ctf-devel libX11 libXau libXi libXtst libXrender libXrender-devel libgcc librdmacm-devel libstdc++ libstdc++-devel libxcb make smartmontools sysstat

创建用户,创建文件夹并授权

adduser oracle
passwd oracle

mkdir -p /app/oracle/product/19.3.000/db_home
mkdir -p /app/oraInventory
mv LINUX.X64_193000_db_home.zip /root/
## 解压文件
unzip LINUX.X64_193000_db_home.zip -d /app/oracle/product/19.3.000/db_home
cd /app/oracle/product/19.3.000/db_home

chown -R oracle:oinstall /app/oracle/
chown -R oracle:oinstall /app/oracle/product/19.3.000/db_home
chmod -R 775 /app/oracle
chown -R oracle:oinstall /app/oraInventory/

oracle用户配置环境变量

su - oracle 
vim ~/.bash_profile

###########配置文件内容###########
export JAVA_HOME=/home/vagrant/jdk1.8
ORACLE_SID=orcl
export ORACLE_SID  
ORACLE_UNQNAME=orcl
export ORACLE_UNQNAME
ORACLE_BASE=/app/oracle/
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/19.3.000/db_home
export ORACLE_HOME
NLS_DATE_FORMAT="YYYY:MM:DDHH24:MI:SS"
export NLS_DATE_FORMAT
export NLS_LANG=american_america.ZHS16GBK
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS11=$ORACLE_HOME/nls/data
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
umask 022

二.图形化安装

安装vnc server

root:
yum install tigervnc-server 
yum -y install xorg-x11-server-utils-7.7-20.el7.x86_64

## 启动 vnc服务 
vncserver
export DISPLAY=:0
yum install xorg-x11-apps
xhost +
xclock
cp /root/.Xauthority /home/oracle/ --可选
chown -R oracle:oinstall /home/oracle/ --可选

su - oracle
export DISPLAY=:0
cd /app/oracle/product/19.3.000/db_home
./runInstaller

如果调用xclock图形的时候有这个warning:Warning: Missing charsets in String to FontSet conversion,设置下如下变量

export LANG=C
[root@oracle19c Desktop]# which xclock
/bin/xclock

因篇幅有点长,图形化安装oracle的过程详细可见最上面的视频,就不一一截图在这里了。 

如果数据库启动时报:ORA-01102: cannot mount database in EXCLUSIVE mode

cd $ORACLE_HOME/dbs
fuser -u lkORCL
fuser -k + lkORCL

打开数据库查看基本情况,因为装的是cdb,打开后可以看到有一个默认的pdb

SYS@orcl>select open_mode,database_role from v$database;

OPEN_MODE				 DATABASE_ROLE
---------------------------------------- --------------------------------
READ WRITE				 PRIMARY

SYS@orcl>show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB			  MOUNTED

你可能感兴趣的:(DBA,linux,运维,服务器)