19c 随系统systemctl启动数据库

http://kopuamonastery.org.nz/felmor/4305 19c 随系统systemctl启动数据库

参考:

2.2.1  Automating Database Startup and Shutdown

一、           修改oratab文件

[root@adg19c ~]# grep woo /etc/oratab
woo:/DBSoft/oracle/product/19.3/dbhome_1:N

[root@adg19c ~]# sed -i 's/:N/:Y/' /etc/oratab
[root@adg19c ~]# grep woo /etc/oratab
woo:/DBSoft/oracle/product/19.3/dbhome_1:Y

二、           编辑ora19c调用文件

[root@adg19c ~]# cat /usr/local/ora19c.sh

! /bin/bash
echo ################################
echo # script For orac19c.service #
echo ################################

/DBSoft/oracle/product/19.3/dbhome_1/lsnrctl start
/DBSoft/oracle/product/19.3/dbhome_1/bin/dbstart /DBSoft/oracle/product/19.3/dbhome_1/
~
[root@adg19c ~]# chmod +x /usr/local/ora19c.sh

三、           编辑ora19c服务配置文件

[root@adg19c ~]# cat /etc/systemd/system/ora19c.service
[Unit]
Description=Oracle19c
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/DBSoft/oracle/product/19.3/dbhome_1"
ExecStart=/usr/local/ora19c.sh
[Install]
WantedBy=multi-user.target

四、           启动数据库

[root@adg19c ~]# systemctl enable ora19c.service
[root@adg19c ~]# systemctl start ora19c.service
[root@adg19c ~]# systemctl status ora19c.service
ora19c.service - Oracle19c
Loaded: loaded (/etc/systemd/system/ora19c.service; enabled; vendor preset: disabled)
Active: active (exited) since Thu 2020-03-12 18:26:26 CST; 11s ago
Process: 4607 ExecStart=/usr/local/ora19c.sh (code=exited, status=0/SUCCESS)
Main PID: 4607 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/ora19c.service
`-4611 /DBSoft/oracle/product/19.3/dbhome_1/bin/tnslsnr LISTENER -inherit
Mar 12 18:26:25 adg19c ora19c.sh[4607]: SNMP OFF
Mar 12 18:26:25 adg19c ora19c.sh[4607]: Listener Parameter File /DBSoft/oracle/product/19.3/dbhome_1/network/admin/listener.ora
Mar 12 18:26:25 adg19c ora19c.sh[4607]: Listener Log File /DBSoft/oracle/diag/tnslsnr/adg19c/listener/alert/log.xml
Mar 12 18:26:25 adg19c ora19c.sh[4607]: Listening Endpoints Summary…
Mar 12 18:26:25 adg19c ora19c.sh[4607]: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adg19c)(PORT=1521)))
Mar 12 18:26:25 adg19c ora19c.sh[4607]: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Mar 12 18:26:25 adg19c ora19c.sh[4607]: The listener supports no services
Mar 12 18:26:25 adg19c ora19c.sh[4607]: The command completed successfully
Mar 12 18:26:25 adg19c ora19c.sh[4607]: Processing Database instance "woo": log file /DBSoft/oracle/product/19.3/dbhome_1/rd…tup.log
Mar 12 18:26:26 adg19c systemd[1]: Started Oracle19c.
Hint: Some lines were ellipsized, use -l to show in full.

五、           完全启动之后状态:

[root@adg19c ~]# systemctl status ora19c.service
ora19c.service - Oracle19c
Loaded: loaded (/etc/systemd/system/ora19c.service; enabled; vendor preset: disabled)
Active: active (exited) since Thu 2020-03-12 18:30:01 CST; 57min ago
Process: 1177 ExecStart=/usr/local/ora19c.sh (code=exited, status=0/SUCCESS)
Main PID: 1177 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/ora19c.service
|-1350 /DBSoft/oracle/product/19.3/dbhome_1/bin/tnslsnr LISTENER -inherit
|-1481 ora_pmon_woo
|-1483 ora_clmn_woo
|-1485 ora_psp0_woo
|-1490 ora_vktm_woo
|-1494 ora_gen0_woo
|-1496 ora_mman_woo
|-1500 ora_gen1_woo
|-1503 ora_diag_woo
|-1505 ora_ofsd_woo
|-1508 ora_dbrm_woo
|-1510 ora_vkrm_woo
|-1512 ora_svcb_woo
|-1514 ora_pman_woo
|-1516 ora_dia0_woo
|-1518 ora_dbw0_woo
|-1520 ora_lgwr_woo
|-1522 ora_ckpt_woo
|-1524 ora_lg00_woo
|-1526 ora_smon_woo
|-1528 ora_lg01_woo
|-1530 ora_smco_woo
|-1532 ora_reco_woo
|-1534 ora_w000_woo
|-1536 ora_lreg_woo
|-1538 ora_w001_woo
|-1540 ora_pxmn_woo
|-1544 ora_mmon_woo
|-1546 ora_mmnl_woo
|-1548 ora_d000_woo
|-1550 ora_s000_woo
|-1552 ora_tmon_woo
|-1575 ora_m000_woo
|-1579 ora_p000_woo
|-1581 ora_p001_woo
|-1583 ora_p002_woo
|-1585 ora_tt00_woo
|-1588 ora_tt01_woo
|-1590 ora_tt02_woo
|-1594 ora_aqpc_woo
|-1598 ora_p003_woo
|-1600 ora_p004_woo
|-1602 ora_p005_woo
|-1604 ora_p006_woo
|-1606 ora_p007_woo
|-1609 ora_cjq0_woo
|-1611 ora_w002_woo
|-1858 ora_m001_woo
|-1860 ora_m002_woo
|-1862 ora_m003_woo
|-1890 ora_w003_woo
|-1898 ora_w004_woo
|-1900 ora_qm02_woo
|-1906 ora_q003_woo
|-1947 ora_q00f_woo
|-2456 ora_w005_woo
|-2460 ora_w006_woo
`-2469 ora_w007_woo
Mar 12 18:29:48 adg19c ora19c.sh[1177]: SNMP OFF
Mar 12 18:29:48 adg19c ora19c.sh[1177]: Listener Parameter File /DBSoft/oracle/product/19.3/dbhome_1/network/admin/listener.ora
Mar 12 18:29:48 adg19c ora19c.sh[1177]: Listener Log File /DBSoft/oracle/diag/tnslsnr/adg19c/listener/alert/log.xml
Mar 12 18:29:48 adg19c ora19c.sh[1177]: Listening Endpoints Summary…
Mar 12 18:29:48 adg19c ora19c.sh[1177]: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adg19c)(PORT=1521)))
Mar 12 18:29:48 adg19c ora19c.sh[1177]: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Mar 12 18:29:48 adg19c ora19c.sh[1177]: The listener supports no services
Mar 12 18:29:48 adg19c ora19c.sh[1177]: The command completed successfully
Mar 12 18:29:48 adg19c ora19c.sh[1177]: Processing Database instance "woo": log file /DBSoft/oracle/product/19.3/dbhome_1/rd…tup.log
Mar 12 18:30:01 adg19c systemd[1]: Started Oracle19c.
Hint: Some lines were ellipsized, use -l to show in full.

六、           登录数据库验证

[root@adg19c ~]# su - oracle
[oracle@adg19c ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 12 18:30:42 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> select instance_name,status from gv$instance;
INSTANCE_NAME STATUS
---------------- ------------
woo OPEN
SQL>

七、           方法二,时候老版本Linux

7.1      编辑/etc/oratab

[root@adg19c ~]# grep woo /etc/oratab
woo:/DBSoft/oracle/product/19.3/dbhome_1:N

[root@adg19c ~]# sed -i 's/:N/:Y/' /etc/oratab
[root@adg19c ~]# grep woo /etc/oratab
woo:/DBSoft/oracle/product/19.3/dbhome_1:Y

7.2       编辑dbora服务文件

[root@adg19c ~]# vi /etc/init.d/dbora
! /bin/sh
description: Oracle auto start-stop script.
#
Set ORA_HOME to be equivalent to the $ORACLE_HOME
from which you wish to execute dbstart and dbshut;
#
Set ORA_OWNER to the user id of the owner of the
Oracle database in ORACLE_HOME.
ORA_HOME=/DBSoft/oracle/product/19.3/dbhome_1
ORA_OWNER=oracle
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
Remove "&" if you don't want startup as a background process.
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" & touch /var/lock/subsys/dbora ;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" &
rm -f /var/lock/subsys/dbora
;;
Esac

7.3      修改文件权限

[root@adg19c ~]# chgrp dba /etc/init.d/dbora
[root@adg19c ~]# chmod 750 /etc/init.d/dbora

7.4      添加到启动文件中

[root@adg19c init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
[root@adg19c init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
[root@adg19c init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
发表在 19c, Oracle, Oracle基础, 数据库 | 标签为 , | 留下评论

19c(19.3) 单机数据库静默安装

19c(19.3) 单机数据库静默安装

一、           环境介绍

操作系统Red Hat Enterprise Linux Server release   7.7 (Maipo)
数据库版本Oracle database 19.3
主机名adg19c
IP地址192.168.84.99
安装目录/DBSoft/oracle/product/19.3/dbhome_1
数据库名称woo
字符集AL32UTF8

二、           环境准备

2.1.    关闭防火墙

[root@adg19c ~]# systemctl stop firewalld
[root@adg19c ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

2.2.    禁用NetworkManager服务

[root@adg19c ~]# systemctl stop NetworkManager
[root@adg19c ~]# systemctl disable NetworkManager

2.3.    禁用SELINUX

[root@adg19c ~]# setenforce 0
setenforce: SELinux is disabled
[root@adg19c ~]# sed -i "/^SELINUX=/s#enforcing#disabled#" /etc/selinux/config

2.4.    配置HOSTS解析

[root@adg19c ~]# cat >> /etc/hosts <<EOF
> 
> 192.168.84.99        adg19c
> EOF

2.5.    修改主机名

[root@adg19c ~]#sed -i 's#^HOSTNAME=.$#HOSTNAME=db01#' /etc/sysconfig/network [root@adg19c ~]# sed -i 's#^NETWORKING_IPV6=.$#NETWORKING_IPV6=no#' /etc/sysconfig/network

2.6.        配置NOZEROCONFIG

[root@adg19c ~]# cat >> /etc/sysconfig/network <<EOF
> NOZEROCONF=yes
> EOF

2.7.    创建组和用户

创建dba和onstall两个用户组
[root@adg19c ~]# groupadd -g 501 dba
[root@adg19c ~]# groupadd -g 502 oinstall

创建oracle用户
[root@adg19c ~]# useradd -u 503 -g oinstall -G dba oracle

配置oracle用户密码
[root@adg19c ~]# echo "oracle"|passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.

2.8.    创建安装目录并赋权

创建目录
[root@adg19c ~]# mkdir -p /DBSoft/oraInventory
[root@adg19c ~]# mkdir -p /DBSoft/oracle/product/19.3/dbhome_1

赋权
[root@adg19c ~]# chown -R oracle:oinstall /DBSoft
[root@adg19c ~]# chmod -R 775 /DBSoft

2.9.    配置用户环境变量

[root@adg19c ~]# cat >> /home/oracle/.bash_profile <<EOF
> export TMP=/tmp
>  export TMPDIR=\$TMP
> export EDIT=vi
> alias vi=vim
> export ORACLE_HOSTNAME=$HOST_NAME
> export ORACLE_UNQNAME=woo
> export ORACLE_BASE=/DBSoft/oracle
>  export ORACLE_HOME=\$ORACLE_BASE/product/19.3/dbhome_1
> export ORACLE_SID=woo
> export ORACLE_TERM=xterm
> export PATH=/usr/sbin:\$PATH
> ex girlfriend started dating right away    export PATH=\$ORACLE_HOME/bin:\$PATH
> export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
> export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
> export NLS_LANG=AMERICAN_AMERICA AL32UTF16
> umask 022
> EOF

2.10. 配置系统环境变量

[root@adg19c ~]#cat >> /etc/profile <<EOF
> if [ \$USER = "oracle" ]; then
>    if [ \$SHELL = "/bin/ksh" ]; then
>          ulimit -p 16384
>          ulimit -n 65536
>    else
>          ulimit -u 16384 -n 65536
>    fi
> fi
> EOF

2.11. 修改系统内核参数

[root@adg19c ~]# cat >> /etc/sysctl.conf <<EOF
> kernel.shmall = 4294967296
> kernel.sem = 5130 65280 510 256
> kernel.shmmni = 4096
> kernel.shmmax = 549755813888 #support max TotalMemory 512GB
> net.ipv4.ip_local_port_range = 9000 65500
> net.core.rmem_default = 1048576
> net.core.rmem_max = 4194304
> net.core.wmem_default = 262144
> net.core.wmem_max = 1048576
> fs.file-max = 6815744
> fs.aio-max-nr = 1048576
> vm.swappiness = 10
> vm.dirty_background_ratio = 20
> vm.dirty_ratio = 80
> vm.dirty_expire_centisecs = 500
> vm.dirty_writeback_centisecs = 100
> net.ipv4.tcp_sack = 0
> net.ipv4.tcp_timestamps = 0
> net.ipv4.conf.default.rp_filter = 0
> net.ipv4.tcp_wmem = 262144
> net.ipv4.tcp_rmem = 4194304
> EOF

[root@adg19c ~]# /sbin/sysctl -p
kernel.shmall = 4294967296
kernel.sem = 5130 65280 510 256
kernel.shmmni = 4096
kernel.shmmax = 549755813888 #support max TotalMemory 512GB
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.file-max = 6815744
fs.aio-max-nr = 1048576
vm.swappiness = 10
vm.dirty_background_ratio = 20
vm.dirty_ratio = 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.tcp_wmem = 262144
net.ipv4.tcp_rmem = 4194304

2.12. 配置LIMITS限制参数

[root@adg19c ~]# cat >> /etc/security/limits.conf <<EOF
> oracle soft nproc 16384
> oracle hard nproc 16384
> oracle soft nofile 65536
> oracle hard nofile 65536
> oracle soft memlock 3145728
> oracle hard memlock 3145728
> EOF

2.13. 配置PAM验证

[root@adg19c ~]# cat >> /etc/pam.d/login <<EOF
> session required /lib64/security/pam_limits.so
> EOF

2.14. 安装依赖包

2.14.1     挂载系统介质

[root@adg19c ~]# mount /dev/sr0 /mnt/
mount: /dev/sr0 is write-protected, mounting read-only

2.14.2     配置yum包

[root@adg19c ~]# cat > /etc/yum.repos.d/local.repo <<EOF
[base]
name=base
baseurl=file:///mnt
enabled=1
gpgcheck=0
multilib_policy=all
EOF

[root@adg19c ~]# yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Cleaning repos: base

[root@adg19c ~]# yum makecache
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base | 2.8 kB 00:00:00
(1/4): base/group_gz | 103 kB 00:00:00
(2/4): base/primary | 2.0 MB 00:00:00
(3/4): base/filelists | 3.1 MB 00:00:00
(4/4): base/other | 1.1 MB 00:00:00
base 5229/5229
base 5229/5229
base 5229/5229
Metadata Cache Created

2.13.3           安装依赖包

[root@adg19c ~]# yum install -y bc binutils compat-libcap1 compat-libstdc++ elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender libXrender-devel libgcc libstdc++ libstdc++-devel libxcb make net-tools nfs-utils python python-configshell python-rtslib python-six targetcli smartmontools sysstat unzip vim

Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base | 2.8 kB 00:00:00
(1/2): base/group_gz | 103 kB 00:00:00
(2/2): base/primary | 2.0 MB 00:00:00
base 5229/5229
Package binutils-2.27-41.base.el7.x86_64 already installed and latest version
No package compat-libstdc++ available.
Package elfutils-libelf-0.176-2.el7.x86_64 already installed and latest version
Package glibc-2.17-292.el7.x86_64 already installed and latest version
Package libaio-0.3.109-13.el7.x86_64 already installed and latest version
Package libgcc-4.8.5-39.el7.x86_64 already installed and latest version
Package libstdc++-4.8.5-39.el7.x86_64 already installed and latest version
Package 1:make-3.82-24.el7.x86_64 already installed and latest version
Package python-2.7.5-86.el7.x86_64 already installed and latest version
Package python-six-1.9.0-2.el7.noarch already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package bc.x86_64 0:1.06.95-13.el7 will be installed
---> Package compat-libcap1.x86_64 0:1.10-7.el7 will be installed
---> Package elfutils-libelf-devel.x86_64 0:0.176-2.el7 will be installed
--> Processing Dependency: pkgconfig(zlib) for package: elfutils-libelf-devel-0.176-2.el7.x86_64
---> Package fontconfig-devel.x86_64 0:2.13.0-4.3.el7 will be installed
--> Processing Dependency: fontconfig(x86-64) = 2.13.0-4.3.el7 for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
--> Processing Dependency: pkgconfig(freetype2) >= 20.0.14 for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
--> Processing Dependency: freetype-devel >= 2.8-7 for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
--> Processing Dependency: pkgconfig(uuid) for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
--> Processing Dependency: pkgconfig(expat) for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
---> Package glibc-devel.x86_64 0:2.17-292.el7 will be installed
--> Processing Dependency: glibc-headers = 2.17-292.el7 for package: glibc-devel-2.17-292.el7.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-292.el7.x86_64
---> Package ksh.x86_64 0:20120801-139.el7 will be installed
---> Package libX11.x86_64 0:1.6.7-2.el7 will be installed
--> Processing Dependency: libX11-common >= 1.6.7-2.el7 for package: libX11-1.6.7-2.el7.x86_64
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
---> Package libXi.x86_64 0:1.7.9-1.el7 will be installed
--> Processing Dependency: libXext.so.6()(64bit) for package: libXi-1.7.9-1.el7.x86_64
---> Package libXrender.x86_64 0:0.9.10-1.el7 will be installed
---> Package libXrender-devel.x86_64 0:0.9.10-1.el7 will be installed
--> Processing Dependency: pkgconfig(renderproto) >= 0.9 for package: libXrender-devel-0.9.10-1.el7.x86_64
--> Processing Dependency: pkgconfig(xproto) for package: libXrender-devel-0.9.10-1.el7.x86_64
--> Processing Dependency: pkgconfig(x11) for package: libXrender-devel-0.9.10-1.el7.x86_64
---> Package libXtst.x86_64 0:1.2.3-1.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-39.el7 will be installed
---> Package libxcb.x86_64 0:1.13-1.el7 will be installed
---> Package net-tools.x86_64 0:2.0-0.25.20131004git.el7 will be installed
---> Package nfs-utils.x86_64 1:1.3.0-0.65.el7 will be installed
--> Processing Dependency: libtirpc >= 0.2.4-0.7 for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: gssproxy >= 0.7.0-3 for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: rpcbind for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: quota for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libnfsidmap for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libevent for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: keyutils for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libtirpc.so.1()(64bit) for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libevent-2.0.so.5()(64bit) for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
---> Package python-configshell.noarch 1:1.1.fb25-1.el7 will be installed
--> Processing Dependency: python-urwid for package: 1:python-configshell-1.1.fb25-1.el7.noarch
--> Processing Dependency: pyparsing for package: 1:python-configshell-1.1.fb25-1.el7.noarch
---> Package python-rtslib.noarch 0:2.1.fb69-3.el7 will be installed
--> Processing Dependency: python-kmod for package: python-rtslib-2.1.fb69-3.el7.noarch
---> Package smartmontools.x86_64 1:7.0-1.el7 will be installed
--> Processing Dependency: mailx for package: 1:smartmontools-7.0-1.el7.x86_64
---> Package sysstat.x86_64 0:10.1.5-18.el7 will be installed
--> Processing Dependency: libsensors.so.4()(64bit) for package: sysstat-10.1.5-18.el7.x86_64
---> Package targetcli.noarch 0:2.1.fb49-1.el7 will be installed
---> Package unzip.x86_64 0:6.0-20.el7 will be installed
---> Package vim-enhanced.x86_64 2:7.4.629-6.el7 will be installed
--> Running transaction check
---> Package expat-devel.x86_64 0:2.1.0-10.el7_3 will be installed
---> Package fontconfig.x86_64 0:2.13.0-4.3.el7 will be installed
--> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.13.0-4.3.el7.x86_64
--> Processing Dependency: dejavu-sans-fonts for package: fontconfig-2.13.0-4.3.el7.x86_64
---> Package freetype-devel.x86_64 0:2.8-14.el7 will be installed
--> Processing Dependency: pkgconfig(libpng) for package: freetype-devel-2.8-14.el7.x86_64
---> Package glibc-headers.x86_64 0:2.17-292.el7 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-292.el7.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-292.el7.x86_64
---> Package gssproxy.x86_64 0:0.7.0-26.el7 will be installed
--> Processing Dependency: libini_config >= 1.3.1-31 for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libverto-module-base for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libref_array.so.1(REF_ARRAY_0.1.1)(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libini_config.so.3(INI_CONFIG_1.2.0)(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libini_config.so.3(INI_CONFIG_1.1.0)(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libref_array.so.1()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libini_config.so.3()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libcollection.so.2()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libbasicobjects.so.0()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
---> Package keyutils.x86_64 0:1.5.8-3.el7 will be installed
---> Package libX11-common.noarch 0:1.6.7-2.el7 will be installed
---> Package libX11-devel.x86_64 0:1.6.7-2.el7 will be installed
--> Processing Dependency: pkgconfig(xcb) >= 1.11.1 for package: libX11-devel-1.6.7-2.el7.x86_64
--> Processing Dependency: pkgconfig(xcb) for package: libX11-devel-1.6.7-2.el7.x86_64
---> Package libXext.x86_64 0:1.3.3-3.el7 will be installed
---> Package libevent.x86_64 0:2.0.21-4.el7 will be installed
---> Package libnfsidmap.x86_64 0:0.25-19.el7 will be installed
---> Package libtirpc.x86_64 0:0.2.4-0.16.el7 will be installed
---> Package libuuid-devel.x86_64 0:2.23.2-61.el7 will be installed
---> Package lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7 will be installed
---> Package mailx.x86_64 0:12.5-19.el7 will be installed
---> Package pyparsing.noarch 0:1.5.6-9.el7 will be installed
---> Package python-kmod.x86_64 0:0.9-4.el7 will be installed
---> Package python-urwid.x86_64 0:1.1.1-3.el7 will be installed
---> Package quota.x86_64 1:4.01-19.el7 will be installed
--> Processing Dependency: quota-nls = 1:4.01-19.el7 for package: 1:quota-4.01-19.el7.x86_64
--> Processing Dependency: tcp_wrappers for package: 1:quota-4.01-19.el7.x86_64
---> Package rpcbind.x86_64 0:0.2.0-48.el7 will be installed
---> Package xorg-x11-proto-devel.noarch 0:2018.4-1.el7 will be installed
---> Package zlib-devel.x86_64 0:1.2.7-18.el7 will be installed
--> Running transaction check
---> Package dejavu-sans-fonts.noarch 0:2.33-6.el7 will be installed
--> Processing Dependency: dejavu-fonts-common = 2.33-6.el7 for package: dejavu-sans-fonts-2.33-6.el7.noarch
---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed
---> Package kernel-headers.x86_64 0:3.10.0-1062.el7 will be installed
---> Package libbasicobjects.x86_64 0:0.1.1-32.el7 will be installed
---> Package libcollection.x86_64 0:0.7.0-32.el7 will be installed
---> Package libini_config.x86_64 0:1.3.1-32.el7 will be installed
--> Processing Dependency: libpath_utils.so.1(PATH_UTILS_0.2.1)(64bit) for package: libini_config-1.3.1-32.el7.x86_64
--> Processing Dependency: libpath_utils.so.1()(64bit) for package: libini_config-1.3.1-32.el7.x86_64
---> Package libpng-devel.x86_64 2:1.5.13-7.el7_2 will be installed
---> Package libref_array.x86_64 0:0.1.5-32.el7 will be installed
---> Package libverto-libevent.x86_64 0:0.2.5-4.el7 will be installed
---> Package libxcb-devel.x86_64 0:1.13-1.el7 will be installed
--> Processing Dependency: pkgconfig(xau) >= 0.99.2 for package: libxcb-devel-1.13-1.el7.x86_64
---> Package quota-nls.noarch 1:4.01-19.el7 will be installed
---> Package tcp_wrappers.x86_64 0:7.6-77.el7 will be installed
--> Running transaction check
---> Package dejavu-fonts-common.noarch 0:2.33-6.el7 will be installed
---> Package libXau-devel.x86_64 0:1.0.8-2.1.el7 will be installed
---> Package libpath_utils.x86_64 0:0.2.1-32.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================
Package Arch Version Repository Size
Installing:
bc x86_64 1.06.95-13.el7 base 115 k
compat-libcap1 x86_64 1.10-7.el7 base 19 k
elfutils-libelf-devel x86_64 0.176-2.el7 base 39 k
fontconfig-devel x86_64 2.13.0-4.3.el7 base 138 k
glibc-devel x86_64 2.17-292.el7 base 1.1 M
ksh x86_64 20120801-139.el7 base 885 k
libX11 x86_64 1.6.7-2.el7 base 607 k
libXau x86_64 1.0.8-2.1.el7 base 29 k
libXi x86_64 1.7.9-1.el7 base 40 k
libXrender x86_64 0.9.10-1.el7 base 26 k
libXrender-devel x86_64 0.9.10-1.el7 base 17 k
libXtst x86_64 1.2.3-1.el7 base 20 k
libaio-devel x86_64 0.3.109-13.el7 base 13 k
libstdc++-devel x86_64 4.8.5-39.el7 base 1.5 M
libxcb x86_64 1.13-1.el7 base 214 k
net-tools x86_64 2.0-0.25.20131004git.el7 base 306 k
nfs-utils x86_64 1:1.3.0-0.65.el7 base 412 k
python-configshell noarch 1:1.1.fb25-1.el7 base 68 k
python-rtslib noarch 2.1.fb69-3.el7 base 102 k
smartmontools x86_64 1:7.0-1.el7 base 546 k
sysstat x86_64 10.1.5-18.el7 base 316 k
targetcli noarch 2.1.fb49-1.el7 base 68 k
unzip x86_64 6.0-20.el7 base 170 k
vim-enhanced x86_64 2:7.4.629-6.el7 base 1.1 M
Installing for dependencies:
dejavu-fonts-common noarch 2.33-6.el7 base 64 k
dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M
expat-devel x86_64 2.1.0-10.el7_3 base 57 k
fontconfig x86_64 2.13.0-4.3.el7 base 254 k
fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k
freetype-devel x86_64 2.8-14.el7 base 447 k
glibc-headers x86_64 2.17-292.el7 base 687 k
gssproxy x86_64 0.7.0-26.el7 base 110 k
kernel-headers x86_64 3.10.0-1062.el7 base 8.7 M
keyutils x86_64 1.5.8-3.el7 base 54 k
libX11-common noarch 1.6.7-2.el7 base 164 k
libX11-devel x86_64 1.6.7-2.el7 base 981 k
libXau-devel x86_64 1.0.8-2.1.el7 base 14 k
libXext x86_64 1.3.3-3.el7 base 39 k
libbasicobjects x86_64 0.1.1-32.el7 base 26 k
libcollection x86_64 0.7.0-32.el7 base 42 k
libevent x86_64 2.0.21-4.el7 base 214 k
libini_config x86_64 1.3.1-32.el7 base 64 k
libnfsidmap x86_64 0.25-19.el7 base 50 k
libpath_utils x86_64 0.2.1-32.el7 base 28 k
libpng-devel x86_64 2:1.5.13-7.el7_2 base 122 k
libref_array x86_64 0.1.5-32.el7 base 27 k
libtirpc x86_64 0.2.4-0.16.el7 base 89 k
libuuid-devel x86_64 2.23.2-61.el7 base 92 k
libverto-libevent x86_64 0.2.5-4.el7 base 8.9 k
libxcb-devel x86_64 1.13-1.el7 base 1.1 M
lm_sensors-libs x86_64 3.4.0-8.20160601gitf9185e5.el7 base 42 k
mailx x86_64 12.5-19.el7 base 245 k
pyparsing noarch 1.5.6-9.el7 base 94 k
python-kmod x86_64 0.9-4.el7 base 57 k
python-urwid x86_64 1.1.1-3.el7 base 654 k
quota x86_64 1:4.01-19.el7 base 179 k
quota-nls noarch 1:4.01-19.el7 base 90 k
rpcbind x86_64 0.2.0-48.el7 base 60 k
tcp_wrappers x86_64 7.6-77.el7 base 79 k
xorg-x11-proto-devel noarch 2018.4-1.el7 base 279 k
zlib-devel x86_64 1.2.7-18.el7 base 50 k
Transaction Summary
Install 24 Packages (+37 Dependent packages)
Total download size: 24 M
Installed size: 53 M
Downloading packages:
Total 108 MB/s | 24 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : xorg-x11-proto-devel-2018.4-1.el7.noarch 1/61
Installing : zlib-devel-1.2.7-18.el7.x86_64 2/61
Installing : libcollection-0.7.0-32.el7.x86_64 3/61
Installing : libXau-1.0.8-2.1.el7.x86_64 4/61
Installing : libxcb-1.13-1.el7.x86_64 5/61
Installing : libref_array-0.1.5-32.el7.x86_64 6/61
Installing : libevent-2.0.21-4.el7.x86_64 7/61
Installing : fontpackages-filesystem-1.44-8.el7.noarch 8/61
Installing : libbasicobjects-0.1.1-32.el7.x86_64 9/61
Installing : libtirpc-0.2.4-0.16.el7.x86_64 10/61
Installing : rpcbind-0.2.0-48.el7.x86_64 11/61
Installing : dejavu-fonts-common-2.33-6.el7.noarch 12/61
Installing : dejavu-sans-fonts-2.33-6.el7.noarch 13/61
Installing : fontconfig-2.13.0-4.3.el7.x86_64 14/61
Installing : libverto-libevent-0.2.5-4.el7.x86_64 15/61
Installing : libXau-devel-1.0.8-2.1.el7.x86_64 16/61
Installing : libxcb-devel-1.13-1.el7.x86_64 17/61
Installing : 2:libpng-devel-1.5.13-7.el7_2.x86_64 18/61
Installing : freetype-devel-2.8-14.el7.x86_64 19/61
Installing : expat-devel-2.1.0-10.el7_3.x86_64 20/61
Installing : mailx-12.5-19.el7.x86_64 21/61
Installing : 1:quota-nls-4.01-19.el7.noarch 22/61
Installing : libnfsidmap-0.25-19.el7.x86_64 23/61
Installing : keyutils-1.5.8-3.el7.x86_64 24/61
Installing : libpath_utils-0.2.1-32.el7.x86_64 25/61
Installing : libini_config-1.3.1-32.el7.x86_64 26/61
Installing : gssproxy-0.7.0-26.el7.x86_64 27/61
Installing : python-kmod-0.9-4.el7.x86_64 28/61
Installing : python-rtslib-2.1.fb69-3.el7.noarch 29/61
Installing : python-urwid-1.1.1-3.el7.x86_64 30/61
Installing : libX11-common-1.6.7-2.el7.noarch 31/61
Installing : libX11-1.6.7-2.el7.x86_64 32/61
Installing : libXext-1.3.3-3.el7.x86_64 33/61
Installing : libXi-1.7.9-1.el7.x86_64 34/61
Installing : libX11-devel-1.6.7-2.el7.x86_64 35/61
Installing : libXrender-0.9.10-1.el7.x86_64 36/61
Installing : lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64 37/61
Installing : tcp_wrappers-7.6-77.el7.x86_64 38/61
Installing : 1:quota-4.01-19.el7.x86_64 39/61
Installing : pyparsing-1.5.6-9.el7.noarch 40/61
Installing : 1:python-configshell-1.1.fb25-1.el7.noarch 41/61
Installing : kernel-headers-3.10.0-1062.el7.x86_64 42/61
Installing : glibc-headers-2.17-292.el7.x86_64 43/61
Installing : libuuid-devel-2.23.2-61.el7.x86_64 44/61
Installing : fontconfig-devel-2.13.0-4.3.el7.x86_64 45/61
Installing : glibc-devel-2.17-292.el7.x86_64 46/61
Installing : targetcli-2.1.fb49-1.el7.noarch 47/61
Installing : 1:nfs-utils-1.3.0-0.65.el7.x86_64 48/61
Installing : sysstat-10.1.5-18.el7.x86_64 49/61
Installing : libXrender-devel-0.9.10-1.el7.x86_64 50/61
Installing : libXtst-1.2.3-1.el7.x86_64 51/61
Installing : 1:smartmontools-7.0-1.el7.x86_64 52/61
Installing : elfutils-libelf-devel-0.176-2.el7.x86_64 53/61
Installing : libaio-devel-0.3.109-13.el7.x86_64 54/61
Installing : compat-libcap1-1.10-7.el7.x86_64 55/61
Installing : ksh-20120801-139.el7.x86_64 56/61
Installing : 2:vim-enhanced-7.4.629-6.el7.x86_64 57/61
Installing : libstdc++-devel-4.8.5-39.el7.x86_64 58/61
Installing : net-tools-2.0-0.25.20131004git.el7.x86_64 59/61
Installing : bc-1.06.95-13.el7.x86_64 60/61
Installing : unzip-6.0-20.el7.x86_64 61/61
Verifying : libXext-1.3.3-3.el7.x86_64 1/61
Verifying : libtirpc-0.2.4-0.16.el7.x86_64 2/61
Verifying : libXi-1.7.9-1.el7.x86_64 3/61
Verifying : libX11-devel-1.6.7-2.el7.x86_64 4/61
Verifying : fontconfig-2.13.0-4.3.el7.x86_64 5/61
Verifying : 2:libpng-devel-1.5.13-7.el7_2.x86_64 6/61
Verifying : libXrender-0.9.10-1.el7.x86_64 7/61
Verifying : libuuid-devel-2.23.2-61.el7.x86_64 8/61
Verifying : 1:nfs-utils-1.3.0-0.65.el7.x86_64 9/61
Verifying : kernel-headers-3.10.0-1062.el7.x86_64 10/61
Verifying : libbasicobjects-0.1.1-32.el7.x86_64 11/61
Verifying : unzip-6.0-20.el7.x86_64 12/61
Verifying : pyparsing-1.5.6-9.el7.noarch 13/61
Verifying : fontpackages-filesystem-1.44-8.el7.noarch 14/61
Verifying : bc-1.06.95-13.el7.x86_64 15/61
Verifying : fontconfig-devel-2.13.0-4.3.el7.x86_64 16/61
Verifying : tcp_wrappers-7.6-77.el7.x86_64 17/61
Verifying : zlib-devel-1.2.7-18.el7.x86_64 18/61
Verifying : xorg-x11-proto-devel-2018.4-1.el7.noarch 19/61
Verifying : dejavu-fonts-common-2.33-6.el7.noarch 20/61
Verifying : net-tools-2.0-0.25.20131004git.el7.x86_64 21/61
Verifying : libXtst-1.2.3-1.el7.x86_64 22/61
Verifying : libX11-1.6.7-2.el7.x86_64 23/61
Verifying : targetcli-2.1.fb49-1.el7.noarch 24/61
Verifying : libxcb-1.13-1.el7.x86_64 25/61
Verifying : freetype-devel-2.8-14.el7.x86_64 26/61
Verifying : lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64 27/61
Verifying : libstdc++-devel-4.8.5-39.el7.x86_64 28/61
Verifying : libini_config-1.3.1-32.el7.x86_64 29/61
Verifying : libX11-common-1.6.7-2.el7.noarch 30/61
Verifying : libXrender-devel-0.9.10-1.el7.x86_64 31/61
Verifying : 2:vim-enhanced-7.4.629-6.el7.x86_64 32/61
Verifying : python-urwid-1.1.1-3.el7.x86_64 33/61
Verifying : sysstat-10.1.5-18.el7.x86_64 34/61
Verifying : ksh-20120801-139.el7.x86_64 35/61
Verifying : libevent-2.0.21-4.el7.x86_64 36/61
Verifying : elfutils-libelf-devel-0.176-2.el7.x86_64 37/61
Verifying : libverto-libevent-0.2.5-4.el7.x86_64 38/61
Verifying : dejavu-sans-fonts-2.33-6.el7.noarch 39/61
Verifying : compat-libcap1-1.10-7.el7.x86_64 40/61
Verifying : libaio-devel-0.3.109-13.el7.x86_64 41/61
Verifying : 1:python-configshell-1.1.fb25-1.el7.noarch 42/61
Verifying : libref_array-0.1.5-32.el7.x86_64 43/61
Verifying : rpcbind-0.2.0-48.el7.x86_64 44/61
Verifying : python-kmod-0.9-4.el7.x86_64 45/61
Verifying : glibc-devel-2.17-292.el7.x86_64 46/61
Verifying : libpath_utils-0.2.1-32.el7.x86_64 47/61
Verifying : 1:quota-4.01-19.el7.x86_64 48/61
Verifying : libxcb-devel-1.13-1.el7.x86_64 49/61
Verifying : gssproxy-0.7.0-26.el7.x86_64 50/61
Verifying : libXau-1.0.8-2.1.el7.x86_64 51/61
Verifying : 1:smartmontools-7.0-1.el7.x86_64 52/61
Verifying : libcollection-0.7.0-32.el7.x86_64 53/61
Verifying : keyutils-1.5.8-3.el7.x86_64 54/61
Verifying : libnfsidmap-0.25-19.el7.x86_64 55/61
Verifying : 1:quota-nls-4.01-19.el7.noarch 56/61
Verifying : python-rtslib-2.1.fb69-3.el7.noarch 57/61
Verifying : mailx-12.5-19.el7.x86_64 58/61
Verifying : expat-devel-2.1.0-10.el7_3.x86_64 59/61
Verifying : glibc-headers-2.17-292.el7.x86_64 60/61
Verifying : libXau-devel-1.0.8-2.1.el7.x86_64 61/61
Installed:
bc.x86_64 0:1.06.95-13.el7 compat-libcap1.x86_64 0:1.10-7.el7 elfutils-libelf-devel.x86_64 0:0.176-2.el7
fontconfig-devel.x86_64 0:2.13.0-4.3.el7 glibc-devel.x86_64 0:2.17-292.el7 ksh.x86_64 0:20120801-139.el7
libX11.x86_64 0:1.6.7-2.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXi.x86_64 0:1.7.9-1.el7
libXrender.x86_64 0:0.9.10-1.el7 libXrender-devel.x86_64 0:0.9.10-1.el7 libXtst.x86_64 0:1.2.3-1.el7
libaio-devel.x86_64 0:0.3.109-13.el7 libstdc++-devel.x86_64 0:4.8.5-39.el7 libxcb.x86_64 0:1.13-1.el7
net-tools.x86_64 0:2.0-0.25.20131004git.el7 nfs-utils.x86_64 1:1.3.0-0.65.el7 python-configshell.noarch 1:1.1.fb25-1.el7
python-rtslib.noarch 0:2.1.fb69-3.el7 smartmontools.x86_64 1:7.0-1.el7 sysstat.x86_64 0:10.1.5-18.el7
targetcli.noarch 0:2.1.fb49-1.el7 unzip.x86_64 0:6.0-20.el7 vim-enhanced.x86_64 2:7.4.629-6.el7
Dependency Installed:
dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7
expat-devel.x86_64 0:2.1.0-10.el7_3 fontconfig.x86_64 0:2.13.0-4.3.el7
fontpackages-filesystem.noarch 0:1.44-8.el7 freetype-devel.x86_64 0:2.8-14.el7
glibc-headers.x86_64 0:2.17-292.el7 gssproxy.x86_64 0:0.7.0-26.el7
kernel-headers.x86_64 0:3.10.0-1062.el7 keyutils.x86_64 0:1.5.8-3.el7
libX11-common.noarch 0:1.6.7-2.el7 libX11-devel.x86_64 0:1.6.7-2.el7
libXau-devel.x86_64 0:1.0.8-2.1.el7 libXext.x86_64 0:1.3.3-3.el7
libbasicobjects.x86_64 0:0.1.1-32.el7 libcollection.x86_64 0:0.7.0-32.el7
libevent.x86_64 0:2.0.21-4.el7 libini_config.x86_64 0:1.3.1-32.el7
libnfsidmap.x86_64 0:0.25-19.el7 libpath_utils.x86_64 0:0.2.1-32.el7
libpng-devel.x86_64 2:1.5.13-7.el7_2 libref_array.x86_64 0:0.1.5-32.el7
libtirpc.x86_64 0:0.2.4-0.16.el7 libuuid-devel.x86_64 0:2.23.2-61.el7
libverto-libevent.x86_64 0:0.2.5-4.el7 libxcb-devel.x86_64 0:1.13-1.el7
lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7 mailx.x86_64 0:12.5-19.el7
pyparsing.noarch 0:1.5.6-9.el7 python-kmod.x86_64 0:0.9-4.el7
python-urwid.x86_64 0:1.1.1-3.el7 quota.x86_64 1:4.01-19.el7
quota-nls.noarch 1:4.01-19.el7 rpcbind.x86_64 0:0.2.0-48.el7
tcp_wrappers.x86_64 0:7.6-77.el7 xorg-x11-proto-devel.noarch 0:2018.4-1.el7
zlib-devel.x86_64 0:1.2.7-18.el7
Complete!

2.14.4     安装compat-libstdc++

[root@adg19c ~]# rpm -ivh /home/oracle/compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
warning: /home/oracle/compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:compat-libstdc++-33-3.2.3-69.el6 ################################# [100%]

http://nielsborchjensen.com/martys/4935 备注:这个包在 RHEL 7 的系统盘里面没有,需要单独下载后手工安装。

2.13.5     检查已安装依赖包

[root@adg19c ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' bc binutils compat-libcap1 compat-libstdc++ elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender libXrender-devel libgcc libstdc++ libstdc++-devel libxcb make net-tools nfs-utils python python-configshell python-rtslib python-six targetcli smartmontools sysstat unzip vim
bc-1.06.95-13.el7 (x86_64)
binutils-2.27-41.base.el7 (x86_64)
compat-libcap1-1.10-7.el7 (x86_64)
package compat-libstdc++ is not installed --只要安装了这个报错没有关系。
elfutils-libelf-0.176-2.el7 (x86_64)
elfutils-libelf-devel-0.176-2.el7 (x86_64)
fontconfig-devel-2.13.0-4.3.el7 (x86_64)
glibc-2.17-292.el7 (x86_64)
glibc-devel-2.17-292.el7 (x86_64)
ksh-20120801-139.el7 (x86_64)
libaio-0.3.109-13.el7 (x86_64)
libaio-devel-0.3.109-13.el7 (x86_64)
libX11-1.6.7-2.el7 (x86_64)
libXau-1.0.8-2.1.el7 (x86_64)
libXi-1.7.9-1.el7 (x86_64)
libXtst-1.2.3-1.el7 (x86_64)
libXrender-0.9.10-1.el7 (x86_64)
libXrender-devel-0.9.10-1.el7 (x86_64)
libgcc-4.8.5-39.el7 (x86_64)
libstdc++-4.8.5-39.el7 (x86_64)
libstdc++-devel-4.8.5-39.el7 (x86_64)
libxcb-1.13-1.el7 (x86_64)
make-3.82-24.el7 (x86_64)
net-tools-2.0-0.25.20131004git.el7 (x86_64)
nfs-utils-1.3.0-0.65.el7 (x86_64)
python-2.7.5-86.el7 (x86_64)
python-configshell-1.1.fb25-1.el7 (noarch)
python-rtslib-2.1.fb69-3.el7 (noarch)
python-six-1.9.0-2.el7 (noarch)
targetcli-2.1.fb49-1.el7 (noarch)
smartmontools-7.0-1.el7 (x86_64)
sysstat-10.1.5-18.el7 (x86_64)
unzip-6.0-20.el7 (x86_64)

三、           安装软件

3.1.         解压数据库软件

[oracle@adg19c ~]$ unzip -q LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
[oracle@adg19c ~]$ du -sh $ORACLE_HOME
6.5G /DBSoft/oracle/product/19.3/dbhome_1

3.2.    开始安装数据库 软件

# 编写相应文件

[oracle@adg19c ~]$ cat 19c_db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/DBSoft/oracle/oraInventory
ORACLE_BASE=/DBSoft/oracle
ORACLE_HOME=/DBSoft/oracle/product/19.3/dbhome_1
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba
oracle.install.db.rootconfig.executeRootScript=true
oracle.install.db.rootconfig.configMethod=ROOT

#  运行安装命令

[oracle@adg19c ~]$ $ORACLE_HOME/runInstaller -silent -force -noconfig -ignorePrereq -responseFile /home/oracle/19c_db_install.rsp
Launching Oracle Database Setup Wizard…
[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
Enter password for 'root' user:
[WARNING] [INS-13014] Target environment does not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2020-03-12_08-38-48AM.log
ACTION: Identify the list of failed prerequisite checks from the log: installActions2020-03-12_08-38-48AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
/DBSoft/oracle/product/19.3/dbhome_1/install/response/db_2020-03-12_08-38-48AM.rsp
You can find the log of this install session at:
/tmp/InstallActions2020-03-12_08-38-48AM/installActions2020-03-12_08-38-48AM.log
Successfully Setup Software with warning(s).
Moved the install session logs to:
/DBSoft/oracle/oraInventory/logs/InstallActions2020-03-12_08-38-48AM

备注:该过程非常快,整个运行不到1分钟,中途会提示输入root用户密码用于自动执行root.sh脚本

四、      创建监听

best site # 编写监听配置文件

[oracle@adg19c ~]$ cat 19c_netca.rsp
[GENERAL]
RESPONSEFILE_VERSION="19.3"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

click resources # 静默配置监听

[oracle@adg19c ~]$ netca /silent /responsefile /home/oracle/19c_netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /home/oracle/19c_netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/DBSoft/oracle/product/19.3/dbhome_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0

五、      创建数据库

 # 编写数据库创建相应文件

[oracle@adg19c ~]$ cat 19c_dbca.rsp
[CREATEDATABASE]
templateName General_Purpose.dbc
gdbname woo
sid woo
createAsContainerDatabase TRUE
numberOfPDBs 1
pdbName woopdb1
pdbAdminPassword woo
sysPassword woo -systemPassword woo
datafileDestination '/DBSoft/oracle/oradata'
recoveryAreaDestination '/DBSoft/oracle/flash_recovery_area'
redoLogFileSize 120
storageType FS
characterset AL32UTF8 -nationalCharacterSet AL16UTF16
sampleSchema true
totalMemory 2048
databaseType OLTP
emConfiguration NONE

# 静默创建数据库

dbca -silent -createDatabase -responseFile /home/oracle/19c_dbca.rsp

六、      创建一个PDBs

[oracle@adg19c ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 12 06:43:25 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED

2 PDB$SEED READ ONLY NO 3 PDB READ WRITE NO
SQL> create pluggable database pdbwoo from pdb file_name_convert=('pdb/','pdbwoo/');
Pluggable database created.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED

2 PDB$SEED READ ONLY NO 3 PDB READ WRITE NO 4 PDBWOO MOUNTED
SQL> alter pluggable database all save state;
Pluggable database altered.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED

2 PDB$SEED READ ONLY NO 3 PDB READ WRITE NO 4 PDBWOO READ WRITE NO

七、      检查监听注册状态

[oracle@adg19c ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 12-MAR-2020 06:53:55
Copyright (c) 1991, 2019, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adg19c)(PORT=1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 12-MAR-2020 06:17:19
Uptime 0 days 0 hr. 36 min. 36 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /DBSoft/oracle/product/19.3/dbhome_1/network/admin/listener.ora
Listener Log File /DBSoft/oracle/diag/tnslsnr/adg19c/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adg19c)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=adg19c)(PORT=5500))(Security=(my_wallet_directory=/DBSoft/oracle/admin/woo/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary…
Service "86b637b62fdf7a65e053f706e80a27ca" has 1 instance(s).
Instance "woo", status READY, has 1 handler(s) for this service…
Service "a09cefc7b6a2b892e0536354a8c08331" has 1 instance(s).
Instance "woo", status READY, has 1 handler(s) for this service…
Service "a09cfefe92a3b95de0536354a8c024a2" has 1 instance(s).
Instance "woo", status READY, has 1 handler(s) for this service…
Service "pdb" has 1 instance(s).
Instance "woo", status READY, has 1 handler(s) for this service…
Service "pdbwoo" has 1 instance(s).
Instance "woo", status READY, has 1 handler(s) for this service…
Service "woo" has 1 instance(s).
Instance "woo", status READY, has 1 handler(s) for this service…
Service "wooXDB" has 1 instance(s).
Instance "woo", status READY, has 1 handler(s) for this service…
The command completed successfully
发表在 12c, Oracle, Oracle基础, 数据库 | 留下评论

11gR2 OneNode Convert RAC

11gR2 OneNode Convert RAC

一、查看状态:

[oracle@ora11grac1 ~]$ srvctl config database -d woo
Database unique name: woo
Database name: woo
Oracle home: /DBSoft/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA001/woo/spfilewoo.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: woo
Database instances:
Disk Groups: DATA001,ARC_001
Mount point paths:
Services: onenode
Type: RACOneNode
Online relocation timeout: 30
Instance name prefix: woo
Candidate servers: ora11grac1
Database is administrator managed

二、转换为RAC:

[oracle@ora11grac1 ~]$ srvctl convert database -d woo -c rac

三、添加新实例:

[oracle@ora11grac1 ~]$ srvctl add instance -d woo -i woo2 -n ora11grac2

四、检查转换后的结果:

[oracle@ora11grac1 ~]$ srvctl config database -d woo
Database unique name: woo
Database name: woo
Oracle home: /DBSoft/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA001/woo/spfilewoo.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: woo
Database instances: woo1,woo2
Disk Groups: DATA001,ARC_001
Mount point paths:
Services: onenode
Type: RAC
Database is administrator managed

五、启动节点二的实例:

[oracle@ora11grac1 ~]$ srvctl start instance -d woo -n ora11grac2
[oracle@ora11grac1 ~]$ srvctl status database -d woo
Instance woo1 is running on node ora11grac1
Instance woo2 is running on node ora11grac2
发表在 11g, Oracle, RAC, 数据库 | 留下评论

11gR2 RAC convert ONENODE

11gR2 RAC convert ONENODE

一、添加services

[oracle@ora11grac1 ~]$ srvctl add service -d woo -s onenode -r "woo1,woo2"
[oracle@ora11grac1 ~]$ srvctl config service -d woo
Service name: onenode
Service is enabled
Server pool: woo_onenode
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Preferred instances: woo1,woo2
Available instances:
[oracle@ora11grac1 ~]$ srvctl start service -d woo -s onenode

二、查看当前数据库状态:

[oracle@ora11grac1 ~]$ srvctl config database -d woo
Database unique name: woo
Database name: woo
Oracle home: /DBSoft/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA001/woo/spfilewoo.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: woo
Database instances: woo1,woo2
Disk Groups: DATA001,ARC_001
Mount point paths:
Services: onenode
Type: RAC
Database is administrator managed
[oracle@ora11grac1 ~]$ srvctl status database -d woo
Instance woo1 is running on node ora11grac1
Instance woo2 is running on node ora11grac2

try this out 三、停掉并移除一个实例:

[grid@ora11grac1 ~]$ srvctl stop instance -d woo -i woo2
[grid@ora11grac1 ~]$ srvctl remove instance -d woo -i woo2
Remove instance from the database woo? (y/[n]) y

四、开始转换为ONENODE:

[oracle@ora11grac1 ~]$ srvctl convert database -d woo -c raconenode -w 30 -i woo

五、检查数据库角色:

[oracle@ora11grac1 ~]$ srvctl config database -d woo
Database unique name: woo
Database name: woo
Oracle home: /DBSoft/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA001/woo/spfilewoo.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: woo
Database instances:
Disk Groups: DATA001,ARC_001
Mount point paths:
Services: onenode
Type: RACOneNode
Online relocation timeout: 30
Instance name prefix: woo
Candidate servers: ora11grac1
Database is administrator managed
发表在 Oracle, Oracle探索系列, RAC, 数据库 | 留下评论

MGR8.0支持savepoint

MGR8.0 支持 savepoint

MGR在MySQL 5.7的版本中开始引入,但是不支持savepoint,这对一些业务场景来说不是太实用。千呼万唤始出来,在MySQL8.0的MGR中终于支持savepoint,但是很多人找不到,这里我来给大家呈现出来。

在 MySQL 8.0.17 以后的环境中尽量 MGR ,配置简单还好用。

Replication: Group Replication now supports SAVEPOINT SQL transactions.

https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-1.html

发表在 Mysql, 数据库 | 留下评论

MySQL 5.7 基于GTID搭建主从复制

MySQL 5.7 基于GTID搭建主从复制

 
 一、搭建过程
1.1 准备三个MySQL实例

mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3307/data/
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3308/data/
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3309/data/

1.2 server_id, server_uuid 不同

mysql -uroot -p123 -e "select @@server_id"
mysql -uroot -p123 -e "select @@server_uuid"

1.3 gtid_mode 是否开启:

mysql -uroot -p123 -e "select @@gtid_mode"
mysql -uroot -p123 -e "select @@server_gtid"
vi 330{7..9}/my.cnf
gtid_mode=ON
enforce_gtid_consistency=ON
log_slave_updates=ON

1.4 确认binlog开启

mysql -uroot -p123 -e "select @@log_bin"

1.5 备份主库数据到从库通过远程方式

mysqldump -uroot -p123 -h 192.168.84.30 -P 3307 > /tmp/full.sql

1.6 恢复数据

mysql> source /tmp/full.sql

1.7 主库创建复制用户

 grant replication slave on *.* to repl@'192.168.84.30' identified by '123';

1.8 从库启动复制

 帮助:
mysql> help change master to
......
找到配置模板:
CHANGE MASTER TO
  MASTER_HOST='master2.example.com',
  MASTER_USER='replication',
  MASTER_PASSWORD='password',
  MASTER_PORT=3306,
  MASTER_LOG_FILE='master2-bin.001',
  MASTER_LOG_POS=4,
  MASTER_CONNECT_RETRY=10;
  
  3308,3309使用如下配置:
CHANGE MASTER TO
  MASTER_HOST='192.168.84.30',
  MASTER_USER='repl',
  MASTER_PASSWORD='123',
  MASTER_PORT=3307,
  master_auto_position=1;
  
开始配置3308
mysql> CHANGE MASTER TO
    ->   MASTER_HOST='192.168.84.30',
    ->   MASTER_USER='repl',
    ->   MASTER_PASSWORD='123',
    ->   MASTER_PORT=3307,
    ->   master_auto_position=1;
Query OK, 0 rows affected, 2 warnings (0.00 sec)
开始配置3309
mysql> CHANGE MASTER TO
    ->   MASTER_HOST='192.168.84.30',
    ->   MASTER_USER='repl',
    ->   MASTER_PASSWORD='123',
    ->   MASTER_PORT=3307,
    ->   master_auto_position=1;
Query OK, 0 rows affected, 2 warnings (0.00 sec)

1.9 查看状态:

mysql> show slave status \G;  查看slave状态
mysql> show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: 192.168.84.30
                  Master_User: repl
                  Master_Port: 3307
                Connect_Retry: 60
              Master_Log_File: 
          Read_Master_Log_Pos: 4
               Relay_Log_File: open_source-relay-bin.000001
                Relay_Log_Pos: 4
        Relay_Master_Log_File: 
             Slave_IO_Running: No
            Slave_SQL_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 0
              Relay_Log_Space: 154
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 0
                  Master_UUID: 
             Master_Info_File: /mysql/3308/data/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: 
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
1 row in set (0.00 sec)
ERROR: 
No query specified

2.0 启动和关闭复制:

start slave;
stop slave;

备注:5.7 MGR 新出的亮点,8.0.17建议用MGR

发表在 Mysql, 安装升级, 集群配置 | 留下评论

MySQL 多实例配置管理

MySQL 多实例配置管理

配置多实例my.cnf:

[root@open_source 3309]# cat /mysql/3307/my.cnf 
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/mysql/3307/data
socket=/tmp/mysql3307.sock
port=3307
server_id=7
[root@open_source 3309]# cat /mysql/3308/my.cnf
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/mysql/3308/data
socket=/tmp/mysql3308.sock
port=3308
server_id=8
[root@open_source 3309]# cat /mysql/3309/my.cnf
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/mysql/3309/data
socket=/tmp/mysql3309.sock
port=3309
server_id=9

初始化多实例

mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3307/data/
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3308/data/
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3309/data/

启动多实例:

[root@open_source 3309]# mysqld_safe  --defaults-file=/mysql/3307/my.cnf &
[root@open_source 3309]# mysqld_safe  --defaults-file=/mysql/3308/my.cnf &
[root@open_source 3309]# mysqld_safe  --defaults-file=/mysql/3309/my.cnf &
[root@open_source 3309]# ps -ef|grep mysql |grep -v grep
root      10251   7511  0 18:57 pts/1    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/mysql/3307/my.cnf
mysql     10428  10251  0 18:57 pts/1    00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/mysql/3307/my.cnf --basedir=/usr/local/mysql --datadir=/mysql/3307/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=open_source.err --pid-file=open_source.pid --socket=/tmp/mysql3307.sock --port=3307
root      10464   7511  0 18:59 pts/1    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/mysql/3308/my.cnf
mysql     10641  10464  0 18:59 pts/1    00:00:01 /usr/local/mysql/bin/mysqld --defaults-file=/mysql/3308/my.cnf --basedir=/usr/local/mysql --datadir=/mysql/3308/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=open_source.err --pid-file=open_source.pid --socket=/tmp/mysql3308.sock --port=3308
root      10672   7511  0 19:00 pts/1    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/mysql/3309/my.cnf
mysql     10849  10672  0 19:00 pts/1    00:00:01 /usr/local/mysql/bin/mysqld --defaults-file=/mysql/3309/my.cnf --basedir=/usr/local/mysql --datadir=/mysql/3309/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=open_source.err --pid-file=open_source.pid --socket=/tmp/mysql3309.sock --port=3309
[root@open_source 3309]# netstat -anlt |grep 33
tcp6       0      0 :::3307                 :::*                    LISTEN     
tcp6       0      0 :::3308                 :::*                    LISTEN     
tcp6       0      0 :::3309                 :::*                    LISTEN

登录多实例server_id:

[root@open_source 3309]# mysql -S /tmp/mysql3307.sock -e "select @@server_id"
+-------------+
| @@server_id |
+-------------+
|           7 |
+-------------+
[root@open_source 3309]# mysql -S /tmp/mysql3308.sock -e "select @@server_id"
+-------------+
| @@server_id |
+-------------+
|           8 |
+-------------+
[root@open_source 3309]# mysql -S /tmp/mysql3309.sock -e "select @@server_id"
+-------------+
| @@server_id |
+-------------+
|           9 |
+-------------+

停止多实例:

[root@open_source ~]# mysqladmin -S /tmp/mysql3307.sock shutdown
2020-03-10T00:04:36.491980Z mysqld_safe mysqld from pid file /mysql/3307/data/open_source.pid ended
[1]   Done                    mysqld_safe --defaults-file=/mysql/3307/my.cnf  (wd: /mysql/3309)
(wd now: ~)
[root@open_source ~]# mysqladmin -S /tmp/mysql3308.sock shutdown
2020-03-10T00:04:45.304744Z mysqld_safe mysqld from pid file /mysql/3308/data/open_source.pid ended
[2]-  Done                    mysqld_safe --defaults-file=/mysql/3308/my.cnf  (wd: /mysql/3309)
(wd now: ~)
[root@open_source ~]# mysqladmin -S /tmp/mysql3309.sock shutdown
2020-03-10T00:04:54.383289Z mysqld_safe mysqld from pid file /mysql/3309/data/open_source.pid ended
[3]+  Done                    mysqld_safe --defaults-file=/mysql/3309/my.cnf  (wd: /mysql/3309)
(wd now: ~)
发表在 Mysql, 数据库 | 留下评论

MySQL 5.7.28 源码安装

http://maplebanon.org/6-ph24623-chloroquine-phosphate-içeren-ilaçlar.html MySQL 5.7.28 源码安装

go to this site 一、介绍:

        除了Oracle商业版数据库以外, MySQL是一款源代码开放的市面上使用率最高高的RDBMS数据库软件,采用的是GPL开源协议,自己是可以修改MySQL源代码用来开发自己的系统。同样也是通过最常用的SQL语句进行管理

MySQL 安装方式通常分为以下三种:

l   在线Yum安装

l   离线rpm安装

l   源码编译安装

二、安装前环境清理:

前面两种安装方式都非常简单,但是所有安装方式都共同需要遵顼以下安装前的步骤:

1)        检查是否有正在运行的MySQL进程

[root@open_source ~]# ps -ef|grep mysql |grep -v grep

2)        检查是否有正在运行的MySQL服务

6.x之前
[root@open_source ~]# chkconfig --list |grep mysql
 
7.x之后
[root@open_source ~]# ls -rtl /etc/init.d/mysqld 
[root@open_source ~]# systemctl status mysql

3)        检查和删除是否有系统自带的Mysql或mariadb

[root@open_source ~

[root@open_source ~]# rpm -qa mysql
[root@open_source ~]# rpm -qa mariadb

[root@open_source ~]# rpm -qa mysql
[root@open_source ~]# rpm -qa mariadb

三、MySQL软件下载:

https://downloads.mysql.com/archives/community/

四、开始安装

       4.1 环境准备

l   安装libaio-devel依赖包

[root@open_source ~]# yum install -y libaio-devel

       4.2 创建用户及目录

                  l  创建用户

[root@open_source ~]# useradd -g mysql mysql

l   创建目录

[root@open_source ~]# mkdir /mysql/3306/data

l   赋权

[root@open_source ~]# chown -R mysql.mysql /mysql

       4.3 开始安装

l          解压软件

[root@open_source ~]# cd /usr/local/
[root@open_source local]# tar zxf mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz

l          创建一个软连接并赋权

[root@open_source local]# ln -s mysql-5.7.28-linux-glibc2.12-x86_64 mysql
[root@open_source local]# chown -R mysql.mysql mysql/

l          配置环境变量

[root@open_source local]# echo "export PATH=/usr/local/mysql/bin:$PATH" /etc/profile
[root@open_source local]# source /etc/profile

l          初始化数据库

[root@open_source local]# mysqld -initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3306/data/

l          配置My.cnf 文件

cat > /etc/my.cnf <<EOF

[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/mysql/3306/data
log_bin=/mysql/3306/binlog/mysql-bin
server_id=7
port=3306
explicit_defaults_for_timestamp=true
socket=/tmp/mysql.sock

[mysql]
socket=/tmp/mysql.sock
EOF

l          准备启动脚本

[root@open_source ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

l          启动数据库

[root@open_source ~]# /etc/init.d/mysqld start

l          登录数据库

[root@open_source ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.7.28-log MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

l   MySQL加固:

[root@open_source ~]# /usr/local/mysql/bin/mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.

New password:

Re-enter new password:

Estimated strength of the password: 50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Dropping test database…
Success.

Removing privileges on test database…
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

                 l  加固后无法直接登录

[root@open_source ~]# mysqlERROR 1045 (28000): Access denied foruser 'root'@'localhost'(using password: NO)

l   查看MySQL状态

mysql> mysql> show master status;
+------------------+----------+--------------+------------------+-------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------------------------------+
| mysql-bin.000009 | 3672 | | | ce8fc1bb-5fd6-11ea-869d-000c29eed638:1-20 |
+------------------+----------+--------------+------------------+-------------------------------------------+
1 row in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| bindb |
| gtdb |
| mdp |
| mysql |
| performance_schema |
| sys |
| woo |
+--------------------+
8 rows in set (0.00 sec)
发表在 Mysql, 安装升级, 数据库 | 留下评论

PostgreSQL 10.12 安装系列 – 源码安装

三、     源码安装

3.1. 下载地址:

https://www.postgresql.org/ftp/source/

3.2 环境要求

       make 版本 3.80以上

[root@open_source ~]# make -version
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

       gcc   版本4.5以上

[root@open_source CentOS_yum]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

       tar gzip bzip 是否安装

       源码包使用的是tar,gzip,bzip2打包压缩的,所以我们需要使用tar gzip bzip这些工具解压

[root@open_source CentOS_yum]# tar --version
tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

[root@open_source CentOS_yum]# gzip --version
gzip 1.5
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License http://www.gnu.org/licenses/gpl.html.
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly.

3.3 安装其它依赖包

yum install -y \
libicu-devel.x86_64 \
icu.x86_64 \
tcl.x86_64 \
tcl-devel.x86_64 \
perl-ExtUtils-Embed.noarch \
readline-devel.x86_64 \
zlib-devel \
openssl-devel \
pam-devel.x86_64 \
libxml2 \
libxml2-devel \
libxslt-devel \
zlib-devel \
openldap-devel.x86_64

[root@open_source ~]# rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" libicu-devel \
icu \
tcl \
tcl-devel \
perl-ExtUtils-Embed \
readline-devel \
zlib-devel \
openssl-devel \
pam-devel \
libxml2 \
libxml2-devel \
libxslt-devel \
zlib-devel \
openldap-devel
zlib-devel-1.2.7-18.el7 (x86_64)
perl-ExtUtils-Embed-1.30-294.el7_6 (noarch)
openldap-devel-2.4.44-21.el7_6 (x86_64)
libxml2-2.9.1-6.el7_2.3 (x86_64)
libxml2-devel-2.9.1-6.el7_2.3 (x86_64)
tcl-devel-8.5.13-8.el7 (x86_64)
openssl-devel-1.0.2k-19.el7 (x86_64)
libxslt-devel-1.1.28-5.el7 (x86_64)
pam-devel-1.1.8-22.el7 (x86_64)
tcl-8.5.13-8.el7 (x86_64)
readline-devel-6.2-11.el7 (x86_64)
libicu-devel-50.2-3.el7 (x86_64)

3.3 解压PostgreSQL安装包并进入目录

[root@open_source ~]# ls postgresql-10.12.tar.bz2
postgresql-10.12.tar.bz2

[root@open_source ~]# tar -jxf postgresql-10.12.tar.bz2
[root@open_source ~]# ls -rld postgresql-10.12
drwxrwxrwx 6 1107 1107 273 Feb 10 17:32 postgresql-10.12

[root@open_source ~]# cd postgresql-10.12
[root@open_source postgresql-10.12]# ls -rtl
total 684
-rw-r--r-- 1 1107 1107 1212 Feb 10 17:19 README
-rw-r--r-- 1 1107 1107 1665 Feb 10 17:19 Makefile
-rw-r--r-- 1 1107 1107 284 Feb 10 17:19 HISTORY
-rw-r--r-- 1 1107 1107 3822 Feb 10 17:19 GNUmakefile.in
-rw-r--r-- 1 1107 1107 1192 Feb 10 17:19 COPYRIGHT
-rw-r--r-- 1 1107 1107 79645 Feb 10 17:19 configure.in
-rwxr-xr-x 1 1107 1107 507965 Feb 10 17:19 configure
-rw-r--r-- 1 1107 1107 493 Feb 10 17:19 aclocal.m4
drwxrwxrwx 55 1107 1107 4096 Feb 10 17:31 contrib
drwxrwxrwx 3 1107 1107 107 Feb 10 17:31 doc
drwxrwxrwx 2 1107 1107 4096 Feb 10 17:31 config
-rw-r--r-- 1 1107 1107 73124 Feb 10 17:32 INSTALL
drwxrwxrwx 16 1107 1107 328 Feb 10 17:32 src

3.4 理解编译安装

[root@open_source postgresql-10.12]# ./configure --help
`configure' configures PostgreSQL 10.12 to adapt to many kinds of systems.

Usage: ./configure [OPTION]… [VAR=VALUE]…
To assign environment variables (e.g., CC, CFLAGS…), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local/pgsql]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, make install' will install all the files in /usr/local/pgsql/bin', /usr/local/pgsql/lib' etc. You can specify an installation prefix other than/usr/local/pgsql' using --prefix', for instance--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/postgresql]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-integer-datetimes
obsolete option, no longer supported
--enable-nls[=LANGUAGES]
enable Native Language Support
--disable-rpath do not embed shared library search path in
executables
--disable-spinlocks do not use spinlocks
--disable-atomics do not use atomic operations
--disable-strong-random do not use a strong random number source
--enable-debug build with debugging symbols (-g)
--enable-profiling build with profiling enabled
--enable-coverage build with coverage testing instrumentation
--enable-dtrace build with DTrace support
--enable-tap-tests enable TAP tests (requires Perl and IPC::Run)
--enable-depend turn on automatic dependency tracking
--enable-cassert enable assertion checks (for debugging)
--disable-thread-safety disable thread-safety in client libraries
--disable-largefile omit support for large files
--disable-float4-byval disable float4 passed by value
--disable-float8-byval disable float8 passed by value
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-extra-version=STRING
append STRING to version
--with-template=NAME override operating system template
--with-includes=DIRS look for additional header files in DIRS
--with-libraries=DIRS look for additional libraries in DIRS
--with-libs=DIRS alternative spelling of --with-libraries
--with-pgport=PORTNUM set default port number [5432]
--with-blocksize=BLOCKSIZE
set table block size in kB [8]
--with-segsize=SEGSIZE set table segment size in GB [1]
--with-wal-blocksize=BLOCKSIZE
set WAL block size in kB [8]
--with-wal-segsize=SEGSIZE
set WAL segment size in MB [16]
--with-CC=CMD set compiler (deprecated)
--with-icu build with ICU support
--with-tcl build Tcl modules (PL/Tcl)
--with-tclconfig=DIR tclConfig.sh is in DIR
--with-perl build Perl modules (PL/Perl)
--with-python build Python modules (PL/Python)
--with-gssapi build with GSSAPI support
--with-krb-srvnam=NAME default service principal name in Kerberos (GSSAPI)
[postgres]
--with-pam build with PAM support
--with-bsd-auth build with BSD Authentication support
--with-ldap build with LDAP support
--with-bonjour build with Bonjour support
--with-openssl build with OpenSSL support
--with-selinux build with SELinux support
--with-systemd build with systemd support
--without-readline do not use GNU Readline nor BSD Libedit for editing
--with-libedit-preferred
prefer BSD Libedit over GNU Readline
--with-uuid=LIB build contrib/uuid-ossp using LIB (bsd,e2fs,ossp)
--with-ossp-uuid obsolete spelling of --with-uuid=ossp
--with-libxml build with XML support
--with-libxslt use XSLT support when building contrib/xml2
--with-system-tzdata=DIR
use system time zone data in DIR
--without-zlib do not use Zlib
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CPP C preprocessor
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
ICU_CFLAGS C compiler flags for ICU, overriding pkg-config
ICU_LIBS linker flags for ICU, overriding pkg-config
LDFLAGS_EX extra linker flags for linking executables only
LDFLAGS_SL extra linker flags for linking shared libraries only
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to pgsql-bugs@postgresql.org.

3.5. 安装PostgreSQL 10

[root@open_source postgresql-10.12]# ./configure \
--prefix=/data/pgsql10/ \
--bindir=/data/pgsql10/bin \
--sysconfdir=/data/pgsql10/etc \
--libdir=/data/pgsql10/lib \
--includedir=/data/pgsql10/include \
--datarootdir=/data/pgsql10/share/ \
--datadir=/data/pgsql10/share/ \
--localedir=/data/pgsql10/share/locale \
--mandir=/data/pgsql10/share/man \
--docdir=/data/pgsql10/share/doc \
--htmldir=/data/pgsql10/share/html \
--enable-nls \
--with-pgport=5435 \
--with-perl \
--with-python \
--with-tcl \
--with-icu \
--with-openssl \
--with-pam \
--with-ldap \
--with-readline \
--with-libxml \
--with-libxslt \
--with-blocksize=8 \
--with-wal-segsize=16 \
--with-wal-blocksize=8 \
--with-zlib \

[root@open_source postgresql-10.12]# export COPT=”-Werror”
[root@open_source postgresql-10.12]# make && make install
……
make[1]: Leaving directory /root/postgresql-10.12/src' make -C config install make[1]: Entering directory/root/postgresql-10.12/config'
/usr/bin/mkdir -p '/data/pgsql10/lib/pgxs/config'
/usr/bin/install -c -m 755 ./install-sh '/data/pgsql10/lib/pgxs/config/install-sh'
/usr/bin/install -c -m 755 ./missing '/data/pgsql10/lib/pgxs/config/missing'
make[1]: Leaving directory `/root/postgresql-10.12/config'
PostgreSQL installation complete.

[root@open_source postgresql-10.12]# ls -rtl /data/pgsql10/
total 16
drwxr-xr-x 2 root root 6 Mar 5 16:28 pgdata
drwxr-xr-x 6 root root 4096 Mar 5 16:43 include
drwxr-xr-x 2 root root 4096 Mar 5 16:43 bin
drwxr-xr-x 7 root root 4096 Mar 5 16:43 share
drwxr-xr-x 4 root root 4096 Mar 5 16:43 lib

3.6 配置postgresql用户环境变量

[root@open_source ~]# echo "export LD_LIBRARY_PATH=/data/pgsql10/lib" >> /home/postgres/.bash_profile
[root@open_source ~]# echo "export PATH=/data/pgsql10/bin:/usr/bin:/usr/sbin:/sbin:\$PATH" >>/home/postgres/.bash_profile
[root@open_source ~]# echo "export MANPATH=/data/pgsql10/share/man/:\$MANPATH" >>/home/postgres/.bash_profile

3.7 创建数据目录

[root@open_source ~]# mkdir -p /data/pgsql10/pgdata

3.8 初始化数据库

[postgres@open_source ~]$ initdb -D /data/pgsql10/pgdata
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /data/pgsql10/pgdata … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting default timezone … America/New_York
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … ok
syncing data to disk … ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

pg_ctl -D /data/pgsql10/pgdata -l logfile start

3.9 启动数据库

[postgres@open_source ~]$ pg_ctl start -D /data/pgsql10/pgdata/ -l /tmp/logfile
waiting for server to start…. done
server started

3.10 登录到数据库

[postgres@open_source ~]$ psql
psql (10.12)
Type "help" for help.

postgres=# 
 
 
[postgres@open_source ~]$ psql -U postgres -d postgres -p 5435
psql (10.12)
Type "help" for help.
 
postgres=#
 
[postgres@open_source ~]$ psql -U postgres -d postgres -h 127.0.0.1 -p 5435
psql (10.12)
Type "help" for help.
 
postgres=# select version();
version                                                  
----------------------------------------------------------------------------------------------------------
PostgreSQL 10.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit
发表在 PostgresSQL, 安装升级, 数据库 | 留下评论

tar (child): bzip2: Cannot exec: No such file or directory 报错

tar (child): bzip2: Cannot exec: No such file or directory 报错

问题现象:

[root@open_source ~]# tar -jxf postgresql-10.12.tar.bz2 
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

问题原因:

       没有安装bzip2包

[root@open_source ~]# rpm -qa|grep bzip
bzip2-libs-1.0.6-13.el7.x86_64

解决办法:

        安装bzip包

[root@open_source ~]# yum install -y bzip2
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
base                                                                          | 2.8 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=====================================================================================================
 Package              Arch                  Version                        Repository           Size
=====================================================================================================
Installing:
 bzip2                x86_64                1.0.6-13.el7                   base                 52 k
 
Transaction Summary
=====================================================================================================
Install  1 Package
 
Total download size: 52 k
Installed size: 86 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : bzip2-1.0.6-13.el7.x86_64                                                         1/1 
  Verifying  : bzip2-1.0.6-13.el7.x86_64                                                         1/1 
 
Installed:
  bzip2.x86_64 0:1.0.6-13.el7                                                                        
 
Complete!
[root@open_source ~]# rpm -qa|grep bzip
bzip2-1.0.6-13.el7.x86_64
bzip2-libs-1.0.6-13.el7.x86_64

验证:

        问题已解决:

[root@open_source ~]# tar -jxf postgresql-10.12.tar.bz2 
[root@open_source ~]# ls -rld postgresql-10.12
drwxrwxrwx 6 1107 1107 273 Feb 10 17:32 postgresql-10.12
发表在 Linux, Linux shell, shell | 留下评论

RHEL 6以上操作系统Yum提示This system is not registered

RHEL 6以上操作系统Yum提示This system is not registered

一、问题现象:

[root@open_source ~]# yum clean

Loaded plugins: product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Error: clean requires an option: headers, packages, metadata, dbcache, plugins, expire-cache, rpmdb, all

[root@open_source ~]# yum check-update

Loaded plugins: product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

[root@open_source ~]# yum makecache

Loaded plugins: product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

base                                                                                | 2.8 kB  00:00:00    

Metadata Cache Created

二、问题原因:

       因为我的操作系统使用的是RedHat,提示需要注册订阅,说白了就是要掏钱才给用。

三、问题分析:

       该问题的处理办法实际上很简单,因为RedHat是商业版企业Linxu系统,其涉及到的包只有Yum,我们可以通过替换社区版的包解决此问题。

四、解决办法:

       替换社区版CentOS的包解决此问题。

4.1. 获取包的途径主要有以下几个:

http://mirror.centos.org/
https://mirrors.edge.kernel.org/
http://mirrors.aliyun.com/centos/

<1span style=”font-family:”&color:#4EA1DB;text-underline:none”>http://mirrors.sohu.com

……

       4.2. 我通过Centos Yum站点下载以下四个所需的包

http://mirror.centos.org/centos-7/7.7.1908/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
http://mirror.centos.org/centos-7/7.7.1908/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
http://mirror.centos.org/centos-7/7.7.1908/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm
http://mirror.centos.org/centos-7/7.7.1908/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
http://mirror.centos.org/centos-7/7.7.1908/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

注意:下载的包要大于或等于当前系统版本,下载之前要确认操作系统版本,可通过命令cat /etc/redhat-release 查看。

       4.3 卸载系统中现有的yum包

[root@open_source ~]# rpm -qa|grep yum
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-163.el7.noarch
yum-rhn-plugin-2.0.1-10.el7.noarch
[root@open_source ~]# rpm -qa|grep yum | xargs rpm -e --nodeps
[root@open_source ~]# rpm -qa|grep yum
[root@open_source ~]#

    4.4 分别安装刚才下载的几个RPM包

[root@open_source CentOS_yum]# rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
warning: python-iniparse-0.4-9.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing… ################################# [100%]
package python-iniparse-0.4-9.el7.noarch is already installed
file /usr/lib/python2.7/site-packages/iniparse/ini.pyc from install of python-iniparse-0.4-9.el7.noarch conflicts with file from package python-iniparse-0.4-9.el7.noarch
file /usr/lib/python2.7/site-packages/iniparse/ini.pyo from install of python-iniparse-0.4-9.el7.noarch conflicts with file from package python-iniparse-0.4-9.el7.noarch

[root@open_source CentOS_yum]# rpm -ivh python-urlgrabber-3.10-9.el7.noarch.rpm
warning: python-urlgrabber-3.10-9.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing… ################################# [100%]
package python-urlgrabber-3.10-9.el7.noarch is already installed
file /usr/lib/python2.7/site-packages/urlgrabber/grabber.pyc from install of python-urlgrabber-3.10-9.el7.noarch conflicts with file from package python-urlgrabber-3.10-9.el7.noarch
file /usr/lib/python2.7/site-packages/urlgrabber/grabber.pyo from install of python-urlgrabber-3.10-9.el7.noarch conflicts with file from package python-urlgrabber-3.10-9.el7.noarch

[root@open_source CentOS_yum]# rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
warning: yum-metadata-parser-1.1.4-10.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:yum-metadata-parser-1.1.4-10.el7 ################################# [100%]

[root@open_source CentOS_yum]# rpm -ivh yum-3.4.3-163.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
warning: yum-3.4.3-163.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:yum-plugin-fastestmirror-1.1.31-5################################# [ 50%]
2:yum-3.4.3-163.el7.centos ################################# [100%]

[root@open_source CentOS_yum]# rpm -qa|grep yum
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-163.el7.centos.noarch
yum-plugin-fastestmirror-1.1.31-52.el7.noarch

   4.5 验证

[root@open_source CentOS_yum]# yum makecache
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Determining fastest mirrors
base | 2.8 kB 00:00:00
(1/5): base/group_gz | 103 kB 00:00:00
(2/5): base/primary | 2.0 MB 00:00:00
(3/5): base/filelists | 3.1 MB 00:00:00
(4/5): base/productid | 1.6 kB 00:00:00
(5/5): base/other | 1.1 MB 00:00:00
base 5229/5229
base 5229/5229
base 5229/5229
Metadata Cache Created

[root@open_source CentOS_yum]# yum install -y ftp
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package ftp.x86_64 0:0.17-67.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================================
Package Arch Version Repository Size
Installing:
ftp x86_64 0.17-67.el7 base 61 k
Transaction Summary
Install 1 Package
Total download size: 61 k
Installed size: 96 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
rhn-check-2.0.2-24.el7.x86_64 has missing requires of yum-rhn-plugin >= ('0', '1.6.4', '1')
Installing : ftp-0.17-67.el7.x86_64 1/1
Verifying : ftp-0.17-67.el7.x86_64 1/1
Installed:
ftp.x86_64 0:0.17-67.el7
Complete!
发表在 Linux, Linux 排错, Linux基础, 操作系统, 故障处理 | 留下评论

PostgreSQL 10.12 安装系列 – 本地RPM安装

二、     本地RPM安装

本地RPM包下载地址

https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7.7-x86_64/

找到如下两个包下载即可:

postgresql10-10.12-1PGDG.rhel7.x86_64.rpm

postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm

创建用于管理PG的用户和组:

[root@open_source ~]# groupadd postgres
[root@open_source ~]# useradd -g postgres postgres
[root@open_source ~]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: The password contains the user name in some form
Retype new password:
passwd: all authentication tokens updated successfully.

本地安装PostgreSQL 10.12:

[root@open_source ~]# ls -rtl
total 6632
-rw-r--r-- 1 root root 6048 Feb 23 15:47 pgdg-redhat-repo-latest.noarch.rpm
-rw-r--r-- 1 root root 1657936 Feb 23 16:14 postgresql10-10.12-1PGDG.rhel7.x86_64.rpm
-rw-r--r-- 1 root root 4753176 Feb 23 16:14 postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm
-rw-r--r-- 1 root root 365156 Feb 23 16:23 postgresql10-libs-10.12-1PGDG.rhel7.x86_64.rpm

[root@open_source ~]# rpm -ivh postgresql10-libs-10.12-1PGDG.rhel7.x86_64.rpm
warning: postgresql10-libs-10.12-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:postgresql10-libs-10.12-1PGDG.rhe################################# [100%]

[root@open_source ~]# rpm -ivh postgresql10-10.12-1PGDG.rhel7.x86_64.rpm
warning: postgresql10-10.12-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:postgresql10-10.12-1PGDG.rhel7 ################################# [100%]

[root@open_source ~]# rpm -ivh postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm
warning: postgresql10-server-10.12-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:postgresql10-server-10.12-1PGDG.r################################# [100%]

检查安装是否成功:
[root@open_source ~]# rpm -qa|grep postgresql10
postgresql10-10.12-1PGDG.rhel7.x86_64
postgresql10-libs-10.12-1PGDG.rhel7.x86_64
postgresql10-server-10.12-1PGDG.rhel7.x86_64

初始化数据库:

[root@open_source ~]# /usr/pgsql-10/bin/postgresql-10-setup initdb
Initializing database … OK

检查配置:

[root@open_source ~]# cat /usr/lib/systemd/system/postgresql-10.service | egrep -v "^$|^#"
[Unit]
Description=PostgreSQL 10 database server
Documentation=https://www.postgresql.org/docs/10/static/
After=syslog.target
After=network.target
[Service]
Type=notify
User=postgres
Group=postgres
Environment=PGDATA=/var/lib/pgsql/10/data/
OOMScoreAdjust=-1000
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0
ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA}
ExecStart=/usr/pgsql-10/bin/postmaster -D ${PGDATA}
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT

TimeoutSec=0
[Install]
WantedBy=multi-user.target

启动数据库方法一:

[root@open_source ~]# systemctl start postgresql-10.service
[root@open_source bin]# systemctl status postgresql-10

postgresql-10.service - PostgreSQL 10 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2020-02-23 17:07:19 EST; 55min ago
Docs: https://www.postgresql.org/docs/10/static/
Process: 12481 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 12486 (postmaster)
CGroup: /system.slice/postgresql-10.service
|-12486 /usr/pgsql-10/bin/postmaster -D /var/lib/pgsql/10/data/
|-12488 postgres: logger process
|-12490 postgres: checkpointer process
|-12491 postgres: writer process
|-12492 postgres: wal writer process
|-12493 postgres: autovacuum launcher process
|-12494 postgres: stats collector process
`-12495 postgres: bgworker: logical replication launcher

Feb 23 17:07:19 open_source systemd[1]: Starting PostgreSQL 10 database server…
Feb 23 17:07:19 open_source postmaster[12486]: 2020-02-23 17:07:19.702 EST [12486] LOG: listening on IPv6 address "::1", port 5432
Feb 23 17:07:19 open_source postmaster[12486]: 2020-02-23 17:07:19.702 EST [12486] LOG: listening on IPv4 address "127.0….t 5432
Feb 23 17:07:19 open_source postmaster[12486]: 2020-02-23 17:07:19.703 EST [12486] LOG: listening on Unix socket "/var/ru….5432"
Feb 23 17:07:19 open_source postmaster[12486]: 2020-02-23 17:07:19.704 EST [12486] LOG: listening on Unix socket "/tmp/.s….5432"
Feb 23 17:07:19 open_source postmaster[12486]: 2020-02-23 17:07:19.710 EST [12486] LOG: redirecting log output to logging…rocess
Feb 23 17:07:19 open_source postmaster[12486]: 2020-02-23 17:07:19.710 EST [12486] HINT: Future log output will appear in…"log".
Feb 23 17:07:19 open_source systemd[1]: Started PostgreSQL 10 database server.
Hint: Some lines were ellipsized, use -l to show in full.

[root@open_source ~]# ps -ef|grep -i postgres |grep -v grep
postgres 12486 1 0 17:07 ? 00:00:00 /usr/pgsql-10/bin/postmaster -D /var/lib/pgsql/10/data/
postgres 12488 12486 0 17:07 ? 00:00:00 postgres: logger process
postgres 12490 12486 0 17:07 ? 00:00:00 postgres: checkpointer process
postgres 12491 12486 0 17:07 ? 00:00:00 postgres: writer process
postgres 12492 12486 0 17:07 ? 00:00:00 postgres: wal writer process
postgres 12493 12486 0 17:07 ? 00:00:00 postgres: autovacuum launcher process
postgres 12494 12486 0 17:07 ? 00:00:00 postgres: stats collector process
postgres 12495 12486 0 17:07 ? 00:00:00 postgres: bgworker: logical replication launcher

启动数据库方法二:

[postgres@open_source ~]$ cd /usr/pgsql-10/bin/
[postgres@open_source bin]$ ./pg_ctl start
waiting for server to start….2020-02-23 18:04:33.686 EST [12823] LOG: listening on IPv4 address “127.0.0.1”, port 5432
2020-02-23 18:04:33.687 EST [12823] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
2020-02-23 18:04:33.688 EST [12823] LOG: listening on Unix socket “/tmp/.s.PGSQL.5432”
2020-02-23 18:04:33.693 EST [12823] LOG: redirecting log output to logging collector process
2020-02-23 18:04:33.693 EST [12823] HINT: Future log output will appear in directory “log”.
done
server started
[postgres@open_source bin]$ ./pg_ctl status
pg_ctl: server is running (PID: 12823)
/usr/pgsql-10/bin/postgres

[postgres@open_source bin]$ ps -ef|grep postgre |grep -v grep
root 12800 9637 0 18:04 pts/0 00:00:00 su - postgres
postgres 12801 12800 0 18:04 pts/0 00:00:00 -bash
postgres 12823 1 0 18:04 pts/0 00:00:00 /usr/pgsql-10/bin/postgres
postgres 12824 12823 0 18:04 ? 00:00:00 postgres: logger process
postgres 12826 12823 0 18:04 ? 00:00:00 postgres: checkpointer process
postgres 12827 12823 0 18:04 ? 00:00:00 postgres: writer process
postgres 12828 12823 0 18:04 ? 00:00:00 postgres: wal writer process
postgres 12829 12823 0 18:04 ? 00:00:00 postgres: autovacuum launcher process
postgres 12830 12823 0 18:04 ? 00:00:00 postgres: stats collector process
postgres 12831 12823 0 18:04 ? 00:00:00 postgres: bgworker: logical replication launcher
postgres 12837 12801 0 18:05 pts/0 00:00:00 ps -ef

配置用户环境变量:

[postgres@open_source ~]$ vi .bash_profile

export PGPORT=5432
export PGHOST=open_source
export PGHOME=/usr/pgsql-10/
export PGDATA=/home/postgres/data
export.utf8
export LD_LIBRARY_PATH=/usr/pgsql-10/lib
export PATH=$PGHOME/bin:/usr/bin:/usr/sbin:/sbin:$PATH
export MANPATH=$PGHOME/share/man:$MANPATH
export PGUSER=postgres
export PGDATABASE=postgres

创建数据库:

[postgres@open_source ~]$ initdb -D $PGDATA
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /home/postgres/data … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting default timezone … America/New_York
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … ok
syncing data to disk … ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

pg_ctl -D /home/postgres/data -l logfile start

登录数据库:

[postgres@open_source ~]$ psql
psql: could not connect to server: Connection refused
Is the server running on host "open_source" (192.168.84.30) and accepting
TCP/IP connections on port 5432?
[postgres@open_source ~]$ cd /var/lib/pgsql/10/data
[postgres@open_source data]$ ls -rtl
total 56
drwx------ 2 postgres postgres 6 Feb 23 16:51 pg_commit_ts
-rw------- 1 postgres postgres 3 Feb 23 16:51 PG_VERSION
drwx------ 2 postgres postgres 6 Feb 23 16:51 pg_twophase
drwx------ 2 postgres postgres 6 Feb 23 16:51 pg_tblspc
drwx------ 2 postgres postgres 6 Feb 23 16:51 pg_snapshots
drwx------ 2 postgres postgres 6 Feb 23 16:51 pg_serial
drwx------ 2 postgres postgres 6 Feb 23 16:51 pg_replslot
drwx------ 4 postgres postgres 36 Feb 23 16:51 pg_multixact
drwx------ 2 postgres postgres 6 Feb 23 16:51 pg_dynshmem
-rw------- 1 postgres postgres 22992 Feb 23 16:51 postgresql.conf
-rw------- 1 postgres postgres 88 Feb 23 16:51 postgresql.auto.conf
-rw------- 1 postgres postgres 1636 Feb 23 16:51 pg_ident.conf
-rw------- 1 postgres postgres 4269 Feb 23 16:51 pg_hba.conf
drwx------ 2 postgres postgres 18 Feb 23 16:51 pg_xact
drwx------ 3 postgres postgres 60 Feb 23 16:51 pg_wal
drwx------ 2 postgres postgres 18 Feb 23 16:51 pg_subtrans
drwx------ 2 postgres postgres 4096 Feb 23 16:51 global
drwx------ 5 postgres postgres 41 Feb 23 16:51 base
-rw------- 1 postgres postgres 58 Feb 23 17:07 postmaster.opts
drwx------ 2 postgres postgres 18 Feb 23 17:07 pg_notify
drwx------ 2 postgres postgres 32 Feb 23 17:07 log
-rw------- 1 postgres postgres 30 Feb 23 17:07 current_logfiles
drwx------ 4 postgres postgres 68 Feb 23 18:03 pg_logical
drwx------ 2 postgres postgres 6 Feb 23 18:03 pg_stat_tmp
drwx------ 2 postgres postgres 25 Feb 23 18:03 pg_stat
[postgres@open_source data]$ echo listen_addresses = "'*'" >> postgresql.conf
[postgres@open_source data]$ echo "host all all 192.xxx.xxx.xxx/32 trust" >> pg_hba.conf
[postgres@open_source data]$ pg_ctl start
waiting for server to start….2020-02-23 18:40:17.588 EST [13271] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-02-23 18:40:17.588 EST [13271] LOG: listening on IPv6 address "::", port 5432
2020-02-23 18:40:17.589 EST [13271] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-02-23 18:40:17.589 EST [13271] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2020-02-23 18:40:17.595 EST [13271] LOG: redirecting log output to logging collector process
2020-02-23 18:40:17.595 EST [13271] HINT: Future log output will appear in directory "log".
done
server started
[postgres@open_source data]$ psql
psql (10.12)
Type "help" for help.
postgres=#
发表在 PostgresSQL, 安装升级, 数据库 | 留下评论

PostgreSQL 10.12 安装系列 – Yum+rpm 安装

Yum仓库下载:

https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

安装yum仓库:

[root@open_source ~]# ls
anaconda-ks.cfg
pgdg-redhat-repo-latest.noarch.rpm

[root@open_source ~]# rpm -ivh pgdg-redhat-repo-latest.noarch.rpm
warning: pgdg-redhat-repo-latest.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:pgdg-redhat-repo-42.0-6 ################################# [100%]

[root@open_source ~]# ls -rtl /etc/yum.repos.d/pgdg-redhat-all.repo
-rw-r--r-- 1 root root 5904 Sep 27 09:04 /etc/yum.repos.d/pgdg-redhat-all.repo

通过yum安装数据库:

[root@open_source ~]# yum install -y postgresql10
[root@open_source ~]# yum install postgresql10-server

初始化数据库:

[root@open_source ~]# /usr/pgsql-10/bin/postgresql-10-setup initdb

配置开启启动:

[root@open_source ~]# systemctl enable postgresql-10

启动数据库:

[root@open_source ~]# systemctl start postgresql-10

不限制任何主机并允许远程登陆:

[root@open_source ~]# vi /var/lib/pgsql/10/data/postgresql.conf
修改listen_addresses = ‘*’

修改pg.hba文件需要重启服务:

[root@open_source ~]# vim /var/lib/pgsql/11/data/pg_hba.conf
添加 host all all 0.0.0.0/0 md5
发表在 PostgresSQL, 安装升级, 数据库 | 留下评论

PostgreSQL 安装扩展包

安装扩展:
一、背景:
因为巡检需要收集PostgreSQL的状态信息,通常会调用extension pg_stat_statements;该模块提供了追踪服务器所执行的所有 SQL 语句的执行统计信息,可用于统计数据库的资源开销,分析TOP SQL。且该模块提供了一个视图 pg_stat_statements以及函数pg_stat_statements_reset 和pg_stat_statements用于访问和操纵这些统计信息。

二、条件:
2.1 PostgreSQL的安装如果是源码安装,且安装包需要存在。
2.2 PostgreSQL的安装如果是Yum或RPM安装,则服务器必须能够访问相应的Yum源。

三、检查该扩展包是否有编译
[root@open_source ~]# ll /usr/pgsql-10/share/extension/
total 1044

[root@open_source extension]# ll pg_stat_statements*
-rw-r--r-- 1 root root 1246 Jul 13 08:18 pg_stat_statements--1.0--1.1.sql
-rw-r--r-- 1 root root 1336 Jul 13 08:18 pg_stat_statements--1.1--1.2.sql
-rw-r--r-- 1 root root 1454 Jul 13 08:18 pg_stat_statements--1.2--1.3.sql
-rw-r--r-- 1 root root 345 Jul 13 08:18 pg_stat_statements--1.3--1.4.sql
-rw-r--r-- 1 root root 305 Jul 13 08:18 pg_stat_statements--1.4--1.5.sql
-rw-r--r-- 1 root root 1427 Jul 13 08:18 pg_stat_statements--1.4.sql
-rw-r--r-- 1 root root 376 Jul 13 08:18 pg_stat_statements--1.5--1.6.sql
-rw-r--r-- 1 root root 191 Jul 13 08:18 pg_stat_statements.control
-rw-r--r-- 1 root root 449 Jul 13 08:18 pg_stat_statements--unpackaged--1.0.sql
四、加载扩展包

postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(1 row)
postgres=# create extension pg_stat_statements;
CREATE EXTENSION
postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
--------------------+---------+------------+-----------------------------------------------------------
pg_stat_statements | 1.5 | public | track execution statistics of all SQL statements executed
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(2 rows)

五、执行巡检脚本,成功调用扩展包内容

sh pgsql_check_script.sh > 20200713_report_10.2.109.11.txt 2>&1

备注:
1、源码编译选择:
./configure –prefix=使用yum 安装位置的 prefix
再执行 make 生成 contrib 需要make 相关的头文件

2、切记:执行 make 后不需要执行 make install ,否则会覆盖原有的相关文件然后cd contrib 目录执行make && make install 既可安装pg原生自带的 extension

发表在 PostgresSQL | 留下评论

OPatch install “Missing command :fuser”

问题现象:

[oracle@dbserver 24006111]$ opatch apply
Oracle Interim Patch Installer version 11.2.0.4
Copyright (c) 2017, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version : 11.2.0.3.12
OUI version : 11.2.0.4.0
Log file location : /DBSoft/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2019-08-20_15-36-30AM_1.log
Verifying environment and performing prerequisite checks…
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
UtilSession failed:
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.

问题分析:

从输出的日志来看,是没有找到fuser 这个命令,我们需要安装fuser这个命令,让报错不在重现即可。

参考文档:

参考mos:1581604.1,安装psmisc rpm包解决该问题。

问题解决:

根据mos问题提示,需安装psmsic。

[root@dbserver ~]# export
[root@dbserver ~]# yum -y install psmsic
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
No package psmsic available.
Error: Nothing to do
[root@dbserver ~]# yum -y install psmisc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package psmisc.x86_64 0:22.20-9.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package          Arch             Version                 Repository      Size
================================================================================
Installing:
psmisc           x86_64           22.20-9.el7             base           140 k
Transaction Summary
================================================================================
Install  1 Package
Total download size: 140 k
Installed size: 479 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : psmisc-22.20-9.el7.x86_64                                    1/1 
Verifying  : psmisc-22.20-9.el7.x86_64                                    1/1 
Installed:
psmisc.x86_64 0:22.20-9.el7                                                   
Complete!
[root@dbserver ~]#

总结:

安装完psmisc包之后补丁安装正常,问题解决。

发表在 11g, Oracle, Oracle安装升级, 数据库 | 留下评论

A.M.D.U数据恢复

A.M.D.U 数据恢复

客户环境:

操作系统: RedHat Enterprise AS Linux 4.6 x64

数据库 DB : Oracle Enterprise Database 10g(10.2.0.4) no psu

集群系统: Oracle Real Application Cluster 10g(10.2.0.4) no psu

问题背景:

       在一个寂静的夜晚被一阵急促的电话铃声吵醒,打来电话的是我的老朋友J,他告知我说数据库起不来了,业务全部中断,存储狂扇,频繁的告警亮灯,寻求我的紧急帮助。我首先安慰老朋友J,说这个可能是存储有问题,比较棘手,还是有修复的可能。J听到我这么一说长舒了一口气,缓缓的吐了几个字说:“吴哥,你得帮帮我!”我说没问题,随即梦醒打了个飞的直奔故障现场。了解到了客户环境:比想象中的更为复杂,上线后就没有任何备份,是一个部署在RHEL4.6环境下的10g(10.2.0.4)的RAC,用的是8盘位DFT低端SAS存储。

问题分析:

       在了解到问题环境之后需要对问题进行进一步的分析和解决,思考了半个小时,CRS服务无法启动,没有数据库备份无法恢复;10gRAC ASM无法mount,内部视图无法查询,磁盘组无法正常加载,给数据恢复带来诸多不便……,看来常规方法是不行了,只能考虑一些非常规的数据恢复方法:DUL? AUL? ODU? 这几个工具一直在大脑中回荡,后来冷静思考,咨询了行业里面的牛人,告诉我说通过11g下的AMDU可以在磁盘组加载之前将ASM元数据抽出来,用于诊断及起库open,之后再重做RAC恢复数据即可。且该工具可以向后兼容,引入到10g中。

       说完就干~!

处理过程:

1.1.基础环境准备

       在Oracle官网下载最新的AMDU工具,在任意节点挂载外置移动硬盘,上传到挂载外置移动硬盘的节点上,进去后赋予oracle:oinstall权限并用oracle用户解压,配置参数文件amdu_par,包含如下内容:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
export PATH=$PATH:`pwd`

1.2. 初始化amdu工具

用oracle用户执行如下命令,将自动生成一个以时间命名的目录,其下的报告

文件记录了磁盘组的相关信息。

./amdu
amdu_2019_03_30_12_26_32

该报告的主要信息如下:

--amdu--
* AMDU Settings **
ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1
System name:Linux
Node name: rac1
Release: 2.6.9-78.ELlargesmp
Version: #1 SMP Wed Jul 9 16:03:59 EDT 2008
Machine:x86_64
amdu run: 30-MAR-19 12:26:32
Endianess: 1
--------------------------------- Operations ---------------------------------
------------------------------- Disk Selection -------------------------------
-diskstring ''
------------------------------ Reading Control -------------------------------
------------------------------- Output Control -------------------------------
DISCOVERY *
----------------------------- DISK REPORT N0001 ------------------------------
Disk Path: /dev/raw/raw1
Unique Disk ID:
Disk Label:
Physical Sector Size: 512 bytes
Disk Size: 199 megabytes
** NOT A VALID ASM DISK HEADER. BAD VALUE IN FIELD blksize_kfdhdb **
----------------------------- DISK REPORT N0002 ------------------------------
Disk Path: /dev/raw/raw2
Unique Disk ID:
Disk Label:
Physical Sector Size: 512 bytes
Disk Size: 299 megabytes
** NOT A VALID ASM DISK HEADER. BAD VALUE IN FIELD blksize_kfdhdb **
----------------------------- DISK REPORT N0003 ------------------------------
Disk Path: ORCL:VOL1
Unique Disk ID:
Disk Label: VOL1
Physical Sector Size: 512 bytes
Disk Size: 2047997 megabytes
Group Name: ORADATA_DG1
Disk Name: VOL1
Failure Group Name: VOL1
Disk Number: 0
Header Status: 3
Disk Creation Time: 2011/01/04 15:51:21.126000
Last Mount Time: 2019/03/30 13:15:19.625000
Compatibility Version: 0x0a100000
Disk Sector Size: 512 bytes
Disk size in AUs: 2047997 AUs
Group Redundancy: 1
Metadata Block Size: 4096 bytes  ---------元数据块大小,4KB
AU Size: 1048576 bytes -------------AU大小:1MB
Stride: 113792 AUs
Group Creation Time: 2011/01/04 15:51:21.013000
File 1 Block 1 location: AU 2 ---------文件使用,从AU 2 开始
----------------------------- DISK REPORT N0004 ------------------------------
Disk Path: ORCL:VOL2
Unique Disk ID:
Disk Label: VOL2
Physical Sector Size: 512 bytes
Disk Size: 2047997 megabytes
Group Name: ORADATA_DG2
Disk Name: VOL2
Failure Group Name: VOL2
Disk Number: 0
Header Status: 3
Disk Creation Time: 2011/01/04 15:51:43.512000
Last Mount Time: 2019/03/30 13:15:19.851000
Compatibility Version: 0x0a100000
Disk Sector Size: 512 bytes
Disk size in AUs: 2047997 AUs
Group Redundancy: 1
Metadata Block Size: 4096 bytes ----------元数据块大小,4KB
AU Size: 1048576 bytes --------------AU大小:1MB
Stride: 113792 AUs
Group Creation Time: 2011/01/04 15:51:43.370000
File 1 Block 1 location: AU 2 ---------文件使用,从AU 2 开始
----------------------------- DISK REPORT N0005 ------------------------------
Disk Path: ORCL:VOL3
Unique Disk ID:
Disk Label: VOL3
Physical Sector Size: 512 bytes
Disk Size: 2047997 megabytes
Group Name: ORADATA_DG3
Disk Name: VOL3
Failure Group Name: VOL3
Disk Number: 0
Header Status: 3
Disk Creation Time: 2011/01/04 15:52:05.086000
Last Mount Time: 2019/03/30 13:15:20.093000
Compatibility Version: 0x0a100000
Disk Sector Size: 512 bytes
Disk size in AUs: 2047997 AUs
Group Redundancy: 1
Metadata Block Size: 4096 bytes ---------元数据块大小,4KB
AU Size: 1048576 bytes --------------AU大小:1MB
Stride: 113792 AUs
Group Creation Time: 2011/01/04 15:52:04.949000
File 1 Block 1 location: AU 2 ---------文件使用,从AU 2 开始
----------------------------- DISK REPORT N0006 ------------------------------
Disk Path: ORCL:VOL4
Unique Disk ID:
Disk Label: VOL4
Physical Sector Size: 512 bytes
Disk Size: 1484867 megabytes
Group Name: RECOVER_DG
Disk Name: VOL4
Failure Group Name: VOL4
Disk Number: 0
Header Status: 3
Disk Creation Time: 2011/01/04 15:52:31.026000
Last Mount Time: 2019/03/30 13:15:20.336000
Compatibility Version: 0x0a100000
Disk Sector Size: 512 bytes
Disk size in AUs: 1484867 AUs
Group Redundancy: 1
Metadata Block Size: 4096 bytes
AU Size: 1048576 bytes ----元数据块大小,4KB
Stride: 113792 AUs  --------AU 大小:1MB
Group Creation Time: 2011/01/04 15:52:30.929000
File 1 Block 1 location: AU 2  ---------文件使用,从AU 2 开始
* END OF REPORT **

1.3.抽取控制文件

由于磁盘组不能Mount,控制文件也无法访问,因此需要首先分析数据库的文件分布情况,进而通过文件的ASM 存储序号来进行文件抽取,通过告警日志,可以找到数据库的控制文件信息。如下所示,控制文件的ASM 文件号是270。

grep control_file $ORACLE_BASE/admin/$ORACLE_SID/bdump/alert_$ORACLE_SID.log
control_files = "+ORADATA_DG1/ORADB/CONTROLFILE/Current.260.739555035"
……….
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.260
amdu_2019_03_30_12_29_43/

1.4. 通过控制文件获取RedoLog 和DataFile

        取得控制文件之后,可以通过控制文件内容获得数据库的数据文件及日志文件分布情况。以下是从控制文件中获得的信息输出。

[root@rac1 ~]# strings ORADATA_DG1_260.f |grep -v archivelog |grep -v oracle/ |grep ORAD| sort
+ORADATA_DG1/oradb/idx_jsnet.dbf
+ORADATA_DG1/oradb/idx_jsnet.dbf
+ORADATA_DG1/oradb/idx_jsnet.ora
+ORADATA_DG1/oradb/idx_jsnet.ora
+ORADATA_DG1/oradb/redo01.log
+ORADATA_DG1/oradb/redo01.log
+ORADATA_DG1/oradb/redo02.log
+ORADATA_DG1/oradb/redo02.log
+ORADATA_DG1/oradb/redo03.log
+ORADATA_DG1/oradb/redo03.log
+ORADATA_DG1/oradb/redo04.log
+ORADATA_DG1/oradb/redo04.log
+ORADATA_DG1/oradb/sysaux01.dbf
+ORADATA_DG1/oradb/sysaux01.dbf
+ORADATA_DG1/oradb/system01.dbf
+ORADATA_DG1/oradb/system01.dbf
+ORADATA_DG1/oradb/tbs_jsnet.dbf
+ORADATA_DG1/oradb/tbs_jsnet.dbf
+ORADATA_DG1/oradb/tbs_jsnet.dbf
+ORADATA_DG1/oradb/tbs_jsnet.dbf
+ORADATA_DG1/oradb/temp01.dbf
+ORADATA_DG1/oradb/temp01.dbf
+ORADATA_DG1/oradb/undotbs01.dbf
+ORADATA_DG1/oradb/undotbs01.dbf
+ORADATA_DG1/oradb/undotbs02.dbf
+ORADATA_DG1/oradb/undotbs02.dbf
+ORADATA_DG1/oradb/users01.dbf
+ORADATA_DG1/oradb/users01.dbf

1.5. 恢复文件

       根据控制文件中的文件分布信息,可以通过amdu工具将所有文件提取出来,根据以数据文件和日志文件信息,创建如下脚本以抽取对应的日志文件和数据文件。

先恢复RedoLog File:

[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL' -extract ORADATA_DG1.263 amdu_2019_03_30_12_32_38/ [oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring '/dev/oracleasm/disks/VOL' -extract ORADATA_DG1.264
amdu_2019_03_30_12_33_12/
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL' -extract ORADATA_DG1.267 amdu_2019_03_30_12_34_11/ [oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring '/dev/oracleasm/disks/VOL' -extract ORADATA_DG1.268
amdu_2019_03_30_12_34_22/

再恢复数据文件:

IDX_JSNET.ora:
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.276
amdu_2019_03_30_12_38_42/

IDX_JSNET:
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.298

TBS_JSNET:
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.277

SYSAUX:
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.257

SYSTEM:
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.256

TEMP:
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.265

UNDOTBS1:
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.258

UNDOTBS2:
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.266

USER:
[oracle@rac1 amdu_2019_03_30_12_26_32]$ amdu -diskstring
'/dev/oracleasm/disks/VOL*' -extract ORADATA_DG1.259

1.6. 校验文件

       到这里文件已经全部恢复出来了,途中未见报错,接下来需要用dbv对文件进行个校验,检查下是否有逻辑坏块:

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_12_
amdu_2019_03_30_12_29_43/ amdu_2019_03_30_12_33_12/ amdu_2019_03_30_12_38_42/ amdu_2019_03_30_12_43_30/
amdu_2019_03_30_12_29_56/ amdu_2019_03_30_12_34_11/ amdu_2019_03_30_12_40_08/ amdu_2019_03_30_12_44_47/
amdu_2019_03_30_12_30_07/ amdu_2019_03_30_12_34_22/ amdu_2019_03_30_12_40_45/
amdu_2019_03_30_12_32_38/ amdu_2019_03_30_12_37_22/ amdu_2019_03_30_12_42_13/

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_12_38_42/ORADATA_DG1_276.f

DBVERIFY: Release 10.2.0.4.0 - Production on Sat Mar 30 14:00:33 2019
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = amdu_2019_03_30_12_38_42/ORADATA_DG1_276.f
DBVERIFY - Verification complete
Total Pages Examined : 25600
Total Pages Processed (Data) : 0
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 8
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 25592
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 753000 (0.753000)

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_12_40_08/ORADATA_DG1_298.f
DBVERIFY: Release 10.2.0.4.0 - Production on Sat Mar 30 14:00:53 2019
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = amdu_2019_03_30_12_40_08/ORADATA_DG1_298.f
DBVERIFY - Verification complete
Total Pages Examined : 32000
Total Pages Processed (Data) : 0
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 28786
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1062
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 2152
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 697113994 (0.697113994)

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_12_40_45/ORADATA_DG1_277.f
DBVERIFY: Release 10.2.0.4.0 - Production on Sat Mar 30 14:01:09 2019
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = amdu_2019_03_30_12_40_45/ORADATA_DG1_277.f
DBVERIFY - Verification complete
Total Pages Examined : 101120
Total Pages Processed (Data) : 95455
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 353
Total Pages Failing (Index): 0
Total Pages Processed (Other): 3290
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 2022
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 697223552 (0.697223552)

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_12_42_13/ORADATA_DG1_257.f
DBVERIFY: Release 10.2.0.4.0 - Production on Sat Mar 30 14:01:17 2019
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = amdu_2019_03_30_12_42_13/ORADATA_DG1_257.f
DBVERIFY - Verification complete
Total Pages Examined : 107520
Total Pages Processed (Data) : 41691
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 33473
Total Pages Failing (Index): 0
Total Pages Processed (Other): 18814
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 13542
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 697247738 (0.697247738)

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_12_43_30/ORADATA_DG1_256.f
DBVERIFY: Release 10.2.0.4.0 - Production on Sat Mar 30 14:01:59 2019
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = amdu_2019_03_30_12_43_30/ORADATA_DG1_256.f
DBVERIFY - Verification complete
Total Pages Examined : 64000
Total Pages Processed (Data) : 38706
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 7385
Total Pages Failing (Index): 0
Total Pages Processed (Other): 2067
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 15842
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 697247727 (0.697247727)

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_12_44_47/ORADATA_DG1_265.f
DBVERIFY: Release 10.2.0.4.0 - Production on Sat Mar 30 14:02:25 2019
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY: Skipping temporary file amdu_2019_03_30_12_44_47/ORADATA_DG1_265.f

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_13_10_37/ORADATA_DG1_258.f
DBVERIFY: Release 10.2.0.4.0 - Production on Sat Mar 30 14:03:18 2019
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = amdu_2019_03_30_13_10_37/ORADATA_DG1_258.f
DBVERIFY - Verification complete
Total Pages Examined : 23680
Total Pages Processed (Data) : 0
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 23432
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 248
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 667630094 (0.667630094)

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_13_14_27/ORADATA_DG1_266.f
DBVERIFY: Release 10.2.0.4.0 - Production on Sat Mar 30 14:03:43 2019
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = amdu_2019_03_30_13_14_27/ORADATA_DG1_266.f
DBVERIFY - Verification complete
Total Pages Examined : 27080
Total Pages Processed (Data) : 0
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 27080
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 0
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 697247738 (0.697247738)

[oracle@rac1 amdu_2019_03_30_12_26_32]$ dbv file=amdu_2019_03_30_13_15_29/ORADATA_DG1_259.f
DBVERIFY: Release 10.2.0.4.0 - Production on Sat Mar 30 14:04:03 2019
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = amdu_2019_03_30_13_15_29/ORADATA_DG1_259.f
DBVERIFY - Verification complete
Total Pages Examined : 640
Total Pages Processed (Data) : 15
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 2
Total Pages Failing (Index): 0
Total Pages Processed (Other): 593
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 30
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 598900 (0.598900)

1.7. 验证数据库版本及补丁信息

[oracle@rac1 amdu_2019_03_30_12_26_32]$ $ORACLE_HOME/OPatch/opatch lsinv
Invoking OPatch 10.2.0.4.2

Oracle Interim Patch Installer version 10.2.0.4.2
Copyright (c) 2007, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.2
OUI version : 10.2.0.4.0
OUI location : /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatc h2019-03-30_13-56-47PM.log
Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollo gs/opatch/lsinv/lsinventory2019-03-30_13-56-47PM.txt

Installed Top-level Products (3):
Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Products 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 3 10.2.0.4.0
There are 3 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
Rac system comprising of multiple nodes
Local node = rac1
Remote node = rac2

OPatch succeeded.

2、构建新的环境

2.1. 安装相同版本数据库

       不要建库,只需安装数据库软件即可。

过程 (略)

2.2. 创建数据库启动参数文件

       编辑好参数文件,将数据库启动到nomount状态:

[oracle@rac1 dbs]$ cat initoradb.ora
db_name=oradb
db_files = 80
db_file_multiblock_read_count = 8
db_block_buffers = 100
shared_pool_size = 123232153
log_checkpoint_interval = 10000
processes = 50
parallel_max_servers = 5
log_buffer = 32768
max_dump_file_size = 10240
global_names = TRUE
control_files = '/oracle/oradata/oradb/control01.ctl'

2.3. 将数据库启到nomount状态

[oracle@rac1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Apr 6 12:47:26 2019
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.
Total System Global Area 4294967296 bytes
Fixed Size 2089472 bytes
Variable Size 4269805056 bytes
Database Buffers 8388608 bytes
Redo Buffers 14684160 bytes

2.4. mount数据库

SQL> alter database mount;
Database altered.

SQL> select instance_name,status from gv$instance;
INSTANCE_NAME STATUS

oradb MOUNTED

接下来就可以修改控制文件里面对应的数据文件及RedoLog的路径,并open数据库了。

2.5 修改路径

       修改控制文件中的数据文件和RedoLog对应路径信息。

RedoLog File RENAME FILE: 

alter database rename file '+ORADATA_DG1/oradb/redo02.log' to '/oracle/oradata/oradb/amdu_2019_03_30_12_33_12/ORADATA_DG1_264.f';
alter database rename file '+ORADATA_DG1/oradb/redo01.log' to '/oracle/oradata/oradb/amdu_2019_03_30_12_32_38/ORADATA_DG1_263.f';
alter database rename file '+ORADATA_DG1/oradb/redo03.log' to '/oracle/oradata/oradb/amdu_2019_03_30_12_34_11/ORADATA_DG1_267.f';
alter database rename file '+ORADATA_DG1/oradb/redo04.log' to '/oracle/oradata/oradb/amdu_2019_03_30_12_34_22/ORADATA_DG1_268.f';
alter database rename file '+ORADATA_DG1/oradb/users01.dbf' to '/oracle/oradata/oradb/amdu_2019_03_30_13_15_29/ORADATA_DG1_259.f';
alter database rename file '+ORADATA_DG1/oradb/sysaux01.dbf' to '/oracle/oradata/oradb/amdu_2019_03_30_12_42_13/ORADATA_DG1_257.f';
alter database rename file '+ORADATA_DG1/oradb/undotbs01.dbf' to '/oracle/oradata/oradb/amdu_2019_03_30_13_10_37/ORADATA_DG1_258.f';
alter database rename file '+ORADATA_DG1/oradb/system01.dbf' to '/oracle/oradata/oradb/amdu_2019_03_30_12_43_30/ORADATA_DG1_256.f';
alter database rename file '+ORADATA_DG1/oradb/undotbs02.dbf' to '/oracle/oradata/oradb/amdu_2019_03_30_13_14_27/ORADATA_DG1_266.f';
alter database rename file '+ORADATA_DG1/oradb/tbs_jsnet.dbf' to '/oracle/oradata/oradb/amdu_2019_03_30_12_40_45/ORADATA_DG1_277.f';
alter database rename file '+ORADATA_DG1/oradb/idx_jsnet.dbf' to '/oracle/oradata/oradb/amdu_2019_03_30_12_40_08/ORADATA_DG1_298.f';

 Temp File RENAME FILE:

alter database rename file '+ORADATA_DG1/oradb/temp01.dbf' to '/oracle/oradata/oradb/amdu_2019_03_30_12_44_47/ORADATA_DG1_265.f';

3.启动数据库

[oracle@redhat5 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Mar 31 03:50:55 2019
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-00369: Current log of thread 1 not useable and other log being cleared
ORA-00312: online log 1 thread 1:
'/oracle/oradata/oradb/amdu_2019_03_30_12_32_38/ORADATA_DG1_263.f'

SQL> alter database clear unarchived logfile group 1;
Database altered.

SQL> alter database open;
Database altered.

SQL> select instance_name,status from v$instance;
INSTANCE_NAMESTATUS

oradb OPEN

4. 数据库业务方面确认

SQL> select username,default_tablespace from dba_users where account_status='OPEN';

USERNAME DEFAULT_TABLESPACE

SYSTEM SYSTEM
SYS SYSTEM
SYSMAN SYSAUX
DBSNMP SYSAUX
MGMT_VIEW SYSTEM
woo TBS_JSNET
6 rows selected.
col OWNER format a8
col OBJECT_NAME format a25
select owner,object_name,status from dba_objects where owner='MAM42SYS';
OWNER OBJECT_NAME STATUS

WOO WOO_NAVBONTMOL VALID
WOO WOO_NAVTONTCOL VALID
WOO WOO_NAV2GATIWN VALID

发表在 Oracle, Oracle备份恢复, 数据库 | 留下评论

ORA-27300: OS system dependent operation:fork failed with status

问题现象:

Sun Sep 30 21:12:28 2018
Errors infile/DBSoft2/oracle/diag/rdbms/fzdbcgbk/fzdbcgbk1/trace/fzdbcgbk1_psp0_221463.trc:
ORA-27300: ͳϵͳز: fork ʧ ״̬Ϊ: 11ORA-27301: ͳϢ: Resource temporarily unavailable
ORA-27302: skgpspawn3
Process J000 died, see its trace fileSun Sep 30 21:12:28 2018kkjcre1p: unable to spawn jobq slave process 
Sun Sep 30 21:12:28 2018
Errors infile/DBSoft2/oracle/diag/rdbms/fzdbcgbk/fzdbcgbk1/trace/fzdbcgbk1_cjq0_222890.trc:
Sun Sep 30 21:12:29 2018
Process startup failed, error stack:
Sun Sep 30 21:12:29 2018
Errors infile/DBSoft2/oracle/diag/rdbms/fzdbcgbk/fzdbcgbk1/trace/fzdbcgbk1_psp0_221463.trc:
ORA-27300: ͳϵͳز: fork ʧ ״̬Ϊ: 11
ORA-27301: ͳϢ: Resource temporarily unavailable
ORA-27302: skgpspawn3

参考资料:

Mos ID:392006.1

SYMPTOMS:

The following message reported in alert log:

Mon Sep 18 18:10:34 2006

Errors in file /u01/oracle/admin/orcl/bdump/orcl1_psp0_954436.trc:

ORA-27300: OS system dependent operation:fork failed with status: 11

ORA-27301: OS failure message: Resource temporarily unavailable

ORA-27302: failure occurred at: skgpspawn3

Mon Sep 18 18:10:35 2006

Process P073 died, see its trace file

CAUSE:

The error messages indicating that oracle has problem in forking more process, the maximum number of PROCESSES allowed per user could be too low.

This is configured by the following kernel settings:

  AIX: maxuproc

  HP and Solaris: maxuprc

  Solaris 10/11: project.max-lwps

  Linux: nproc (/etc/security/limits.conf)

检查配置:

[root@fzdb1 trace]# su - oracle2
[oracle2@fzdb1 ~]$ ulimit-a
core filesize          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
filesize               (blocks, -f) unlimited
pending signals                 (-i) 1031748
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
openfiles                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-timepriority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time(seconds, -t) unlimited
max user processes              (-u) 3047
virtual memory          (kbytes, -v) unlimited
filelocks                      (-x) unlimited
[oracle2@fzdb1 ~]$ ulimit-u 3047
[root@fzdb1 ~]# grep proc /etc/security/limits.conf
#        - nproc - max number of processes
#        - priority - the priority to run user process with
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
oracle           soft    nproc           3047
oracle           hard    nproc           16384
grid             soft    nproc           3047
grid             hard    nproc           16384

问题分析:

   从上面检查我们可以发现oracle2的用户进程数量已经达到了1491,几乎接近oracle2用户的user processes数量,所以数据库日志里面频繁出现大量的ORA-27300,ORA-27301,ORA-27302,根据MOS:392006.1建议修改/etc/security/limits.conf文件里的oracle2 nproc值为更大的值,但是实际上我们并没有发现有关于oracle2用户的配置,所以我们手工添加如下配置后重启数据库服务器就可以了:

oracle2 soft nproc 16384
oracle2 hard nproc 16384
oracle2 soft nofile 65536
oracle2 hard nofile 65536
oracle2 soft memlock 3145728
oracle2 hard memlock 3145728

开始修改:

[root@fzdb1 ~]# cat  >> /etc/security/limits.conf << EOF
> oracle2         soft    nproc           16384
> oracle2         hard    nproc           16384
> oracle2         soft    nofile          65536
> oracle2         hard    nofile          65536
> oracle2         soft    memlock         3145728
> oracle2         hard    memlock         3145728
> EOF

重启服务器:

[oracle2@fzdb1 ~]$ su- root
[root@fzdb1 ~]$ reboot

检查刚才的参数修改:

[oracle2@fzdb1 ~]$ ulimit-u
16384

检查数据库日志:

   修改参数之后通过一天的观察未见ORA-27300,ORA-27301,ORA-27302等报错信息,此故障处理完毕。

发表在 Linux, Linux 性能优化, Oracle, 操作系统, 数据库 | 留下评论

Oracle官文,明确20c不能用于生产环境

Oracle数据库20c仅可用于预览。它不能用于生产。不支持升级到或从Oracle数据库20c升级。

发表在 Oracle, 数据库 | 标签为 , | 留下评论

ORA-27300: OS system dependent operation:fork failed with status

  • 问题现象:
Sun Sep 30 21:12:28 2018
Errors in file /DBSoft2/oracle/diag/rdbms/fzdbcgbk/fzdbcgbk1/trace/fzdbcgbk1_psp0_221463.trc:
ORA-27300: ͳϵͳز: fork ʧ ״̬Ϊ: 11
ORA-27301: ͳϢ: Resource temporarily unavailable
ORA-27302: skgpspawn3
Process J000 died, see its trace file
Sun Sep 30 21:12:28 2018
kkjcre1p: unable to spawn jobq slave process 
Sun Sep 30 21:12:28 2018
Errors in file /DBSoft2/oracle/diag/rdbms/fzdbcgbk/fzdbcgbk1/trace/fzdbcgbk1_cjq0_222890.trc:
Sun Sep 30 21:12:29 2018
Process startup failed, error stack:
Sun Sep 30 21:12:29 2018
Errors in file /DBSoft2/oracle/diag/rdbms/fzdbcgbk/fzdbcgbk1/trace/fzdbcgbk1_psp0_221463.trc:
ORA-27300: ͳϵͳز: fork ʧ ״̬Ϊ: 11
ORA-27301: ͳϢ: Resource temporarily unavailable
ORA-27302: skgpspawn3
  • 参考资料:

Mos ID:392006.1

SYMPTOMS:
The following message reported in alert log:

Mon Sep 18 18:10:34 2006
Errors in file /u01/oracle/admin/orcl/bdump/orcl1_psp0_954436.trc:
ORA-27300: OS system dependent operation:fork failed with status: 11
ORA-27301: OS failure message: Resource temporarily unavailable
ORA-27302: failure occurred at: skgpspawn3
Mon Sep 18 18:10:35 2006
Process P073 died, see its trace file

CAUSE:
The error messages indicating that oracle has problem in forking more process, the maximum number of PROCESSES allowed per user could be too low.

This is configured by the following kernel settings:

  AIX: maxuproc
  HP and Solaris: maxuprc
  Solaris 10/11: project.max-lwps
  Linux: nproc (/etc/security/limits.conf)

  • 检查配置
[root@fzdb1 trace]# su - oracle2
[oracle2@fzdb1 ~]$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 1031748
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 3047
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[oracle2@fzdb1 ~]$ ulimit -u
3047
[root@fzdb1 ~]# grep proc /etc/security/limits.conf
nproc - max number of processes
priority - the priority to run user process with
@student hard nproc 20
@faculty soft nproc 20
@faculty hard nproc 50
ftp hard nproc 0
oracle soft nproc 3047
oracle hard nproc 16384
grid soft nproc 3047
grid hard nproc 16384

  • 问题分析:

从上面检查我们可以发现oracle2的用户进程数量已经达到了1491,几乎接近oracle2用户的user processes数量,所以数据库日志里面频繁出现大量的ORA-27300,ORA-27301,ORA-27302,根据MOS:392006.1建议修改/etc/security/limits.conf文件里的oracle2 nproc值为更大的值,但是实际上我们并没有发现有关于oracle2用户的配置,所以我们手工添加如下配置后重启数据库服务器就可以了:

oracle2         soft    nproc           16384
oracle2         hard    nproc           16384
oracle2         soft    nofile          65536
oracle2         hard    nofile          65536
oracle2         soft    memlock         3145728
oracle2         hard    memlock         3145728
  • 重启服务器:
[oracle2@fzdb1 ~]$ su - root
[root@fzdb1 ~]$ reboot
  • 检查刚才的参数修改:

[oracle2@fzdb1 ~]$ ulimit -u
16384
  • 检查数据库日志:
  •    修改参数之后通过一天的观察未见ORA-27300,ORA-27301,ORA-27302等报错信息,此故障处理完毕。
发表在 Error, Oracle, 数据库 | 留下评论

小记基于控制文件的scn不完全恢复

问题现象:

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/DBSoft/oracle/oradata/woo/system01.dbf'

 

日志中报错:

alter database open
Errors in file /DBSoft/oracle/diag/rdbms/woo/woo/trace/woo_ora_24956.trc:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
ORA-1589 signalled during: alter database open...
Sun Dec 24 05:44:45 2017
Signalling error 1152 for datafile 1!
Signalling error 1152 for datafile 2!
Signalling error 1152 for datafile 3!
Signalling error 1152 for datafile 4!
Signalling error 1152 for datafile 5!
Checker run found 5 new persistent data failures
Sun Dec 24 05:44:51 2017
alter database open resetlogs
Signalling error 1152 for datafile 1!
ORA-1152 signalled during: alter database open resetlogs...
问题分析:
做完recover database正要起库,发现data file 1需要恢复,那么这个时候就应该要想到需要做不完全恢复了。那么不完全恢复自然有四种,基于时间(time)恢复
  基于取消(cancel)恢复
  基于SCN(change)恢复
  基于备份控制文件(unsing backup controlfile)的恢复,那么接下来我们需要了解下,用那种方式最合适了。
查看scn信息:
查看数据文件头部的scn信息:
SQL> select checkpoint_change# from v$datafile_header;

CHECKPOINT_CHANGE#
------------------
	   2247792
	   2247792
	   2247792
	   2247792
	   2247792

 

查看控制文件中记录的scn头部信息:

SQL> select checkpoint_change# from v$datafile;

CHECKPOINT_CHANGE#
------------------
	   2247974
	   2247974
	   2247974
	   2247974
	   2247974
          在这里我们可以很清楚的看到控制文件中记录的scn信息比数据文件头部记录的scn信息更新,且所有数据文件头部信息是一致的,由此可以快速得出,我们将数据库恢复到数据文件的scn这样数据库就可以打开了。
做基于文件头部的scn恢复:
SQL> recover database until change 2247792;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

 

提示需要使用控制文件来做基于scn的恢复。
使用控制文件来做基于scn的恢复:
SQL> recover database until change 2247792 using backup controlfile;
Media recovery complete.

SQL> select * from v$recover_file

     FILE# ONLINE  ONLINE_ ERROR	 CHANGE# TIME
---------- ------- ------- ---------- ---------- ------------------
	 1 ONLINE  ONLINE		 2247792 23-DEC-17
	 2 ONLINE  ONLINE		 2247792 23-DEC-17
	 3 ONLINE  ONLINE		 2247792 23-DEC-17
	 4 ONLINE  ONLINE		 2247792 23-DEC-17
	 5 ONLINE  ONLINE		 2247792 23-DEC-17

 

恢复完成之后,执行open resetlogs:

SQL> alter database open resetlogs;

Database altered.

 

检查:
SQL> col error format a10;
SQL> select * from v$recover_file;

no rows selected

SQL> select checkpoint_change# from v$datafile_header;

CHECKPOINT_CHANGE#
------------------
	   2247797
	   2247797
	   2247797
	   2247797
	   2247797

SQL> select checkpoint_change# from v$datafile;

CHECKPOINT_CHANGE#
------------------
	   2247797
	   2247797
	   2247797
	   2247797
	   2247797

 

总结:必须保证数据文件头部的scn和控制文件中的scn信息保持一致,数据库才能打开,那么正常恢复将遵循就近,就小来恢复。

发表在 Uncategorized | 标签为 | 小记基于控制文件的scn不完全恢复已关闭评论