oracle 19C 安装
说明:
1、对于数据量大的数据库,建议oracle安装目录,数据存放目录和导入导出目录分开规划,提到oracle运行效率,以免共用一个磁盘相互影响。
环境准备:
系统:CentOS7
客户端:MobaXterm
安装包:Oracle 19C
补丁包:
libstdc++33-3.3.3-63.1.x86_64.rpm
p30125133_1900000_Linux-x86-64.zip
p6880880_190000_Linux-x86-64.zip
1、创建系统和磁盘空间
fdisk /dev/vdb
pvcreate /dev/vdb1
vgcreate datavg /dev/vdb1
lvcreate -n oraclelv -L 500G /dev/datavg
lvcreate -n datalv -l 100%Free /dev/datavg
mkfs.ext4 /dev/datavg/oraclelv
2、准备安装包和补丁
mkdir -p /oracle/app/product && cd /oracle/app/product
mkdir -p /oracle/soft
LINUX.X64_193000_db_home.zip
unzip /oracle/soft/LINUX.X64_193000_db_home.zip -d /oracle/app/product
libstdc++33-3.3.3-63.1.x86_64.rpm
p30125133_1900000_Linux-x86-64.zip
p6880880_190000_Linux-x86-64.zip
3、创建用户和配置参数
3.1 创建用户
groupadd oinstall && groupadd dba && useradd -g oinstall -G dba -m oracle && usermod -g oinstall -G dba oracle
3.2 修改内核参数:
cat >> /etc/sysctl.conf <<EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 7549747
kernel.shmmax = 30923764531
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
vm.hugetlb_shm_group = 1000
EOF
执行sysctl -p 命令使以上设置生效
--------------------------------------------------------------------------------
#### 说明:
“shmmax”定义单个共享内存段的最大值,单位为字节。
“shmall”定义系统可以使用的共享内存总量,单位为页(一页=4KB),建议配置为单板的总内存大小。如果“shmall”配置为“4194304”,即4194304*4KB/1024/1024=16GB,则用户创建超过16GB的共享内存会失败。
shmall=是全部允许使用的共享内存大小,shmmax 是单个段允许使用的大小。这两个可以设置为内存的 90%。
例如 16G 内存,16*1024*1024*1024*90% = 15461882265,shmall 的大小为
15461882265/4k(getconf PAGESIZE可得到) = 3774873
---------------------------------------------------------------------------------
3.3 修改“/etc/sysctl.conf”文件,以分配16G内存为例
# vi /etc/sysctl.conf
在“sysctl.conf”中修改如下参数值为加粗部分。
kernel.shmall = 3774873
kernel.shmmax = 15461882265
fs.file-max = 655350
-----------------------------------------------------------------------------------
--16g内存参数
kernel.shmall = 3774873
kernel.shmmax = 15461882265
--32g内存参数
kernel.shmall = 7549747
kernel.shmmax = 30923764531
--64g内存参数
kernel.shmall = 15099494
kernel.shmmax = 61847529062
fs.file-max = 655350
3.4 修改系统参数
cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOF
3.5 oracle用户配置变量:
#suse
cat >> /home/oracle/.profile <<"EOF"
# Oracle Settings
umask 022
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
export ORACLE_BASE=/oracle/app
export ORACLE_HOME=$ORACLE_BASE/product
export ORACLE_SID=ORCL
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch:.
export JAVA_HOME=$ORACLE_HOME/jdk
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
EOF
#centos
cat >> /home/oracle/.bash_profile <<"EOF"
export ORACLE_SID=ORCL
export ORACLE_HOME=/oracle/app/product
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch:.
export JAVA_HOME=$ORACLE_HOME/jdk
set -o vi
EOF
chown oracle.oinstall /home/oracle/.profile
-------------------------------------------------------------
配置客户端图形界面
DISPLAY=<客户端IP>; export DISPLAY
-------------------------------------------------------------
4、配置镜像源
# centos 镜像源
# mkdir /etc/yum.repos.d/backup
# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup
# cat >> /etc/yum.repos.d/CentOS-Base.repo <<EOF
[base]
enabled=1
baseurl=http://mirror.centos.org/centos-7/7.9.2009/os/x86_64/
gpgcheck=0
[update]
baseurl=http://mirror.centos.org/centos-7/7.9.2009/extras/x86_64/
enabled=1
gpgcheck=0
[extras]
baseurl=http://mirror.centos.org/centos-7/7.9.2009/extras/x86_64/
enabled=1
gpgcheck=0
[centosplus]
baseurl=http://mirror.centos.org/centos-7/7.9.2009/centosplus/x86_64/
enabled=1
gpgcheck=0
EOF
5、安装依赖包
zypper install sysstat libstdc* libaio* libcap* libXtst6*
yum install -y sysstat libstdc* libaio* libcap* libXtst6* ksh
# chown oracle.oinstall /oracle/ -R
6、安装oracle
su - oracle
cd /oracle/app/product>
./runInstaller
---------------------------------------
图形界面安装指引略过
---------------------------------------
安装过程根据提示执行以下命令:
# /oracle/oraInventory/orainstRoot.sh
# /oracle/app/product/root.sh
7、安装补丁
停止数据库:
> sqlplus / as sysdba
SQL> shutdown immediate;
一:升级OPatch:
# unzip p6880880_190000_Linux-x86-64.zip -d p6880880_190000_Linux-x86-64
> mv ./app/product/OPatch/ ./app/product/OPatch_bak
> cp -rf ./app/product/soft/p6880880_190000_Linux-x86-64/OPatch/ ./app/product/
检查:
> cat .profile
export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch:.
> ./app/product/OPatch/opatch version
OPatch Version: 12.2.0.1.19
OPatch succeeded.
二:升级补丁
> unzip p30116789_190000_Linux-x86-64.zip -d p30116789_190000_Linux-x86-64
> cd /oracle/app/product/soft/p30116789_190000_Linux-x86-64/30116789/30125133
> opatch apply
以下表示升级成功:
Patching component oracle.nlsrtl.rsf.core, 19.0.0.0.0...
Patching component oracle.precomp.common, 19.0.0.0.0...
Patching component oracle.precomp.lang, 19.0.0.0.0...
Patch 30125133 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a super-set patch [30125133].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /oracle/app/product/cfgtoollogs/opatch/opatch2020-03-17_19-58-57PM_1.log
注:还要以下两步才正式升级成功
(1)
> sqlplus /nolog
SQL> Connect / as sysdba
SQL> startup
SQL> quit
>cd $ORACLE_HOME/OPatch
/oracle/app/product/OPatch> ./datapatch -verbose
(2)
> cd $ORACLE_HOME/rdbms/admin
> sqlplus /nolog
SQL> conn /as sysdba
SQL> @utlrp.sql
检查升级结果:
select * from dba_registry_history;
查出以下内容表示成功
Patch applied from 19.3.0.0.0 to 19.5.0.0.0: Release_Update – 190909180549
- 点赞
- 收藏
- 关注作者
评论(0)