优秀是一种习惯 , 生活是一种过程, 放弃是一种智慧 , 缺点是一种恩惠。 爱好:看书/K歌/上网/游泳/汉服 哼着單身情歌,彈着藍色吉它,展示突然的自我 QQ:19636427 另觅:160左右的女孩

我在linux 中使用rman 備份腳本

上一篇 / 下一篇  2008-07-18 16:15:11

1:

在/home/oracle (安裝帳號)中,修改 .bash_profile 文件查看環境變量

# User specific environment and startup programs

ORACLE_BASE=/usr/local/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_SID=mrp
LC_CTYPE=en_US.UTF-8
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
22
[1]+  Stopped                 more .bash_profile
[oracle@cnsrv161 ~]$

2: 

調用0級備份腳本:
[oracle@cnsrv161 ~]$ more backup_0_sun.sh
PATH=$PATH:$HOME/bin
ORACLE_BASE=/usr/local/oracle
ORACLE_SID=mrp
LD_LIBRARY_PATH=$ORACLE_HOME/lib
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_HOME
export ORACLE_BASE
export ORACLE_SID
export LD_LIBRARY_PATH
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
unset USERNAME
$ORACLE_HOME/bin/rman target / @/home/oracle/backup_0_sun.rms log=/home/oracle/`
date +%y-%m-%d`_full.log

3:

0 級備份腳本:
[oracle@cnsrv161 ~]$ more backup_0_sun.rms
run{
allocate channel c1 type disk maxpiecesize=8G;
allocate channel c2 type disk maxpiecesize=8G;
allocate channel c3 type disk maxpiecesize=8G;
allocate channel c4 type disk maxpiecesize=8G;
BACKUP INCREMENTAL level 0 database filesperset=10;
BACKUP archivelog all delete all input;
delete obsolete;
}
[oracle@cnsrv161 ~]$

4:

linux 中配置任務,自動運新

[root@cnsrv161 etc]# more crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root nice -n 19 run-parts --report /etc/cron.hourly
02 1 * * * root nice -n 19 run-parts --report /etc/cron.daily
22 4 * * 0 root nice -n 19 run-parts --report /etc/cron.weekly
42 4 1 * * root nice -n 19 run-parts --report /etc/cron.monthly
01 00 * * 7 oracle . /home/oracle/backup_0_sun.sh
01 00 * * 1-6 oracle . /home/oracle/backup_1_sun.sh

[root@cnsrv161 etc]#


 


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

我的栏目

日历

« 2008-11-23  
      1
2345678
9101112131415
16171819202122
23242526272829
30      

数据统计

  • 访问量: 4786
  • 日志数: 92
  • 建立时间: 2007-12-18
  • 更新时间: 2008-11-23

RSS订阅

Open Toolbar