{
   sql clone "create spfile from memory";
}

{
   shutdown clone immediate;
   startup clone nomount;
}

{
   set until scn  406717949065;
   sql clone "alter system set  db_name =  ''PR01PIMI'' comment= ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =  ''BT01PIMI'' comment= ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile;
   alter clone database mount;
}

{
   set until scn  406717949065;
   set newname for datafile  1 to "+RECO_DM02_EXT";
   set newname for datafile  2 to "+RECO_DM02_EXT";
   set newname for datafile  3 to "+RECO_DM02_EXT";
   restore  clone database   ;
}

{
   switch clone datafile all;
}

{
   set until scn  406717949065;
   recover clone database delete archivelog;
}

{
   sql clone "alter system set  db_name = ''BT01PIMI'' comment=''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}


CREATE CONTROLFILE REUSE SET DATABASE "BT01PIMI" RESETLOGS ARCHIVELOG 
  MAXLOGFILES    384
  MAXLOGMEMBERS      3
  MAXDATAFILES     4096
  MAXINSTANCES    64
  MAXLOGHISTORY    68736
 LOGFILE
  GROUP  1 ( '+data_dm02', '+reco_dm02' ) SIZE 6 G  REUSE,
  GROUP  2 ( '+data_dm02', '+reco_dm02' ) SIZE 6 G  REUSE,
  GROUP  3 ( '+data_dm02', '+reco_dm02' ) SIZE 6 G  REUSE,
  GROUP  4 ( '+data_dm02', '+reco_dm02' ) SIZE 6 G  REUSE,
  GROUP  5 ( '+reco_dm02', '+data_dm02' ) SIZE 6 G  REUSE,
  GROUP  6 ( '+reco_dm02', '+data_dm02' ) SIZE 6 G  REUSE
 DATAFILE
  '+RECO_DM02_EXT/bt01pimi/datafile/system.639.834164493',
  '+RECO_DM02_EXT/bt01pimi/datafile/system.639.834164493',
  '+RECO_DM02_EXT/bt01pimi/datafile/system.639.834164493'
 CHARACTER SET AL32UTF8
 ;

-- Set Database Guard and/or Supplemental Logging
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

-- Create log files for threads other than thread one.
ALTER DATABASE ADD LOGFILE THREAD 2
  GROUP 7 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 8 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 9 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 10 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 11 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 12 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE
  ;

ALTER DATABASE ADD LOGFILE THREAD 3
  GROUP 13 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 14 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 15 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 16 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 17 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 18 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE
  ;

ALTER DATABASE ADD LOGFILE THREAD 4
  GROUP 19 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 20 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 21 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 22 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 23 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE,
  GROUP 24 ( '+RECO_DM02') SIZE 6144M BLOCKSIZE 512 REUSE
  ;

{
   set newname for tempfile  1 to "+RECO_DM02_EXT";
   set newname for tempfile  2 to "+RECO_DM02_EXT";
   set newname for tempfile  3 to "+RECO_DM02_EXT";
   switch clone tempfile all;
}


alter system enable restricted session;

-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

 
  
  

   