반응형


CentOS ulimit 값 변경 (Too many open files Tomcat Error and NoClassDefFoundError)




Too many open files Tomcat Error and  NoClassDefFoundError 에러가 톰캣에서 발생할 때 해결하는 방법이에요


OS에서 파일 갯수를 제한하고 있는데 이걸 늘려줌으로써 해결할 수 있어요





centos 상에서 ulimit 값은 아래와 같이 디폴트로 설정되어있어요


(ulimit -a 쳐보면 나와요) --> 현재 로그인 된 계정의 설정 값이 보임


    /proc/[pid]/limits : 이것을 통해 프로세스에 적용된 limit 정보도 확인 가능










이 값은 실행중인 파일이나 프로세스가 증가함에 따라 문제가 일으킬 수 있어요


open files 값이나 max user processes 값이 적어서 생기는 문제에요


이럴땐 


/etc/security/limits.conf로 들어가서


제일마지막에


root hard nofile 65535


root soft nofile 65535


root hard nproc 65535


root soft nproc 65535


이걸 추가해주고 centos를 재시작해주면 끝! --> 재시작 안해도 되는 듯 합니다.


그럼 ulimit -a명령어를 쳤을 경우 아래처럼 값이 변경되요













위의 방법은 user lever open file 갯수 조정하는 방법이고


전체 조정 방법은


    최대 open file 갯수 조회 방법


      #cat /proc/sys/fs/file-max


      #sysctl fs.file-max


로 조회가 가능하고


vi /etc/sysctl.conf에 들어가서 fs.file-max=66536과 같은 방식으로 조정이 가능해요



반응형
LIST
반응형

1.     VirtualBox 설치

1.1.    다운로드

 

1.2.    설치

별로 고민할 필요없이 Next만 하면 된다...

  • VirtualBox-5.0.6-103037-Win.exe 실행
  • "Welcom to the Oracle VM VirtualBox 5.x.x Setup Wizard" --- [Next >]
  • "Custom Setup" --- Location: C:\Program Files\Oracle\VirtualBox\ --- [Next >]
  • [ ] Create a shortcut on the desktop --- [ ] Create a shortcut in the Quick Launch Bar --- [Next >]
  • "Warning: Network Interfaces" --- [Yes]
  • "Ready to Install" --- [Install]


  •  

2.     CentOS 7 다운로드

2.1.    다운로드

 


 

3.     VirtualBox CentOS 7 설치

3.1.    개요

윈도우 VirtualBox CentOS 7 설치하기

  • CentOS 7 최소 설치
  • 네트워크를 반가상으로 하여 enp0s3 대신 eth0이 나오도록 함
  • root 패스워드는 설정하고, 다른 사용자 계정은 만들지 않음
  • 인터넷공유기를 이용하는 브리지 네트워크 구성
  • 윈도우에서 CentOS 7 VM으로 SSH 접속까지 실습함

 

3.2.    사전 작업

  • VirtualBox 설치
  • CentOS 7 다운로드
  • 윈도우 tcping 설치

3.3.    VM 생성

  • VirtualBox 실행
  • [새로 만들기(N)] 클릭
  • (가상 머신 만들기)[1] --- 이름: CentOS7[2] --- [다음(N)]

  • 메모리 크기[3] --- [다음(N)]

  • 하드 디스크[4] --- [만들기]
  • (가상 하드 디스크 만들기) 하드 디스크 파일 종류[5] --- [다음(N)]

  • (O) 동적 할당(D) --- [다음(N)]

  • (파일 위치 및 크기)[6] --- [만들기]

 

이제 CentOS7 이라는 VM이 보인다.

3.4.    네트워크 설정 -> 기본 NAT를 이용하여 인터넷만 되게 사용.(설정필요없음)

  • CentOS7 우클릭 --- 설정(S)...
  • (CentOS7 - 설정) --- 네트워크 --- 어댑터 1[7][8] --- "▶ 고급(D)" 클릭
  • 어댑터 종류(T): 반가상 네트워크 (virtio-net) --- [확인]

3.5.    VM 시작, iso 마운트

  • [시작(T)] 버튼 클릭하여 VM 시작
  • (시동 디스크 선택 창) iso 파일(: CentOS-7-x86_64-DVD-1503-01.iso) 선택 --- [시작]

3.6.    CentOS 7 설치

  • 키를 눌러 Install CentOS 7 선택 Enter

(텍스트 모드에서 그래픽 모드로 전환됨)

  • (기본값) English --- [Continue]
  • [INSTALLATION DESTINATION] 클릭
  • 좌상단 [Done] 클릭
  • [Begin Installation] 클릭

(설치는 곧바로 시작되며, 진행중에 ROOT PASSWORD 등 설정)

  • [ROOT PASSWORD] 클릭
  • Root Password: P@ssw0rd --- Confirm: P@ssw0rd --- [Done] 클릭

(... 계속 설치진행)

  • [Reboot] 클릭

3.7.    리눅스 시작

재부팅이 끝나면 리눅스 콘솔이 뜬다.

CentOS release 7 (Core)

Kernel 3.10.0-229.el7.x86_64 on an x86_64

 

localhost login:

root와 패스워드를 입력하여 로그인하자.

localhost login: root

Password: P@ssw0rd

[root@localhost ~]#

 

3.8.    인터넷 연결 확인

[root@localhost ~]# ping 8.8.8.8
connect: Network is unreachable
[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:2a:8b:80 brd ff:ff:ff:ff:ff:ff
[root@localhost ~]# ifup eth0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/0)
[root@localhost ~]# ping 8.8.8.8 -c2
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=13 ttl=29 time=323 ms
64 bytes from 8.8.8.8: icmp_req=14 ttl=29 time=339 ms
 
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1447ms
rtt min/avg/max/mdev = 323.499/331.351/339.204/7.873 ms

 

3.9.    (Optional) 브리지 네트워크로 전환

16px-Crystal_Clear_app_xmag.svg.pngVirtualBox 리눅스 SSH 연결 (브리지) 문서를 참고하십시오.

인터넷 공유기[9]를 사용하는 경우

  • (Oracle VM VirtualBox 관리자) CentOS7 우클릭 --- 설정(S)...
  • (CentOS7 - 설정) 네트워크 --- 다음에 연결됨(A): 브리지 어댑터 --- [확인]

 

3.10. NetworkManager 비활성화

  • (CentOS7 [실행중] - Oracle VM VirtualBox) 리눅스 쉘

[root@localhost ~]# systemctl status network | head -3

network.service - LSB: Bring up/down networking

   Loaded: loaded (/etc/rc.d/init.d/network)

   Active: active (exited) since Mon 2015-12-21 09:03:40 EST; 3min 31s ago

[root@localhost ~]# systemctl status NetworkManager | head -3

NetworkManager.service - Network Manager

   Loaded: loaded (/usr/lib/systemd/NetworkManager.service; enabled)

   Active: active (running) since Mon 2015-12-21 09:03:40 EST; 3min 40s ago

[root@localhost ~]# systemctl stop NetworkManager

[root@localhost ~]# systemctl disable NetworkManager

rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service'

rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service'

rm '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'

 

3.11. eth0 자동시작 설정

  • ifcfg-eth0 파일 수정

UUID 주석 처리

ONBOOT yes로 수정

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet

BOOTPROTO=dhcp

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPV6_FAILURE_FATAL=no

NAME=eth0

#UUID=46f80b25-791d-3ace-b6d8-0f24ce791a3d

DEVICE=eth0

#ONBOOT=no

ONBOOT=yes

 

3.12. 재부팅 후 확인

[root@localhost ~]# reboot

(... 재부팅 ...)

CentOS release 7 (Core)

Kernel 3.10.0-229.el7.x86_64 on an x86_64

 

localhost login: root

Password: P@ssw0rd

Last login: Mon Dec 21 09:05:35 on tty1

[root@localhost ~]#

[root@localhost ~]# ping 8.8.8.8 -c2

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

64 bytes from 8.8.8.8: icmp_req=13 ttl=29 time=323 ms

64 bytes from 8.8.8.8: icmp_req=14 ttl=29 time=339 ms

 

--- 8.8.8.8 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1447ms

rtt min/avg/max/mdev = 323.499/331.351/339.204/7.873 ms

[root@localhost ~]# ip addr | grep 'inet '

    inet 127.0.0.1/8 scope host lo

    inet 192.168.0.33/24 brd 192.168.0.255 scope global dynamic eth0

→ 공유기로부터 192.168.0.33 이라는 IP주소를 받았다.

[root@localhost ~]# service network restart

Restarting network (via systemctl):                        [  OK  ]

service network restart도 잘 된다.

 

3.13. 윈도우에서 SSH 접속 확인

  • cmd 실행 ( 윈도우 cmd Enter )

C:\Users\jmnote>ping 192.168.0.33

 

Ping 192.168.0.33 32바이트 데이터 사용:

192.168.0.33 응답: 바이트=32 시간<1ms TTL=64

192.168.0.33 응답: 바이트=32 시간<1ms TTL=64

192.168.0.33 응답: 바이트=32 시간<1ms TTL=64

192.168.0.33 응답: 바이트=32 시간<1ms TTL=64

 

192.168.0.33 대한 Ping 통계:

    패킷: 보냄 = 4, 받음 = 4, 손실 = 0 (0% 손실),

왕복 시간(밀리초):

    최소 = 0ms, 최대 = 0ms, 평균 = 0ms

C:\Users\jmnote>tcping 192.168.0.33 22

 

Probing 192.168.0.33:22/tcp - Port is open - time=4.513ms

Probing 192.168.0.33:22/tcp - Port is open (23 bytes read) - time=6.500ms

Probing 192.168.0.33:22/tcp - Port is open - time=1.196ms

Probing 192.168.0.33:22/tcp - Port is open (23 bytes read) - time=7.575ms

 

Ping statistics for 192.168.0.33:22

     4 probes sent.

     4 successful, 0 failed.

Approximate trip times in milli-seconds:

     Minimum = 1.196ms, Maximum = 7.575ms, Average = 4.946ms

→ 윈도우에서 VM 22포트를 직접 접근할 수 있다.

PuTTY 등을 이용하여 리눅스 쉘에 접속해보자.

Connecting to 192.168.0.33:22...

Connection established.

To escape to local shell, press 'Ctrl+Alt+]'.

 

Last login: Mon Oct  5 22:57:02 2015

[root@localhost ~]# hostname

localhost.localdomain

 

3.14. (Optional) 스냅샷 생성

  • (Oracle VM VirtualBox 관리자 창) --- CentOS7 선택 --- 우상단 [스냅샷(S)] 클릭 --- 카메라 아이콘 클릭
  • (현재 가상 머신의 스냅샷 찍기) --- 스냅샷 이름(N): OS설치완료 --- [확인]

 

3.15. 64Bit 설치 안 되는 경우

바이오스에서 CPU 설정 부분에 있는 인텔 가상화 모드가 꺼져있어서 발생한 문제

반응형
LIST
반응형

DELIMITER //

CREATE DEFINER=`user`@`%` EVENT `EV_COLLECT_DATA_EXPORT` ON SCHEDULE EVERY 1 DAY STARTS '2016-10-04 01:00:00' ON COMPLETION NOT PRESERVE ENABLE DO CALL SP_COLLECT_EXPORT_N_DELETE()//

DELIMITER ;



-- 프로시저 IOTDEV.SP_COLLECT_EXPORT_N_DELETE 구조 내보내기

DELIMITER //

CREATE DEFINER=`user`@`%` PROCEDURE `SP_COLLECT_EXPORT_N_DELETE`()

BEGIN

DECLARE exit handler for SQLEXCEPTION,SQLWARNING

BEGIN

ROLLBACK;        

SHOW ERRORS;

   SHOW WARNINGS;

END;

/* 트랜젝션 시작 */

START TRANSACTION;


SET @exp_date = DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -6 DAY ), '%Y-%m-%d');


/* EXPORT */

SET @sql = CONCAT(' SELECT  `data`

, `id`

         , `reg_dt`

  FROM TB_TEST

WHERE reg_dt < @exp_date'

, ' INTO OUTFILE \''

, 'test-', @exp_date,'.csv'

, '\' FIELDS TERMINATED BY \',\' ENCLOSED BY \'"\' LINES TERMINATED BY \'\n\'');

PREPARE statement FROM @sql;

EXECUTE statement;

/* DELETE */

DELETE FROM TB_TEST

WHERE reg_dt < @exp_date;

COMMIT;

END//

DELIMITER ;



반응형
LIST
반응형

Temporary tablespaces are used to manage space for database sort operations and for storing global temporary tables. For example, if you join two large tables, and Oracle cannot do the sort in memory (see SORT_AREA_SIZE initialization parameter), space will be allocated in a temporary tablespace for doing the sort operation. Other SQL operations that might require disk sorting are: CREATE INDEX, ANALYZE, Select DISTINCT, ORDER BY, GROUP BY, UNION, INTERSECT, MINUS, Sort-Merge joins, etc.

1.       Create another  Temporary Tablespace

CREATE TEMPORARY TABLESPACE TEMP2TEMPFILE  ‘/xxx/xxx/temp02′ SIZE 500m;

2.       Change default Database temporary tablespace

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP2;          

3.       Make sure No sessions are using your Old Temp tablespace

SELECT USERNAME, SESSION_NUM, SESSION_ADDR FROM V$SORT_USAGE;
If you find some sort of operation in progress, wait until the terms or manually end the process

USERNAME                       SESSION_NUM        SESSION_ADDR

——————————   ———————      —————————

SYS                                      65                              000007FF646EDE68

 

4.       Drop old tablespace temp

DROP TABLESPACE TEMP1 INCLUDING CONTENTS AND DATAFILES;

5.       Recreate tablespace temp1

CREATE TEMPORARY TABLESPACE TEMP1 TEMPFILE /xxx/xxx/temp01′ SIZE 500M;

6.       Move Tablespace Temp, back to new temp tablespace

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP1;

7.       Drop tablespace temp2 because default temporary tablespace is temp1

DROP TABLESPACE TEMP2 INCLUDING CONTENTS AND DATAFILES;

http://www.orafaq.com/node/2

http://dbafix.blogspot.it/2010/08/how-to-drop-and-recreate-temp.html


출처 http://www.areaetica.com/how-to-drop-and-create-a-temporary-tablespace/


*추가* 

- CREATE TEMPORARY TABLESPACE 쿼리

CREATE TEMPORARY TABLESPACE TEMP1

TEMPFILE '/app/oracle/oradata/ORCL/temp01.dbf' SIZE 500M REUSE

AUTOEXTEND ON NEXT 100M MAXSIZE unlimited

EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;


반응형
LIST

+ Recent posts