everydayminder

learn something everyday

Archive for the ‘Database’ Category

PPAS에서 Oracle로 DB Link 연결하다 겪은 에러 – ORA-21561 : OID generation failed

leave a comment »

PPAS에서 Oracle로 DB Link를 연결하였고,
연결한 상태에서

SELECT * FROM xx@ora_link;

와 같이 실행했는데,

ERROR:  OCI error: ORA-21561: OID generation failed

********** Error **********

ERROR: OCI error: ORA-21561: OID generation failed
SQL state: 25000

와 같은 에러가 발생하였다.

문제를 확인하기 위해,
SQLPlus를 사용하여 동일한 문제가 발생하는지 다음과 같이 확인하였다.

sqlplus username/password@servicename

그랬더니, 동일한 에러가 발생하였다.
결국, PPAS 자체의 문제가 아니라 Oracle client가 접속할 때 생기는 문제.

인터넷을 찾아보고 다음과 같이 조치/ 해결하였다.

hostname

를 실행하여, 호스트이름을 확인한다.

/etc/hosts내에 다음의 내용을 추가한다.

127.0.0.1 localhost 호스트이름

그 후, sqlplus로 접속 시도를 했더니 정상적으로 연결이 되었으며,
앞서 생성한 DBLINK를 통한 연산도 정상적으로 수행되었다.

Written by everydayminder

January 8, 2015 at 21:24

Posted in Database, linux

Tagged with ,

DRBD, Pacemaker, Corosync + PostgreSQL 환경에서 Failover시 Unmanaged라고 뜬다면?

leave a comment »

DRBD, Pacemaker, Corosync기반으로 H/A 환경을 구축하고, 그 위에 PostgreSQL을 실행시켰는데
H/A failover가 정상적으로 되는지 확인하기 위해 다음과 같은 테스트를 수행하였다.

1. Postgres kill 시키기 : auto restart
2. Virtual IP용 NIC 강제로 ifdown : fail over
3. crm node standby 명령어 실행을 통한 강제 switch over

위의 테스트를 트래픽이 없거나(적은) 환경에서는 별 문제 없이 수행할 수 있었는데,
트래픽을 많이 발생시킨 (heavy transaction) 환경에서는 기대와는 다르게 동작하는 것을 확인하였다.

그 에러 메시지가 crm_mon 명령어로 확인했을 때, PostgreSQL이 정상적으로 동작하지 않으면서 “Unmanaged”
라고 뜨는 것이었다.

이를 위해 crm resource edit를 하여,
PostgreSQL 리소스의 정보를 아래와 같이 수정하였다.

op monitor role=Started timeout=120 interval=30 depth=0 \
op start role=Stopped interval=0 timeout=120s \
op stop role=Started interval=0 timeout=120s

모니터링, 시작, 종료시 interval과 timeout을 부여했는데,
특히 timeout의 값을 120초로 주었다.

만약, 이보다 더 작은 값으로 지정한다면 edit 종료시, crm shell에서 사실 “default보다 작은 값을 지정했다”면서
경고 메시지를 준다.

경고를 무시하면, 이와 같이 Unmanaged라는 상황을 만날 수 있다.

교훈)
테스트 환경 구축만으로 잘 되었다고 생각하면, 트래픽이 발생하는 운영 상황에서 auto failover가 안되는 수가 있다.

Written by everydayminder

August 19, 2014 at 00:04

Posted in Database, linux

[oracle] 사용자 조회/ 비밀번호 변경하기

leave a comment »

1. 어떤 사용자 id가 등록되어 있는지 보려면,

select * from dba_users;

2. 특정 사용자의 비밀번호를 변경하려면,

alter user 사용자명 identified by 비밀번호;

Written by everydayminder

September 9, 2010 at 01:31

Posted in Database

Tagged with , ,

from Data Model to Relational Schema

leave a comment »

1. 각 클래스에 대해 table을 만든다

2. 각 속성에 대해 필드를 만들고, 적절한 타입을 할당한다. 
   필요시, 필드를 하위 필드의 조합으로 구성한다.

3. 한 개 또는 여러 필드의 조합으로 primary key를 선정한다.
   선정 과정에서, 해당 키의 고유성이 보장되는지 충분히 검토한다.

4. Many-Many Relationship은, 한 개의 새로운 중간 클래스를 연계하여,
   두 개의 1-Many relationship으로 분할하여 처리한다.

5. 1-Many relationship의 경우, 1쪽의 primary key를 Many 쪽에 foreign key로 등록하여 처리한다.

6. 1-1 relationship은 서로 비교하여, 해당 정보를 보다 필요로 하는 쪽으로  나머지 클래스의
   primary key를 자신의 foreign key로 등록한다.

7. 필수 항목에 대해, foreign key가 null이 아니어야 한다는 제약 조건을 부여한다.

8. 상속에 대해, 1-1 relationship의 규칙을 적용한다. parent의 key를 child에 foreign key로 등록한다.

from Beginnig Database Design, pp 136, Clare Churcher

Written by everydayminder

June 7, 2009 at 23:52

Data Model to Relational Database

leave a comment »


























 Feature in Model Technique Used in Relational Database 
 Class  add a table with a primary key
 Attribute  add a field with an appropriate data type to the table
 Object  add a row of data to the table
 1-Many Relationship  use a foreign key, i.e., a reference to a particular row (or object) in the table at the 1 end of the relationship
 Many-Many Relationshop  add a new table and two 1-Many relationships
 OPtionality of 1 at the 1 end of a relationship  make the value of the foreignh key required
 Inheritence  add a table for each class, with 1-1 relationships between each child class and the parent (not an exact representation but OK)

from Table 7-1. Techiniques to represent aspects of the data model,
pp. 115, Beginning Database Design From Novice to Professional, Clare Churcher

Written by everydayminder

June 3, 2009 at 23:58

Posted in Database

Tagged with , , ,