目的是备份数据库;又没与多余的硬盘空间,想挂载LINUX下的NFS 来实现;把步骤记录下来,供参考:


一、在LINUX 下把NFS 搭建完成;

[root@hostback ~]# rpm -qa |grep nfs
nfs-utils-lib-1.0.8-7.9.el5
nfs-utils-1.0.9-60.el5


[root@hostback CentOS]# pwd
/home/install_source/cdsorce/CentOS


[root@hostback CentOS]# ls nfs*
nfs4-acl-tools-0.3.3-3.el5.x86_64.rpm
nfs-utils-1.0.9-60.el5.x86_64.rpm
nfs-utils-lib-1.0.8-7.9.el5.i386.rpm
nfs-utils-lib-1.0.8-7.9.el5.x86_64.rpm
nfs-utils-lib-devel-1.0.8-7.9.el5.i386.rpm
nfs-utils-lib-devel-1.0.8-7.9.el5.x86_64.rpm

[root@hostback CentOS]# rpm -ivh nfs4-acl-tools-0.3.3-3.el5.x86_64.rpm
warning: nfs4-acl-tools-0.3.3-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
   1:nfs4-acl-tools         ########################################### [100%]
[root@hostback CentOS]# rpm -ivh nfs-utils-lib-devel-1.0.8-7.9.el5.x86_64.rpm
warning: nfs-utils-lib-devel-1.0.8-7.9.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
   1:nfs-utils-lib-devel    ########################################### [100%]



[root@hostback CentOS]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              67G  4.5G   59G   8% /
/dev/sda5              20G  4.5G   14G  25% /home
/dev/sda2             436G  199M  414G   1% /dbbak  //要把该目录挂载到AIX下;
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 7.9G     0  7.9G   0% /dev/shm
/dev/hda              4.3G  4.3G     0 100% /media/CentOS_5.8_Final
/dev/hda              4.3G  4.3G     0 100% /mnt/cdrom



[root@hostback ~]# vi /etc/exports       

/dbbak/   192.168.80.0/24(rw,no_root_squash)


 然后重新启动NFS服务器,现在我们的SELINUX是强制状态,iptablesinput和output都是默认ACCEPT,由于NFS服务是基于portmap服务的,所以我们需要先启动portmap服务:service portmap restart ,然后 service nfs restart  使用showmount 指令看看是否共享成功showmount -e  后面跟你的服务器IP

[root@hostback ~]# showmount -e 192.168.80.98
Export list for 192.168.80.98:
/dbbak 192.168.80.0/24


[root@hostback /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              67G  4.5G   59G   8% /
/dev/sda5              20G  4.5G   14G  25% /home
/dev/sda2             436G  199M  414G   1% /dbbak
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 7.9G     0  7.9G   0% /dev/shm
/dev/hda              4.3G  4.3G     0 100% /media/CentOS_5.8_Final
/dev/hda              4.3G  4.3G     0 100% /mnt/cdrom
[root@hostback /]#


[root@hostback ~]# mount -t nfs 192.168.80.98:/dbbak /mnt/nfs     //自己当作客户端挂载自己nfs 目录要新建

[root@hostback /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              67G  4.5G   59G   8% /
/dev/sda5              20G  4.5G   14G  25% /home
/dev/sda2             436G  199M  414G   1% /dbbak
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 7.9G     0  7.9G   0% /dev/shm
/dev/hda              4.3G  4.3G     0 100% /media/CentOS_5.8_Final
/dev/hda              4.3G  4.3G     0 100% /mnt/cdrom
192.168.80.98:/dbbak  436G  198M  414G   1% /mnt/nfs           //已经有了


二、登录AIX ,

1、挂在linux nfs

root@ptdb1:/# mount 192.168.80.98:/dbbak /rmanbak
mount: 1831-008 giving up on:
192.168.80.98:/dbbak
vmount: Operation not permitted.


root@ptdb1:/# nfso -a | grep nfs_use_reserved_ports
      nfs_use_reserved_ports = 0

默认情况,AIX系统执行mount命令请求时并不使用预先定义好的端口,设置nfs_use_reserved_ports后可使用1024以下的预定义端口


root@ptdb1:/# nfso -o nfs_use_reserved_ports=1
Setting nfs_use_reserved_ports to 1
root@ptdb1:/#
root@ptdb1:/# nfso -a | grep nfs_use_reserved_ports
      nfs_use_reserved_ports = 1
root@ptdb1:/# mount -v nfs -o rw,bg,hard,rsize=32768,wsize=32768,vers=3,nointr,timeo=600,proto=tcp 192.168.80.98:/backdata   /rmanbak      //这样AIX 就可以正确挂载Linux 的nfs 共享文件了 


root@ptdb1:/# df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4           6.00      5.73    5%    10619     1% /
/dev/hd2          15.00     12.57   17%    51403     2% /usr
/dev/hd9var        5.00      4.66    7%     6253     1% /var
/dev/hd3          10.00      9.96    1%      438     1% /tmp
/dev/fwdump        1.00      0.99    1%       16     1% /var/adm/ras/platform
/dev/hd1          20.00     19.97    1%      177     1% /home
/dev/hd11admin      5.00      5.00    1%        5     1% /admin
/proc                 -         -    -         -     -  /proc
/dev/hd10opt       5.00      4.78    5%     8548     1% /opt
/dev/livedump      2.00      2.00    1%        4     1% /var/adm/ras/livedump
/dev/fslv00       80.00     66.49   17%    65283     1% /oracle
/dev/fslv01       70.00     48.63   31%   644368     6% /grid
192.168.80.98:/dbbak    435.91    413.21    6%       11     1% /rmanbak



root@ptdb1:/rmanbak# mount
  node       mounted        mounted over    vfs       date        options     
-------- ---------------  ---------------  ------ ------------ ---------------
         /dev/hd4         /                jfs2   Oct 21 20:38 rw,log=/dev/hd8
         /dev/hd2         /usr             jfs2   Oct 21 20:38 rw,log=/dev/hd8
         /dev/hd9var      /var             jfs2   Oct 21 20:38 rw,log=/dev/hd8
         /dev/hd3         /tmp             jfs2   Oct 21 20:38 rw,log=/dev/hd8
         /dev/fwdump      /var/adm/ras/platform jfs2   Oct 21 20:39 rw,log=/dev/hd8
         /dev/hd1         /home            jfs2   Oct 21 20:39 rw,log=/dev/hd8
         /dev/hd11admin   /admin           jfs2   Oct 21 20:39 rw,log=/dev/hd8
         /proc            /proc            procfs Oct 21 20:39 rw             
         /dev/hd10opt     /opt             jfs2   Oct 21 20:39 rw,log=/dev/hd8
         /dev/livedump    /var/adm/ras/livedump jfs2   Oct 21 20:39 rw,log=/dev/hd8
         /dev/fslv00      /oracle          jfs2   Oct 21 20:39 rw,log=/dev/hd8
         /dev/fslv01      /grid            jfs2   Oct 21 20:39 rw,log=/dev/hd8
192.168.80.98 /dbbak           /rmanbak         nfs3   Jun 09 21:51           


2、使用smitty nfs ,创建NFS文件系统,或者直接在/etc/filesystems后面有添加如下显示:


/home/oracle/rmanbak:
        dev             = /backdata
        vfs             = nfs
        nodename        = 192.168.80.98
        mount           = true
        options         =  rw,bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,vers=3,timeo=600
        account         = false


测试:

oracle@ptdb1:/rmanbak$expdp system/oracle directory=mypump dumpfile=expxiaobi.dmp log=expxiaobi.log schemas=xiaobi

Export: Release 11.2.0.3.0 - Production on Wed Aug 6 15:22:03 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "log=expxiaobi.log" Location: Command Line, Replaced with: "logfile=expxiaobi.log"
Legacy Mode has set reuse_dumpfiles=true parameter.
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/******** directory=mypump dumpfile=expxiaobi.dmp logfile=expxiaobi.log schemas=xiaobi reuse_dumpfiles=true
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 30 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
. . exported "XIAOBI"."TEST"                             8.253 MB   85644 rows
. . exported "XIAOBI"."TEST2"                            8.253 MB   85645 rows
. . exported "XIAOBI"."TEST3"                            8.253 MB   85646 rows
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
  /rmanbak/expxiaobi.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at 15:23:01




oracle@ptdb1:/rmanbak$impdp system/oracle directory=mypump dumpfile=expxiaobi.dmp  log=impxiaobi.log remap_schema=xiaobi:xiahao

Import: Release 11.2.0.3.0 - Production on Wed Aug 6 15:28:57 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "log=impxiaobi.log" Location: Command Line, Replaced with: "logfile=impxiaobi.log"
Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** directory=mypump dumpfile=expxiaobi.dmp logfile=impxiaobi.log remap_schema=xiaobi:xiahao
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:"XIAHAO" already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "XIAHAO"."TEST"                             8.253 MB   85644 rows
. . imported "XIAHAO"."TEST2"                            8.253 MB   85645 rows
. . imported "XIAHAO"."TEST3"                            8.253 MB   85646 rows
Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 1 error(s) at 15:29:09

oracle@ptdb1:/rmanbak$
oracle@ptdb1:/rmanbak$
oracle@ptdb1:/rmanbak$exit

15:29:26 sys@PORTALDB> conn xiahao/xiahao123
Connected.
15:29:34 xiahao@PORTALDB> select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
TEST                           TABLE
TEST2                          TABLE
TEST3                          TABLE

使用RMAN测试 也是正常的;

RMAN> backup tablespace xiahao format '/rmanbak/%U';

Starting backup at 06-AUG-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=+ORADATA/portaldb/datafile/xiahao.283.834596721
input datafile file number=00007 name=+ORADATA/portaldb/datafile/xiahao.284.834596877
channel ORA_DISK_1: starting piece 1 at 06-AUG-14
channel ORA_DISK_1: finished piece 1 at 06-AUG-14
piece handle=/rmanbak/0jpf9ctb_1_1 tag=TAG20140806T153259 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-AUG-14

Starting Control File and SPFILE Autobackup at 06-AUG-14
piece handle=/oracle/product/11.2.0/dbs/c-663718102-20140806-00 comment=NONE
Finished Control File and SPFILE Autobackup at 06-AUG-14