반응형

1. svn 백업

아래는 다음과 같은 값을 가질 때 예

svn root : /var/svn

저장소명 : gov

백업 파일명 : gov_backup.dump

#> svnadmin dump /var/svn/gov > gov_backup.dump

 

2. svn 복구

svn root 위치에 해당 파일(gov_backup.dump)

복사후 수행

 

a. 저장소 생성

#> svnadmin create --fs-type fsfs gov

 

b. 생성된 저장소에 내용 로드

#> svnadmin load gov < gov_backup.dump

반응형

'Private' 카테고리의 다른 글

웹 페이지 성능분석 및 로딩 속도 최적화  (0) 2019.09.03
D3  (0) 2019.05.31
node-red oracledb  (0) 2018.06.25
서버 용량 산정 / 성능 측정 / tpmc / bops / tpc / tpc-h  (0) 2013.05.10
오라클 접속 ORA-12505 에러 관련  (0) 2013.05.02
반응형

후암..


우선,


참고 : http://www.mondorescue.org(확인해봐야하는 백업 복구 사이트!)

참고 : http://readytoact.tistory.com/159 (G4l) => Ghost for Linux  여기로 해본다...


clonezilla 를 하라는 말 부터 하고 ... http://clonezilla.org


아래는 생짜배기(압축과 풀기)로 하는 방식...


출처 : http://kldp.org/node/84594


이글은 우분투 포럼에 A-star라는 작자가 올린 글을 요약 정리 한겁니다.
http://ubuntuforums.org/showthread.php?t=81311

방법은 간단합니다.
tar로 전체 시스템을 압축하는 명령어를 사용하면서 
/proc , /lost+found , /mnt , /sys 는 제외하고 압축하고 
나중에 복원은 이 파일 압축 푸는 방식입니다.

===========압축=========================

방법은 아래에 순서대로 작성했습니다.

sudo su 
cd /
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/media --exclude=/sys /

그러니까 루트 권한으로 바꾸고 나서 최상위 리스트로 올라가서 tar 명령어를 적용하는데 
압축 파일이름은 backup.tgz로 하고 압축시 /proc , /lost+found , /mnt , /sys, /media 는 제외하자는 겁니다.
각자 사정에 맞춰서 제외할 디렉토리는 더 추가하시면 되겠죠.

그런 후에 backup.tgz파일을 dvd로 굽든 랜으로 다른 컴터로 옮기시든 하시면 되겠죠.

압축 종료후 나오는 'tar: Error exit delayed from previous errors'란 메세지는 쌩까시면 됩니다.
압축률을 좀더 높이자면 Bzip2나 7zip으로 압축하시면 됩니다.
Bzip2로 압축할 경우 아래 명령어를 쓰시면 됩니다. (cvpzf에서 cvpjf로 옵션을 바꿔야합니다.)

tar cvpjf backup.tar.bz2 --exclude=/proc --exclude=/lost+found --exclude=/backup.tar.bz2 --exclude=/mnt --exclude=/media --exclude=/sys --exclude=/boot /

==============복원===================
backup.tgz는 루트디렉토리에 있어야합니다. 
sudo su
그리고 아래 명령어를 먹여주면 됩니다.
tar xvpzf backup.tgz -C /

Bz2로 압축한 경우 
tar xvpjf backup.tar.bz2 -C /

그러고 나서 압축시 제외했던 폴더는 따로 만들어 주면됩니다mkdir sys.
아래처럼 
mkdir proc
mkdir lost+found
mkdir mnt
mkdir sys
mkdir media
etc...
=====================================

만약 압축하고 자시고 하는게 너무 귀찮다하시면 아래 방법을 쓰면 됩니다.
이건 어떤 분 블러그에서 보고 배운건데 
원본 시스템이 깔린 하드 A가 있고 그 시스템을 똑같이 복사할 하드 B가 있다고 하면 
하드 B를 하드 A에 케이블로 연결을 해서 아래 명령어를 적용시키면 됩니다.

cat (하드A) > (하드B)

만약 하드 A 위치가 /dev/hdb이고 하드 B 위치가 /dev/hdc라면 이렇게 되는거죠.

cat /dev/hdb > /dev/hdc

그러면 하드A의 내용이 하드B에 완전히 모조리 똑같이 백업됩니다. 당연히 시스템 디바이스 관련된것도
같이 가니까 사용할 컴터 스펙은 동일해야겠죠.

반응형

'OS > Linux' 카테고리의 다른 글

vi 색상 표기  (0) 2019.05.08
CENTOS 7에 XRDP 설치하기  (0) 2017.08.26
삼성 컴퓨터 유분투 설치기.  (0) 2012.02.06
rkhunter (리눅스 침입 탐지 사용하기)  (1) 2010.10.14
ps auxc 와 ps aux 결과 비교하기  (0) 2010.01.21
반응형

################################################################
1. Backup 하기

################################################################



1.
백업 가능대상
 

 - database (all datafile 과 현재 control file)
 - tablespace
 - datafile (current 또는 image copy)
 - archived redo log
 - control file (current 또는 image copy)
   
* 백업이 되는 않는 대상( init.ora, password file. listener.ora, tnsnames.ora, BFILES)

 

2. 백업 분류 

 - consistent vs Inconsistent 백업

     RMAN을 통한 백업은 대상 DB open 혹은 close된 시점에서 백업이 가능하며, open 상태에서의 백업은 항상 Inconsistent 이며, consistent 백업은 항상 mount상태에서 백업을 받은 것을 말하며 이전에 DB crash되거나 비 정상 종료가 되지 않아야 한다.

     ( NOARCHIVE MODE에서는 INCONSISTENT 백업을 허용하지 않는다)  


3.
백업 방법
3.1 전체 database 백업 

 run {

        allocate channel c1 device type disk;

        backup database

        format ‘/data/backup/rman/%d_%p_%t’;

  }

 
3.2 tablespace 백업

 run {

       allocate channel c1 device type disk;

       allocate channel c2 device type disk;

       allocate channel c3 device type disk;

       backup filesperset=3                                  ## 한 백업set datafile 3개를 넘어서 백업받지 않는 조건

       tablespace example , users,system

       include current controlfile;                          ## 현재 control file도 같이 백업

 }


3.3 datafile
백업

 run {

       allocate channel c1 device type disk;

       backup  datafile 1, 2, 3, 4, 5, 6 ;

 }

 
3.4 datafile copy

 run {

        allocate channel c1 device type disk;   

        backup datafilecopy ‘/home/oracle/oradata/testdb/users01.dbf’

        format ‘/data/backup/rman/users01.bak’;

 }

 
3.5 current control file 백업

 run {

       allocate channel ch1 type disk;

       backup current controlfile

       tag = mondayPMbackup;

  }

 
3.6 다른 object 백업시 control file 백업 추가 방법

 run {

       allocate channel ch1 type disk;

       backup tablespace users

       include current controlfile;                          ## users 라는 tablespace 백업시 currnet control file 포함

 }

 
3.7 Archive redo log 백업

 

 run {

       allocate channel ch1 type disk;

       backup archivelog all                                 ## archive된 모든 redo log 백업

       delete input;                                               ## 백업받은 archive log 삭제

 }

 

 * archived redo log 백업시 time, SCN, log sequence number 조건을 사용해서 백업 받을수 있다.

    예) time 조건

 run {

        allocate channel ch1 type disk;

        backup archivelog

        from time ‘SYSDATE-2’ until time ‘SYSDATE-1’;         ## 2일전부터 1일전까지 발생한 archived redolog

 }                                                                                              

 

4. incremental 백업

 

 run {

       allocate channel ch1 type disk;

       backup incremental level=0                        ## level 0 으로 database incremental backup

       database;

 }

 

 run {

       allocate channel ch1 type disk;

       backup incremental level=1                        ## level 1 system tablespace sale.f datafile 을 백업

       tablespace system                                     ##   하는데 level 0 또는 1이후로 변경된 사항만

       datafile ‘/home/oracle/oradata/testdb/example01.dbf’;   ##                     백업받는다.

 }

 

 run {

       allocate channel ch1 type disk;

       backup incremental level=2 cumulative       ## level 2 tbs_1 tablespace 백업하는데 level 0 또는 1

       tablespace  example;                                 ## 이후로 변경된 사항만 백업(cumulative 옵션사용)

 }

 

 

5. image copies

 

1. datafile

2. archived redo log

3. control file

 
5.1 datafile controlfile image copy

1)

 run {

       allocate channel ch1 type disk;

       copy

       datafile 1 to ‘/data/backup/rman/df_1.bak,

       datafile 2 to ‘/data/backup/rman/df_2.bak’,

       datafile 3 to ‘/data/backup/rman/df_3.bak’,

       datafile 4 to ‘/data/backup/rman/df_4.bak’,

       current controlfile to ‘/data/backup/rman/control.bak;

 }

 

  

################################################################
Restore

################################################################

 

1. Restore Datafile, Controlfile, Archived redo log file

 - restore 명령으로 백업set이나 image copy본에서 restore가능하다.

 (image copy본은 disk에서만 가능)

 

2. restore database

 - database restore시에는 db는 항상 close상태이어야 한다. (db open된 상태라면 아래와 같이 shutdown , startup mount 상태로 한다.)

 

     shutdown immediate

     startup mount

 

ex) 기존의 datafile 위치에 database restore 하는경우

 run {

       allocate channel ch1 type disk;

       allocate channel ch2 type disk;

       allocate channel ch2 type disk;

       restore database;

 }

 

3. tablespace datafile restore
3.1 기존위치에 tablespace restore

 run {

        sql ‘alter tablespace example offline ’;

        allocate channel ch1 type disk;

        restore tablespace  example;

 }

 
3.2 새로운 위치에 tablespace restore

 run {

        allocate channel ch1 type disk;

        sql ‘alter tablespace  example offline’ ;

         ## 새로운 위치에 datafile restore

         set newname for datafile ‘/home/oracle/oradata/testdb/example01.dbf’
          
to ‘/home/oracle/temp/example01.dbf’;

         restore tablespace example;

         ## 변경된 위치로 control file이 인식할 수 있게 함

         switch datafile all;

 }


4. control file restore

 - nomount 단계에서 restore 해야함

 run {

       allocate channel ch1 type disk;

       restore controlfile;

       alter database mount;

 }

 

5. Archived redo log restore

 - mount 단계에서 restore

 run {

       ## init.ora 에 명시되어있는 log_archive_dest 위치가 아니 다른 위치에 restore하고자 할때

       set archivelog destination to ‘/oracle/temp_restore’;

       allocate channel ch1 type disk;

       restore archivelog all;

 }

  

################################################################
Recovery

################################################################

1. Complete Recovery
1.1 recover database

 shutdown immediate;

 startup mount;

 

 run {

       allocate channel ch1 type disk;

       restore database;

       recover database;

 }

 
1.2 recover database (control file 백업본을 restore하고 복구하는 경우)

 startup nomount;

 

 run {

        allocate channel ch1 type ‘sbt_tape’;

        restore controlfile;

        alter database mount;

        restore database;

        recover database;

        alter database open resetlogs;

 }

 * resetlogs database open한 경우 reset database명령수행이 필요하며, 다시 database를 백업받는다.

 
1.3. recover tablespace
1.3.1 database close상태이고 tablespace위치에 접근가능할 때

 run {

        allocate channel ch1 type disk;

        restore tablespace tbs_3;

        recover tablespace tbs_3;

 }

 
1.3.2 database close상태이고 tablespace위치에 접근가능하지 못할 때
(datafile 위치를 바꿀 필요가 있을때)

 run {

        allocate channel ch1 type disk;

        set newname for datafile ‘/disk1/oracle/tbs_1.f’ to ‘/disk2/oracle/tbs_1.f’;

        restore tablespace tbs_1;

        switch datafile all;

        recover tablespace tbs_1;

 }

 
1.3.3 database open된 상태이고 tablespace위치에 접근가능할 때

 run {

        sql ‘alter tablespace user_data offline temporary’;

        allocate channel ch1 type disk;

        set archivelog destination to ‘/oracle/temp/arc1_restore’;

        restore tablespace user_data;

        recover tablespace user_data;

        sql ‘alter tablespace user_data online’;

 }


1.3.4 database
open된 상태이고 tablespace위치에 접근불가능할 때

 run {

        sql ‘alter tablespace tbs_1 offline temporary’;

        allocate channel ch1 type disk;

        set newname for datafile ‘/disk1/oracle/tbs_1.f’ to ‘/disk2/oracle/tbs_2.f’;

        restore tablespace tbs_1;

        switch datafile all;

        recover tablespace tbs_1;

        sql ‘alter tablespace tbs_1 online’;

 }


2. Incomplete Recovery
2.1 time base Incomplete Recovery

   time base Incomplete Recovery를 하고자 할 때는 time format을 확인한 후 작업해야 한다.

  (필요시 time format설정 변경)

 

   ) NLS_LANG=american

   NLS_DATE_FORMAT=’Mon DD YYYY HH24:MI:SS’

 

   database open시는 반드시 shutdown후 작업

     shutdown immediate;

     startup mount;

 

 run {

       set until time ‘Nov 15 1998 09:00:00’;

       allocate channel ch1 type ‘sbt_tape’;

       restore database;

       recover databse;

       alter database open resetlogs;

 }

 

   resetlogs database open후 반드시 recovery catalog database reset database 명령으로 초기화 후 target database를 백업 받도록 한다.

 


2.2
특정 SCN까지 recovery

 database open시는 반드시 shutdown후 작업

   shutdown immediate;

   startup mount;

 

 run {

       set until scn 1000;

       allocate channel ch1 type ‘sbt_tape’;

       restore database;

       recover database;

       alter database open resetlogs;

 }

 

   resetlogs database open후 반드시 recovery catalog database reset database 명령으로 초기화 후 target database를 백업 받도록 한다.

 


2.3
특정 log sequence까지 recovery

  어느시점까지 recovery할것인지는 v$log_history view 조회를 통해서 결정

 

   database open시는 반드시 shutdown후 작업

    shutdown immediate;

    startup mount;

 

 ## thread 1에 대해 log sequence 6 까지 recovery하는 예

 run {

       set until logseq 6 on thread 1;

       allocate channel ch1 type ‘sbt_tape’;

       restore database;

       recover database;

       alter database open resetlogs;

 }

  resetlogs database open후 반드시 recovery catalog database reset database 명령으로 초기화 후 target database를 백업 받도록 한다.


3.  recovery catalog
없이 DBPITR(DataBase Point In Time Recovery)할때

 - recovery catalog 없이 DBPITR 수행을 하고자 할때는 아래와 같은 몇가지 필요한 사항들이 있다

 - control file은 별도로 백업을 받아 두도록 한다.

    database 백업시 control file도 자동으로 백업을 받아지기는 하지만 그때 발생한 database 백업에 대한 정보를 가지고 있지 못하기 때문에 별도로 아래와 같이 백업을 받도록 한다.

 

     backup database;

    backup current controlfile tag = ‘database backup’;

 

    controlfile 백업시 tag 옵션을 사용하여 향후에 특정시점에 백업받은 controlfile을 사용할 수 있도록 한다.

 - tablespace 변경 시나 datafile 추가시 백업을 수행하도록 한다.(control file도 포함)

 

 예)

     catalog없이 rman 시작

     rman target / nocatalog

 

     만일 database open된 상태라면 shutdown mount시킨다.

     startup force mount;

 

     특정 임시위치에 control file restore

 run {

        set until time ‘Jun 18 1998 16:32:36’;

        allocate channel ch1 type disk;

        restore controlfile to ‘/tmp/cf.tmp’ from tag = ‘database backup’;

 }

 

 백업받은 특정 controlfile restore할 수 없을 때는 rman을 통해 restore받은 controlfile아래와 같은 sql 명령으로 백업받은 후 init.ora 관련 파라미터를 조정한후 다음단계를 수행하도록 한다.


 - sql > alter database backup controlfile to ‘/tmp/original_cf’;

 - database shutdown

 - init.ora 에 명시된 CONTROL_FILES 파라미터를 적절히 조정

 - 백업받은 controlfile을 적당한 위치에 copy

 - startup mount

 run {

        set until time ‘Jun 18 1998 16:32:36’;

        allocate channel ch1 type disk;

        restore database;

        recover database noredo;                         ## database Noarchive Mode일때 noredo 옵션사용

        alter database open resetlogs;                  ## Archive Mode일때는 noredo 옵션없이 recover한다.

 }


출처 : cafe.naver.com/prodba
반응형

'Database > ORACLE' 카테고리의 다른 글

오라클 클론 디비로 복구 하기  (0) 2010.07.13
PL/SQL Exception  (0) 2010.07.06
오라클 암호화 기능  (0) 2010.07.02
오라클 pump 관련 자료  (0) 2010.06.30
오라클 기본 유저 정보  (0) 2010.06.30

+ Recent posts