Rman Script For Automatially

Rman Script For Automatially
1)usage
1@@@@inside script
@@@you must have catalog before you use it.
[oracle@station60 ~]$ rman target / catalog u60/oracle@rmandb
RMAN> create catalog; 
RMAN> register database; 
RMAN> create script myscript1{
2> backup tablespace users; 
3> }
created script myscript1
 
RMAN> run{      
2> execute script myscript1;
3> }
executing script: myscript1


 
2@@@@outside script
[oracle@station60 ~]$ cat 1.rcv 
backup tablespace users;
exit;
 
@@@rman revoke the script which write some command in
@@@add "exit",it would be exit autometically.
[oracle@station60 admin]$ rman target / cmdfile='/home/oracle/1.rcv'
.........................
RMAN> backup tablespace users;
2> exit;
....................
Recovery Manager complete.
[oracle@station60 ~]$ 
 
@@@it also record the procedure to a appointed logfile.
[oracle@station60 ~]$ rman target / cmdfile=/home/oracle/1.rcv log=/home/oracle/1.log
RMAN> 2> [oracle@station60 ~]$ cat 1.log 
 
@@@write it into crontab,it is convenient for job.
@@@it would do as you wish.monitor as below.
[root@station60 ~]# tail -f /var/spool/mail/oracle 
[oracle@station60 ~]$ tail -f crontab_rman.log 
 
@@@you must add key word "append" or the logfile would be 
@@@overwrited by new log information!!!! 
[oracle@station60 ~]$ crontab -e
* * * * *  . /home/oracle/.bash_profile;rman target / cmdfile=/home/oracle/1.rcv log=/home/oracle/crontab_rman.log append
[oracle@station60 ~]$ cat crontab_rman.log 


@@@
@@@remote mode
$ rman TARGET SYS/sys_pwd@prod1 @'/oracle/backup_all_l0.rcv'
 
@@@how to use the date of MACRO in the crontab? continue........
[root@station60 ~]# date --help
  %Y   year
  %r   locale's 12-hour clock time (e.g., 11:11:04 PM)
  %D   date; same as %m/%d/%y
[root@station60 ~]# echo $(date +%Y-%m-%d###%T)
2011-12-19###10:49:17 AM
[root@station60 ~]# echo "$(date +%Y-%m-%d###%T)_.log"
2011-12-19###11:15:22_.log

你可能感兴趣的:(rman,backup,script,autometically)