quinta-feira, 20 de junho de 2013

Backup RMAN - Alguns scripts

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

Nenhum comentário:

Postar um comentário

Isso te ajudou? Comente...

Postagem em destaque

[ORACLE] Embedding ONNX model for Vector Search tests with Oracle Database 23ai

Hello, everyone. How's it going? Today, I'm going to show you how to load an ONNX model into the Oracle 23ai database for your vecto...