0 Flares Twitter 0 Facebook 0 Filament.io 0 Flares ×

Boa tarde jovens.

Vou postar aqui um script de backup (e suas variações) que está mais que testado e que me ajuda bastante quando preciso fazer algo rápido e manual.

==================
— Backup
==================
rman target / << EOF
run {
    allocate channel d1 type disk MAXPIECESIZE 8G;
    SQL ‘ALTER SYSTEM ARCHIVE LOG CURRENT’;
    SQL ‘ALTER SYSTEM CHECKPOINT’;
    backup AS COMPRESSED BACKUPSET format ‘/backups/PROD/%d_%Y%M%D_%I_%s_%U.dat’ database;
    sql ‘alter system archive log current’;
    backup AS COMPRESSED BACKUPSET format ‘/backups/PROD/%d_%Y%M%D_%I_%s_%U.dat’ archivelog all;
    release channel d1;
}
exit;
EOF

==================
— Backup deletando archives e backupsets
==================
rman target / <
run {
    allocate channel d1 type disk MAXPIECESIZE 8G;
    SQL ‘ALTER SYSTEM ARCHIVE LOG CURRENT’;
    SQL ‘ALTER SYSTEM CHECKPOINT’;
    backup AS COMPRESSED BACKUPSET format ‘/backups/PROD/%d_%Y%M%D_%I_%s_%U.dat’ database;
    sql ‘alter system archive log current’;
    backup AS COMPRESSED BACKUPSET format ‘/backups/PROD/%d_%Y%M%D_%I_%s_%U.dat’ archivelog all;
    DELETE NOPROMPT ARCHIVELOG UNTIL TIME ‘SYSDATE-5’;
    DELETE NOPROMPT OBSOLETE DEVICE TYPE DISK;
    release channel d1;
}
exit;
EOF

========================
— Backup somente de archives
========================
rman target / <
run {
    allocate channel d1 type disk MAXPIECESIZE 8G;
    SQL ‘ALTER SYSTEM ARCHIVE LOG CURRENT’;
    SQL ‘ALTER SYSTEM CHECKPOINT’;
    backup AS COMPRESSED BACKUPSET format ‘/backups/PROD/%d_%Y%M%D_%I_%s_%U.dat’ archivelog all;
    release channel d1;
}
exit;
EOF

Simples e objetivo caso precise rodar algo manualmente.

Abraço
Mario

Leave a Reply

Your email address will not be published. Required fields are marked *