Home » RDBMS Server » Backup & Recovery » delete archivelogs older than 1 day. (Oracle 10g, linux. ASM Storage.)
delete archivelogs older than 1 day. [message #298822] Thu, 07 February 2008 17:08 Go to next message
geeklol
Messages: 59
Registered: March 2005
Member
i am using ASM to store my archive logs. What i am trying to do is 1.) BACKUP THE ARCHIVELOGS 2.) DELETE ALL THE ARCHIVELOGS ON ASM THAT ARE OLDER THAN 1 DAY.
when i use the following command, i get the error,

If i say, archivelog all delete input IT WORKS. but when i say sysdate-1 is when it complains.

MY SCRIPT:

run {
# Hot database level 0 whole backup
allocate channel t1 type 'SBT_TAPE';
backup
incremental level 0
skip inaccessible
# recommended format
format 'dashgp_%s_%p_%t'
database
filesperset = 500;
sql 'alter system archive log current';
release channel t1;

allocate channel t1 type 'SBT_TAPE';
backup
format 'cntrl_%s_%p_%t'
current controlfile;
release channel t1;

allocate channel t1 type 'SBT_TAPE';
backup
format 'arch_%s_%p_%t'
archivelog all delete input 'sysdate-1';
release channel t1;
}

ERROR:


9> connect target
10> connect catalog *
11>
12> run {
13> # Hot database level 0 whole backup
14> allocate channel t1 type 'SBT_TAPE';
15> backup
16> incremental level 0
17> skip inaccessible
18> # recommended format
19> format 'dashgp_%s_%p_%t'
20> database
21> filesperset = 500;
22> sql 'alter system archive log current';
23> release channel t1;
24>
25> allocate channel t1 type 'SBT_TAPE';
26> backup
27> format 'cntrl_%s_%p_%t'
28> current controlfile;
29> release channel t1;
30>
31> allocate channel t1 type 'SBT_TAPE';
32> backup
33> format 'arch_%s_%p_%t'
34> #DELETE COPY OF ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-1';
35> #format 'arch_%s_%p_%t'
36> archivelog all delete input 'sysdate-1'
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "single-quoted-string": expecting one of: "archivelog, backup, backupset, channel, copy, controlfile
copy, current, database, datafile, datafilecopy, delete, diskratio, db_recovery_file_dest, filesperset, format, from, force, include
, keep, (, maxsetsize, noexclude, nokeep, not, pool, plus, reuse, recovery, ;, skip, spfile, setsize, tablespace, tag, to"
RMAN-01007: at line 36 column 29 file: /home/oracle/nbscripts/dashgp_backup_level0.rcv

Thank you.
Re: delete archivelogs older than 1 day. [message #298823 is a reply to message #298822] Thu, 07 February 2008 17:23 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>but when i say sysdate-1 is when it complains.
It complains because that is not valid syntax.

valid alternatives are:
delete force
delete expired
delete obsolete

such as

delete obsolete recovery window of 2 days;
Re: delete archivelogs older than 1 day. [message #299661 is a reply to message #298822] Tue, 12 February 2008 21:44 Go to previous message
monto
Messages: 60
Registered: November 2007
Location: DALLAS
Member
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-1';
But be careful this deletes it from disk and catalog too
Previous Topic: Assistance with recovering a database?
Next Topic: Copy database
Goto Forum:
  


Current Time: Wed May 15 19:26:07 CDT 2024