반응형



소개글 : http://web-dev.tistory.com/562


위의 글은 아크로 에디터를 다운로드 받는 등 간단한 소개 내역이다.


사실 


울트라 에디터를 사용했던 주된 이유는 


대용량 한글 텍스트 파일(1GB 이상)을 부담없이 열어주며,


정규식 표현으로 특정 단어 + 다음줄 변환이 가능했기 때문이다.


그동안 아크로 에디터에서는 안되는 줄 알았는데,...


제 무지였음을 깨닿고 내용을 남깁니다.



-> 대용량 텍스트 연계 파일의 경우


DxxxxDxxxDxxx 등과 같이 특정 단어로 시작하는 경우가 많다.


그럴 경우


1. 아크로에디트 -> 찾기 -> 바꾸기 실행

    



2. 아래는 바꾼 후의 사진

    - 멋지지 않은가?

      실제 사례로... xml 태그 같은 경우

      찾는 문자열 : ><

      바꿀 문자열 : >\n< 

     정규 표현식 사용 체크, 범위 전체 체크 하면

     깔끔한 형태로 보여진다.


3. 기타 팁

    편집 -> 모두 선택 (전체가 블록 지정된 상태) -> 도구 -> 빈 줄 자동 삭제

    즉 필요없이 엔터가 많은 파일에서는 위의 설정을 선택하면 모든 빈줄이 사라진다 !



   


반응형
반응형

후암...


Shell 과 같은 형태로 BAT를 만드는 것은 왜케 어렵나 -_-


참조 사이트 : http://mwultong.blogspot.com/2007/05/batch-file-infinity-loop.html


우선 local PC와 원격 서버와의 연결 정보(대용량 엑셀 다운로드 시)


확인하기 위해


주기적인 findstr 과 netstat를 통해 정보를 추출할 필요가 있다!


그런데.. 손가락 아퍼...


그래서 1초  단위로 Ctrl +  C 누를 때까지 무한 반복하는 BAT 파일임...



@echo off
setlocal

:LOOP
echo 종료할려면 Ctrl + C를 누르면 강제 종료함.

::::::::::::::::::::::::::::::::::::::::
:: 이 부분이 없으면 영원한 무한루프가 됨
set /a myStopper+=1
if %myStopper% GEQ 10 goto QUIT
::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::루프구간
:: 총 1초 대기
for /L %%i in (1,-1,1) do (ping 127.0.0.1 -n 2 > nul | echo "============================================================================")

echo =) 접속 PC
echo %COMPUTERNAME%
echo =) 현재 날짜는
date /t
echo =) 현재 시각
time /t


netstat -an | findstr 125.160.248.111

goto LOOP

:QUIT


반응형

'OS' 카테고리의 다른 글

net 명령어  (0) 2014.11.13
폴더 계정별 권한 부여하기  (0) 2014.11.13
CMD 창 모양 크기 색 변경하기  (2) 2013.01.10
반응형

엑셀을 처리하는 방법

1. 일반적인 방법

   - DB <---> WAS (JAVA) 파일 생성 <---> JSP 다운로드

   - 문제점 : WAS에 메모리에서 엑셀 파일을 만들기 때문에 메모리 할당 공간이 부족할 때는 OOM(Out Of Memory)으로

                 힙 덤프를 사정없이 발사 !

 

2. 대용량 엑셀 처리 방법

    - 엑셀을 생성할 때 XML 방식으로 생성함

      http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats#Excel_XML_Spreadsheet_example

    - outputStream으로 행별로 Text를 써야 메모리에 한꺼번에 올리지 않아 WAS가 OOM를 뿜으면서 죽지 않음.

       ※ 첨부된 자바파일을 참고함

    - 대용량이므로 속도에 신경 쓰지 않을 수 없다 !!!

      그러므로 Fetch Size(JAVA에서 Oracle를 사용할 때 가지고오는 row의 양...)을 조절하여 성능향샹의 효과 까지 볼수 있다.

 

후후... 재미있는건... 난 자바를 잘 모른다...

개발자들도 원인을 잘 찾지 않는다...

귀찮은 걸까... 해결하고 싶지 않을껄까...

난 인프라 담당인데 하하하 -_-

 

BigGridDemo.java

반응형
반응형


참고 사이트 (Reference Site)

  1.MAT (Eclipse Memory Analyzer) 메모리 분석 GUI 툴
    http://www.eclipse.org/mat/downloads.php 

  2. IBM Diagnostic Tool Framework for Java Version 1.5
    http://www.ibm.com/developerworks/java/jdk/tools/dtfj.html  

  3.일본 MAT 적용 참고 사이트   
     http://d.hatena.ne.jp/kakku22/20110910/1315646914 
 


heapdump는 시스템 운영 중 항상 발생할 수 있는 문제이며,

빵빵한 시스템에서는 IBM Heap Analyzer를 사용하여 분석한다

다만,

위와 같은 빵빵한(?) 시스템이 지원되지 않는 환경(Windows 32bit)에서는

분석하는 방법이 없을까 많은 고민을 하였고, 찾다보니 아에 방법이 없지만은 않았다.


1. GUI 툴 다운로드
    - 이클립스 사이트에서 dump 분석을 위한 툴을(MAT) 제공한다.
    - 위의 참고사이트 1번 항목을 방문하면 다운로드 가능하다.

 
     - 다운 받은 파일의 압축을 풀고 해당 디렉토이에 들어가면 MemoryAnlyzer.exe와 MemoryAnalyzer.ini 파일등이 보인다.
     - 32bit 환경에서 최대 할당 가능한 heap 사이즈로 로딩 가능하도록 MemoryAnlyzer.ini 파일을 수정한다.

  -vmargs
 -Xmx1372m
 
2. IBM Heapdump 분석을 위해서는 별도의 plug-in을 추가한다.
   (인터넷 검색하면 많은 내용이 나오지만 위의 DTFJ 파일 방식이 대용량의 힙 덤프 분석에는 최고다..)
   - 2번 사이트 방문하여 다운로드 한다.


위의 클릭을 하면 zip 파일을 받을 수 있다.
   
받은 zip 파일을 MAT 압축을 풀은 디렉토리 내에 DTFJ 폴더를 만들어 그안에 복사하여 놓는다.

3. MAT에 Plug-IN 설치
    - MemoryAnlyzer.exe 더블 클릭하여 MAT 를 실행함.
    - 실행화면
     

 
     -  Help -> Install New Software... 실행


   - Add.. 를 크릭하여 설치 가능한 소프트웨어를 추가함.


     - Name에는 명칭을 적고, Location 부분은 우측의 Archive를 클릭하여 다운받은 dtfj-updatesite.zip를 직접 지정함

 
    - Check 후 Next를 클릭 -> Next

 
 - 라이센스 동의 후 Finish 클릭

 

- local 설치이다 보니 보안 땜시 한번더 묻는거임... ok 살포시 눌러줌

 
 - 다시 시작함(Restart Now를 눌러)

 
  - File -> Open Heap Dump... 를 눌러 IBM Heapdump 파일을 선택하여 분석함..

 
나머지 분석과 관련된 상세한 사항은 인터넷 검색 ㄱㄱ 
반응형
반응형

Memory-mapped files

Memory-mapped files allow you to create and modify files that are too big to bring into memory. With a memory-mapped file, you can pretend that the entire file is in memory and that you can access it by simply treating it as a very large array. This approach greatly simplifies the code you write in order to modify the file. Here’s a small example:

//: c12:LargeMappedFiles.java
// Creating a very large file using mapping.
// {RunByHand}
// {Clean: test.dat}
import java.io.*;
import java.nio.*;
import java.nio.channels.*;

public class LargeMappedFiles {
  static int length = 0x8FFFFFF; // 128 Mb
  public static void main(String[] args) throws Exception {
    MappedByteBuffer out = 
      new RandomAccessFile("test.dat", "rw").getChannel()
      .map(FileChannel.MapMode.READ_WRITE, 0, length);
    for(int i = 0; i < length; i++)
      out.put((byte)'x');
    System.out.println("Finished writing");
    for(int i = length/2; i < length/2 + 6; i++)
      System.out.print((char)out.get(i));
  }
} ///:~


To do both writing and reading, we start with a RandomAccessFile, get a channel for that file, and then call map( ) to produce a MappedByteBuffer, which is a particular kind of direct buffer. Note that you must specify the starting point and the length of the region that you want to map in the file; this means that you have the option to map smaller regions of a large file.

MappedByteBuffer is inherited from ByteBuffer, so it has all of ByteBuffer’s methods. Only the very simple uses of put( ) and get( ) are shown here, but you can also use things like asCharBuffer( ), etc.

The file created with the preceding program is 128 MB long, which is probably larger than the space your OS will allow. The file appears to be accessible all at once because only portions of it are brought into memory, and other parts are swapped out. This way a very large file (up to 2 GB) can easily be modified. Note that the file-mapping facilities of the underlying operating system are used to maximize performance.

Performance

Although the performance of “old” stream I/O has been improved by implementing it with nio, mapped file access tends to be dramatically faster. This program does a simple performance comparison:

//: c12:MappedIO.java
// {Clean: temp.tmp}
import java.io.*;
import java.nio.*;
import java.nio.channels.*;

public class MappedIO {
  private static int numOfInts = 4000000;
  private static int numOfUbuffInts = 200000;
  private abstract static class Tester {
    private String name;
    public Tester(String name) { this.name = name; }
    public long runTest() {
      System.out.print(name + ": ");
      try {
        long startTime = System.currentTimeMillis();
        test();
        long endTime = System.currentTimeMillis();
        return (endTime - startTime);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
    public abstract void test() throws IOException;
  }
  private static Tester[] tests = { 
    new Tester("Stream Write") {
      public void test() throws IOException {
        DataOutputStream dos = new DataOutputStream(
          new BufferedOutputStream(
            new FileOutputStream(new File("temp.tmp"))));
        for(int i = 0; i < numOfInts; i++)
          dos.writeInt(i);
        dos.close();
      }
    }, 
    new Tester("Mapped Write") {
      public void test() throws IOException {
        FileChannel fc = 
          new RandomAccessFile("temp.tmp", "rw")
          .getChannel();
        IntBuffer ib = fc.map(
          FileChannel.MapMode.READ_WRITE, 0, fc.size())
          .asIntBuffer();
        for(int i = 0; i < numOfInts; i++)
          ib.put(i);
        fc.close();
      }
    }, 
    new Tester("Stream Read") {
      public void test() throws IOException {
        DataInputStream dis = new DataInputStream(
          new BufferedInputStream(
            new FileInputStream("temp.tmp")));
        for(int i = 0; i < numOfInts; i++)
          dis.readInt();
        dis.close();
      }
    }, 
    new Tester("Mapped Read") {
      public void test() throws IOException {
        FileChannel fc = new FileInputStream(
          new File("temp.tmp")).getChannel();
        IntBuffer ib = fc.map(
          FileChannel.MapMode.READ_ONLY, 0, fc.size())
          .asIntBuffer();
        while(ib.hasRemaining())
          ib.get();
        fc.close();
      }
    }, 
    new Tester("Stream Read/Write") {
      public void test() throws IOException {
        RandomAccessFile raf = new RandomAccessFile(
          new File("temp.tmp"), "rw");
        raf.writeInt(1);
        for(int i = 0; i < numOfUbuffInts; i++) {
          raf.seek(raf.length() - 4);
          raf.writeInt(raf.readInt());
        }
        raf.close();
      }
    }, 
    new Tester("Mapped Read/Write") {
      public void test() throws IOException {
        FileChannel fc = new RandomAccessFile(
          new File("temp.tmp"), "rw").getChannel();
        IntBuffer ib = fc.map(
          FileChannel.MapMode.READ_WRITE, 0, fc.size())
          .asIntBuffer();
        ib.put(0);
        for(int i = 1; i < numOfUbuffInts; i++)
          ib.put(ib.get(i - 1));
        fc.close();
      }
    }
  };
  public static void main(String[] args) {
    for(int i = 0; i < tests.length; i++)
      System.out.println(tests[i].runTest());
  }
} ///:~


As seen in earlier examples in this book, runTest( ) is the Template Method that provides the testing framework for various implementations of test( ) defined in anonymous inner subclasses. Each of these subclasses perform one kind of test, so the test( ) methods also give you a prototype for performing the various I/O activities.

Although a mapped write would seem to use a FileOutputStream, all output in file mapping must use a RandomAccessFile, just as read/write does in the preceding code.

Here’s the output from one run:

Stream Write: 1719
Mapped Write: 359
Stream Read: 750
Mapped Read: 125
Stream Read/Write: 5188
Mapped Read/Write: 16


Note that the test( ) methods include the time for initialization of the various I/O objects, so even though the setup for mapped files can be expensive, the overall gain compared to stream I/O is significant.

출처 : http://www.linuxtopia.org/

반응형
반응형

입력되는 테이블을 NoLogging 상태로 만들기

alter table  TFEI_TEMP_SND_RCV_FILE nologging;

append 힌트 사용하기

대용량 데이타를 insert 할 경우는 시간이 매우 많이 걸리게 된다.

 그러다가 temp 사이즈나 데이타 오류로 인해 에러가 나더라도

바로 에러를 밷는것이 아니라 롤백을 모두 한후에야

에러를 나타낸다.
 

총 insert 하는 데 걸리는 시간이 3시간이라면

2시간 진행된 작업이 잘못 됐다는걸 알았다(또는 에러가 났다는걸 알았다)

 

그러면 바로 에러를 뱉어내는 것이 아니라 롤백을 2시간 해주어야 된다

즉..  잘못된 insert 작업을 2시간 하다가 취소하면 2시간 기다려야(롤백하느라) 된다는 것이다..


 

얼마나 짜증나는 일인가???
 

해답이 있다 APPEND 를 쓰면 된다.

 

insert /*+append*/ into aaa

select * from ......



 

append 힌트는 롤백을 쌓지않고 바로 테이블스페이스에 저장하게 된다.

취소할 경우에는 그동안 저장된 데이타만 날리기때문에 취소도 즉시 된다.

 

정말 빠르다~~


 

하지만 단점이 있으니....


 

롤백을 쌓는 insert 의 경우에는 얼마나 작업이 진행됐는지 롤백 세그먼트 크기를

보면서 모니터를 할 수 있다.


 

하지만 append 는 롤백을 쌓지 않기 때문에 얼마나 진행됐는지 확인하기가 쉽지 않다.


 

한가지 힌트가 있다면

insert 되는

테이블의 크기라 1024M 이고 익스텐트를 128M이라면

insert 되는 데이타가 1024M의 용량을 넘었다면 익스텐트를 일으키기 때문에

extend 를 하는지 안하는지를 보면 작업이 어느정도 진행되는지 알수 있다.

 

출처 : 일부 나... 그외

http://shinyoung.kr/514

또한 프로세스 개수가 넉넉하다면 PARALLEL 옵션을 주면 더욱 좋다 ㅋ

반응형

+ Recent posts