출처 : http://mediakorea.net/sirboard/board_view.php
오라클 백업명령어인 imp/exp에 대한 간단한 예입니다.
1. 백업
[root@web jeous]# exp
Export: Release 8.0.5.1.0 - Production on 화 Sep 18 11:41:26 2001
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Username: leona/leona ( 사용자 어카운트 및 패스워드 )
Connected to: Oracle8 Release 8.0.5.1.0 - Production
PL/SQL Release 8.0.5.1.0 - Production
Enter array fetch buffer size: 4096 > ( 버퍼 사이즈 )
Export file: expdat.dmp > ( 저장될 바이너리 파일명의 지정 )
(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > t ( 테이블단위로 혹은 유저 단위로 백업할지의 여부 )
Export table data (yes/no): yes > ( no할 경우 스키마만 백업함. )
Compress extents (yes/no): yes > ( 압축 허용 여부 )
Export done in KO16KSC5601 character set and JA16SJISFIXED NCHAR character set
About to export specified tables via Conventional Path ...
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > test2 ( 테이블명 지정 )
. . exporting table TEST2 3 rows exported
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >
Export terminated successfully without warnings.
[root@web jeous]#
2. 복구
[root@web jeous]# imp
Import: Release 8.0.5.1.0 - Production on 화 Sep 18 11:36:26 2001
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Username: leona/leona ( 사용자 어카운트 및 패스워드 )
Connected to: Oracle8 Release 8.0.5.1.0 - Production
PL/SQL Release 8.0.5.1.0 - Production
Import file: expdat.dmp > exp1.dmp (exp1.dmp 파일명을 지정한 경우)
Enter insert buffer size (minimum is 4096) 30720> ( 사이즈가 클수록 수행속도 빨라짐 )
Export file created by EXPORT:V08.00.05 via conventional path
List contents of import file only (yes/no): no > ( 복구되어지는 내용을 보겠는가? )
Ignore create error due to object existence (yes/no): no > ( 수행시의 에러를 보겠는가? )
Import grants (yes/no): yes > (사용자가 가지고 있는 권한까지 다시 생성할지 여부)
Import table data (yes/no): yes > yes (테이블을 만들고 나서 테이터를 저장할 것인지의 여부)
Import entire export file (yes/no): no > yes (백업 파일내의 모든 데이터를 다시 저장하고 싶을때 yes)
. importing DEVELOPER's objects into DEVELOPER
. . importing table "TEST2" 3 rows imported
Import terminated successfully without warnings.
[root@web jeous]#
*주의
테이블 백업 시에는 같은 테이블이 존재하면 imp 실행시 에러가 발생합니다.
#### user 데이터 백업의 예
exp예:
# exp userid=nanu/passwd file=/home/oraback/nanu041701.dmp` owner=nanu consistent=n
(consistent=n -> 테이블 단위로 읽기 일관성 보장)
imp예:
# imp nanune/passwd full=n grants=y rows=y commit=y fromuser=nanu touser=nanu file=nanu041701.dmp ignore=n
(ignore=n -> object가 이미 존재할때 error를 출력함)



최근 덧글