Salvaguarda e Recuperação
Database Backup & Recovery
Carlos Pampulim Caldeira
http://www.di.uevora.pt/~ccaldeira
Administr...
Falhas numa base de dados
• Instância (usual/ não danificam os dados)
• Aplicação/Transação (tempo, input, ordem)
• Media ...
Cópias (backups) dos dados
• “COPY” | RMAN (Oracle)
• Imagem dos dados
• Registos de logs
Cópias (backups) dos dados
SELECT log_mode FROM V$DATABASE;
ALTER DATABASE archivelog;
Ver/Alterar métodos dos logs
SQL Error: ORA-01126: database mu...
Ver/Alterar métodos dos logs
Ver/Alterar métodos dos logs
Ver/Alterar métodos dos logs
Ver/Alterar métodos dos logs
Ver/Alterar métodos dos logs
Ver/Alterar métodos dos logs
Oracle | redundancy set
• Ficheiro com dados (datafile)
• Ficheiro de controlo (control file)
• Ficheiro(s) de registo (on...
Oracle | primary files
O {discos | outro media} que contém o
{redundância} DEVE SER DISTINTO
do {discos | outro media} que...
Backups totais vs. incrementais
Oracle | Utilitário backup
Recovery Manager (RMAN)
Consistentes: quando a BD está num estado
consistente:
- SHUTDOWN NORMA...
Oracle | RMAN
RMAN: em NOARCHIVELOG inconsistentes
ARCHIVELOG:
- datafiles
- redo logs
Então um backup inconsistente pode ...
Oracle | RMAN
Backups INCREMENTAIS
Dois níveis: 0 e 1
Um backup incremental de nível 0 é uma cópia
total da BD que por aca...
Oracle | RMAN
O incremental de nível 1 tem dois tipos:
• Incr. diferencial que salva os dados alte-
rados após a salvaguar...
Oracle | RMAN
Salvaguardas Incrementais diferenciais
Oracle | RMAN
Salvaguardas Incrementais cumulativas
Oracle | RMAN
Oracle | RMAN
Próximos SlideShares
Carregando em…5
×

Salvaguarda e Recuperação da Base de Dados | Oracle

435 visualizações

Publicada em

Normas gerais de salvaguarda (backup) e de recuperação (recovery) de bases de dados em Oracle.

Publicada em: Software
0 comentários
0 gostaram
Estatísticas
Notas
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Sem downloads
Visualizações
Visualizações totais
435
No SlideShare
0
A partir de incorporações
0
Número de incorporações
77
Ações
Compartilhamentos
0
Downloads
6
Comentários
0
Gostaram
0
Incorporações 0
Nenhuma incorporação

Nenhuma nota no slide
  • Instance Failure
    Instance failure occurs when an instance abnormally terminates. An instance failure can occur because:
    A power outage causes the server to crash.
    The server becomes unavailable because of hardware problems.
    The operating system crashes.
    One of the Oracle background processes fails.
    You issue a SHUTDOWN ABORT statement.

    Fortunately, Oracle performs instance recovery automatically: all you need to do is restart the database. 
  • Favor full image copies for small databases objects. The definition of “small” will vary from site to site and DBMS to DBMS. Far large/medium mainframe | Unix a “small” object is probably within the 150GB to 200GB range.
  • A consistent shutdown guarantees that all redo has been applied to the datafiles. If you mount the database and make a backup at this point, then you can restore the database backup later and open it without performing media recovery.
    ____________________________

    Shutdown Immediate
    Perhaps the best way to initially shutdown the database is the shutdown immediate command. This command will prevent any new logins, then rollback any uncommitted transactions, and then bring down the database. In the process of bringing down the database, Oracle will flush all the changes in memory out to the database datafiles too, just like a regular shutdown does. This makes database startup quicker. Here is an example of shutting down a database with the shutdown immediate command:
    __________________________________
    Shutdown Abort
    The shutdown abort command is pretty much a guaranteed way to get your database to shutdown. It’s a “hard crash” of the database, and this can result in a longer time to start the database back up. Still, you can’t really hurt the database using the shutdown abort command, and during your DBA years you will find more than a few occasions to use the shutdown abort command.
    A shutdown abort can be your first shutdown method of choice, since there may be times when you must force the database down. Here is an example using the shutdown abort command:
  • A consistent shutdown guarantees that all redo has been applied to the datafiles. If you mount the database and make a backup at this point, then you can restore the database backup later and open it without performing media recovery.

    If the database runs in ARCHIVELOG mode, and you back up the archived redo logs and datafiles, inconsistent backups can be the foundation for a sound backup and recovery strategy. Inconsistent backups offer superior availability because you do not have to shut down the database to make backups that fully protect the database.
  • In contrast to a full backup, an incremental backup copies only those data blocks that have changed since a previous backup. You can use RMAN to create incremental backups of datafiles, tablespaces, or the whole database. A full backup cannot be part of an incremental backup strategy; that is, it cannot be the parent for a subsequent incremental backup.
  • Incremental backups are differential by default.
  • In the example shown in Figure 8-2, the following activity occurs each week:
    Sunday
    An incremental level 0 backup backs up all blocks that have ever been in use in this database.
    Monday through Saturday
    On each day from Monday through Saturday, a differential incremental level 1 backup backs up all blocks that have changed since the most recent incremental backup at level 1 or 0. The Monday backup copies blocks changed since Sunday level 0 backup, the Tuesday backup copies blocks changed since the Monday level 1 backup, and so forth.
  • In a cumulative level 1 backup, RMAN backs up all blocks used since the most recent level 0 incremental backup in either the current or parent incarnation. Cumulative incremental backups reduce the work needed for a restore operation by ensuring that you only need one incremental backup from any particular level. Cumulative backups require more space and time than differential backups because they duplicate the work done by previous backups at the same level.
    In the example shown in Figure 8-3, the following occurs each week:
    Sunday
    An incremental level 0 backup backs up all blocks that have ever been in use in this database.
    Monday - Saturday
    A cumulative incremental level 1 backup copies all blocks changed since the most recent level 0 backup. Because the most recent level 0 backup was created on Sunday, the level 1 backup on each day Monday through Saturday backs up all blocks changed since the Sunday backup.
  • Salvaguarda e Recuperação da Base de Dados | Oracle

    1. 1. Salvaguarda e Recuperação Database Backup & Recovery Carlos Pampulim Caldeira http://www.di.uevora.pt/~ccaldeira Administração de Bases de Dados
    2. 2. Falhas numa base de dados • Instância (usual/ não danificam os dados) • Aplicação/Transação (tempo, input, ordem) • Media (hardware, dados apagados)
    3. 3. Cópias (backups) dos dados • “COPY” | RMAN (Oracle) • Imagem dos dados • Registos de logs
    4. 4. Cópias (backups) dos dados
    5. 5. SELECT log_mode FROM V$DATABASE; ALTER DATABASE archivelog; Ver/Alterar métodos dos logs SQL Error: ORA-01126: database must be mounted in this instance and not open in any instance 01126. 00000 - "database must be mounted in this instance and not open in any instance" *Cause: Obvious
    6. 6. Ver/Alterar métodos dos logs
    7. 7. Ver/Alterar métodos dos logs
    8. 8. Ver/Alterar métodos dos logs
    9. 9. Ver/Alterar métodos dos logs
    10. 10. Ver/Alterar métodos dos logs
    11. 11. Ver/Alterar métodos dos logs
    12. 12. Oracle | redundancy set • Ficheiro com dados (datafile) • Ficheiro de controlo (control file) • Ficheiro(s) de registo (online redo log)
    13. 13. Oracle | primary files O {discos | outro media} que contém o {redundância} DEVE SER DISTINTO do {discos | outro media} que contém • Ficheiro com dados (datafile) | • Ficheiro de controlo (control file) | • Ficheiros de log (online redo log) |
    14. 14. Backups totais vs. incrementais
    15. 15. Oracle | Utilitário backup Recovery Manager (RMAN) Consistentes: quando a BD está num estado consistente: - SHUTDOWN NORMAL - SHUTDOWN IMMEDIATE - SHUTDOWN TRANSACTIONAL Inconsistentes
    16. 16. Oracle | RMAN RMAN: em NOARCHIVELOG inconsistentes ARCHIVELOG: - datafiles - redo logs Então um backup inconsistente pode ser uma boa estratégia: - SHUTDOWN ……
    17. 17. Oracle | RMAN Backups INCREMENTAIS Dois níveis: 0 e 1 Um backup incremental de nível 0 é uma cópia total da BD que por acaso é o pai de um proces- so incremental.
    18. 18. Oracle | RMAN O incremental de nível 1 tem dois tipos: • Incr. diferencial que salva os dados alte- rados após a salvaguarda mais recente de nível 1 ou 0 • Incr. cumulativo que salva todos os dados alterados desde a salvaguarada mais recente de nível 0
    19. 19. Oracle | RMAN Salvaguardas Incrementais diferenciais
    20. 20. Oracle | RMAN Salvaguardas Incrementais cumulativas
    21. 21. Oracle | RMAN
    22. 22. Oracle | RMAN

    ×