Team Fly | ![]() ![]() |
-- Create a text version of a controlfile backup alter database backup controlfile to trace; spool off; exit;
This is a SQL script that can be run from a UNIX shell script or a Windows command file. To run this in Windows environments, the file copies are performed using the host start /wait c:\oracle\ora81\bin\ocopy.exe command rather than with the UNIX ! cp command, which hosts out and runs the UNIX version of copy. ocopy is an Oracle copy utility that must be run under Windows to allow file sharing to occur during hot backups. The standard DOS copy command does not allow this.
Cold backups are similar to the preceding except that the begin backup and end backup commands are not needed. The copy commands are surrounded by a consistent database shutdown before the copies have started, and a startup after the copies have completed. Note that in Windows environments, you should use the standard ''copy" utility for cold backups.
You should also add your parameter files, dump files, and alert logs to your backups. Once you've added those, you'll have everything backed up except for your archive logs. Let's see how to manage those next.
Managing archive logs is one of the more difficult tasks on a busy Oracle database. You will want to have archive logs available to you in case they are needed for a database recovery. At the same time, the archive logs must be written to disk and if disk space fills up, the instance will stop processing requests until more space becomes available. Trying to balance both of these competing requirements can be tricky, especially if your system writes a large number of log records.
To meet the first requirement of trying to keep the archive logs available to your online system in the event of a recovery, try to keep archive logs since the last backup (or, even better, the last two backups) on disk. Compress the archive files if you need to. If you are unable to keep archive logs online due to space issues, then you will need to write a script that regularly backs up the archive logs to tape and deletes them from disk. An example of a space management script that backs up archive logs once the archive directory is over 50 percent full is shown here:
#Pseudo-shell-code for free archive log space # Check used and free space: this is a very simple script # df -k (on linux: location of fields varies by platform) # Filesystem 1k-blocks Used Available Use% Mounted on # /dev/hda3 3763404 102676 3469556 3% / Log_arch_dest='/u01/oradata/db01/arch' arch_dir_mountPoint='df -k ${log_arch_dest}|grep -v blocks|awk '{print $6}'' arch_dir_freeSpace='df -k ${log_arch_dest}|grep -v blocks|awk '{print $4}''
Team Fly | ![]() ![]() |