How does one automate on-line backups?
Submitted by admin on Sat, 2004-08-07 08:18
Body:
Write a CRON job to:
- Get the tablespace names from Oracle:
SELECT TABLESPACE_NAME FROM SYS.DBA_TABLESPACES;
- Put the tablespaces in backup mode:
ALTER TABLESPACE ... BEGIN BACKUP;
- Get the database file names from Oracle:
SELECT NAME FROM SYS.V_$DATAFILE; SELECT NAME FROM SYS.V_$CONTROLFILE; SELECT MEMBER FROM SYS.V_$LOGFILE;
- Backup the files using pax, tar, ufsdump, dd, cpio or whatever file copy command you fancy. Note that if your database is on a raw partition, you can only use dd. Some examples:
$ find . -depth -print | cpio -ocBv >/dev/tapedevice $ dd if=/dev/raw_device of=/dev/tape_device BS=8k $ pax -w -f archive.pax *
- End backup mode for all the tablespaces.
ALTER TABLESPACE ... END BACKUP;
Note: See the scripts section for some examples.
»
- Log in to post comments