|
|
|
|
|
|
|
|
|
|
|
Re: Script for Schedule Backup. [message #243512 is a reply to message #243457] |
Thu, 07 June 2007 10:34 |
DreamzZ
Messages: 1666 Registered: May 2007 Location: Dreamzland
|
Senior Member |
|
|
Connect with rman then create the script like this
create script xxx_backup_whole
{
allocate channel ch1 type disk format '$GAM_ORABACKUP/%U.bck';
allocate channel ch2 type disk format '$GAM_ORABACKUP/%U.bck';
allocate channel ch3 type disk format '$GAM_ORABACKUP/%U.bck';
set limit channel ch1 kbytes 2024800;
set limit channel ch2 kbytes 2024800;
set limit channel ch3 kbytes 2024800;
backup database;
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
backup archivelog all format '$GAM_ORABACKUP/al_%U.bck';
backup current controlfile
tag = cf1
format '$GAM_ORABACKUP/cf_%U.bck';
}
then create a file in OS like
vi daily_backup.com
and put the enteries like this
#!/bin/ksh
. $HOME/.profile_dbname
rman target system/manager catalog rman/rman@RCATO log $xxx_ORABACKUP/mlog.f << rman_exit
run { execute script xxx_backup_whole; }
exit
rman_exit
then make the entry for this in crontab
00 18 * * * /export/home/oracle/abc7.2/script/daily_backup.com > /export/home/oracle/abc7.2/script/daily/log/daily_backup.log &
|
|
|
|
|
Re: Script for Schedule Backup. [message #388982 is a reply to message #388431] |
Thu, 26 February 2009 20:37 |
trantuananh24hg
Messages: 744 Registered: January 2007 Location: Ha Noi, Viet Nam
|
Senior Member |
|
|
Some ways to scheduler backup using rman, and DreamzZ gave you one.
In NT, you can write rman's script, put it in a bat file, and scheduler the bat file with NT's system tool (or command line).
In Unix, you can write rman's script, put it-the file_name in a executable file, in which, content is very simple, such as:
-- rman's script
$ cat >> /u01/app/level0.rc <<EOF
> run{
> allocate channel d1 type disk format
> '/u01/app/backupfull/level_0_%d_%s_%t.bkp'
> connect 'sys/pwdunix@sid;
> set limit channel d1 kbytes 1048576;
> crosscheck backup;
> sql 'alter system archive log current';
> backup as compressed backupset incremental level 0 database
> tag=sid_level_0
> plus archivelog delete input
> tag=sid_archive_level_0
> filesperset 4;
> delete obsolete;
> delete expired backup ;
> backup current controlfile
> format '/u01/app/backupfull/controlfile_%d_%t.bkp';
> release channel d1;
> }
^D
$
-- Executable file
$ cat >> /u01/app/level0_execute <<EOF
> ~/.profile
> rman target sys/pwdunix@sid @/u01/app/level0.rc
^D
$ chmod +x /u01/app/level0_execute
Finally, you will make a job scheduler
-- Make a job scheduler by crontab utility
$ export EDITOR=vi
$ crontab -e
...
20 03 * * 6 /u01/app/level0_execute
!wq
$ crontab -l
20 03 * * 6 /u01/app/level0_execute
P/S:
- You should backup full in midnight or later, about 2-3am
- You will make yourself backup incremental level 1, put it in a crontab utility as above, and force to run it every day at 00am or later, depend yours.
- You can choose OS's utility (system_tool in NT or crontab in Unix) or you can make a job scheduler by DBMS_SCHEDULER. The DBMS_SCHEDULER could be different & difficult more than OS's utility, but it has a better idea: It-the scheduler execution file does not run if Database do not open, but OS does.
- My idea of BlackSwan's point is better than me to make a script file with DreamzZ script.
[Updated on: Thu, 26 February 2009 22:35] Report message to a moderator
|
|
|