Restore e Recover di un Tablespace
Supponiamo che il datafile 24 del database "primary" sia stato corrotto.
Il db "primary" è un container mentre il pluggable database che contiene il catalogo, su un altro server, è "rcatpdb" e il pdb che contiene il darafile 24 è "pdb1".
[oracle@rmancat admin]$ rman target sys/system@primary catalog rcatown/rcatown@rcatpdb
RMAN> list failure;
Database Role: PRIMARY
no failures found that match specification
Il comando precedente non rileva errori, allora proviamo a validare il datafile 24.
RMAN> validate datafile 24;
Starting validate at 11-MAR-21
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of validate command on ORA_DISK_1 channel at 03/11/2021 16:03:45
ORA-01122: database file 24 failed verification check
ORA-01110: data file 24: '/u01/app/oracle/oradata/orcl/pdb1/tbs_bat02.df'
ORA-01565: error in identifying file '/u01/app/oracle/oradata/orcl/pdb1/tbs_bat02.df'
ORA-27048: skgfifi: file header information is invalid
Additional information: 2
Accedere al db "primary" e mettere offline il datafile 24 dal pdb. Risalgo al nome tablespace.
SQL> conn /as sysdba
SQL> select b.file#, a.name, b.name from v$tablespace a, v$datafile b where a.ts#=b.ts#
and b.file#=24; 2
FILE# NAME NAME
--------------------------------------------------------------------------------
24 TBS_BAT /u01/app/oracle/oradata/orcl/pdb1/tbs_bat02.df
SQL> alter session set container=pdb1;
SQL> alter tablespace TBS_BAT offline;
Se non funziona aggiungere IMMEDIATE
Effettuare restore e recover del datafile 24.
RMAN> restore tablespace pdb1:tbs_bat;
RMAN> recover tablespace pdb1:tbs_bat;
Verifichiamo che il datafile sia stato rispistinato correttamente:
RMAN> validate datafile 24;
Accedere al db "primary"SQL> alter tablespace TBS_BAT online;
RMAN> validate datafile 24;
Starting validate at 11-MAR-21
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00024 name=/u01/app/oracle/oradata/orcl/pdb1/tbs_bat02.df
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
24 OK 0 1 257 2822353
File Name: /u01/app/oracle/oradata/orcl/pdb1/tbs_bat02.df
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 134
Index 0 0
Other 0 121
Finished validate at 11-MAR-21