SQL>> SQL> select file_name from dba_data_files;
FILE_NAME
/u01/app/oracle/oradata/zylong/pdb4/pdb4/system01.dbf
/u01/app/oracle/oradata/zylong/pdb4/pdb4/sysaux01.dbf
/u01/app/oracle/oradata/zylong/pdb4/pdb4/undotbs01.dbf
[oracle@12cr2 ~]$ rm /u01/app/oracle/oradata/zylong/pdb4/pdb4/system01.dbf
[oracle@12cr2 ~]$ rm /u01/app/oracle/oradata/zylong/pdb4/pdb4/sysaux01.dbf
[oracle@12cr2 ~]$ sqlplus / as sysdba
ERROR:
ORA-09817: Write to audit file failed.
ORA-01075: you are currently logged on
故障现象
[root@12cr2 opt]# su - oracle
[oracle@12cr2 ~]$ sqlplus / as sysdba
SQL>> SQL> select file_name from dba_data_files;
FILE_NAME
/u01/app/oracle/oradata/zylong/pdb4/pdb4/system01.dbf
/u01/app/oracle/oradata/zylong/pdb4/pdb4/sysaux01.dbf
/u01/app/oracle/oradata/zylong/pdb4/pdb4/undotbs01.dbf
SQL> create user test>
create user test> ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01116: error in opening database file 38
ORA-01110: data file 38:
'/u01/app/oracle/oradata/zylong/pdb4/pdb4/system01.dbf'
ORA-27041: unable to open file
SQL> conn / as sysdba
SQL>>
Pluggable database>
SQL>> alter pluggable database pdb4 open
ERROR at line 1:
ORA-01113: file 40 needs media recovery
ORA-01110: data file 40:
'/u01/app/oracle/oradata/zylong/pdb4/pdb4/undotbs01.dbf'
恢复
[oracle@12cr2 ~]$ rman target /
----可以在下一层指定PDB来进行相关操作,也可以在当前指定PDB进行连接:rman target sys/password@hostname:1521/pdb_name,此时恢复跟11G没多大区别,直接可以restore datafile n,recover datafile n,restore tablespace n,recover tablepace n等等操作。
RMAN> restore tablespace pdb4:system;
RMAN> restore tablespace pdb4:sysaux;
RMAN> recover tablespace pdb4:system;
RMAN> recover tablespace pdb4:sysaux;
RMAN>> RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of sql statement command at 06/11/2017 21:00:12
ORA-01113: file 40 needs media recovery
ORA-01110: data file 40: '/u01/app/oracle/oradata/zylong/pdb4/pdb4/undotbs01.dbf'
RMAN> recover tablespace pdb4:UNDOTBS1;
SQL> create tablespace users datafile '/u01/app/oracle/oradata/zylong/pdb4/pdb4/users01.dbf'>
SQL> create user test> SQL> grant dba to test;
SQL> conn test/oracle@192.168.16.81:1521/pdb4
SQL> create table test as select * from all_objects where rownum commit;
SQL> !rm /u01/app/oracle/oradata/zylong/pdb4/pdb4/users01.dbf
故障后的现象
SQL> select count(*) from test;
SQL> insert into test select * from test;
SQL> commit;
SQL> insert into test select * from test;
SQL> commit;
SQL>> ERROR at line 1:
ORA-03113: end-of-file on communication channel
SQL> insert into test select * from test;
ORA-03114: not connected to ORACLE
SQL> conn test/oracle@192.168.16.81:1521/pdb4
ORA-01033: ORACLE initialization or shutdown in progress
SQL> conn / as sysdba
SQL> show pdbs;