본문 바로가기
  • SDXL 1.0 + 한복 LoRA
  • SDXL 1.0 + 한복 LoRA
Development/Tips

[옛 글] [DBMS]repository create error 처리

by 마즈다 2013. 7. 5.
반응형

최초 작성일 : 2010/03/22 10:25 


EM Database Control 11.1.0.6.0 을 구성하는 도중에 발생하는 repository create error에 관한 
원인 및 해결 방법을 제시합니다. 

Problem Description
다음은 emca를 구성하여 repository를 구성하려다가 실패하여 다시 
drop하고 create 시에 이와 같은 ORA-20001 이라고 하는 SYSMAN user가 이미 존재한다고 
하는 에러에 대한 해결방법입니다.

emca -deconfig dbcontrol db -repos drop 수행 중에 다음과 같이 failed가 발생하고,

구 43: WHERE username = upper('&EM_REPOS_USER') ;
신 43: WHERE username = upper('SYSMAN') ;
09-03-2008 11:42:20 Drop Repos User. Return code = 58.
09-03-2008 11:42:20 Failed. <===
09-03-2008 11:42:20 Dropping Roles/Synonymns/Tablespaces ... 
09-03-2008 11:42:23 Return code = 66.
09-03-2008 11:42:23 Failed.
09-03-2008 11:42:23 Unquiescing DB ... 
09-03-2008 11:42:24 Return code = 66.
09-03-2008 11:42:24 Failed. <===
09-03-2008 11:42:24 Dropped Repository Successfully.

위와 같이 drop fail 이후에 emca -config dbcontrol db -repos create 수행 시 

ORA-20001: SYSMAN already exists..
ORA-06512: 줄 17에서

이와 같은 에러를 만나서 다시 create가 제대로 되지 않는 경우를 볼 수 있다.

Environment :

아래의 이름과 환경변수는 사용자의 환경에 따라 달라질 수 있습니다.

OS : Microsoft Windows XP Professional 32bit windows
컴퓨터이름 : jeher
Database version : 11.1.0.6.0
ORACLE_SID : orcl
ORACLE_HOME : D:\app\jeher\product\11.1.0\db_1
em 에 사용되는 HOSTNAME_SID : jeher_orcl 

에러 증상

아래의 log는 실제 emca 수행 시 자세한 log를 확인할 수 있는 
D:\app\jeher\cfgtoollogs\emca\orcl\emca_repos_create_2008_03_09_14_39_55.log 의 내용입니다.

Check if repos user already exists.

구 6: WHERE username=UPPER('&EM_REPOS_USER');
신 6: WHERE username=UPPER('SYSMAN');
구 8: IF ( '&EM_CHECK_TYPE' = 'EXISTS') THEN
신 8: IF ( 'NOT_EXISTS' = 'EXISTS') THEN
구 11: raise_application_error(-20000, '&EM_REPOS_USER does not exists..');
신 11: raise_application_error(-20000, 'SYSMAN does not exists..');
구 14: ELSIF ( '&EM_CHECK_TYPE' = 'NOT_EXISTS' ) THEN
신 14: ELSIF ( 'NOT_EXISTS' = 'NOT_EXISTS' ) THEN
구 17: raise_application_error(-20001, '&EM_REPOS_USER already exists..');
신 17: raise_application_error(-20001, 'SYSMAN already exists..');
구 21: raise_application_error(-20002, 'Invalid Check type &EM_CHECK_TYPE');
신 21: raise_application_error(-20002, 'Invalid Check type NOT_EXISTS');
DECLARE
*
1행에 오류:
ORA-20001: SYSMAN already exists..
ORA-06512: 줄 17에서

Explanation

이러한 에러는 주로 emca command 중에서 emca -deconfig dbcontrol db -repos drop

을 수행하다가 Service만 정리가 되고, repository가 깨끗하게 정리가 되지 않고 

오류가 발생하거나 hang 이 발생하는 경우에 나중에 다시 create 시에 나타나는 에러입니다. 

11g emca 수행 시 에러 log는 $ORACLE_BASE\\cfgtoollogs\emca\orcl\ 아래에 생성된 log를 확인합니다.

Solution Description

다음과 같은 명령으로 EM Configuration file들과 repository를 정리할 수 있습니다. 

<Note:278100.1> How To Drop, Create And Recreate DB Control In A 10g Database?

A. Delete DB Control Objects 의 상세 설명은 Manual하게 DB Control을 DELETE하는 절차입니다.
이 부분을 보시면 아주 자세히 설명되어 있습니다.

The procedure is the same for 10g R1, R2 and 11g 11.1.0.6.0.

절차1) Configuration file 정리 작업

A) To delete the configurartion files:

- remove the following directories from your filesystem:
<ORACLE_HOME>/<hostname_sid>
예를 들어 D:\app\jeher\product\11.1.0\db_1\JEHER_ORCL 이라는 디렉토리를 제거합니다.

<ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>
예를 들어 D:\app\jeher\product\11.1.0\oc4j\j2ee\OC4J_DBConsoleJEHER_ORCL 이라는 
디렉토리를 제거합니다.

B) 레지스트리에서 SERVICE 제거 작업.

Note: On Windows you aslo need to delete the DB Console service:
- run regedit
- navigate to HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services
- locate the OracleDBConsole<sid> entry and delete it

OracleDBConsoleORCL 이라는 서비스 엔트리를 클릭하고 제거합니다. 


Alternatively on Windows XP and Windows Server 2003 you can run the following from the command line: 

'sc delete <service_name>' where <service_name> is the DB Control service name (typically: OracleDBConsole<sid>)

절차2) EM repository 를 manual 하게 drop하기.

To delete the repository 

Logon SQLPLUS as user SYS or SYSTEM, and drop the sysman account 
and mangement objects:

sqlplus "/as sysdba"
SHUTDOWN IMMEDIATE;
STARTUP RESTRICT;
EXEC sysman.emd_maintenance.remove_em_dbms_jobs;
EXEC sysman.setEMUserContext('',5);
REVOKE dba FROM sysman;
DECLARE
CURSOR c1 IS
SELECT owner, synonym_name name
FROM dba_synonyms
WHERE table_owner = 'SYSMAN'
;
BEGIN
FOR r1 IN c1 LOOP
IF r1.owner = 'PUBLIC' THEN
EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name;
ELSE
EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;
END IF;
END LOOP;
END;
/
DROP USER mgmt_view CASCADE;
DROP ROLE mgmt_user;
DROP USER sysman CASCADE;
ALTER SYSTEM DISABLE RESTRICTED SESSION;

참고 사항

1) DROP USER mgmt_view CASCADE; 를 수행 시 이미 mgmt_view가 emca -deconfig 명령에 의해 
drop이 되었다면 ORA-1918 ERROR가 발생하는데, 이는 무시합니다.

"ORA-01918: 사용자 'MGMT_VIEW'(이)가 존재하지 않습니다."

2) 참고 명령어

Note: The above(절차2) will completely delete the DB Control repository from the database; 
under certain circumstances (e.g. you want to recreate the repository later on) 
the following statemnts may be sufficient to remove the repository:

sqlplus "/as sysdba"
a. drop user sysman cascade;
b. drop role MGMT_USER;
c. drop user MGMT_VIEW cascade;
d. drop public synonym MGMT_TARGET_BLACKOUTS;
e. drop public synonym SETEMVIEWUSERCONTEXT;

===================================

절차3) EM console HTTP port와 Agent port 설정 해제 작업

Remove the entries for the old dbconsole information from the
$ORACLE_HOME/install/portlist.ini file

제거 작업 단계 중 마지막으로 D:\app\jeher\product\11.1.0\db_1\install\portlist.ini file 
내에서 old dbconsole 정보를 제거합니다. 

Example 

Ultra Search HTTP 포트 번호 =5620
Enterprise Manager 콘솔 HTTP 포트(orcl) = 1158
Enterprise Manager 에이전트 포트(orcl) = 3938

위와 같이 Enterprise Manager 콘솔 HTTP 포트와 Enterprise Manager 에이전트 포트(orcl)
가 보이는데, 이 line들을 지웁니다.

아래의 절차4) 부터 절차8) 까지는 다시 create해주는 과정과 환경 셋업 작업입니다.

절차4) C:\WINDOWS\system32\drivers\etc\hosts file에서 다음을 추가해 줍니다. 

127.0.0.1 localhost
10.10.10.10 jeher 

10.10.10.10 은 내 네트워크 환경 -> 로컬연결영역3(Microsoft Loopback Adapter)
-> 속성(인터넷 프로토콜 TCP/IP)
-> 속성(다음 ip 주소 사용의 IP 주소가 10.10.10.10) 
위와 같이 확인하여 얻어질 수 있습니다. 

절차5) 다시 emca -config dbcontrol db -repos create 를 수행합니다.

절차6) 레지스트리에 문자열값 oracle_hostname 이 jeher로 되어 있는 지 확인.

절차5 가 성공적으로 수행이 되면 관리도구 -> 서비스에 OracleDBConsoleORCL 이라는 
서비스가 다시 생성됩니다. 

- run regedit
- navigate to HKEY_LOCAL_MACHINE/Software/Oracle/Sysman/OracleDBConsoleORCL
- 문자열값 oracle_hostname : jeher 로 되어 있는지 확인합니다. 

절차7) emd.properties 에서 timezone 수정 

D:\app\jeher\product\11.1.0\db_1\jeher_orcl\sysman\config 아래에 있는 
emd.properties file에서 agent timezone를 Asia/Seoul 로 대소문자를 구분하여 입력합니다.

For example)
omsRecvDir=D:/app/jeher/product/11.1.0/db_1/jeher_orcl/sysman/recv
agentTZRegion=Asia/Seoul 

이와 같이 저장하고 나옵니다. 

절차8) EM 11g LOGIN 접속 방법.

https://jeher.kr.oracle.com:1158/em 로 접속하면 됩니다.

username : sys
password : oracle
connect as SYSDBA 

OC4J 에 설치 시 보안 설정이 되어 있으므로, http 가 아닌 https 로 접속해야 합니다. 
11g의 경우, password file이 자동으로 $ORACLE_HOME/dbs (windows 의 경우, $ORACLE_HOME/database) 아래에
생성되므로, 따로 생성이 불필요합니다. 
remote_login_passwordfile='EXCLUSIVE'로 자동 setting 되어 있습니다.

출처: OTN Discussion Forums 

반응형

'Development > Tips' 카테고리의 다른 글

[옛 글] [linux] watch 명령어  (0) 2013.07.16
[옛 글] [Tip] enum 선언  (0) 2013.07.15
[옛 글] [Tip] alloc(new), copy, retain  (0) 2013.07.15
[옛 글] [Tip] UITableView  (0) 2013.07.08
[옛 글] [SQL] Merge문 예제  (0) 2013.07.05