Thread로 DB(Oracle) 작업시 Connect 문제

hbsnow의 이미지

Thread를 사용해서 통신관련작업과 DB 저장관련 작업을 수행하고 있습니다..

클라이언트 요청(connect)에 대해 서버는 수용을(accept) 하고 Thread를 생성해서 시작시간과 client 정보를 DB(Oracle)에 저장하게 됩니다.

Oracle에 저장작업은
- connect()
- insert()
- disconnect()

를 수행합니다

이렇게 멀티쓰레드 환경에서 작업을 수행중에 문제가 발생합니다.
문제는 세그먼트폴트를 발생시킵니다.

원인을 유추해봅니다.
- 1. 첫번째 쓰레드가 Oracle 를 열어서 아직 닫지 못한 상태에서 두번째 쓰레드가 다시 Oracle 을 열었을때 발생하지 않는가?
- 2. 쓰레드가 Oracle에 열고 추가하고 닫는 작업에 대해 근본적인 문제가 있는가? 예를 들어 Oracle DB 에 대한 일련에 작업은 프로세스로 처리가 안정적이라든지...
- 3. 겉으로 들어나 있지 않는 Oracle 내부적인 작업으로 인한 에러인가?

현재는 이렇게 추정을 하고 있답니다.
쓰레드가 Oracle DB를 열고 추가하고 닫는 작업이 많은 시간을 소요하지 않기때문에 (한 0.1 -0.2초) 많은 컨넥션을 유지함에 생기는 문제는 아니라고 판단하고 있습니다.

현재 해결방안으로
- 1. 프로세스를 만들어서 거기서 일련에 DB 작업을 하게 한다
- 2. 쓰레드에서 connect -> insert ->disconnect 형태에서 connect ->{ 일련에 작업 }->disconnect... 다시 말해 connect를 해놓고 요청이 있을때 마다 insert 작업을 하는 형태를 구상중입니다.

쓰레드 환경에서 DB(Oracle) 관련 작업을 해보시분에 조언을 부탁드립니다.
읽어주셔 감사합니다.

thkim86의 이미지

누가 비슷한 경우에 대한 답변을 올린게 있네요. 그걸 여기에 복사해드릴테니 참고하세요

Hello
Login to http://technet.oracle.com/software and select Oracle 8 Server
Take Linux section
There is a patch available for that software. download it
When u are installing, please be sure that u are following the below steps
1. First do the installation of the server with no database
2. Then run the patch
3. Create the database
4. edit the tnsnames.ora and listener.ora inthe
$ORACLE_HOME/network/admin/
5. To get the test users scott and all,
a. cd $ORACLE_HOME/rdbms/admin
b. sqlplus system/<Password>
c. @utlsampl.sql
logout
d. cd $ORACLE_HOME/sqlplus/admin
e.sqlplus sys/<password>
f.@p...

That will do and the server will be up
u can start the listener by $ORACLE_HOME/bin/lsnrctl start
and also start the server by
svrmgrl
start

그리고 커넥션풀을 사용하시길 권해드립니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.