1.查看之前的数据库化身

    1. RMAN> list incarnation of database;
    2. List of Database Incarnations
    3. DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
    4. ------- ------- -------- ---------------- --- ---------- ----------
    5. 1 1 ORCL 1549746193 PARENT 1 17-APR-19
    6. 2 2 ORCL 1549746193 PARENT 1920977 18-OCT-19

    2.执行还原
    注意:需要使用上一次执行resetlogs命令打开数据库之前的备份来还原数据库
    有恢复目录时的还原

    1. startup force nomount
    2. reset database to incarnation 2;
    3. run{
    4. set until time "to_date('2019-11-25 09:47:00','yyyy-mm-dd hh24:mi:ss')";
    5. restore controlfile;
    6. restore database;
    7. recover database;
    8. }
    9. alter database open resetlogs;

    没有恢复目录时的还原

    1. startup force nomount
    2. run{
    3. set until time "to_date('2019-11-25 09:47:00','yyyy-mm-dd hh24:mi:ss')";
    4. restore controlfile from autobackup;
    5. }
    6. alter database mount;
    7. reset database to incarnation 2;
    8. run{
    9. set until scn 3318383;
    10. restore database force;
    11. recover database;
    12. }
    13. alter database open resetlogs;