Bacula-users

[Bacula-users] Issue backing up Oracle database using Bacula

2010-06-30 09:27:10
Subject: [Bacula-users] Issue backing up Oracle database using Bacula
From: Mogaroy <bacula-forum AT backupcentral DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Wed, 30 Jun 2010 09:24:29 -0400

Mike Holden wrote:
> Mogaroy wrote:
> 
> > Thanks Mike,
> > 
> 
> No problem!!
> 
> 
> > Will recheck the points you mentioned.Meanwhile, some searching has
> > led me to feel that it has something to do with the PL/SQL script
> > (runhotbackup.sql) which does the actual backup to local disk
> > (/var/oracle/backup) in my case.
> > The 'host' command which is used in the script to rsync the
> > datafiles is not recognized by PL/SQL, and maybe that's causing it
> > to throw the errors.
> > 
> > http://www.orafaq.com/wiki/PL/SQL_FAQ
> > 
> > To verify, I tried copying a single file, running the command
> > manually from SQL prompt, and the file got copied successfully.
> > 
> > But, since the author of the script has tested the whole thing
> > successfully, I'm wondering if it indeed is the cause.
> > 
> > I came upon an earlier thread where the author mentions about his
> > article, and I'm following it up there as well hoping to find a
> > solution:
> > 
> > http://www.backupcentral.com/phpBB2/two-way-mirrors-of-external-mailing-lists-3/bacula-25/oracle-database-backup-question-79798/#337777
> > 
> 
> The hotbackup script doesn't use pl/sql to execute a host command.
> What is does is create a text file containing a list of commands,
> several of which are "host" statements. It then uses that generated
> script as input into an sqlplus session to do the actual backup
> commands.
> 
> Like I said earlier, if your commands and database files are stored
> in different directories to where the original authore placed them,
> you will need to modify the runhotbackup.sql script to put the
> correct locations, as well as any of the other files that you copied
> from that wiki entry at
> http://wiki.bacula.org/doku.php?id=application_specific_backups:oracle_rdbms
> 
> In detail, the hotbackup script does the following steps:
> 
> creates a file called
> /app/oracle/oradata/db1/scripts/hotbackupscript.sql, as defined in
> the "spool" statement. This path must exist and be writeable to the
> user. This script file will be written to incluse a number of
> sqlplus statements, which are later executed using the line
> beginning with " < at > " right at the bottom.
> 
> It then adds commands to do the following:
> 
> does an "rm" of /app/oracle/backup/*, so again this directory must
> exist and be writeable.
> 
> Create a list of "ALTER DATABASE" statements to enter and exit hot
> backup mode for the tablespace. For each tablespace, it also adds an
> "host rsync" command into the file to do the backup copy to
> /app/oracle/backup for each datafile in the current tablespace (a
> tablespace may have several datafiles).
> 
> Finally, once this loop for tablespaces has completed, it adds
> various other commands to backup controlfiles, handle archived
> redologs etc.
> 
> So you see, pl/sql ISN'T running a "host" statement at all, sqlplus is!
> 
> Maybe if you told us exactly what changes tou made to the locations
> from the original wiki, and what changes you made to the scripts we
> may be able to spot what is wrong!
> 
> Can you run the hotbackup script directly in sqlplus using " < at > 
> runhotbackup.sql" from within sqlplus? If so, then the problem is
> elsewhere, if not then error message sill help us diagnose the
> problem further.
> -- 
> Mike Holden
> 
> http://www.by-ang.com - the place to shop
> for all manner of hand crafted items,
> including Jewellery, Greetings Cards and Gifts
> 
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Bacula-users mailing list
> Bacula-users < at > lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bacula-users



Thanks Mike, for clearing up a few things.Appreciate your patience !

I finally managed to identify the cause of the errors.The problem, as I see it, 
is with the way in which the hotbackupscript.sql is being created.
The host rsync command inside that file is being split into 2 lines instead of 
appearing in a single line.Just to be sure, I edited 
the file to make the first couple of commands appear in a single line and 
tested by running it manually from SQL prompt, and the script executes 
successfully!

This is how the commands appear in the hotbackupscript.sql file:

host rm -f /var/oracle/backup/*
ALTER TABLESPACE ATGINT BEGIN BACKUP;
host rsync -vcW /home/dbusr/app/dbusr/product/11.1.0/db_1/dbs/ATGINT.dbf
/var/oracle/backup/
ALTER TABLESPACE ATGINT END BACKUP;
ALTER TABLESPACE ATL_CONTENT_DATA BEGIN BACKUP;
host rsync -vcW /home/dbusr/app/dbusr/oradata/orcl/ATL_CONTENT_DATA
/var/oracle/backup/
ALTER TABLESPACE ATL_CONTENT_DATA END BACKUP;
ALTER TABLESPACE ATL_CONTROL_DATA BEGIN BACKUP;
host rsync -vcW /home/dbusr/app/dbusr/oradata/orcl/ATL_CONTROL_DATA
/var/oracle/backup/
ALTER TABLESPACE ATL_CONTROL_DATA END BACKUP;
ALTER TABLESPACE AT_CATA BEGIN BACKUP;
host rsync -vcW /home/dbusr/app/dbusr/product/11.1.0/db_1/dbs/atcata.dbf
/var/oracle/backup/
ALTER TABLESPACE AT_CATA END BACKUP;
ALTER TABLESPACE AT_CATB BEGIN BACKUP;
host rsync -vcW /home/dbusr/app/dbusr/product/11.1.0/db_1/dbs/atcatb.dbf
/var/oracle/backup/


I tried different combinations of placing the quotes in the relevant line of 
runhotbackup.sql(with spaces, without space etc), but no matter 
how I try, am not able to have the hotbackupscript.sql file generated in the 
right format(i,e having the rsync command in a single line).Any 
help here would be greatly appreciated.

Thanks again for guiding me thus far !!

NK Mogaroy

+----------------------------------------------------------------------
|This was sent by mogaroy AT gmail DOT com via Backup Central.
|Forward SPAM to abuse AT backupcentral DOT com.
+----------------------------------------------------------------------



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users