KfWiki : OracleBackup

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

HomePage » Database » Oracle » OracleBackup

Backup script


#!/bin/sh
# Clean up obsolete backup files, if any.
find /obackup/ -mtime +5 -exec rm -f {} \;

# Start full backup and send backup report by mail
# Each backup file will not exceed 640MBm, and 20MB/sec is allowed
messagelog="/obackup/xpc8db_fullbak/fullbk-`date +%Y%d%m-%H%M`.log"
/oracle/9.2.0/bin/rman catalog=rman/rman1234@instance_name target=sys/ora1234 msglog $messagelog <<EOF
configure default device type to disk;
configure controlfile autobackup on;
configure channel device type disk maxpiecesize=640m rate=30m format '/obackup/fullbk_%d_%U.bak';
run {
   backup database plus archivelog;
   delete noprompt obsolete;
}
resync catalog;
exit
EOF
mail -s "fullbackup `date +%Y%d%m-%H%M` sysadmin@domain.com < $messagelog



Restore

Run the following
$ORACLE_HOME/bin/rman target sys/syspwd@instance_name

run {
allocate channel d2 type disk;
restore database;
recover database;
release channel d2;
}


Recover a particular tablespace
run {
allocate channel d2 type disk;
restore tablespace tb1;
recover tablespace tb1;
release channel d2;
}


Oracle Cold Backup

Shutdown instance and

Backup datafiles
select name from v$datafile

Backup control files
select name from v$controlfile

Backup instance config files
init.ora, listener.ora, sqlnet.ora

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.7527 seconds