CentOS7 安装 oracle19c

第一步:预安装

yum localinstall -y /root/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm 


       这一步会自动做好如下工作:

  • 创建用户和组
  • 设置 /etc/sysctl.conf 

 

第二步:安装包依赖

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

  

第三步:创建必要文件夹并授权

mkdir -p /u01/oraInventory
mkdir -p /u01/app/oracle/product/19.3.000/db_home
unzip /root/LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.000/db_home

 

授权

chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle

 

第四步:配置信息 vim /home/oracle/.bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

# User specific environment and startup programs
export PATH=$PATH:$HOME/.local/bin:$HOME/bin

export ORACLE_SID=crm
export ORACLE_UNQNAME=crm
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.000/db_home
export NLS_DATE_FORMAT="YYYY:MM:DDHH24:MI:SS"
export NLS_LANG=american_america.ZHS16GBK
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS11=$ORACLE_HOME/nls/data
export PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp

umask 022

 然后执行 source ~/.bash_profile 使其立即生效。

 

第五步:图形化界面演示安装过程

用 MobaXterm 打开

su - oracle
cd $ORACLE_HOME
export DISPLAY=192.168.181.1:0.0
./runInstaller

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

第六步:启停脚本

[oracle@c7-oarcle19c bin]$ more start-lsnr.sh 
#!/bin/sh

lsnrctl start

[oracle@c7-oarcle19c bin]$ more stop-lsnr.sh 
#!/bin/sh

lsnrctl stop

[oracle@c7-oarcle19c bin]$ more start-instance-crm.sh 
#!/bin/sh

echo "startup" | sqlplus / as sysdba

[oracle@c7-oarcle19c bin]$ more stop-instance-crm.sh 
#!/bin/sh

echo "shutdown immediate" | sqlplus / as sysdba

 

第七步:创建表空间

create tablespace GG_DATA
logging 
datafile '/u01/app/oracle/oradata/ORCL/GG_DATA_01.DBF'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;

 

第八步:创建用户

-- Drop user first
drop user base cascade;
drop user sec cascade;

-- Create the user
create user base     identified by "1q1w1e1r"    default tablespace GG_DATA profile DEFAULT;
create user sec      identified by "1q1w1e1r"    default tablespace GG_DATA profile DEFAULT;

-- Grant role privileges
grant connect, resource to base;
grant connect, resource to sec;

-- Grant system privileges
grant select any table to base;
grant select any table to sec;

grant select any dictionary to base;
grant select any dictionary to sec;

-- Grant dataspace privileges
alter user base quota unlimited on GG_DATA;
alter user sec  quota unlimited on GG_DATA;

  

 

posted @ 2023-01-06 13:40  Steven.Chow  阅读(1925)  评论(0编辑  收藏  举报