$title =

Canivete Suiço para Backup e Restore

;

$conteúdo = [

Fala galera, recentemente estive recriando algumas situações de Restore em laboratório para me aprofundar um pouco melhor nas funcionalidades do RMAN e decidi aproveitar o que foi feito para montar aqui nesse artigo algumas possibilidades de Restauração que podem ajudar os DBAs durante muitas crises principalmente.

Aqui neste post irei deixar alguns métodos de restore como por exemplo:

1. Backup e Restore de CDB

2. Restore e Recover de CDB PITR

3. Backup e Restore de PDB

4. Restore e Recover de PDB PITR

5. Backup e Restore de PDBSEED

6. Backup e Restore de tablespace

7. Backup e Restore de datafile

Então bora lá, irei colocar os exemplos na prática e espero que ajude.

Backup e Restore de CDB

De início, o ambiente em questão será composto por um PDB apenas

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB MOUNTED
SQL>

Irei remover alguns datafiles do meu CDB para simular uma perda e após isso, não poderei abrir o meu CDB devido à perda dos arquivos

[grid@oragrid ~]$ asmcmd
ASMCMD> rm -rf +DATA/ORAGRID/DATAFILE/sys*
ASMCMD> rm -rf +DATA/ORAGRID/DATAFILE/undo*
[oracle@oragrid ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Thu Nov 7 16:23:40 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup force;
Oracle instance started
database mounted
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 11/07/2024 16:24:02
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '+DATA/ORAGRID/DATAFILE/system.259.1184422537'
RMAN>

Então primeiramente irei manter o meu banco em MOUNT

RMAN> startup mount force;
Oracle instance started
database mounted
Total System Global Area 2969564224 bytes
Fixed Size 9139264 bytes
Variable Size 603979776 bytes
Database Buffers 2348810240 bytes
Redo Buffers 7634944 bytes
RMAN>

E realizar um Restore/Recover database root

RMAN> restore database root;
Starting restore at 07-NOV-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=139 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/ORAGRID/DATAFILE/system.259.1184422537
channel ORA_DISK_1: restoring datafile 00003 to +DATA/ORAGRID/DATAFILE/sysaux.258.1184422537
channel ORA_DISK_1: restoring datafile 00004 to +DATA/ORAGRID/DATAFILE/undotbs1.257.1184422537
channel ORA_DISK_1: restoring datafile 00007 to +DATA/ORAGRID/DATAFILE/users.260.1184093859
channel ORA_DISK_1: reading from backup piece +FRA/ORAGRID/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.263.1184421413
channel ORA_DISK_1: piece handle=+FRA/ORAGRID/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.263.1184421413 tag=TAG20241107T135653
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 07-NOV-24
RMAN> recover database root;
Starting recover at 07-NOV-24
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 07-NOV-24
RMAN>

Simples assim, agora o meu banco já pode ser aberto novamente

RMAN> alter database open;
Statement processed
RMAN>
SQL> SELECT INSTANCE_NAME, STATUS, DATABASE_STATUS, version FROM V$INSTANCE;
INSTANCE_NAME STATUS DATABASE_STATUS VERSION
--------------- -------- ----------------- -----------
oragrid OPEN ACTIVE 19.0.0.0.0
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL>

Restore e Recover de CDB PITR

Para realizar o teste vou começar criando uma tabela de teste e vou especificar a cláusula rowdependencies para cada linha que eu inserir ter um SCN específico, mas em um ambiente produtivo não teríamos essa necessidade devido à carga de dados ser maior por lá.

SQL> create table tb_teste_pit (texto varchar2(100)) rowdependencies;
Table created.
SQL>

Vou realizar alguns inserts e para cada commit irei realizar um switch logfile

SQL> insert into tb_teste_pit values ('Esta linha deve permanecer após Point in Time');
commit;
1 row created.
SQL>
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> insert into tb_teste_pit values ('Esta linha NÃO deve permanecer após Point in Time');
commit;
1 row created.
SQL>
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> insert into tb_teste_pit values ('Esta linha NÃO deve permanecer após Point in Time');
commit;
1 row created.
SQL>
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL>
Observação: a partir de agora é importantíssimo você possuir o backup dos archives após os inserts para continuar o procedimento

Após realizar o backup dos archives, vou verificar o SCN dos inserts que realizei

[oracle@oragrid ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 8 21:38:35 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> select ora_rowscn, texto from tb_teste_pit;
ORA_ROWSCN
----------
TEXTO
--------------------------------------------------------------------------------
2262808
Esta linha deve permanecer após Point in Time
2262816
Esta linha NÃO deve permanecer após Point in Time
2262825
Esta linha NÃO deve permanecer após Point in Time
SQL>

Agora é reiniciar o banco em mount e realizar a recuperação

RMAN> shutdown immediate;
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down
RMAN>
[oracle@oragrid ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 8 21:40:32 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 2969564224 bytes
Fixed Size 9139264 bytes
Variable Size 603979776 bytes
Database Buffers 2348810240 bytes
Redo Buffers 7634944 bytes
Database mounted.
SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oragrid ~]$
[oracle@oragrid ~]$ rman target sys/oracle@oragrid
Recovery Manager: Release 19.0.0.0.0 - Production on Fri Nov 8 21:40:57 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORAGRID (DBID=3616092002, not open)
RMAN> RUN
{
SET UNTIL SCN 2262811;
RESTORE DATABASE;
RECOVER DATABASE;
}
ALTER DATABASE OPEN RESETLOGS;
2> 3> 4> 5> 6>
executing command: SET until clause
Starting restore at 08-NOV-24

E após o Restore e Recover estarem concluídos a minha consulta anterior estará me retornando apenas o insert do SCN que eu restaurei

Finished recover at 08-NOV-24
RMAN>
Statement processed
RMAN>
Recovery Manager complete.
[oracle@oragrid ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 8 21:42:19 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> select ora_rowscn, texto from tb_teste_pit;
ORA_ROWSCN
----------
TEXTO
--------------------------------------------------------------------------------
2262808
Esta linha deve permanecer após Point in Time
SQL>

Backup e Restore de PDB

Para simular a perda novamente, irei apagar os arquivos do PDB e ele não irá subir após isso

ASMCMD> rm -rf +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E
ASMCMD>
SQL> alter pluggable database PDB open;
alter pluggable database PDB open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 12 - see DBWR trace file
ORA-01110: data file 12: '+DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/users.275.1184094717'
SQL>

Mas para a tratativa basta realizar o restore/recover do PDB

RMAN> restore pluggable database PDB;
Starting restore at 07-NOV-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=396 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00009 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/system.272.1184094703
channel ORA_DISK_1: restoring datafile 00010 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/sysaux.273.1184094703
channel ORA_DISK_1: restoring datafile 00011 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/undotbs1.271.1184094703
channel ORA_DISK_1: restoring datafile 00012 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/users.275.1184094717
channel ORA_DISK_1: reading from backup piece +FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.264.1184421449
channel ORA_DISK_1: piece handle=+FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.264.1184421449 tag=TAG20241107T135653
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 07-NOV-24
RMAN>
RMAN> recover pluggable database PDB;
Starting recover at 07-NOV-24
using channel ORA_DISK_1
applied offline range to datafile 00009
offline range RECID=22 STAMP=1184428096
applied offline range to datafile 00010
offline range RECID=21 STAMP=1184428096
applied offline range to datafile 00011
offline range RECID=20 STAMP=1184428096
applied offline range to datafile 00012
offline range RECID=19 STAMP=1184428096
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 07-NOV-24
RMAN>
RMAN> alter pluggable database PDB open;
Statement processed
RMAN>
Recovery Manager complete.
[oracle@oragrid ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 7 15:55:06 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- --------------- ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB READ WRITE NO
SQL>

Restore e Recover de PDB PITR

De início, irei inserir dados no CDB

SQL> insert into c##pdbpit.tb_testepit values ('Este registro permanece.');
commit;
1 row created.
SQL>
Commit complete.
SQL> insert into c##pdbpit.tb_testepit values ('Este registro também permanece.');
commit;
insert into c##pdbpit.tb_testepit values ('Este registro também permanece de novo.');
commit;
1 row created.
SQL>
Commit complete.
SQL>
1 row created.
SQL>
Commit complete.
SQL>
SQL>

E no PDB

SQL> insert into pdbpit.tb_testepit values ('Este registro permanece.');
commit;
insert into pdbpit.tb_testepit values ('Este registro permanece.');
commit;
insert into pdbpit.tb_testepit values ('Este registro permanece.');
commit;
insert into pdbpit.tb_testepit values ('Este registro NÃO permanece.');
commit;
insert into pdbpit.tb_testepit values ('Este registro NÃO permanece.');
commit;
1 row created.
SQL>
Commit complete.
SQL>
1 row created.
SQL>
Commit complete.
SQL>
1 row created.
SQL>
Commit complete.
SQL>
1 row created.
SQL>
Commit complete.
SQL>
1 row created.
SQL>
Commit complete.
SQL>
1 row created.
SQL>
Commit complete.
SQL>

Agora irei verificar o SCN no qual quero voltar o meu PDB

➡️ SCN do CDB

SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> select ora_rowscn, texto from c##pdbpit.tb_testepit;
ORA_ROWSCN
----------
TEXTO
--------------------------------------------------------------------------------
2284960
Este registro permanece.
2284964
Este registro também permanece.
2284967
Este registro também permanece de novo.
ORA_ROWSCN
----------
TEXTO
--------------------------------------------------------------------------------
2286202
De novo. Este registro permanece.
2286204
De novo. Este registro também permanece.
2286207
De novo. Este registro também permanece de novo.
6 rows selected.
SQL>

➡️ SCN do PDB

SQL> alter session set container=pdb;
Session altered.
SQL> select ora_rowscn, texto from pdbpit.tb_testepit;
ORA_ROWSCN
----------
TEXTO
--------------------------------------------------------------------------------
2286182
Este registro permanece.
2286185
Este registro permanece.
2286188
Este registro permanece.
ORA_ROWSCN
----------
TEXTO
--------------------------------------------------------------------------------
2286191
Este registro NÃO permanece.
2286194
Este registro NÃO permanece.
SQL>

Algo interessante que posso fazer antes de realizar o PITR é verificar o procedimento com o comando validate

[oracle@oragrid ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Thu Nov 7 18:46:01 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORAGRID (DBID=3616092002)
RMAN> restore pluggable database pdb until scn 2286188 validate;
Starting restore at 07-NOV-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK
channel ORA_DISK_1: starting validation of datafile backup set
channel ORA_DISK_1: reading from backup piece +FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t183429_0.266.1184438085
channel ORA_DISK_1: piece handle=+FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t183429_0.266.1184438085 tag=TAG20241107T183429
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
Finished restore at 07-NOV-24
RMAN>

Após a validação, já é possível eu realizar o restore/recover até o SCN desejado. Durante o recover, irei colocar de destino auxiliar o diretório /bkp/aux

RMAN> alter pluggable database pdb close immediate;
Statement processed
RMAN> restore pluggable database pdb until scn 2286188;
Starting restore at 07-NOV-24
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00009 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/system.273.1184428419
channel ORA_DISK_1: restoring datafile 00010 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/sysaux.275.1184428419
channel ORA_DISK_1: restoring datafile 00011 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/undotbs1.272.1184428419
channel ORA_DISK_1: restoring datafile 00012 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/users.271.1184428419
channel ORA_DISK_1: reading from backup piece +FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t183429_0.266.1184438085
channel ORA_DISK_1: piece handle=+FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t183429_0.266.1184438085 tag=TAG20241107T183429
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 07-NOV-24
RMAN> recover pluggable database pdb until scn 2286188 auxiliary destination '/bkp/aux';
Starting recover at 07-NOV-24
current log archived
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 07-NOV-24
RMAN>

Por fim, realizar um open resetlogs

RMAN> alter pluggable database pdb open resetlogs;
Statement processed
RMAN>

O CDB em si, permanece intacto pois não realizamos a alteração nele e sim no PDB

SQL> select ora_rowscn, texto from c##pdbpit.tb_testepit;
ORA_ROWSCN
----------
TEXTO
--------------------------------------------------------------------------------
2284960
Este registro permanece.
2284964
Este registro também permanece.
2284967
Este registro também permanece de novo.
ORA_ROWSCN
----------
TEXTO
--------------------------------------------------------------------------------
2286202
De novo. Este registro permanece.
2286204
De novo. Este registro também permanece.
2286207
De novo. Este registro também permanece de novo.
6 rows selected.
SQL>

Portanto o PDB não irá possuir os registros que eu inseri após o SCN que retornei o banco

SQL> alter session set container = pdb;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
PDB
SQL>
SQL>
SQL>
SQL> select ora_rowscn, texto from pdbpit.tb_testepit;
ORA_ROWSCN
----------
TEXTO
--------------------------------------------------------------------------------
2286182
Este registro permanece.
2286185
Este registro permanece.
SQL>

Backup e Restore de PDBSEED

De ínicio vou fechar o PDB$SEED

SQL> alter pluggable database PDB$SEED close immediate;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- -------------- ---------- ----------
2 PDB$SEED MOUNTED
3 PDB MOUNTED
SQL>

Irei remover os arquivos desse pdb para evitar sua abertura posteriormente

ASMCMD> cd +DATA/ORAGRID/86B637B62FE07A65E053F706E80A27CA/DATAFILE
ASMCMD> ls
SYSAUX.267.1184094115
SYSTEM.266.1184094115
UNDOTBS1.268.1184094115
ASMCMD> rm -rf +DATA/ORAGRID/86B637B62FE07A65E053F706E80A27CA*
ASMCMD>
SQL> alter pluggable database pdb$seed open read only;
alter pluggable database pdb$seed open read only
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '+DATA/ORAGRID/86B637B62FE07A65E053F706E80A27CA/DATAFILE/undotbs1.268.1184094115'
SQL>

Uma informação importante é que durante o restore você precisa especificar as aspas duplas devido ao “$”

[oracle@oragrid ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Thu Nov 7 15:42:02 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORAGRID (DBID=3616092002)
RMAN> restore pluggable database "pdb$seed";
Starting restore at 07-NOV-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=396 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to +DATA/ORAGRID/86B637B62FE07A65E053F706E80A27CA/DATAFILE/system.266.1184094115
channel ORA_DISK_1: restoring datafile 00006 to +DATA/ORAGRID/86B637B62FE07A65E053F706E80A27CA/DATAFILE/sysaux.267.1184094115
channel ORA_DISK_1: restoring datafile 00008 to +DATA/ORAGRID/86B637B62FE07A65E053F706E80A27CA/DATAFILE/undotbs1.268.1184094115
channel ORA_DISK_1: reading from backup piece +FRA/ORAGRID/260A521AB304130DE0635E0FA8C0DE94/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.265.1184421465
channel ORA_DISK_1: piece handle=+FRA/ORAGRID/260A521AB304130DE0635E0FA8C0DE94/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.265.1184421465 tag=TAG20241107T135653
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 07-NOV-24
RMAN>

Agora basta finalizar com o recover do PDB$SEED

RMAN> recover pluggable database "pdb$seed";
Starting recover at 07-NOV-24
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 07-NOV-24
RMAN>

E já resolvemos o problema

RMAN> alter pluggable database "pdb$seed" open read only;
Statement processed
RMAN>
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- -------------- ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB MOUNTED
SQL>

Backup e Restore de tablespace no PDB

Irei acessar o RMAN através da string de conexão do meu pdb e deixarei a tablespace users offline para o restore/recover e após isso basta deixar a tablespace online novamente

[oracle@oragrid ~]$ rman target sys/oracle@pdb
Recovery Manager: Release 19.0.0.0.0 - Production on Thu Nov 7 15:58:00 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORAGRID:PDB (DBID=1154798471)
RMAN> alter tablespace users offline;
[oracle@oragrid ~]$ rman target sys/oracle@pdb
Recovery Manager: Release 19.0.0.0.0 - Production on Thu Nov 7 15:58:00 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORAGRID:PDB (DBID=1154798471)
RMAN> alter tablespace users offline;
RMAN> restore tablespace users;
Starting restore at 07-NOV-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=396 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00012 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/users.271.1184428419
channel ORA_DISK_1: reading from backup piece +FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.264.1184421449
channel ORA_DISK_1: piece handle=+FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.264.1184421449 tag=TAG20241107T135653
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 07-NOV-24
RMAN> recover tablespace users;
Starting recover at 07-NOV-24
using channel ORA_DISK_1
applied offline range to datafile 00012
offline range RECID=19 STAMP=1184428096
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 07-NOV-24
RMAN> alter tablespace users online;

Backup e Restore de datafile

O procedimento a seguir será realizado no PDB

[oracle@oragrid ~]$ rman target sys/oracle@pdb
Recovery Manager: Release 19.0.0.0.0 - Production on Thu Nov 7 15:59:43 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORAGRID:PDB (DBID=1154798471)
RMAN> alter database datafile 10 offline;

Após colocar o datafile offline, basta seguir o restore/recover do datafile 10 e após isso deixa-lo online novamente

RMAN> restore datafile 10;
Starting restore at 07-NOV-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=396 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00010 to +DATA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/DATAFILE/sysaux.275.1184428419
channel ORA_DISK_1: reading from backup piece +FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.264.1184421449
channel ORA_DISK_1: piece handle=+FRA/ORAGRID/260A740669B62ACDE0635E0FA8C06B2E/BACKUPSET/2024_11_07/nnndf0_tag20241107t135653_0.264.1184421449 tag=TAG20241107T135653
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 07-NOV-24
RMAN> recover datafile 10;
Starting recover at 07-NOV-24
using channel ORA_DISK_1
applied offline range to datafile 00010
offline range RECID=21 STAMP=1184428096
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 07-NOV-24
RMAN> alter database datafile 10 online;
Statement processed
RMAN>

E com isso finalizamos alguns procedimentos que separei para o post, mas futuramente a ideia é trazer novas opções de restauração, espero que tenham gostado e que o post tenha ajudado.

];

$namorado(a) =

;

$category =

;

$author =

;

$previous =

;