계층 구조 쿼리 하기

Oracle 2008. 11. 19. 14:09

create table t_group (
    group_uid number not null,
    group_name varchar2(1000),
    parent_uid number,
    constraint t_group primary key ( group_uid )
)

insert into t_group values ( 1, 'company', NULL );
insert into t_group values ( 2, 'marketing', 1 );
insert into t_group values ( 3, 'sales', 1 );
insert into t_group values ( 4, 'sales1', 3 );
insert into t_group values ( 5, 'sales2', 3 );
insert into t_group values ( 6, 'sales3', 3 );
insert into t_group values ( 7, 'company2', NULL );
insert into t_group values ( 8, 'marketing', 7 );
insert into t_group values ( 9, 'sales', 7 );
insert into t_group values ( 10, 'marketing1', 2 );

select LPAD(' ', 4*(LEVEL-1)) || group_name from t_group
connect by prior group_uid = parent_uid
start with parent_uid is null
order siblings by group_name


LPAD('',4*(LEVEL-1))||GROUP_NAME
--------------------------------------------------------------------------------
company
    marketing
        marketing1
    sales
        sales1
        sales2
        sales3
company2
    marketing
    sales

10 rows selected.

Posted by 알모리
,

Oracle Client Bug

Oracle 2008. 7. 31. 12:17
오늘 서비스 중이던 서버에서 데몬이 동작하지 않는 현상이 발생 하였습니다. 데몬을 새로 실행 시키는데 오라클 DB에 접속을 하지 못하더군요.

그래서 sqlplus로 접속을 시도해보니 이 넘도 응답을 하지 않습니다.
DB 서버가 문제가 있나 싶어서 telnet 으로 1521 포트에 접속 해보니..접속이 되더군요.

strace로 system call을 추적해 보니 time 함수를 계속 호출 하고 있었습니다.

tnsname.ora, /etc/hosts 파일, system log, network card 등등등.. 여러가지를 체크해 보았으나.. 원인이 안 보이더군요. 에라 모르겠다 reboot ~

리부팅 후에 모두 정상적으로 동작을 합니다. 이런 제길... ㅠㅠ

저는 Linux x68, Oracle Client 10.2.0.1 를 사용 하고 있었습니다. 문제 발생 당시 uptime을 확인해 보지는 않았지만 서버를 부팅한지 몇달은 지난것 같습니다.

아래 버그리포팅을 보시면 오라클 라이브러리에... 문제가 있다는 군요 ㅠㅠ


오라클 matelink.oracle.com 의 원문 ( 계정이 필요 합니다. )

사용자 삽입 이미지
사용자 삽입 이미지
Posted by 알모리
,

SELECT do.object_name, do.owner, do.object_type,do.owner, vo.xidusn, vo.session_id, vo.locked_mode
FROM v$locked_object vo , dba_objects do
WHERE vo.object_id = do.object_id ;
Posted by 알모리
,
Posted by 알모리
,

package source

Oracle 2007. 8. 5. 17:53


select object_name, subobject_name from user_objects where object_type = 'PACKAGE BODY';


select * from user_objects where object_name = 'PKG_XXX';


select text from user_source where name = 'PKG_XXX';

Posted by 알모리
,

add following line into $ORACLE_HOME/sqlplus/admin/glogin.sql or login.sql in current directory

define_editor=vi

Posted by 알모리
,


Friday, January 25 2007

select to_char( sysdate, 'Day, Month DD YYYY' ) from dual;

alter session set NLS_TERRITORY = 'AMERICA';
alter session set nls_date_format = 'Day, Month DD YYYY';
select sysdate from dual;

Posted by 알모리
,