본문 바로가기
  • 노란색 세상은 어디에 있을까?
  • 봄이 오면 여기에 있겠지.
  • 잠시나마 유유자적 하겠네.
오라클/테이블(시스템관리)

[ 환경정보 ] 테이블 생성을 아래와 같이 진행합니다.

by 태백성 2024. 4. 12.

-- ------------------------------------------------------------------------------------------------
-- [ 시스템관리 ] 환경정보 테이블 생성
conn system/built123$@ndb;
-- ------------------------------------------------------------------------------------------------
-- 테이블 생성
drop   table bsys.sys_env cascade constraints;
create table bsys.sys_env
(
 user_cd                 varchar2(50)   not null    
    ,last_login_timestamp    timestamp      default systimestamp not null
    ,corp_id                 number
    ,biz_id                  number
    ,dept_id                 number
    ,emp_id                  number
    ,lang_cd                 varchar2(50)   default 'KO' not null
    ,decrypto_yn             varchar2(1)    default 'N'  not null
) tablespace bdb_data;

-- 테이블 설명
comment on table  bsys.sys_env                          is '[시스템관리] 환경정보';
comment on column bsys.sys_env.user_cd                  is '사용자코드';
comment on column bsys.sys_env.last_login_timestamp     is '최종로그인일시(초)';
comment on column bsys.sys_env.corp_id                  is '법인ID';
comment on column bsys.sys_env.biz_id                   is '사업장ID';
comment on column bsys.sys_env.dept_id                  is '부서ID';
comment on column bsys.sys_env.emp_id                   is '임직원ID';
comment on column bsys.sys_env.lang_cd                  is '언어코드';
comment on column bsys.sys_env.decrypto_yn              is '복호화여부';

-- primary 인덱스
alter table bsys.sys_env add constraint sys_env_pk primary key (user_cd) using index tablespace bdb_idx;

-- 권한부여
grant select, insert, update, delete on bsys.sys_env to bcom with grant option;
grant select, insert, update, delete on bsys.sys_env to bhrm with grant option;

-- 시노님 생성
conn bcom/1234@ndb;
create or replace synonym sys_env for bsys.sys_env;

conn bhrm/1234@ndb;
create or replace synonym sys_env for bsys.sys_env;