22 error linux
2017-05-24 17:38:32 weixin_38116011 阅读数 146

1.关于SMTP的基本配置:

##**环境配置**

重置两台虚拟机
对desktop
vim /etc/sysconfig/network-scripts/ifcfg-eth0    ##**网络配置**
BOOTPROTO=none
IPADDR=172.25.254.141
PREFIX=24
systemctl restart network            ##**重启网络**
vim /etc/yum.repos.d/...            ##**编辑yum源**
yum clean all                    ##**清除yum缓存**
hostnamectl set-hostname westos-mail.westos.com

dns解析
yum install bind -y
systemctl start named
vim /etc/named.conf
11 //      listen-on port 53 { 127.0.0.1; };
12 //      listen-on-v6 port 53 { ::1; };
17 //      allow-query     { localhost; };
32         dnssec-validation no;
vim  /etc/named.rfc1912.zones
zone "westos.com" IN {
        type master;
        file "westos.com.zone";
        allow-update { none; };
};

zone "qq.com" IN {
        type master;
        file "qq.com.zone";
        allow-update { none; };
};
vim /var/named/westos.com.zone
$TTL 1D
@    IN SOA    dns.westos.com. root.westos.com. (
                    0    ; serial
                    1D    ; refresh
                    1H    ; retry
                    1W    ; expire
                    3H )    ; minimum
            NS    dns.westos.com.
dns            A    172.25.254.141
westos.com.        MX 1    172.25.254.141.
vim /var/named/qq.com.zone
systemctl restart named
vim /etc/resolv.conf
nameserver 172.25.254.141


对server
vim /etc/sysconfig/network-scripts/ifcfg-eth0   ##**网络配置**
vim /etc/yum.repos.d/...
yum clean all
hostnamectl set-hostname qq-mail.qq.com
vim /etc/resolv.conf
nameserver 172.25.254.141

dig -t mx qq.com                                     ####查看此域名是否真常##
dig -t mx westos.com                            ####查看此域名是否真常##



##**postfix**

1.
postfix提供smtp协议用来投递邮件
默认端口25
/var/log/maillog    ##**mail日志存放点**
发送邮件
mail root@qq.com
Subject: www
sadad
afdad
.            ##**.表示邮件结束**
EOT

mailq            ##**查看邮件队列**
postqueue -f        ##**重发邮件队列**
postsuper -d        ##**清除邮件队列**
默认情况下邮件端口只在127.0.0.1上开启


2.主要配置(都配置)
(1)
vim /etc/postfix/main.cf         ##**编辑配置文件**
76 myhostname = westos-mail.westos.com    ##**指定mta主机名称**
83 mydomain = westos.com        ##**指定mta主机域名**
99 myorigin = westos.com        ##**指定邮件来源结尾(即@后的字符)**
119 inet_protocols = all        ##**25端口开启的网络接口**
164 mydestination = $myhostname, $mydomain, localhost, westos.com    ##**接受邮件结尾字符(即@westos-mail.westos.com  @westos.com  root)**
systemctl stop firewalld        ##**关闭火墙**
systemctl restart postfix.service    ##**重启服务**

(2)测试:
mail 查看邮件


3.邮件别名
(1)
在收端编辑:
[root@qq-mail ~]# vim /etc/aliases    ##**编辑文件**
别名:    真名
别名:    :include:filename        ##**群发邮件(filename可以为/etc/postfix/moreuser)**
[root@qq-mail ~]# vim filename        ##**编辑更多user文件**    
user1
user2

[root@westos-mail ~]# postalias /etc/aliases


(2)测试:
————发端————
mail 别名@qq.com
————收端————
mail查看邮件
mail -u username


4.通过远程主机发送邮件
(1)
远程主机(这里使用真机)
yum install telnet -y                ##**下载telnet**
[root@foundation41 ~]# telnet 172.25.254.141 25    ##**远程通过172.25.254.141的25端口**
Trying 172.25.254.141...
Connected to 172.25.254.141.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
ehlo hello            ##****
250-westos-mail.westos.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:root@westos.com    ##**邮件发送端**
250 2.1.0 Ok
rcpt to:root@qq.com        ##**邮件接受端**
250 2.1.5 Ok
data                ##**邮件内容**
354 End data with <CR><LF>.<CR><LF>
assdf                ##**由此键入**
fafaf
fafaf
.                ##**结束点**
250 2.0.0 Ok: queued as 13873246204
quit                ##**退出**
221 2.0.0 Bye
Connection closed by foreign host.

(2)测试:
接受端:
mail 查看邮件


5.邮件访问控制
(1)
在mta上
发送端:
[root@westos-mail ~]# postconf -e "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access                ##****
[root@westos-mail ~]# tail -n 1 /etc/postfix/main.cf     ##**查看主配置文件的最后一行会发现参数已经添加**
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access
[root@westos-mail ~]# vim /etc/postfix/access        ##**编辑加密文件**
476 172.25.254.41 REJECT                ##**最后一行添加要拒绝的主机**
[root@westos-mail ~]# postmap /etc/postfix/access    ##**加密文件**
[root@westos-mail ~]# ls /etc/postfix/            ##**.db为真实的加密文件**
access     canonical  header_checks  master.cf  relocated  virtual
access.db  generic    main.cf        moreuser   transport
[root@westos-mail ~]# systemctl restart postfix.service     ##**重启服务**

(2)测试:
[root@foundation41 ~]# telnet 172.25.254.141 25
Trying 172.25.254.141...
Connected to 172.25.254.141.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
mail from:root@westos.com
250 2.1.0 Ok
rcpt to:root@qq.com
554 5.7.1 <unknown[172.25.254.41]>: Client host rejected: Access denied                    ##**发送邮件时发现被拒绝**
quit
221 2.0.0 Bye
Connection closed by foreign host.


6.限制用户发送
(1)
首先清除上次实验的控制
[root@westos-mail ~]# vim /etc/postfix/main.cf    ##**注释掉邮件访问控制语句**
#smtpd_client_restrictions = check_client_access hash:/etc/postfix/access
 
(2)
然后再开始实验
在mta上:
[root@westos-mail ~]# postconf -e "smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender"        ##**限制用户发送邮件,使用哈希在/etc/postfix/sender加密**
[root@westos-mail ~]# tail -n 1 /etc/postfix/main.cf     ##**查看主配置文件发现参数已经添加**
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender
[root@westos-mail ~]# vim /etc/postfix/sender    ##**编辑加密文件,写入要加密的用户**
student@westos.com REJECT
[root@westos-mail ~]# postmap /etc/postfix/sender     ##**对加密文件进行加密**
[root@westos-mail ~]# ls /etc/postfix/             ##**sender.db即生成的加密文件**
access     canonical  header_checks  master.cf  relocated  sender.db  virtual
generic    main.cf        moreuser   sender     transport
[root@westos-mail ~]# systemctl restart postfix.service ##**重启服务**

(3)测试:
[root@foundation41 Desktop]# telnet 172.25.254.141 25
Trying 172.25.254.141...
Connected to 172.25.254.141.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
mail from:student@westos.com
250 2.1.0 Ok
rcpt to:root@qq.com
554 5.7.1 <student@westos.com>: Sender address rejected: Access denied    ##**发送被限制**


7.限制用户接收
(1)
在mta上:
[root@westos-mail ~]# postconf -e "smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip"    ##**限制用户接受文件,使用哈希加密在/etc/postfix/recip加密**
[root@westos-mail ~]# vim /etc/postfix/recip    ##**编辑加密文件,写入加密用户**
westos@westos.com REJECT
[root@westos-mail ~]# postmap /etc/postfix/recip     ##**对加密文件进行加密,生成.db文件**
[root@westos-mail ~]# ls /etc/postfix/
access     generic        main.cf    moreuser  recip.db   sender     transport
canonical  header_checks  master.cf  recip     relocated  sender.db  virtual
[root@westos-mail ~]# systemctl restart postfix.service ##**重启服务**

(2)测试:
[root@foundation41 Desktop]# telnet 172.25.254.141 25
Trying 172.25.254.141...
Connected to 172.25.254.141.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
mail from:westos@westos.com    ##**发送者**
250 2.1.0 Ok
rcpt to:root@qq.com        ##**接收者**
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
123
1213
.
250 2.0.0 Ok: queued as 06562EAC27 ##**由此看出westos@westos.com可以发送邮件**
mail from:root@qq.com
250 2.1.0 Ok
rcpt to:westos@westos.com
554 5.7.1 <westos@westos.com>: Recipient address rejected: Access denied ##**由此看出不能接受邮件**
quit
221 2.0.0 Bye
Connection closed by foreign host.


8.出站地址伪装
(1)
[root@westos-mail ~]# postconf -e "smtp_generic_maps = hash:/etc/postfix/generic"        ##**出站地址伪装**
[root@westos-mail ~]# vim /etc/postfix/generic        ##**编辑地址伪装文件**
真实名称        伪装名称
westos@westos.com    hello@gmail.com

[root@westos-mail ~]# postmap /etc/postfix/generic    ##**进行加密**
[root@westos-mail ~]# systemctl restart postfix.service ##**重启服务**

(2)测试:
[root@westos-mail ~]# su - westos
[westos@westos-mail ~]$ mail root@qq.com

[root@qq-mail ~]# mail
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/root": 2 messages 2 new
>N  1 westos@westos.com     Sat May 20 21:44  14/492   
 N  2 hello@gmail.com       Sat May 20 22:30  22/727   "123"


9.入站地址转换
(1)
[root@westos-mail ~]# vim /etc/postfix/main.cf     ##**编辑主配置文件,注释westos用户不能收件的功能**
#smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip

(2)DNS解析
[root@westos-mail ~]# vim /etc/named.rfc1912.zones
zone "gmail.com" IN {
        type master;
        file "gmail.com.zone";
        allow-update { none; };
};

[root@westos-mail ~]# cp -p /var/named/westos.com.zone /var/named/gmail.com.zone
[root@westos-mail ~]# vim /var/named/gmail.com.zone
把westos换成gmail
[root@westos-mail ~]# systemctl restart named

dig -t mx gmail.com

(3)转换地址
[root@westos-mail ~]# postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual"        ##**入站地址转换**
[root@westos-mail ~]# vim /etc/postfix/virtual    ##**编辑虚拟地址转换文件**
虚拟名称    真实名称
hello@gmail.com    westos@westos.com

[root@westos-mail ~]# postmap /etc/postfix/virtual    ##**进行加密**    
[root@westos-mail ~]# systemctl restart postfix.service ##**重启服务**

(4)测试
[root@qq-mail ~]# mail hello@gmail.com        ##**向hello@gmail.com回复邮件**

[root@westos-mail ~]# mail -u westos
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/mail/westos": 1 message
>   1 root                  Sat May 20 22:39  23/731   "2333"
& 1
Message  1:
From root@qq.com  Sat May 20 22:39:54 2017
Return-Path: <root@qq.com>
X-Original-To: hello@gmail.com        ##**虚拟名称**
Delivered-To: westos@westos.com        ##**转换成了真实名称**


#####出站地址伪装和入站地址转换构成了企业邮箱功能


##**dovecot**
1.
/etc/services  端口文件
dovecot 用来提供收件协议
pop3    110
imap    143
imaps    993
pop3s    995

给定用户名称,用户密码,dovecot程序代我们去看这个用户的邮件文件

2.下载
yum install dovecot -y        ##**下载dovecot**

3.配置
vim /etc/dovecot/dovecot.conf         ##**编辑主配置文件**
24 protocols = imap pop3 lmtp        ##**使用imap pop3 lmtp协议**
48 login_trusted_networks = 0.0.0.0/0    ##**全网访问**
49 disable_plaintext_auth = no        ##**使用明文密码登陆**

vim /etc/dovecot/conf.d/10-mail.conf             ##**编辑子配置文件**
30 mail_location = mbox:~/mail:INBOX=/var/mail/%u    ##**用户邮件所在地**
#mbox - mail's box
#~/mail - 用户家目录/mail
#INBOX=/var/mail/%u - INBOX中存放的是/var/mail/%u中的文件
#%u - username

systemctl restart dovecot        ##**重启服务**

[root@westos-mail ~]# su - westos     ##**切换westos用户**
[westos@westos-mail ~]$ pwd
/home/westos
[westos@westos-mail ~]$ mkdir mail/.imap/ -p    ##**建立邮件目录**
[westos@westos-mail ~]$ touch mail/.imap/INBOX    ##**建立邮件存储文件**


[root@westos-mail ~]# mkdir /etc/skel/mail/.imap -p    ##**建立用户(新建立的所有)邮件目录**
[root@westos-mail ~]# touch /etc/skel/mail/.imap/INBOX    ##**建立用户(新建立的所有)邮件存储文件**


4.测试
mutt -f pop://westos@172.25.254.141    ##**查看邮件**



##**postfix+mysql**

1.数据库基础设置
yum install httpd  php php-mysql.x86_64 mariadb-server.x86_64 -y
mv /etc/postfix/main.cf /mnt        ##**备份配置文件**
yum reinstall postfix.x86_64         ##**重新下载**
vim /etc/postfix/main.cf         
systemctl restart postfix.service     
systemctl start mariadb
mysql_secure_installation        ##**数据库安全证书初始化**
tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2 -C /var/www/html/
rm *.bz2 -f
mv phpMyAdmin-3.4.0-all-languages/ admin/
cp /var/www/html/admin/config.sample.inc.php /var/www/html/admin/config.sample.php
vim /var/www/html/admin/config.sample.php
vim /etc/my.cnf
systemctl restart mariadb
systemctl restart httpd
-----web建立表格
mysql -uroot -pwestos
create user postuser@localhost identified by 'postuser';    ##**建立数据库用户**
grant select,update,insert on email.* to postuser@localhost;    ##**授权**


2.设置postfix
(1)用户名查询
vim /etc/postfix/mailuser.cf    ##**用户名查询**
hosts = localhost        ##**数据库所在主机**
user = postuser            ##**登陆数据库的用户**
password = postuser        ##**登陆数据库的用户的密码**
dbname = email            ##**postfix要查询的库名称**
table = emailuser        ##**postfix要查询的表的名称**
select_field = username        ##**postfix要查询的字段**
where_field = username        ##**用户给定的postfix的查询条件**

(2)用户域名查询
vim /etc/postfix/maildomain.cf     ##**用户域名查询**
hosts = localhost
user = postuser
password = postuser
dbname = email
table = emailuser
select_field = domain
where_field = domain

(3)用户邮箱位置查询        
vim /etc/postfix/mailbox.cf     ##**用户邮箱位置查询**
hosts = localhost
user = postuser
password = postuser
dbname = email
table = emailuser
select_field = maildir
where_field = username

(4)测试
[root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:/etc/postfix/mailuser.cf
lee@lee.com
[root@westos-mail postfix]# postmap -q "lee.com" mysql:/etc/postfix/maildomain.cf
lee.com
[root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:/etc/postfix/mailbox.cf
/mnt/lee.com/lee/


3.配置postfix
(1)
groupadd -g 666 vmail
useradd -s /sbin/nologin -u 666 vmail -g 666

(2)
postconf -e "virtual_mailbox_base = /home/vmail"
postconf -e "virtual_uid_maps = static:666"
postconf -e "virtual_alias_maps = mysql:/etc/postfix/mailuser.cf"
postconf -e "virtual_mailbox_domains = mysql:/etc/postfix/maildomain.cf"
postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mailbox.cf"
systemctl restart postfix.service

(3)
mail lee@lee.com
ls /home/vmail


















              关于team链路聚合的学习--------------
1.team也是链路聚合的一种方式
最多支持八块网卡
支持模式:
广播,轮询,主备,负载均衡
2.配置
 nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.142/24
 nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
 nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
3.测试
 /watch -n 1 teamdctl team0 stat    ####监测工作状态
 /ping 172.25.254.42             ####查看网络连接状态
 /ifconfig eth0 down            
 ifconfig eth0 up

[root@foundation42 Desktop]# rht-vmctl poweroff desktop  ####关掉虚拟机
Powering off desktop..
[root@foundation42 Desktop]#
[root@foundation42 Desktop]# cd /etc/sysconfig/network-scripts/
[root@foundation42 network-scripts]# ls
ifcfg-br0      ifdown-isdn      ifup-bnep   ifup-routes
ifcfg-enp0s25  ifdown-post      ifup-eth    ifup-sit
ifcfg-lo       ifdown-ppp       ifup-ib     ifup-Team
ifcfg-wlp3s0   ifdown-routes    ifup-ippp   ifup-TeamPort
ifdown         ifdown-sit       ifup-ipv6   ifup-tunnel
ifdown-bnep    ifdown-Team      ifup-isdn   ifup-wireless
ifdown-eth     ifdown-TeamPort  ifup-plip   init.ipv6-global
ifdown-ib      ifdown-tunnel    ifup-plusb  network-functions
ifdown-ippp    ifup             ifup-post   network-functions-ipv6
ifdown-ipv6    ifup-aliases     ifup-ppp
[root@foundation42 network-scripts]# mv ifcfg-br0 ifcfg-enp0s25 /mnt/  ####备份br0
[root@foundation42 network-scripts]# nm-connection-editor    ####删掉system enp0s25 和 bridge enp0s25
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

** (nm-connection-editor:5872): WARNING **: Unsupported connection type 'generic'

** (nm-connection-editor:5872): WARNING **: Unsupported connection type 'generic'
[root@foundation42 network-scripts]# vim ifcfg-enp0s25  ####编写配置   
DEVICE=enp0s25
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.42
NETMASK=255.255.255.0

[root@foundation42 network-scripts]# systemctl stop NetworkManager.service  ###关掉服务
[root@foundation42 network-scripts]# systemctl restart network   ####重启网络
[root@foundation42 network-scripts]# ls
ifcfg-enp0s25  ifdown-post      ifup-eth     ifup-sit
ifcfg-lo       ifdown-ppp       ifup-ib      ifup-Team
ifcfg-wlp3s0   ifdown-routes    ifup-ippp    ifup-TeamPort
ifdown         ifdown-sit       ifup-ipv6    ifup-tunnel
ifdown-bnep    ifdown-Team      ifup-isdn    ifup-wireless
ifdown-eth     ifdown-TeamPort  ifup-plip    init.ipv6-global
ifdown-ib      ifdown-tunnel    ifup-plusb   network-functions
ifdown-ippp    ifup             ifup-post    network-functions-ipv6
ifdown-ipv6    ifup-aliases     ifup-ppp
ifdown-isdn    ifup-bnep        ifup-routes
            -------------------网桥---------------
真实主机中
[root@foundation42 ~]# cd /etc/sysconfig/network-scripts/
[root@foundation42 network-scripts]# vim ifcfg-enp0s25
DEVICE=enp0s25     ####设备名称
ONBOOT=yes         ####开启服务设备自动激活
BOOTPROTO=none     ####网卡工作状态
BRIDGE=br0         ####网卡开启的网桥接口

[root@foundation42 network-scripts]# vim ifcfg-br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.42
NETMASK=255.255.255.0
TYPE=Bridge         ####网络接口类型是桥接

[root@foundation42 network-scripts]# systemctl stop NetworkManager.service   ####服务用来记录网卡位置
[root@foundation42 network-scripts]# systemctl restart network   ####重启网络
[root@foundation42 network-scripts]# systemctl start  NetworkManager.service
[root@foundation42 network-scripts]# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.25.254.42  netmask 255.255.255.0  broadcast 172.25.254.255
        inet6 fe80::221:ccff:feb8:6c5d  prefixlen 64  scopeid 0x20<link>
        ether 00:21:cc:b8:6c:5d  txqueuelen 0  (Ethernet)
        RX packets 40  bytes 4311 (4.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 24  bytes 3144 (3.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
/恢复:
[root@foundation42 network-scripts]# mv ifcfg-br0 ifcfg-enp0s25 /mnt/  ####备份br0
[root@foundation42 network-scripts]# vim ifcfg-enp0s25  ####编写配置
DEVICE=enp0s25
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.42
NETMASK=255.255.255.0

---命令管理方式--
虚拟主机中
添加:
nm-connection-editor  ###删除team0
systemctl stop NetworkManager.service   ####服务用来记录网卡位置
brctl show         ####显示网桥
brctl addbr br0    ###添加网桥
brctl addif br0 eth0   ####添加网桥的接口到eth0
ifconfig eth0 up       ####开启接口
ifconfig br0 172.25.254.142 netmask 255.255.255.0   ####配置br0
brctl show     ####显示网桥
ping 172.25.254.250    ####查看网络状态

删除:
ifconfig br0 down   ####关掉br0
brctl delif br0 eth0  ####断开网桥接口
brctl delbr br0      ###删除接口
brctl show            ####显示网桥

----------ipv6---------
1.internet proto version 6
ipv4  32/2      地址枯竭  子网掩码 24 16 8
iopv6 128/2     子网 16 32 48 64 80
128/2  --------> 128/8       16 ------> 0-f
2017:0:0:0:f:0:0:1

重置虚拟机
systemctl stop NetworkManager.service   ####服务用来记录网卡位置
vim /etc/sysconfig/network-scripts/eth0
 DEVICE=eth0
 ONBOOT=yes
 BOOTPROTO=none
 IPADDR=172.25.254.142
 NETMASK=255.255.255.0
 IPV6INIT=yes
 IPV6_AUTOCONF=no
 IPV6ADDR=2017::42/64

systemctl restart network
ping6 2017::a


2018-05-02 11:20:47 qq_41869566 阅读数 41
数据库

数据库的类型
db2  oracle   mysql(mariadb)   sqlserver

数据库相当于高级的excel表格,其中的字段相当于

一、数据库的设置


 1.重置虚拟机,修改网络配置、主机名和yum源

 vim /etc/sysconfig/network-scripts/ifcfg-eth0


 hostnamectl set-hostname testdb.westos.com(修改主机名字)


 vim /etc/yum.repos.d/yum.repo



 2.安装数据库(mariadb)服务
  若不知道mariadb的安装包:
 [root@testdb ~]# yum search mariadb
 

 yum install mariadb-server.x86_64 -y




 3.数据库相关设置
  打开并设置开启自启动
 [root@testdb ~]# systemctl start mariadb

 [root@testdb ~]# systemctl enable mariadb



  查看数据库接口mysql    ##3306接口打开不安全
 [root@testdb ~]# netstat -antuple | grep mysql

 tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      27         68511      3272/mysqld



  关闭数据库接口(修改配置文件/etc/my.cnf)
 skip-networking=1
 [mysqld_safe]
 log-error=/var/log/mariadb/mariadb.log

 pid-file=/var/run/mariadb/mariadb.pid


(修改配置文件后重起服务systemctl restart mariadb)

 

重启后再次查看数据库接口

 [root@testdb ~]# netstat -antuple | grep mysql

  

修改数据库密码 mysql_secure_installation  

 Enter current password for root (enter for none):
 Set root password? [Y/n] Y
 Remove anonymous users? [Y/n]
 Disallow root login remotely? [Y/n]
 Remove test database and access to it? [Y/n]

 Reload privilege tables now? [Y/n]


 
 登陆数据库   ##注意:密码不要写在-p后(quit退出)
 [root@testdb ~]# mysql -uroot -p
 Enter password:
 
二、数据库编辑

 1.显示数据库(相当于ls)
MariaDB [(none)]> show databases;  (注意:命令以;结尾)


 2.进入数据库(相当于cd)
MariaDB [(none)]> use mysql;      ##切换到mysql数据库中
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

 3.显示数据库中的表格(相当于ls)


 4.查询user表中的Host,User,Password信息
MariaDB [mysql]> select Host,User,Password from user;


 5.查询user表的数据结构  desc user;
MariaDB [mysql]> desc user;
  

 6.新建数据库 create database westos;
MariaDB [(none)]> create database westos;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| westos             |
+--------------------+

 7.新建数据库westos中的表格  create table linux
MariaDB [(none)]> use westos;
Database changed
MariaDB [westos]> show tables;
Empty set (0.00 sec)

MariaDB [westos]> create table linux (
    -> username varchar(50) not null,    ##字符类型为char,不能为空
    -> password varchar(50) not null     ##字符类型为char,不能为空
    -> );
Query OK, 0 rows affected (0.01 sec)

MariaDB [westos]> show tables;


 8.在linux表格中插入信息  insert into linux values('hi','1234');
MariaDB [westos]> insert into linux values('hi','1234');
Query OK, 1 row affected (0.01 sec)

MariaDB [westos]> select * from linux;   ##查看linux表格中的所有信息


 9.修改linux表格中的信息(例:password)
MariaDB [westos]> update linux set password='01230' where username='hi';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0



 10.在linux表格中添加age字段
MariaDB [westos]> alter table linux add age varchar(4) after username;
Query OK, 2 rows affected (0.05 sec)               
Records: 2  Duplicates: 0  Warnings: 0

MariaDB [westos]> select * from linux;


 11.在linux表格中移除age字段
MariaDB [westos]> alter table linux drop age;
Query OK, 2 rows affected (0.03 sec)               
Records: 2  Duplicates: 0  Warnings: 0

MariaDB [westos]> select * from linux;

 
 12.修改表格名字
MariaDB [westos]> alter table linux rename mydata;
Query OK, 0 rows affected (0.01 sec)

MariaDB [westos]> show tables;
+------------------+
| Tables_in_westos |
+------------------+
| mydata           |
+------------------+

 13.删除表格中的某一行
MariaDB [westos]> delete from mydata where username='hi';
Query OK, 1 row affected (0.01 sec)

MariaDB [westos]> select * from mydata;
+----------+----------+
| username | password |
+----------+----------+
| hello    | 123      |
+----------+----------+

 14.删除表格
MariaDB [westos]> drop table mydata;
Query OK, 0 rows affected (0.01 sec)

MariaDB [westos]> show tables;
Empty set (0.00 sec)

 15.删除数据库
MariaDB [westos]> drop database westos;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show databases;


三、数据库用户管理

 1.用户创建  
MariaDB [(none)]> create user hate@localhost identified by 'redhat';
Query OK, 0 rows affected (0.00 sec)
  ##hate@localhost 本地用户    ##hate@‘%’ 远程用户

 2.用户授权
MariaDB [(none)]> grant INSERT,SELECT on westos.* to hate@localhost;

Query OK, 0 rows affected (0.01 sec)


  查看用户权限
MariaDB [(none)]> show grants for hate@localhost;

 
 3.此时用hate用户登陆实验
  具备select权限,可以查看westos数据库:
MariaDB [(none)]> show databases;

  具备insert权限,可以在westos.linux表格中插入:
MariaDB [(none)]> insert into westos.linux values('hi','123');
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> select * from westos.linux;
+----------+----------+
| username | password |
+----------+----------+
| hello    | 123      |
| hi       | 123      |
+----------+----------+
  不具备delete权限,不能删除:
MariaDB [(none)]> delete from westos.linux where username='hi';
ERROR 1142 (42000): DELETE command denied to user 'hate'@'localhost' for table 'linux'

 4.撤销用户权限(切换root用户)
MariaDB [(none)]> revoke INSERT on westos.* from hate@localhost;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show grants for hate@localhost;
 
 
 5.重载授权表  flush privileges
MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)



 6.删除用户
MariaDB [(none)]> drop user hate@localhost;

Query OK, 0 rows affected (0.00 sec)




四、数据库资料备份

 1.数据库资料备份方式
mysqldump -uroot -predhat --all-database > /mnt/westos.all   ##所有数据库资料备份
mysqldump -uroot -predhat --all-database --no-data > /mnt/westos.err  ##只备份数据结构,不备份数据

mysqldump -uroot -predhat westos > /mnt/westos.sql  ##指定westos数据库的资料备份



 2.数据恢复
  注意:当备份的数据库不存在时,会报错(例:删除westos数据库)
[root@testdb ~]# mysql -uroot -predhat < /mnt/westos.sql

ERROR 1046 (3D000) at line 22: No database selected



  恢复方式1:修改备份文件  /mnt/westos.sql
CREATE DATABASE westos;
USE westos;
DROP TABLE IF EXISTS `linux`;
[root@testdb ~]# mysql -uroot -predhat < /mnt/westos.sql
  恢复后,登陆数据库查看
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| westos             |
+--------------------+

  恢复方式2:建立westos数据库
[root@testdb ~]# mysql -uroot -predhat -e "create database westos;"
[root@testdb ~]# mysql -uroot -predhat westos < /mnt/westos.sql
  登陆数据库查看
MariaDB [(none)]> show databases;


五、用户密码更改

 1.若用户密码忘记,关闭数据库服务,跳过认证列表
[root@testdb ~]# systemctl stop mariadb.service
[root@testdb ~]# mysqld_safe --skip-grant-tables &
[1] 2678
[root@testdb ~]# 180428 01:33:00 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
180428 01:33:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

 2.进入数据库修改(mysql回车即可)
MariaDB [(none)]> update mysql.user set Password='redhat' where User='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

 查看密码 select * from mysql.user  ##以上修改密码为明文
  | localhost | root | redhat     | Y

 以加密方式修改密码:
MariaDB [mysql]> update mysql.user set Password=password('123') where User='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

 再次查看密码(mysql.user):
| localhost | root | *23AE809DDACAF96AF0FD78ED04B6A265E05AA257 | Y

 3.查看mysql相关进程,全部关闭
[root@testdb ~]# ps aux | grep mysql
root      3228  0.0  0.1 113252  1560 pts/1    S    01:44   0:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables
mysql     3383  0.1  9.2 859064 89276 pts/1    Sl   01:44   0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --skip-grant-tables --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root      3416  0.0  0.0 112640   936 pts/1    R+   01:45   0:00 grep --color=auto mysql
  关闭后重启mysql服务,新密码登陆即可
[root@testdb ~]# systemctl restart mariadb.service
[root@testdb ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.35-MariaDB MariaDB Server




2017-05-07 15:53:28 qingyuanluofeng 阅读数 247

例3:设置时间为下午14点36分。
date -s 12:04:00
Fri Nov 26 14:15:00 CST 1999
例4:设置时间为1999年11月28号。
date -s 991128
Sun Nov 28 00:00:00 CST 1999
写入时钟
clock -w

2014-10-24 11:45:00 weixin_34072159 阅读数 51

在Linux服务器(虚拟机)上使用fdisk添加分区、格式化分区后,遇到了Linux Error: 22: Invalid argument错误,操作步骤如下所示

[root@oracle-server ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@oracle-server ~]# fdisk -l
 
Disk /dev/sda: 584.6 GB, 584646328320 bytes
255 heads, 63 sectors/track, 71079 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       19441   156151808   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2           19441       44937   204796672   83  Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3           44937       57685   102398336   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4           57685       71080   107595584    5  Extended
Partition 4 does not end on cylinder boundary.
/dev/sda5           57685       70433   102398336   83  Linux
/dev/sda6           70433       70949     4144768   82  Linux swap
/dev/sda7           70949       71080     1052288   83  Linux
 
Disk /dev/sdb: 146.1 GB, 146156158976 bytes
2 heads, 24 sectors/track, 5947109 cylinders
Units = cylinders of 48 * 512 = 24576 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               3     5947064   142729472   83  Linux
 
Disk /dev/sdc: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       13054   104856223+  83  Linux
 
Disk /dev/sdd: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdd doesn't contain a valid partition table
 
 
[root@oracle-server ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
 
The number of cylinders for this disk is set to 10443.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
 
Command (m for help): p
 
Disk /dev/sdd: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-10443, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10443, default 10443): 
Using default value 10443
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
 
[root@oracle-server ~]# mkfs.ext3 /dev/sdd1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
10485760 inodes, 20970841 blocks
1048542 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=20971520
640 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000
 
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 
 
[root@oracle-server ~]# more /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/1                /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/u01              /u01                    ext3    defaults        1 2
LABEL=/u02              /u02                    ext3    defaults        1 2
LABEL=/u03              /u03                    ext3    defaults        1 2
LABEL=SWAP-sda6         swap                    swap    defaults        0 0
/dev/sdb1               /u03/flash_recovery_area        ext3    defaults        1 2
/dev/sdc1               /u04                            ext3    defaults        1 2
192.168.4.21:/volume1/NFSforLinux/7222  /mnt/nfsbak     nfs     defaults        0 0
/dev/hda                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
 
 
[root@oracle-server ~]# vi /etc/fstab
 
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/1                /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/u01              /u01                    ext3    defaults        1 2
LABEL=/u02              /u02                    ext3    defaults        1 2
LABEL=/u03              /u03                    ext3    defaults        1 2
LABEL=SWAP-sda6         swap                    swap    defaults        0 0
/dev/sdb1               /u03/flash_recovery_area        ext3    defaults        1 2
/dev/sdc1               /u04                            ext3    defaults        1 2
/dev/sdd1               /u05                            ext3    defaults        1 2
192.168.7.63:/volume1/NFSforLinux/7222  /mnt/nfsbak     nfs     defaults        0 0
/dev/hda                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
 
"/etc/fstab" 17L, 1285C written
 
[root@oracle-server ~]# mkdir /u05
[root@oracle-server ~]# mount -a
[root@oracle-server ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             147G   90G   51G  65% /
/dev/sda7            1012M   34M  927M   4% /tmp
/dev/sda5              97G   78G   14G  86% /u01
/dev/sda3              97G   77G   15G  85% /u02
/dev/sda2             193G  165G   18G  91% /u03
/dev/sdb1             134G   95G   33G  75% /u03/flash_recovery_area
/dev/sdc1              99G   66G   28G  71% /u04
192.168.7.63:/volume1/NFSforLinux/7222
                      2.7T  1.9T  839G  70% /mnt/nfsbak
/dev/sdd1              79G   89M   75G   1% /u05
[root@oracle-server ~]# chown -R oracle:oinstall /u05
[root@oracle-server ~]# chmod -R 775 /u05
[root@oracle-server ~]# 

处理完成后,登录ORACLE数据库出现错误,检查告警日志,发现如下错误信息:

检查/var/log/messages ,没有发现什么错误信息

image

网上搜索到一篇资料(请见参考资料) 介绍了使用fdisk出现Linux Error: 22: Invalid argument的原因.

Run "kpartx -a" after FDISK is completed to add all partition mappings on the newly-created multipath device

当时没有使用这个命令去操作,因为不敢确认这个命令能否解决问题,于是重启Server来解决问题。下次遇到这种情况也可以使用kpartx命令试试。

kpartx -a /dev/sdd1

参考资料:

http://homyzh.blog.163.com/blog/static/31055124200982493216612/

2016-04-26 11:23:53 weixin_34349320 阅读数 6

在Linux服务器(虚拟机)上使用fdisk添加分区、格式化分区后,遇到了Linux Error: 22: Invalid argument错误,操作步骤如下所示

[root@oracle-server ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@oracle-server ~]# fdisk -l
 
Disk /dev/sda: 584.6 GB, 584646328320 bytes
255 heads, 63 sectors/track, 71079 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       19441   156151808   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2           19441       44937   204796672   83  Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3           44937       57685   102398336   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4           57685       71080   107595584    5  Extended
Partition 4 does not end on cylinder boundary.
/dev/sda5           57685       70433   102398336   83  Linux
/dev/sda6           70433       70949     4144768   82  Linux swap
/dev/sda7           70949       71080     1052288   83  Linux
 
Disk /dev/sdb: 146.1 GB, 146156158976 bytes
2 heads, 24 sectors/track, 5947109 cylinders
Units = cylinders of 48 * 512 = 24576 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               3     5947064   142729472   83  Linux
 
Disk /dev/sdc: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       13054   104856223+  83  Linux
 
Disk /dev/sdd: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdd doesn't contain a valid partition table
 
 
[root@oracle-server ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
 
The number of cylinders for this disk is set to 10443.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
 
Command (m for help): p
 
Disk /dev/sdd: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-10443, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10443, default 10443): 
Using default value 10443
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
 
[root@oracle-server ~]# mkfs.ext3 /dev/sdd1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
10485760 inodes, 20970841 blocks
1048542 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=20971520
640 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000
 
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 
 
[root@oracle-server ~]# more /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/1                /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/u01              /u01                    ext3    defaults        1 2
LABEL=/u02              /u02                    ext3    defaults        1 2
LABEL=/u03              /u03                    ext3    defaults        1 2
LABEL=SWAP-sda6         swap                    swap    defaults        0 0
/dev/sdb1               /u03/flash_recovery_area        ext3    defaults        1 2
/dev/sdc1               /u04                            ext3    defaults        1 2
192.168.4.21:/volume1/NFSforLinux/7222  /mnt/nfsbak     nfs     defaults        0 0
/dev/hda                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
 
 
[root@oracle-server ~]# vi /etc/fstab
 
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/1                /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/u01              /u01                    ext3    defaults        1 2
LABEL=/u02              /u02                    ext3    defaults        1 2
LABEL=/u03              /u03                    ext3    defaults        1 2
LABEL=SWAP-sda6         swap                    swap    defaults        0 0
/dev/sdb1               /u03/flash_recovery_area        ext3    defaults        1 2
/dev/sdc1               /u04                            ext3    defaults        1 2
/dev/sdd1               /u05                            ext3    defaults        1 2
192.168.7.63:/volume1/NFSforLinux/7222  /mnt/nfsbak     nfs     defaults        0 0
/dev/hda                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
 
"/etc/fstab" 17L, 1285C written
 
[root@oracle-server ~]# mkdir /u05
[root@oracle-server ~]# mount -a
[root@oracle-server ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             147G   90G   51G  65% /
/dev/sda7            1012M   34M  927M   4% /tmp
/dev/sda5              97G   78G   14G  86% /u01
/dev/sda3              97G   77G   15G  85% /u02
/dev/sda2             193G  165G   18G  91% /u03
/dev/sdb1             134G   95G   33G  75% /u03/flash_recovery_area
/dev/sdc1              99G   66G   28G  71% /u04
192.168.7.63:/volume1/NFSforLinux/7222
                      2.7T  1.9T  839G  70% /mnt/nfsbak
/dev/sdd1              79G   89M   75G   1% /u05
[root@oracle-server ~]# chown -R oracle:oinstall /u05
[root@oracle-server ~]# chmod -R 775 /u05
[root@oracle-server ~]# 

处理完成后,登录ORACLE数据库出现错误,检查告警日志,发现如下错误信息:

clip_image001

检查/var/log/messages ,没有发现什么错误信息

image

网上搜索到一篇资料(请见参考资料) 介绍了使用fdisk出现Linux Error: 22: Invalid argument的原因.

Run "kpartx -a" after FDISK is completed to add all partition mappings on the newly-created multipath device

当时没有使用这个命令去操作,因为不敢确认这个命令能否解决问题,于是重启Server来解决问题。下次遇到这种情况也可以使用kpartx命令试试。

kpartx -a /dev/sdd1

没有更多推荐了,返回首页