it depends on recovering files from previous backup
- create PFILE for new database based on PFILE from source database
init[db_new].ora
main changes:
- db_name
- control_files
- audit_file_dest
- background_dump_dest
- user_dump_dest
- core_dump_dest
- db_name
- create password file for new database:
orapwd file=orapw[db_new] password=[pass]
- add new database to listener.ora and tnsnames.ora,
- create dirs for new database file,
- create directories for trace logs as admin with subdirectories: adump, udump, cdump, bdump,
- startup new auxiliary database in nomout mode(! then exit from your session because it will be hang on)
- start rman with ORACLE_SID = auxiliary database:
- at the auxiliary server run command:
rman auxiliary / target sys/[sys_pass]@[targetdb_tnsalias] catalog rman/[rman_pass]@[catalogdb_tnsalias]
you should get an output:
connected to target database: [db_name] (DBID=[db_id])
connected to recovery catalog database
connected to auxiliary database: [db_name] (not mounted) - run script:
run {
set newname for datafile 4 to '/oracle/oradata/[db_new]/users01.dbf';
set newname for datafile 3 to '/oracle/oradata/[db_new]/sysaux01.dbf';
set newname for datafile 2 to '/oracle/oradata/[db_new]/undotbs01.dbf';
set newname for datafile 1 to '/oracle/oradata/[db_new]/system01.dbf';
set newname for datafile 5 to '/oracle/oradata/[db_new]/example01.dbf';
set newname for tempfile 1 to '/oracle/oradata/[db_new]/temp.dbf';
duplicate target database to [db_new]
pfile=/oracle/product/10.2.0/db_1/dbs/init[db_new]aux.ora
logfile
'/oracle/oradata/[db_new]/redo01.log' size 50m,
'/oracle/oradata/[db_new]/redo02.log' size 50m,
'/oracle/oradata/[db_new]/redo03.log' size 50m;}
to generate script above use sql at source db:
spool clonescript.rcv
select 'set newname for datafile '||file_id||' to '''||file_name||''';' from dba_data_files order by file_id;
select 'set newname for tempfile '||file_id||' to '''||file_name||''';' from dba_temp_files order by file_id;
spool off;
and next modify output in vim:
:% s/ora6\/oradata\/DBSRC/u01\/oradata\/DBAUX\/datafile
or another script:
run {
set until time "to_date('2010-07-02:01:00','yyyy-mm-dd:hh24:mi')";
configure default device type to sbt;
configure device type sbt parallelism 2;
configure auxiliary channel 1 device type sbt parms 'ENV=(NB_ORA_SERV=server_name,NB_ORA_CLIENT=server_target_name)';
configure auxiliary channel 2 device type sbt parms 'ENV=(NB_ORA_SERV=server_name,NB_ORA_CLIENT=server_target_name)';
duplicate target database to [db_new]
DB_FILE_NAME_CONVERT=('[target_path1]/','[aux_path]',
'[target_path2]/','[aux_path]')
pfile=[pfile_aux_path]/[db_new].ora
logfile
'[logfile_aux_path]/redo01.log' size 100m,
'[logfile_aux_path]/redo02.log' size 100m,
'[logfile_aux_path]/redo03.log' size 100m;
}