Discussion:
RMAN "backup as copy" + until time (or COMPLETED BEFORE) Question
Chris Taylor
2018-10-28 14:35:32 UTC
Permalink
Does anyone know how to combine the "backup as copy" PLUS an until time?

Oracle 12.1.0.2

Long story short:
We are doing a process that generates a ton of archivelogs in DEST_ID=1 and
we have to save these archivelogs. (Multiple days)

I need to run a periodic RMAN job to MOVE the archivelogs from DEST_ID=1 to
a backup destination WITHOUT backing them up - only MOVE them.

So, enter "BACKUP AS COPY" like this:
backup as copy archivelog like '/dpdump/archivelog/%' format
'/HP-MSA-MIA/orabackup/archivelog/%U' delete input;

(The secondary location (HP-MSA) is too slow to use for the primary
destination but works fine as a dumping ground)

However, this script wants to backup ALL the archivelogs instead of just
the ones completed before the UNTIL TIME:

/* This is a handful of logs as a test case */
run
{
set until time "sysdate-1";
backup as copy archivelog like '/dpdump/archivelog/%' format
'/HP-MSA-MIA/orabackup/archivelog/%U' delete input;
}

Basically, what I WANT to do is this but I can't combine the 'COMPLETED
BEFORE' with the COPY command:

{rman command that does NOT work}

backup as copy archivelog like '/dpdump/archivelog/%' format
'/HP-MSA-MIA/orabackup/archivelog/%U' COMPLETED BEFORE 'SYSDATE-1' delete
input;

*RMAN-01009: syntax error: found "completed": expecting one of:
"archivelog *

Same with:
backup as copy archivelog like '/dpdump/archivelog/%' COMPLETED BEFORE
'sysdate-1' format '/HP-MSA-MIA/orabackup/archivelog/%U' delete input

I would have thought the 'SET UNTIL TIME' would give me what I want but it
doesn't.

Any thoughts/suggestions on how to combine the two?

Thanks,
Chris
Hemant K Chitale
2018-10-28 14:46:35 UTC
Permalink
Why do you need the LIKE clause. SET UNTIL SEQUENCE or TIME or UNTIL
TIME or COMPLETED BEFORE would identify the archivelogs required. My
guess is that the LIKE clause does an override

Hemant K Chitale




On Sun, Oct 28, 2018 at 10:38 PM Chris Taylor <
Post by Chris Taylor
Does anyone know how to combine the "backup as copy" PLUS an until time?
Oracle 12.1.0.2
We are doing a process that generates a ton of archivelogs in DEST_ID=1
and we have to save these archivelogs. (Multiple days)
I need to run a periodic RMAN job to MOVE the archivelogs from DEST_ID=1
to a backup destination WITHOUT backing them up - only MOVE them.
backup as copy archivelog like '/dpdump/archivelog/%' format
'/HP-MSA-MIA/orabackup/archivelog/%U' delete input;
(The secondary location (HP-MSA) is too slow to use for the primary
destination but works fine as a dumping ground)
However, this script wants to backup ALL the archivelogs instead of just
/* This is a handful of logs as a test case */
run
{
set until time "sysdate-1";
backup as copy archivelog like '/dpdump/archivelog/%' format
'/HP-MSA-MIA/orabackup/archivelog/%U' delete input;
}
Basically, what I WANT to do is this but I can't combine the 'COMPLETED
{rman command that does NOT work}
backup as copy archivelog like '/dpdump/archivelog/%' format
'/HP-MSA-MIA/orabackup/archivelog/%U' COMPLETED BEFORE 'SYSDATE-1' delete
input;
"archivelog *
backup as copy archivelog like '/dpdump/archivelog/%' COMPLETED BEFORE
'sysdate-1' format '/HP-MSA-MIA/orabackup/archivelog/%U' delete input
I would have thought the 'SET UNTIL TIME' would give me what I want but
it doesn't.
Any thoughts/suggestions on how to combine the two?
Thanks,
Chris
Chris Taylor
2018-10-28 14:54:31 UTC
Permalink
Because I have archivelogs already in HP-MSA location - so if I don't use
the "LIKE" clause, it will try to move the archivelogs already in HP-MSA to
the same location (I think - I haven't tested it).

So right now:

Archivelog Locations:
/HP-MSA-MIA/orabackup/archivelog/ --- Contains lots of archivelogs as this
was the first location I wanted to write to starting this weekend but
proved too slow
/dpdump/archivelog - Flash storage and contains logs starting yesterday but
is smaller storage area

If I don't do the "LIKE" I believe it will "move" the archivelogs already
in /HP-MSA-MIA to a new name - if it does a "move" versus a "copy" that
would be ok as it would be quick, but if it does a "copy and then delete"
which I'm almost 100% certain it does, then that's no good.

Right now I'm working around it with this and completely manual moves:

# Sequence numbers here are in the dpdump location starting from earliest
# Takes 17 minutes to copy each archivelog to the HP storage
backup as copy archivelog from sequence 263685 until sequence 263700 thread
3 format '/HP-MSA-MIA/orabackup/archivelog/%U' delete input;

For the above, I have query the db to find the sequence #s and manually
update the script and kick it off manually and was hoping to be able to use
a SYSDATE-6/24 to keep a rolling window of logs moving to the HP storage.

Chris
Post by Hemant K Chitale
Why do you need the LIKE clause. SET UNTIL SEQUENCE or TIME or UNTIL
TIME or COMPLETED BEFORE would identify the archivelogs required. My
guess is that the LIKE clause does an override
Hemant K Chitale
On Sun, Oct 28, 2018 at 10:38 PM Chris Taylor <
Post by Chris Taylor
Does anyone know how to combine the "backup as copy" PLUS an until time?
Oracle 12.1.0.2
We are doing a process that generates a ton of archivelogs in DEST_ID=1
and we have to save these archivelogs. (Multiple days)
I need to run a periodic RMAN job to MOVE the archivelogs from DEST_ID=1
to a backup destination WITHOUT backing them up - only MOVE them.
backup as copy archivelog like '/dpdump/archivelog/%' format
'/HP-MSA-MIA/orabackup/archivelog/%U' delete input;
(The secondary location (HP-MSA) is too slow to use for the primary
destination but works fine as a dumping ground)
However, this script wants to backup ALL the archivelogs instead of just
/* This is a handful of logs as a test case */
run
{
set until time "sysdate-1";
backup as copy archivelog like '/dpdump/archivelog/%' format
'/HP-MSA-MIA/orabackup/archivelog/%U' delete input;
}
Basically, what I WANT to do is this but I can't combine the 'COMPLETED
{rman command that does NOT work}
backup as copy archivelog like '/dpdump/archivelog/%' format
'/HP-MSA-MIA/orabackup/archivelog/%U' COMPLETED BEFORE 'SYSDATE-1' delete
input;
"archivelog *
backup as copy archivelog like '/dpdump/archivelog/%' COMPLETED BEFORE
'sysdate-1' format '/HP-MSA-MIA/orabackup/archivelog/%U' delete input
I would have thought the 'SET UNTIL TIME' would give me what I want but
it doesn't.
Any thoughts/suggestions on how to combine the two?
Thanks,
Chris
Mladen Gogala
2018-10-29 07:06:29 UTC
Permalink
Post by Chris Taylor
Because I have archivelogs already in HP-MSA location - so if I don't
use the "LIKE" clause, it will try to move the archivelogs already in
HP-MSA to the same location (I think - I haven't tested it).
That is why there is Perl.
--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
Loading...