2014년 3월 12일 수요일

pro*c 요약 정리 for Method 4

pro*c 요약 정리 for Method 4

https://community.oracle.com/thread/470562?tstart=1260

http://cluster1.cafe.daum.net/_c21_/bbs_search_read?grpid=1GBrw&fldid=DMtF&datanum=57&openArticle=true&docid=1GBrwDMtF5720090121152640

LONG 컬럼에 넣을 때 메모리를 동적으로 할당받는 예제

PRO*C를 이용하여 LONG 컬럼에 텍스트 화일 등의 데이타를 넣는 예제다.
Memory Allocation을 dynamic하게 처리한 경우인데, FILESIZE 대신에 실제
의 화일 크기 등을 이용하여 Memory Allocation을 하면 된다.

LONG 컬럼을 처리하기 위해서 사용되는 HOST 변수는 다음 예제처럼 EXTERNAL
DATA TYPE인 LONG VARCHAR 사용해야 한다.

EXTERNAL DATATYPE은 바로 사용할 수는 없으므로 TYPE 을 선언해서 사용한다.

LONG 컬럼에 들어 있는 데이타가 작은 경우에는 VARCHAR를 사용해도 처리가
가능하지만 VARCHAR에서는 .len 필드가 unsinged short 로 선언되어 있기
때문에 처리 가능한 데이타가 이 값에 제한을 받는다.

char로 선언하게 되면 INSERT시에는 별 문제가 없지만 SELECT시에는 ORA-932
에러가 발생하므로 사용할 수가 없다.


#include
#define FILESIZE 10000

typedef struct TAGmy_long {
int len;
unsigned char arr[1];
} my_long;

VARCHAR   username[20];
VARCHAR   password[20];
EXEC SQL  TYPE my_long IS LONG VARCHAR(1000000000) REFERENCE;
EXEC SQL  INCLUDE sqlca;
my_long *buffer;

void sqlerror();               /* handles unrecoverable errors    */
FILE *fp;
main()
{
       strcpy(username.arr, "SCOTT");
       username.len = strlen(username.arr);
       strcpy(password.arr, "TIGER");
       password.len = strlen(password.arr);

       EXEC SQL WHENEVER SQLERROR DO sqlerror();
       EXEC SQL CONNECT :username IDENTIFIED BY :password;
       EXEC SQL WHENEVER SQLERROR DO sqlerror();

       buffer = (my_long *)malloc(sizeof(my_long)+FILESIZE);
 
       fp=fopen("longtest.txt","r");
       fread(buffer->arr, 1, FILESIZE, fp);
       buffer->len = FILESIZE;
      
       EXEC SQL INSERT INTO LONGTEST VALUES (:buffer);
       EXEC SQL COMMIT WORK RELEASE;
}
void sqlerror()
{
   EXEC SQL WHENEVER SQLERROR CONTINUE;
   printf("\nORACLE error detected:\n");
   printf("\n% .70s \n", sqlca.sqlerrm.sqlerrmc);
   EXEC SQL ROLLBACK WORK RELEASE;
   exit(1);
}

2014년 3월 9일 일요일

debug file sample

#define SDB_DEBUG_CTX   __FILE__, __LINE__
int DebugPrint(char* filename, int line, char* format, ...){
        char string[4000];
        FILE* fp_debug_tmp = NULL;

        va_list ap;
        va_start(ap, format);
        vsnprintf(string, sizeof(string), format, ap);
        va_end(ap);

        if((fp_debug_tmp = fopen("/tmp/safedbsdk4c.tmp", "a+"))==NULL){
                return;
        }

        fprintf(fp_debug_tmp, "[SDK LOG]%s\n", string);
        if(fp_debug_tmp){
                fclose(fp_debug_tmp);
        }
}


DebugPrint(SDB_DEBUG_CTX, "%s", sadf);

Makefile

AR=ar
CC=gcc
LD=ld
RM=rm -rf
LN=ln -sf

VERSION=2.3.2
SYSTEM=Linux-2.6.18
MODULE_NAME_CPU=el5xen
MODULE_NAME_BIT=64
MODULE_NAME_CC=$(CC)
LIB_LDSHARED=gcc -shared
LIB_SUFFIX=.so


INCLUDE=
LIBS=

CFLAGS=
LDFLAGS=

LIBNAME=

TARGET=lib$(LIBNAME)_$(VERSION)_$(SYSTEM)$(MODULE_NAME_CPU)$(MODULE_NAME_BIT)$(MODULE_NAME_CC)$(LIB_SUFFIX)
LN_TARGET=lib$(LIBNAME)$(LIB_SUFFIX) lib$(LIBNAME)$(LIB_SUFFIX)

SRCS = $(OBJS:.o=.c)
OBJS = sdk_multi.o

$(TARGET): $(OBJS)
ifeq ($(LIB_SUFFIX), .a)
        $(RM) $@
        $(AR) cr $@ $(OBJS)
        $(RANLIB) $@
else
        $(LIB_LDSHARED) -o $(TARGET) $(OBJS) $(LDFLAGS) $(LIBS)
        $(LN) $(TARGET) $(LN_TARGET)
endif

clean:
        $(RM) $(TARGET) $(LN_TARGET) $(OBJS) core *.o

ubuntu 에서 disk mount 하기

/etc/fstab


inuk@inuk-dsktp-dev01:~$ df -k
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda5       47929224   3135168  42352688   7% /
udev             4052316        12   4052304   1% /dev
tmpfs            4061660     13292   4048368   1% /tmp
tmpfs            1624664      1092   1623572   1% /run
none                5120         0      5120   0% /run/lock
none             4061660       156   4061504   1% /run/shm
/dev/sda1         944120     28588    866740   4% /boot
/dev/sdb5       47986568    816108  44726224   2% /var
/dev/sdb1      192114268  63198624 119150064  35% /home
/dev/sdc2       33535360   9966064  23569296  30% /media/INUK_SHR_01
/dev/sdc3       33551356  33020264    531092  99% /media/새 볼륨
/dev/sdc1      209712476 177666332  32046144  85% /media/INUK_NT_0




inuk@inuk-dsktp-dev01:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda5 during installation
UUID=cc4a6b97-63c5-4edf-b532-666ed66dabb9 /               ext4    errors=remount-ro,noatime,discard 0       1
# /boot was on /dev/sda1 during installation
UUID=d9d270ac-b585-4ff1-a4ba-877d10197299 /boot           ext4    defaults        0       2
# /home was on /dev/sdb1 during installation
UUID=e365bb0a-b966-47d3-aa8f-67ce22dd7f6e /home           ext4    defaults        0       2
# /var was on /dev/sdb5 during installation
UUID=e72b95f2-1d91-4d24-b1e3-bd0e4d8b2d55 /var            ext4    defaults        0       2
# Move /tmp to RAM
tmpfs /tmp tmpfs defaults,nosuid 0 0
/dev/sdc1 /home/inuk/nt01 auto defaults 0 0
/dev/sdc2 /home/inuk/shr01 auto defaults 0 0
/dev/sdc3 /home/inuk/nv01 auto defaults 0 0
/dev/sdc5 /home/inuk/iushr auto defaults 0 0



df -k
df -Th
df -h
df -a

ubuntu에서 synergy 자동으로 실행하기

https://help.ubuntu.com/community/SynergyHowto#On%20the%20Client



Autostart Synergy before logging in (GDM)

Note: Autostarting Synergy before logging in requires that your network connection be available at all times and not just after you log in. This is accomplished by enabling the network connection for all users. To do this, choose System->Preference->Network Connections. Choose the network name and select Edit. Select "Available to all users", and then click "Apply". This connection will now be available at all times, including at the GDM login screen.
To make sure synergy is running at all times, the following has to happen: First, synergy is started when the GDM login screen starts. Then, synergy is killed and restarted when a user logs in. When the user logs out, synergy is killed and GDM starts it again. To edit system configuration files in the following sections open a text editor as the root user:
sudo gedit

On the Server

At the end of the file /etc/gdm/Init/Default, just before the line that says exit 0 add the following:
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
/usr/bin/synergys
Add the following to the end of /etc/gdm/PostLogin/Default (create this file file if it does not already exist):
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
If you created the file, make sure it is executable with this command:
sudo chmod +x /etc/gdm/PostLogin/Default
Now, create a session file /etc/X11/Xsession.d/85synergys with the following contents
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
/usr/bin/synergys
Lastly, we must make the file executable with this command:
sudo chmod +x /etc/X11/Xsession.d/85synergys

On the Client

At the end of /etc/gdm/Init/Default, just before the line that says exit 0 add the following:
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
/usr/bin/synergyc <SERVER HOSTNAME>
Be sure to replace <SERVER HOSTNAME> with the host name or IP address of the computer running synergys.
NOTE: If your system has been configured to login automatically, this step may cause ubuntu to hang right before going to the desktop. If this is the case, remove these lines from /etc/gdm/Init/Default and everything should work properly. If your system is hanging at this stage, you can hit CTRL-ALT-F1 to login through command line and edit this file.(Tested on 10.04LTS Lucid Lynx)
Add the following to the end of /etc/gdm/PostLogin/Default (create this file file if it does not already exist):
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
If you created the file, make sure it is executable with this command:
sudo chmod +x /etc/gdm/PostLogin/Default
Now, create a session file /etc/X11/Xsession.d/85synergyc with the following contents
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
/usr/bin/synergyc <SERVER HOSTNAME>
This will run synergyc when any user logs in. Be sure to replace <SERVER HOSTNAME> with the host name or IP address of the computer running synergys. Lastly, we must make the file executable with this command:
sudo chmod +x /etc/X11/Xsession.d/85synergyc

Autostart Synergy before logging in (KDM)

On the Client

Follow these steps to start the synergyc client when the KDM login screen launches.
Add the following to the end of /etc/kde3/kdm/Xsetup:
/usr/bin/killall synergyc
sleep 1
/usr/bin/synergyc <SERVER HOSTNAME>
Be sure to replace <SERVER HOSTNAME> with the host name or IP address of the computer running synergys.
For the client file we must also edit the Xstartup script to kill our synergyc process running as root before the user Xsession scripts run. To do this add the following to the end of /etc/kde3/kdm/Xstartup and it should look like this:
# Xstartup - run as root before session starts

PATH="$PATH:/usr/bin/X11"

if [ -e /etc/nologin ]; then
  # always display the nologin message, if possible
  if [ -s /etc/nologin ] && which xmessage > /dev/null 2>&1; then
    xmessage -file /etc/nologin -geometry 640x480
  fi
  if [ "$(id -u)" != "0" ] && \
     ! grep -qs '^ignore-nologin' /etc/kde3/kdm/kdm.options; then
    exit 1
  fi
fi

# synergyc process, running as root, ends here. This is the last script in the gdm login sequence before things start running as user.
/usr/bin/killall synergyc
sleep 1

if grep -qs '^use-sessreg' /etc/kde3/kdm/kdm.options && \
   which sessreg > /dev/null 2>&1; then
      exec sessreg -a -l "$DISPLAY" -u /var/run/utmp \
                   -h "`echo $DISPLAY | cut -d: -f1`" "$USER"
      # NOTREACHED
fi

Autostart Synergy before logging in (LightDM)

On the client

Add the following line at the end of /etc/lightdm/lightdm.conf:
greeter-setup-script=/usr/bin/synergyc <SERVER HOSTNAME>
Where <SERVER HOSTNAME> is the name/IP of the server you are connecting to.

On the server

Add the following line at the end of /etc/lightdm/lightdm.conf:
greeter-setup-script=/usr/bin/synergys <CONFIG FILE>
Where <CONFIG FILE> is the path to your config file for synergy (see above for typical locations).

리눅스 버전별 커널 및 glibc 버전


strings /lib/libc.so.6 | grep GLIBC


[Linux 배포판-kernel-glibc]

- RedHat 7.2
kernel: 2.4.7-10
glibc : 2.2.4-13

- RedHat 7.3
kernel: 2.4.18-3
glibc : 2.2.5-34

- RedHat 8.0
kernel: 2.4.18-14
glibc : 2.2.93-5

- RedHat 9.0
kernel: 2.4.20-8
glibc : 2.3.2-11

- Fedora Core 1
kernel: 2.4.22-1
glibc : 2.3.2-101

- Fedora Core 2
kernel: 2.6.5-1
glibc : 2.3.3.27

###############################################################
### 리눅스 버전별 패키지 버전들

http://distrowatch.com/table.php?distribution=redhat


###################################################################
### Redhat

  • 1.0 (Mother's Day), November 12, 1994 (Linux 1.2.8)
  • 1.1 (Mother's Day+0.1), August 1, 1995 (Linux 1.2.11)
  • 2.0, September 20, 1995 (Linux 1.2.13-2)
  • 2.1, November 23, 1995 (Linux 1.2.13)
  • 3.0.3 (Picasso), May 1, 1996 (Linux 1.2.X) - first release supporting DEC Alpha
  • 4.0 (Colgate), October 3, 1996 (Linux 2.0.18) - first release supporting SPARC
  • 4.1 (Vanderbilt), February 3, 1997 (Linux 2.0.27)
  • 4.2 (Biltmore), May 19, 1997 (Linux 2.0.30-2)
  • 5.0 (Hurricane), December 1, 1997 (Linux 2.0.32-2)
  • 5.1 (Manhattan), May 22, 1998 (Linux 2.0.34-0.6)
  • 5.2 (Apollo), November 2, 1998 (Linux 2.0.36-0.7)
  • 6.0 (Hedwig), April 26, 1999 (Linux 2.2.5-15)
  • 6.1 (Cartman), October 4, 1999 (Linux 2.2.12-20)
  • 6.2 (Zoot), April 3, 2000 (Linux 2.2.14-5.0)
  • 7 (Guinness), September 25, 2000 (this release is labeled "7" not "7.0") (Linux 2.2.16-22)
  • 7.1 (Seawolf), April 16, 2001 (Linux 2.4.2-2)
  • 7.2 (Enigma), October 22, 2001 (Linux 2.4.7-10, Linux 2.4.9-21smp)
  • 7.3 (Valhalla), May 6, 2002 (Linux 2.4.18-3)
  • 8.0 (Psyche), September 30, 2002 (Linux 2.4.18-14)
  • 9 (Shrike), March 31, 2003 (Linux 2.4.20-8) (this release is labeled "9" not "9.0")
  • The Fedora and Red Hat Projects were merged on September 22, 2003.[15]
In version 6 Red Hat moved to glibc 2.1, egcs-1.2, and to the 2.2 kernel
Version 7 was released in preparation for the 2.4 kernel, although the first release still used the stable 2.2 kernel. Glibc was updated to version 2.1.92
Version 9 supported the Native POSIX Thread Library, which was ported to the 2.4 series kernels by Red Hat

###################################################################
### RHEL

  • RHEL 2
- Red Hat Enterprise Linux 2.1 AS (Pensacola), 2002-03-26. Uses Linux 2.4.9-e.3
Update 1, 2003-02-14 (kernel 2.4.9-e.12)
Update 2, 2003-05-29 (kernel 2.4.9-e.24)
Update 3, 2003-12-19 (kernel 2.4.9-e.34)
Update 4, 2004-04-21 (kernel 2.4.9-e.40)
Update 5, 2004-08-18 (kernel 2.4.9-e.49)
Update 6, 2004-12-13 (kernel 2.4.9-e.57)
Update 7, 2005-04-28

- Red Hat Enterprise Linux 2.1 ES (Panama), May 2003

  • RHEL3
- Red Hat Enterprise Linux 3 (Taroon), 2003-10-22. Uses Linux 2.4.21-4
Update 1, 2004-01-16 (kernel 2.4.21-9)
Update 2, 2004-05-12 (kernel 2.4.21-15)
Update 3, 2004-09-03 (kernel 2.4.21-20)
Update 4, 2004-12-12 (kernel 2.4.21-27)
Update 5, 2005-05-18 (kernel 2.4.21-32)
Update 6, 2005-09-28 (kernel 2.4.21-37)
Update 7, 2006-03-17 (kernel 2.4.21-40)
Update 8, 2006-07-20 (kernel 2.4.21-47)
Update 9, 2007-06-15 (kernel 2.4.21-50)

  • RHEL4
- Red Hat Enterprise Linux 4 (Nahant), 2005-02-15. Uses Linux kernel 2.6.9-5
4.1, also termed Update 1, 2005-06-08 (kernel 2.6.9-11)
4.2, also termed Update 2, 2005-10-05 (kernel 2.6.9-22)
4.3, also termed Update 3, 2006-03-12 (kernel 2.6.9-34)
4.4, also termed Update 4, 2006-08-10 (kernel 2.6.9-42)
4.5, also termed Update 5, 2007-05-01 (kernel 2.6.9-55)
4.6, also termed Update 6, 2007-11-15 (kernel 2.6.9-67)
4.7, also termed Update 7, 2008-07-29 (kernel 2.6.9-78)
4.8, also termed Update 8, 2009-05-19 (kernel 2.6.9-89)
4.9, also termed Update 9, 2011-02-16 (kernel 2.6.9-100)

  • RHEL5
- Red Hat Enterprise Linux 5 (Tikanga), 2007-03-14. Uses Linux kernel 2.6.18-8
5.1, also termed Update 1, 2007-11-07 (kernel 2.6.18-53)
5.2, also termed Update 2, 2008-05-21 (kernel 2.6.18-92)
5.3, also termed Update 3, 2009-01-20 (kernel 2.6.18-128)
5.4, also termed Update 4, 2009-09-02 (kernel 2.6.18-164)
5.5, also termed Update 5, 2010-03-30 (kernel 2.6.18-194)
5.6, also termed Update 6, 2011-01-13 (kernel 2.6.18-238)
5.7, also termed Update 7, 2011-07-21 (kernel 2.6.18-274)
5.8, also termed Update 8, 2012-02-20 (kernel 2.6.18-308)

  • RHEL6
- Red Hat Enterprise Linux 6 (Santiago), 2010-11-10 Uses Linux kernel 2.6.32-71
6.1, also termed Update 1, 2011-05-19 (kernel 2.6.32-131)
6.2, also termed Update 2, 2011-12-06 (kernel 2.6.32-220)
6.3, also termed Update 3, 2012-06-20 (kernel 2.6.32-279)
6.4, also termed Update 4, 2013-02-21 (kernel 2.6.32-358)

  • RHEL7
- Red Hat Enterprise Linux 7 (?), 2013-6+ Uses Linux kernel 3.?

서버별 shutdown 명령어

# AIX
Shutdown
shutdown        ( 60 sec)shutdown now (shutdown  60 sec)
 > shutdown 명령만 실행시 mount 연결이 정상적으로 끊기지 않아 무기한 대기상태에 빠질수 있음.
 > 아래의 -F 옵션을 붙이길 권장
shutdown -F     (force shutdown)

Reboot
shutdown -r     (reboot and flush cache to disk)
shutdown -Fr     (force reboot)
reboot         (Not flush cache to disk)


# HP
Shutdown
shutdown -hy 0 (Force shutdown  0 sec)
init 0

Reboot
shutdown -ry 0 (Force restart  0 sec)
reboot


# Solaris
Shutdown
shutdown -i5 -y -g0
sync;sync;init 5
poweroff

Reboot
shutdown -i6 -y -g0
sync;sync;init 6
reboot


# Linux
Shutdown
shutdown -h now (Force shutdown  0 sec)
init 0
halt
poweroff

Reboot
shutdown -r now (Force restart  0 sec)
reboot
init 6

uml tool

Lucid Chard
크롬 설치 후 플러그인

web 시퀀스 다이어그림
http://www.websequencediagrams.com/

oracle plsql sample

******** loop START

declare
   cnt number :=0;
begin
   loop
      cnt:= cnt+1;
      insert into inuk_test_plugin(name, ssn, addr) values('name'||cnt , cnt, 'ADDR'||cnt);
      exit when cnt=20;
   end loop;
end;

======== loop END


oracle에서 대량의 data 를 update 나 insert 할때 모니터링 쿼리.

select sofar * 84690924 / totalwork from v$session_longops where sid = 6369 ;


 84690924  :  총 건수를 대신입력

6369 : session 의 SID 입력..

윤성열천재

[보안] SSL, 인증서, PKCS..., RFC

SSL

http://yiwontae.tistory.com/80

인증서 읽기 유틸

http://user.chol.com/~jinhwan/BerReader/

공인인증서 위키

http://ko.wikipedia.org/wiki/%EA%B3%B5%EC%9D%B8%EC%9D%B8%EC%A6%9D%EC%84%9C

RFC 3280 - Internet X.509 Public Key Infrastructure Certificate

http://www.faqs.org/rfcs/rfc3280.html

solaris에서 포트를 사용하는 프로세스 알아내기

Solaris 의 경우, lsof 패키지를 따로 설치하여 확인하는 법도 있지만, 기본 명령어로도 확인 가능하다.
pfiles 를 통해 검색된 결과를 가지고 확인하는 방법을 기술 한다.

명령어

pfiles /proc/* > ./pfiles.out

결과

01.4969:   /user/id/bin/ProcessName
02.Current rlimit: 8192 file descriptors
03.0: S_IFCHR mode:0620 dev:360,0 ino:12582928 uid:601 gid:7 rdev:24,6
04.O_RDWR
05./devices/pseudo/pts@0:6
06.1: S_IFCHR mode:0620 dev:360,0 ino:12582928 uid:601 gid:7 rdev:24,6
07.O_RDWR
08./devices/pseudo/pts@0:6
09.2: S_IFCHR mode:0620 dev:360,0 ino:12582928 uid:601 gid:7 rdev:24,6
10.O_RDWR
11./devices/pseudo/pts@0:6
12.3: S_IFDOOR mode:0444 dev:369,0 ino:54 uid:0 gid:0 size:0
13.O_RDONLY|O_LARGEFILE FD_CLOEXEC  door to nscd[174]
14./var/run/name_service_door
15.4: S_IFSOCK mode:0666 dev:367,0 ino:62276 uid:0 gid:0 size:0
16.O_RDWR
17.SOCK_STREAM
18.SO_REUSEADDR,SO_KEEPALIVE,SO_SNDBUF(40960),SO_RCVBUF(41272),IP_NEXTHOP(0.0.161.56)
19.sockname: AF_INET 0.0.0.0  port: xxxxx
01 줄의 ProcessName 이 해당 포트를 Listen 하는 프로세스 이고,
19 줄의 port: xxxxx 가 수신 포트 번호 이다.

참고사이트

http://goodjoon.tistory.com/142

unix shell script tip

#bash
while :
do

done


***********************************************************************
/* wihle line count */
while [ 1 ]
do
date
        wc -l dist*/log/KEYD_20130306.log
        echo ""
        sleep 5
done

/* fboot */
for i in 1 2 3
do
        cd dist$i
        ./keydctl fboot
        sleep 1
        cd ..
done

/* start */
for i in 1 2 3
do
        cd dist$i
        ./keydctl start
        sleep 1
        cd ..
done

/* stop */
for i in 1 2 3
do
        cd dist$i
        ./keydctl stop
        sleep 1
        cd ..
done

nohup 파일 명 변경

nohup some_command > nohup2.out 2>&1&

database별 auto_increment

************ APACHE DERBY **************
While creating a table a particular column / field can be made autoincrement as :
1CREATE TABLE students
2(
3id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
4name VARCHAR(24) NOT NULL,
5address VARCHAR(1024),
6CONSTRAINT primary_key PRIMARY KEY (id)
7) ;
The value of an autoincrement column increments automatically with every insert and doesnt need to be specified in the insert command. It is 1 + the value of the same field in the previous row.
Now data can be inserted as :
1insert into students(name , address) values('Sanjay' 'New Delhi');
Note that the value for the id field (which is an autoincrement field) is not specified. It fills automatically by taking the value of the previous row and adding 1 to it.


******************* MYSQL *******************
CREATE TABLE tb_table (
table_seq INT(11) NOT NULL AUTO_INCREMENT COMMENT 'table 고유아이디',
database_seq INT(11) NOT NULL                COMMENT 'database 고유아이디 (FK)',
table_name VARCHAR(100) NOT NULL           COMMENT 'table 실제 이름',
table_owner_name VARCHAR(100)                    COMMENT 'table 소유자 이름',
table_type VARCHAR(10) COMMENT 'table 용도 : [table type] 코드 정의 참고',
enc_name VARCHAR(100) COMMENT '암호화된 table 이름',
description VARCHAR(1000)                   COMMENT 'table 설명',
    
PRIMARY KEY ( table_seq ),
UNIQUE KEY uk_table_name (database_seq, table_name, table_owner_name),
CONSTRAINT fk_table FOREIGN KEY ( database_seq ) REFERENCES tb_database ( database_seq ) ON DELETE CASCADE
) DEFAULT charset=utf8;