2014년 12월 15일 월요일

[백업복구]Hot Backup Script[SQL/ORACLE12c/ORACLE11g/오라클자바커뮤니티/SQL실무교육학원추천]


rem Script Description: This script automates hot backups (only available when 
rem                    the archivelog mode is on). It creates a script called hotback.sql, 
rem                    that will automatically back up tablespaces and control files. 
rem 
rem 
rem Output file:        hotbackups.sql 
rem 
rem Prepared By:        Oracle Resource Stop 
rem 
rem Usage Information:  SQLPLUS SYS/pswd 
rem                    @autohotbackups.sql  {target directory} 
rem 

set serveroutput on 
set heading off 
set feedback off 

spool hotbackups.sql 

declare 
fname  varchar2(80); 
tname  varchar2(80); 
tname1  varchar2(80); 

cursor cur1 is 
      select tablespace_name,file_name 
      from v$datafile,sys.dba_data_files 
      where enabled like '%WRITE%' 
        and file# = file_id 
      order by 1; 

begin 
  dbms_output.enable(32000); 
  dbms_output.put_line('spool hotbackups'); 

  if cur1%ISOPEN 
  then 
    close cur1; 
  end if; 

  open cur1; 

  fetch cur1 into tname,fname; 

  tname1 := tname; 
  dbms_output.put_line('alter tablespace '||tname||' begin backup;'); 

  while cur1%FOUND loop 

        if tname1 != tname then 
          dbms_output.put_line('alter tablespace '||tname1||' end backup;'); 
          dbms_output.put_line('alter tablespace '||tname||' begin backup;'); 
          tname1 := tname; 
        end if;        

        dbms_output.put_line('!cp '||fname||' &&target_directory'); 

        fetch cur1 into tname,fname; 

  end loop; 
  dbms_output.put_line('alter tablespace '||tname1||' end backup;'); 

  close cur1; 

  dbms_output.put_line('alter database backup controlfile to trace;'); 

  dbms_output.put_line('alter database backup controlfile to '||''''|| 
                      ' &&target_directory'||'/control.'|| 
                      to_char(sysdate,'DDMMYYYYHH24MISS')||''''||';'); 
  dbms_output.put_line('spool off'); 
end; 

spool off 
set heading on 
set feedback on 
set serveroutput off 

-- Unremark/Uncomment the following line to run the script 
-- or can be run from the sqlplus prompt. 
-- @hotbackups 

* 이종철님에 의해서 게시물 이동되었습니다 (2006-06-04 12:25)


 [100%환급,실무전문]SQL/빅데이터/자바/스프링/웹퍼블리싱/안드…오라클자바…12-272850
 [채용확정무료교육]오라클자바개발잘하는신입뽑기2개월과정,교육…오라클자바…12-112079
53 [평일100%환급7건]웹퍼블리싱,자바&JSP,안드로이드,C#닷넷,SQL기… 오라클자바…03-151917
52 [주말]C#,ASP.NET마스터 오라클자바…01-312069
51 [기업100%환급,평일주간]SQL기초에서스키마오브젝트,PLSQL,힌트… 오라클자바…01-313032
50 [주말주간]자바&웹,jQUERY,스프링프레임워크,마이바티스 오라클자바…01-311595
49 [평일주간/야간,주말주간/야간]Spring,MyBatis,Hibernate개발자… 오라클자바…01-191923
48 [평일주간/야간,주말주간/야간]안드로이드개발자과정(Adnroid 교… 오라클자바…01-111783
47 [평일야간,주말주간야간]JAVA,Network&JSP&Spring,MyBatis,Hiber… 오라클자바…01-032383
46 [100%환급,실무전문]SQL/빅데이터/자바/스프링/웹퍼블리싱/안드… 오라클자바…12-272850
45 [주말야간]개발자를위한PLSQL,SQL튜닝,힌트(토/일) 오라클자바…12-192003
44 [평일주간/야간,주말주간/야간]웹퍼블리싱 마스터(HTML5,CSS3,jQ… 오라클자바…12-141975
43 [채용확정무료교육]오라클자바개발잘하는신입뽑기2개월과정,교육… 오라클자바…12-112079
42 [주말야간]JAVA,JSP,Spring,PLSQL,힌트,웹퍼블리싱,안드로이드,… 오라클자바…12-091616
41 [평일야간,주말야간]닷넷(C#,Network,ADO.NET,ASP.NET)마스터 오라클자바…12-011836
40 [기업100%환급]오라클&자바웹스프링신입과정3주(SQL,JAVA,JSP,Se… 오라클자바…12-012076
39 [평일야간,주말]SQL기초에서실무까지(SQL기초,PLSQL,힌트,튜닝) 오라클자바…12-011492

댓글 없음:

댓글 쓰기