日期:2014-05-16 浏览次数:20499 次
今早登录服务器发现有172.16.0.133的/backup里没有备份的数据库数据,并且在/data文件夹里的tar.gz文件大小也不对
(
[root@mylinux01 oracle]# ls /data/ -lta
total 434784
drwxrwxrwx? 2 oracle dba?????? 4096 Mar? 1 00:00 .
-rw-r--r--? 1 oracle dba???????? 45 Mar? 1 00:00 mydata20100301.tar.gz
-rw-r--r--? 1 oracle dba???????? 45 Feb 28 00:00 mydata20100228.tar.gz
-rw-r--r--? 1 oracle dba???????? 45 Feb 27 00:00 mydata20100227.tar.gz
drwxr-xr-x 32 root?? root????? 4096 Feb 25 23:26 ..
-rwxr--r--? 1 oracle dba? 120416256 Feb 25 18:33 444.dmp
-rw-r--r--? 1 oracle dba? 324329472 Feb 25 06:45 20100225.dmp
[root@mylinux01 oracle]#
),检查/bat/databasebackup.sh后,发现一个是oracle用户没有mount命令的权限,导致没有挂载上windows共享文件夹,另外myfile用户没有数据,mynewfile里有业务数据,已经修改过来了,(即,添加oracle用户的mount命令的sudo权限:
添加oracle? ALL=(root)NOPASSWD:/bin/mount到/usr/sbin/visudo
以及修改myfile为mynewfile):
[oracle@mylinux01 ~]$ cat /bat/databackup.sh
#!/bin/sh
# source /home/oracle/.bashrc
# Daily backup dump and copy it's .tar.gz to windows share folder.
# Delete previous .dmp and .tar.gz files every 7 days.
export DATE=$(date +%Y%m%d)
export DATE7AGO=$(date +%Y%m%d -d '-7 day')
export DATE30GO=$(date +%Y%m%d -d '30 day ago')
export ORACLE_HOME=/u01/oracle/product/10.2.0/db_1
export ORACLE_BASE=/u02
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
export PATH=$PATH:$ORACLE_HOME:$ORACLE_HOME/bin
export ORACLE_HOME_LISTNER=$ORACLE_HOME
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export NLS_LANG=american_america.ZHS16GBK
sudo mount
-t cifs -o username=administrator,passwd=mypwd,ip=172.16.1.92 //172.16.1.92/linuxdata /backup
cd /data
exp mynewfile/passwd@ORCL_LOCAL? file=mydata$DATE.dmp full=y
tar czf mydata$DATE.tar.gz mydata$DATE.dmp
cp mydata$DATE.tar.gz /backup
rm mydata$DATE7AGO.dmp -f
rm mydata$DATE7AGO.tar.gz -f
cd /backup
rm mydata$DATE30GO.tar.gz -f
[oracle@mylinux01 ~]$
?此致
?
?敬礼
--