Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
I have a script doing backup everyday, it look like this:
svrmgrl <<EOF
!rm /backup/log/daily_backup.backup
alter database backup controlfile to
'/backup/log/daily_backup.backup';
!tar -cvf /dev/rmt/0mn /backup/log/daily_backup.backup
alter tablespace ACN begin backup;
!tar -cvf /dev/rmt/0mn /acn/log/*.dbf
!tar -cvf /dev/rmt/0mn /var/log/acn/*.log
alter tablespace ACN end backup;
alter tablespace SAL begin backup;
!tar -cvf /dev/rmt/0mn /sal/log/*.dbf
!tar -cvf /dev/rmt/0mn /var/log/sal/*.log
alter tablespace SAL end backup;
EOF
mt -t /dev/rmt/0m offlineNow me question are:
1. How to list the contain of the tape by should of tarring method?
2. How to extract one of the file from the tape?
3. What dose those with a "alter" lines means?
4. What are those "!" for?
5. Why all are cvf? Why not using rvf?Thanks for any reply.

1. How to list the contain of the tape by should of tarring method?
===> tar tvf <tape device>2. How to extract one of the file from the tape?
===> tar xvf <tape device> <the file wanted to be extarcted>3. What dose those with a "alter" lines means?
===> Your whole scriprt runs in Oracle svrmgrl. Alter tablespace is an Oracle SQL command.4. What are those "!" for?
===> To run an OS command from Oracle SQL(like svrmgrl or SQLPLUS), "!" at the beginning of the line is needed.5. Why all are cvf? Why not using rvf?
===> r: Add the named file to the end of the archive.
c: Create a new archive.Luke Chi

Thanks for the reply Luke Chi,
Q1. When I use tar tvf /dev/rmt/0m, it only show the first section of the file in that tape, for my case is /backup/log/daily_backup.backup, it can't list all the files in that tape.
Q5. When using cvf, it create a new archive, it means it will over write all files already in that tape, so in my script, all are using cvf, when the backup finished, it only left the last file in that tape which is wrong. Am I right?
Please advise. Thanks.

Regarding the alter tablespace begin/end backup ...
You have to tell the Oracle rdbms that you are about to use an OS utility to make a backup copy of running (hot) database files. This causes the rdbm to write entire block images to the redolog instead of block fragments. If it did not do this, the OS utility could end up copying an inconsistent (fractured) block. It would be simpler (code-wise) to put all the tablespaces in hot backup mode, then copy all the files, then take all tablespaces out of hot backup mode. But this would place ALL tablespaces in hot backup mode for the entire duration of the copies, which could generate a huge amount of redo due to the full block images being journaled.
So your script is taking the recommended approach of placing only a single tablespace at a time in hot backup mode.
But a much more sophisticated approach is to use Oracle's Recovery Manager (RMAN), which comes bundled with the rdbms. You can schedule full and incremental backups, and it does these while the database is running. But it does not place the tablespaces in hot backup mode - it does not have to because it is knowledgeable of database block structure, and if it grabs an inconsistent block due to bad timing, it knows it so it just reads the block again. And RMAN backs up only in-use blocks, so a 30 GB database backup might consume only 18 GB. RMAN creates its backups files to disk, and I don't know what you get with Standard Edition, but the Enterprise Edition has tight integration with 3rd-party backup software such as Veritas.
And RMAN is very solid beginning Oracle 9i.

![]() |
complicated problem
|
Shell Script help - move...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |