달력

3

« 2024/3 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
.. .. ..

vi test

file  = 20120620_TB_KT_TALLEHPOINTAUTH.dmp
log   = 20120620_TB_KT_TALLEHPOINTAUTH.log
tables     = cpass.KT_TMCHT_TRAN_INFO
query     = "WHERE  TO_DATE(JOB_DT, 'YYYYMMDD') >  TO_DATE('20120301', 'YYYYMMDD')"

 

exp 아이디/패스워드 parfile=vi로만든 파일이름

 

 

 

 

참고자료

[펌] :  https://kr.forums.oracle.com/forums/thread.jspa?messageID=1698906

 

제품 : ORACLE SERVER

작성날짜 : 2004-03-17

EXPORT 시 QUERY OPTION에 대한 사용 예(ORACLE 8I 이상)
============================================

PURPOSE
============
oracle 8i에서 export 시 query option에 대한 사용 예


8i에서 export의 query syntax 를 이용하여 table data의 한 부분만 exporting 이 가능


- 8i 에서 select 문장의 where 절을 사용하는 것처럼 export 시에 부분적으로 table data 를 받아 낼수 있는 기능을 소개 한다.
- Direct 옵션은 사용될 수 없다..
- where 절에 해당하는 export utility는 query parameter 를 사용한다.

UNIX syntax:



- Example:
1.SCOTT.Emp table의 ename 이 JAME과 비슷한 이름의 data 를 export ..
exp scott/tiger query=\"where ename like \'JAME%\'\" tables=emp file=exp.dmp log=exp.log


2. employee와 cust table에서 new york 주의 data 만 export ..
exp scott/tiger query=\"where st=\'NY\'\" tables=(employee,cust) file=exp.dmp log=exp.log

query 문장에서 UNIX reserved characters( ", ', ,< .. 등) 를 사용하는 경우에는 escape ('\') 을 반드시 사용해야 한다.
예)query=\"where JOB = \'SALESMAN\' and salary \< 1600\"

더 중요한 것은 command line에서 export option을 사용할때는 반드시 escape 이 있어야 하나
parfile을 사용할때는 eacape이 불필요하다.

예를 보면 .. p라는 이름의 file을 다음과 같이 생성
tables=emp query="where job='SALESMAN'"

parfile을 이용해서 export 를 실행해 보면
[rmtdchp6]/apac/rdbms/64bit/app/oracle/product/9.2.0> exp scott/tiger parfile=p

Export: Release 9.2.0.4.0 - Production on Wed Mar 17 00:12:34 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses KO16KSC5601 character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table EMP 4 rows exported
와 같이 정상 처리 됨을 알수 있다.

만일 command line에서 위의 내용을 실행하게 되면 다음과 같이 error 를 만난다.
exp scott/tiger tables=emp query="where job='SALESMAN'"

LRM-00101: unknown parameter name 'job'

EXP-00019: failed to process parameters, type 'EXP HELP=Y' for help
EXP-00000: Export terminated unsuccessfully

command line에는 query 내에 single(')나 double quotes(") 를 사용한다면 반드시 double quotes(") 를 사용하여
query 문을 묶어야 한다.그러나 query 내에서 single ('')나 double quotes(") 를 사용하지 않는다면 single quotes (')을 사용하여
query 문을 수행할 수도 있다..

다음 예를 보면..
1>exp scott/tiger tables=emp query=\'where deptno=20\'

Export: Release 9.2.0.4.0 - Production on Wed Mar 17 00:22:00 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses KO16KSC5601 character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table EMP 4 rows exported

2>exp scott/tiger tables=emp query=\'where job=\'SALESMAN\'\'

LRM-00112: multiple values not allowed for parameter 'query'

EXP-00019: failed to process parameters, type 'EXP HELP=Y' for help
EXP-00000: Export terminated unsuccessfully

즉.. 정리를 하자면
command line에서 query 내에 '," 을사용하지 않는 다면 '나 " 으로 query option을 사용할수 있다
query=\'where deptno = 20\'
query=\"where deptno = 20\"
query=\'where deptno \< 2\'
(이 경우 single 이나 double quotes 을 둘다 사용할수 있다.)

parfile을 사용하는 경우에는 다음과 같이 단순하게 사용이 가능하다.
query='where deptno = 20'
query="where deptno = 20"
query='where deptno < 20'


WINDOWS NT / 2000 와 NETWARE syntax:


다음의 자료를 참조바란다.

Example:

EXP demo/demo tables=emp file=exp1.dmp query="""where deptno>30"""

double quotes(") 를 둘러 싸는 경우에는 space 가있으면 안된다.

parfile의 사용은 다음과 같이 하시면 됩니다.

file=exp66.dmp
query="where deptno > 20"
tables=(emp)
log=log66.txt
userid=scott/tiger


Explanation


Windows NT or Win2000의 경우 command line에서는 3 double quotes 이 필요하고
'PARFILE 을 사용하는 경우에는 double quotes(") 한번만 필요함

Reference Documents


Oracle8i Utilities guide
Note:91864.1

.
:
Posted by .07274.