first of all you need to switch the log files which are not currently switched. so first login to sqlplus as sys user and issue below commands:
>sqplplus / as sysdba
sql> alter system switch logfile;
Now login to rman using below command and issue below commands:
> rman target sys/sysadmin or >rman target=/
rman>run {
crosscheck archivelog all;
crosscheck backupset;
backup as copy current controlfile format 'control_%s.bak';
backup spfile;
backup as compressed backupset database;
backup as compressed backupset archivelog all;
DELETE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE 'sysdate -1';
DELETE NOPROMPT OBSOLETE REDUNDANCY = 1;
}exit;
How to automate the process for windows.
create a windows batch file named mysysbackup.bat
insert below commands and save file
sqlplus /nolog @c:\sqlpluscom.sql
rman target=/ cmdfile="c:\backupdb.sql"
now create sqlpluscom.sql and backupdb.sql files in c:\ drive
sqlpluscom.sql
connect / as sysdba
alter system switch logfile;
exit;
backupdb.sql
run {
crosscheck archivelog all;
crosscheck backupset;
backup as copy current controlfile format 'control_%s.bak';
backup spfile;
backup as compressed backupset database;
backup as compressed backupset archivelog all;
DELETE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE 'sysdate -1';
DELETE NOPROMPT OBSOLETE REDUNDANCY = 1;
}
exit;
now shedule the batch as a windows schedule task...
No comments:
Post a Comment