Hot backup

March 2nd, 2012
source database:
select * from dba_tablespaces;

alter tablespace  begin backup;
...

--
select 'alter tablespace '||tablespace_name||' begin backup;' from dba_tablespaces
where contents != 'TEMPORARY';

select * from v$backup;

select 'alter tablespace '||tablespace_name||' end backup;' from dba_tablespaces
where contents != 'TEMPORARY';

select * from v$backup;
--

scp (copy datafiles from host1 to host2)

alter tablespace  end backup;
...


target database:
startup mount;

alter database rename file '' to '';
...

alter database rename file '' to '';
...

--
select * from v$datafile;
select 'alter database rename file '''||NAME||''' to '''||NAME||''';' from v$datafile;

select * from v$logfile;
select 'alter database rename file '''||MEMBER||''' to '''||MEMBER||''';' from v$logfile;
--

-- alter database tempfile '' drop;
select 'alter database tempfile '''||NAME||''' drop' from v$tempfile;
--

recover database; 
or
recover database using backup controlfile;
or
recover database until cancel using backup controlfile;

--shutdown immediate;

-- if there are no archivelogs
alter database noarchivelog; 
alter database open [resetlogs];
Comments are closed.