[oracle] rman에서 생성한 query

— 기초 백업 확인
list backup of database;

— 기초 전체 백업(명령)
backup database;

— 기본 전체 백업(batch job)
run {  
allocate channel Channel1 type disk format ‘C:\ORACLE\ORADATA\ST00\b_%u_%p_%c’;
backup  
   ( database  include current controlfile );

backup  ( archivelog all  delete input );

}

— 데이터 파일 백업
run {  
allocate channel challel1 type disk format ‘c:\st00_backup\b_%u_%p_%c’;
backup  
   ( datafile “C:\ORACLE\ORADATA\ST00\USERS01.DBF”   include current controlfile );

}

— 테이블 스페이스 백업
run {
allocate channel Channel1 type disk format ‘/home/orahome/oradata/FUND/back/b_%u_%p_%c’;
backup
   ( tablespace ‘USERS’   include current controlfile );

backup  ( archivelog all  delete input );

}

— 이미지 파일 백업
run {
allocate channel ch0 type disk;
copy
        datafile “/opt/oracle/oradata/FUND/users01.dbf” to “/home/orahome/oradata/FUND/imgbak/users01.dbf”,
        current controlfile to “/home/orahome/oradata/FUND/imgbak/control01.ctl”;

}

— 다체널 백업
run {
allocate channel Channel1 type disk format ‘/home/orahome/oradata/FUND/back/b_%u_%p_%c’;
allocate channel Channel2 type disk format ‘/opt/oracle/oradata/FUND/back/b_%u_%p_%c’;
backup
   ( tablespace ‘USERS’   include current controlfile );

backup  ( archivelog all  delete input );

}

— 증분백업
run {
allocate channel Channel1 type disk format ‘/home/orahome/oradata/FUND/back/b_%u_%p_%c’;
backup  incremental level 2  cumulative
   ( database  include current controlfile );

backup  ( archivelog all  delete input );

}

===================================================

— tablespace 복구
run {
allocate channel Channel1 type disk format ‘/home/orahome/oradata/FUND/back/b_%u_%p_%c’;
sql ‘alter tablespace “USERS” offline immediate’;
set newname for datafile “/opt/oracle/oradata/FUND/users01.dbf” to “/home/orahome/oradata/FUND/users01.dbf”;
restore ( tablespace ‘USERS’  );
switch datafile all;
recover  tablespace ‘USERS’ ;
sql ‘alter tablespace “USERS” online’;

}

— incomplete recover
regedit->home0-> key=>NLS_DATE_FORMAT, value=>YY/MM/DD HH24:MI:SS
cmd창 다시 열기
run {
allocate channel Channel1 type disk format ‘/home/orahome/oradata/FUND/back/b_%u_%p_%c’;
sql ‘alter tablespace “EXAMPLE” offline immediate’;
set until time ’07/10/14 16:29:00′;
restore ( tablespace ‘EXAMPLE’  );

}

run {
allocate channel Channel1 type disk format ‘/home/orahome/oradata/FUND/back/b_%u_%p_%c’;
set until time ’07/10/14 16:31:00′;
restore ( tablespace ‘EXAMPLE’  );

}

Loading