[root@localhost ~]# vi /etc/exports
#增加
/nfs 192.168.10.132(rw,no_root_squash,no_all_squash,async)
[root@testdg ~]# mount -t nfs 192.168.10.20:/nfs /rman
mount.nfs: Input/output error
NFS服务系统重启后自动运行
[root@testdg ~]# chkconfig --list nfs
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@testdg ~]# chkconfig nfs on
[root@testdg ~]# chkconfig --list nfs
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
NFS挂载共享目录
[root@testdg ~]# showmount -e 192.168.10.20
Export list for 192.168.10.20:
/nfs 192.168.10.132
[root@testdg ~]# mount -t nfs 192.168.10.20(NFS机器IP):/nfs /rman
mount.nfs: Input/output error
--这里主要是服务没启动导致的,启动下就可以了
[root@testdg ~]# service portmap status
portmap is stopped
[root@testdg ~]# service portmap start
Starting portmap: [ OK ]
[root@testdg ~]# service portmap status
portmap (pid 5183) is running...
查看是否成功
[root@testdg ~]# df -h |grep /rman
192.168.10.20:/nfs 2.0T 1.2T 686G 65% /rman
现在已经挂上了。。。
NFS备份自动挂载和卸载
[oracle@test-db01 ~]$ crontab -l
00 03 * * 1,4 /home/oracle/dba/backup/backup_datafile_nas.sh
--NFS 有时不大稳定,现在让其在备份时候才挂上,备份完再去掉
[oracle@test-db01 ~]$
[oracle@test-db01 ~]$ cat /home/oracle/dba/backup/backup_datafile_nas.sh
#!/bin/bash
sudo mount -l |grep /rman
if [ $? -ne 0 ]
then
sudo mount -t nfs 192.168.10.20:/nfs /rman
sudo mount -l |grep /rman
if [ $? -ne 0 ]
then
exit
fi
fi
source /home/oracle/.bash_profile
$ORACLE_HOME/bin/rman target / log=/home/oracle/dba/backup/log/rman_backup_nas_`date +%m%d`.log append <<EOF
run
{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
allocate channel ch4 device type disk;
backup as compressed backupset database format '/rman/db_%d_%T_%U_full.bak';
backup current controlfile format '/rman/ctl_%d_%T_%U.bak';
backup as compressed backupset archivelog all format '/rman/arch_%d_%T_%U_full.bak';
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}
EOF
sudo umount -l /rman