欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux挂载网络上的windows共享磁盘

程序员文章站 2022-07-14 16:16:01
...
  • # mkdir  /hisback
    # mkdir /hisback           ---------------在根下创建hisback挂载点
    #[[email protected] hisback]# ll /          ----------查看根下hisback权限,u=roo,g=root
    total 162
    drwxr-xr-x    2 oracle oinstall 36864 Mar 12 19:43 archive
    drwxr-xr-x    2 root   root      4096 Mar 12 20:15 hisback
    drwxr-xr-x    2 oracle oinstall  4096 Mar  8 00:51 rman
    drwxr-xr-x.   4 root   oinstall  4096 Mar 13  2016 u01
    
    [[email protected] /]# chown -R oracle:oinstall hisback   ----------更改hisback的所有者为oracle,属组为oinstall;   
    drwxr-xr-x    2 oracle oinstall  4096 Mar 12 20:15 hisback
                                               ---------------尽管所有者已更改为oracle,但后面oracle模式,raman 备份依旧提示没有权限,permission denied;
    [[email protected] /]# chmod 777 hisback    ---------------修改hisback 权限为777,u=7,g=7,o=7
  • [[email protected] /]#  mount -o username=hisbackup,password=hisbackup //192.168.1.1/his1rman /hisback  ----------我当时是用这个命令挂载的,网络盘确实挂载上了,但这种命令没法赋予权限。
  1. [[email protected] hisback]# id oracle     --------------查看oracle的uid和gid
    uid=1002(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba),1004(asmdba)
  2. [[email protected] /]# mount -t smbfs -o username="hisbackup",password="hisbackup",gid="1001",uid="1002" //172.16.2.99/his1rman /hisback
    mount: unknown filesystem type 'smbfs'  -----------------发现有报错,尝试用cifs
  3. [[email protected] /]# mount -t cifs -o username="hisbackup",password="hisbackup",gid="1001",uid="1002" //192.168.1.1/his1rman /hisback   ------//192.168.1.1/his1rman为局域网windows网络共享磁盘,/hisback为挂载点。
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)   --------------成功挂载
  4. ####  如果不加uid,gid,挂载时默认缺省所有者,所属组为root,加这个就是修改挂载时默认所有者和属组为oracle
  5. [[email protected] /]# mount                -------------mount一下查看,挂载状态
    /dev/mapper/vg_his2-lv_root on / type ext4 (rw)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    tmpfs on /dev/shm type tmpfs (rw)
    /dev/sda2 on /boot type ext4 (rw)
    /dev/sda1 on /boot/efi type vfat (rw,umask=0077,shortname=winnt)
    /dev/mapper/vg_his2-lv_home on /home type ext4 (rw)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    none on /sys/kernel/config type configfs (rw)
    sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
    oracleasmfs on /dev/oracleasm type oracleasmfs (rw)
    gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)

    //192.168.1.1/his1rman on /hisback type cifs (rw)
  6. [[email protected] /]# su - oracle             
    his2:/home/oracle>\rman target /                   -----------------rman备份

    Recovery Manager: Release 11.2.0.4.0 - Production on Tue Mar 12 20:43:31 2019

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

    connected to target database: KTYYDB (DBID=2321736913)

    RMAN> run {
    2> allocate channel d1 type disk;                      -----------------------分配通道号d1
    3> allocate channel d2 type disk;
    4> allocate channel d3 type disk;
    5> allocate channel d4 type disk;
    6> backup database format='
    /hisback/ktyy_db_%U';         --------------/hisback为要备份的路径
    7> }

    using target database control file instead of recovery catalog
    allocated channel: d1
    channel d1: SID=1906 instance=ktyydb2 device type=DISK

    allocated channel: d2
    channel d2: SID=1271 instance=ktyydb2 device type=DISK

    allocated channel: d3
    channel d3: SID=1283 instance=ktyydb2 device type=DISK

    allocated channel: d4
    channel d4: SID=507 instance=ktyydb2 device type=DISK

    Starting backup at 12-MAR-19
    channel d1: starting full datafile backup set
    channel d1: specifying datafile(s) in backup set
    input datafile file number=00006 name=+DG/ktyydb/datafile/ufhis_data01.dbf
    input datafile file number=00005 name=+DG/ktyydb/datafile/undotbs2.262.906346667
    input datafile file number=00011 name=+DG/ktyydb/datafile/ufhis_data05.dbf
    channel d1: starting piece 1 at 12-MAR-19
    channel d2: starting full datafile backup set
    channel d2: specifying datafile(s) in backup set
    input datafile file number=00007 name=+DG/ktyydb/datafile/ufhis_data02.dbf
    input datafile file number=00001 name=+DG/ktyydb/datafile/system.264.906346485
    input datafile file number=00010 name=+DG/ktyydb/datafile/sysaux01.260906346485
    channel d2: starting piece 1 at 12-MAR-19
    channel d3: starting full datafile backup set
    channel d3: specifying datafile(s) in backup set
    input datafile file number=00008 name=+DG/ktyydb/datafile/ufhis_data03.dbf
    input datafile file number=00004 name=+DG/ktyydb/datafile/users.257.906346485
    input datafile file number=00009 name=+DG/ktyydb/datafile/ufhis_data04.dbf
    channel d3: starting piece 1 at 12-MAR-19
    channel d4: starting full datafile backup set
    channel d4: specifying datafile(s) in backup set
    input datafile file number=00002 name=+DG/ktyydb/datafile/sysaux.259.906346485
    input datafile file number=00003 name=+DG/ktyydb/datafile/undotbs1.258.906346485
    channel d4: starting piece 1 at 12-MAR-19
    channel d4: finished piece 1 at 12-MAR-19
    piece handle=/hisback/ktyy_db_3uts9ctc_1_1 tag=TAG20190312T204635 comment=NONE
    channel d4: backup set complete, elapsed time: 00:19:25
    channel d1: finished piece 1 at 12-MAR-19
    piece handle=/hisback/ktyy_db_3rts9ctc_1_1 tag=TAG20190312T204635 comment=NONE
    channel d1: backup set complete, elapsed time: 00:20:15
    channel d2: finished piece 1 at 12-MAR-19
    piece handle=/hisback/ktyy_db_3sts9ctc_1_1 tag=TAG20190312T204635 comment=NONE
    channel d2: backup set complete, elapsed time: 00:20:15
    channel d3: finished piece 1 at 12-MAR-19
    piece handle=/hisback/ktyy_db_3tts9ctc_1_1 tag=TAG20190312T204635 comment=NONE
    channel d3: backup set complete, elapsed time: 00:24:36
    Finished backup at 12-MAR-19

    Starting Control File and SPFILE Autobackup at 12-MAR-19
    piece handle=/rman/c-2321736913-20190312-00 comment=NONE
    Finished Control File and SPFILE Autobackup at 12-MAR-19
    released channel: d1
    released channel: d2
    released channel: d3
    released channel: d4

    RMAN> exit              ---------------退出rman


    Recovery Manager complete.
    his2:/home/oracle>exit                ---------------------退出oracle

  7. [[email protected] /]# ls -lh hisback            ---------------------查看备份的数据文件
    total 160G
    -rwxr-xr-x 1 oracle oinstall 34G Mar 12 12:58 ktyy_db_3rts9ctc_1_1
    -rwxr-xr-x 1 oracle oinstall 34G Mar 12 12:58 ktyy_db_3sts9ctc_1_1
    -rwxr-xr-x 1 oracle oinstall 62G Mar 12 13:03 ktyy_db_3tts9ctc_1_1
    -rwxr-xr-x 1 oracle oinstall 32G Mar 12 12:58 ktyy_db_3uts9ctc_1_1

  8. [[email protected] /]# ls -lh /rman                   ------------------查看备份的控制文件
    total 21M
    -rw-r----- 1 oracle asmadmin  21M Mar 12 21:11 c-2321736913-20190312-00