Restore/recover PITR database from RMAN
set ORACLE_SID=DB
rman target /
RMAN> shutdown immediate

database closed
database dismounted
Oracle instance shut down

-- Take a cold backup of current database just in case the recovery fails
--

SPOOL LOG TO 'F:\temp\recoveryDB.log';
run {
startup mount
restore database until time "to_date('2019-01-11 7:00:00', 'YYYY-MM-DD HH24:MI:SS')";
recover database until time "to_date('2019-01-11 7:00:00', 'YYYY-MM-DD HH24:MI:SS')";
}
SPOOL LOG off

alter database open resetlogs;

select sequence#, first_time,resetlogs_id from v$archived_log order by 1 desc;
 SEQUENCE# FIRST_TIM RESETLOGS_ID
---------- --------- ------------
      4867 23-OCT-18    924512818
      4866 22-OCT-18    924512818
      4865 22-OCT-18    924512818
      4864 22-OCT-18    924512818
         2 12-JAN-19    997347070
         1 12-JAN-19    997347070

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 21 DAYS;

-- run a full backup