[Tibero] 티베로(tibero) - 티베로 인스턴스 기동(2) Mount 모드
본문 바로가기
IT/DataBase

[Tibero] 티베로(tibero) - 티베로 인스턴스 기동(2) Mount 모드

by 로진김 2021. 7. 19.

mount까지 티베로 인스턴스를 기동 시키는 Test

 

[tibero@T1:/DataDisk/T1/tibero2]$ tbdown
tbdown failed. proc info file is deleted.
Hint: Please check if the tbsvr instance was already stopped.
[tibero@T1:/DataDisk/T1/tibero2]$ ps -ef | grep tbsvr
tibero   26233 18629  0 11:34 pts/1    00:00:00 grep --color=auto tbsvr

  #tbdown 되었는지 확인하려면 ps 명령어로 프로세스 살아있나 체크

[tibero@T1:/DataDisk/T1/tibero2]$ cp tbdata2/*.ctl tbdata

  #Control File 만 해당 경로에 복사

[tibero@T1:/DataDisk/T1/tibero2]$ ls -l tbdata
total 44576
-rw------- 1 tibero dba 22822912 Jul 14 11:34 c1.ctl
-rw------- 1 tibero dba 22822912 Jul 14 11:34 c2.ctl

  #Control File만 있는 상태
  
[tibero@T1:/DataDisk/T1/tibero2]$ tbboot

  #디폴트 값인 Normal모드로 부트시킴

Change core dump dir to /tibero/edu/tibero6/bin/prof.
Listener port = 8629

********************************************************
* Critical Warning : Raise svmode failed. The reason is
*   TBR-1024 :  Database needs media recovery: open failed(/DataDisk/T1/tibero2/tbdata/system001.dtf).
*   Current server mode is MOUNT.
********************************************************

  #파일이 손상되거나 찾을 수 없을 때 나오는 에러 메시지
  #에러 내용 미디어 복구가 필요 (미디어 : 저장장치(하드디스크))
  #에러 다음은 진행하지 않고, Open 모드 못하고 Mount모드까지만 함.
  #즉, 다른 파일은 문제가 없다는 뜻은 아님.
  #쿼리 접근 불가

Tibero 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.
Tibero instance started suspended at MOUNT mode.

 이 Test도 tbdown을 먼저 시행하고 시작해야 합니다. 기동 종료를 확인하기 위해 ps -ef | grep tbsvr로 열려있는 프로세스를 조회합니다. 다행히 종료된 것을 확인한 후 Control File만 복사하여 경로에 위치시킵니다. 이 상태로 normal 모드로 부팅시키면 Media recovery에 관련된 에러 메시지가 발생합니다. 이는 저장장치 즉, 하드디스크에 관련된 오류이고, Control File을 제외한 데이터베이스 기본 파일을 조회할 수 없어서 Nomount 모드 윗 단계인 Mount 모드로 부팅된 것을 확인하였습니다.

 

 주석에서 보다시피 Control File 까지만 조회했기 때문에 Data File이나 Redo Log File에 문제를 디텍팅 하지 못합니다. 물론 SQL 문으로 접속하지 못합니다.

 

 Mount 모드는 Control File만 보기 때문에 테이블, 딕션어리 테이블 모두 조회할 수 없습니다. 모든 Table에 접근하지 못하고 쿼리로 조회하는 것과 sys 유저가 아닌 일반 유저는 접속할 수 없습니다. 유저에 대한 정보도 딕션어리 테이블에 있고, 딕션어리 테이블은 데이터 파일에 있고, 데이터 파일은 오픈하지 않았기 때문입니다.

[tibero@T1:/DataDisk/T1/tibero2]$ tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

TBR-12021: Only SYS user can log on in restricted boot mode.

SQL> SELECT NAME FROM V%DATAFILE;
TBS-70004: Not connected to the server.

SQL> SELECT NAME FROM V%DATAFILE;
TBS-70004: Not connected to the server.

SQL> CONN SYS/TIBERO
TBR-17001: Login failed: invalid user name or password.

SQL> SELECT NAME FROM V$DATAFILE;
TBS-70004: Not connected to the server.

SQL> quit

 sys 유저에 대한 정보도 딕션어리 테이블에 있어서 접속이 불가능하다고 생각할 수 있지만, Mount 모드에서도 로그인이 되어 Control File 정보를 볼 수 있어야 합니다. DB 생성 기본 디렉터리에 .passwd파일이 별도로 담겨서 인증하게 됩니다. 이 것을 복사하지 않았기 때문에 sys 유저로 로그인이 안 되는 것입니다.

 

 .passwd 파일을 이전에 설치한 티베로에서 복사해보겠습니다.

[tibero@T1:/DataDisk/T1/tibero2]$ cp tbdata2/.passwd tbdata
[tibero@T1:/DataDisk/T1/tibero2]$ ls -l tbdata
total 44576
-rw------- 1 tibero dba 22822912 Jul 14 11:34 c1.ctl
-rw------- 1 tibero dba 22822912 Jul 14 11:34 c2.ctl
[tibero@T1:/DataDisk/T1/tibero2]$ ls -al tbdata
total 44580
drwxr-xr-x 2 tibero dba       49 Jul 14 11:43 .
drwxr-xr-x 5 tibero dba       47 Jul 14 11:25 ..
-rw------- 1 tibero dba 22822912 Jul 14 11:34 c1.ctl
-rw------- 1 tibero dba 22822912 Jul 14 11:34 c2.ctl
-r-------- 1 tibero dba       24 Jul 14 11:43 .passwd
[tibero@T1:/DataDisk/T1/tibero2]$ tbsql sys/tibero

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.
 
 #로그인이 잘되는 것을 확인
 #Data File에서 name을 조회
 
SQL> SELECT NAME FROM V$DATAFILE;

NAME
--------------------------------------------------------------------------------
/DataDisk/T1/tibero2/tbdata/system001.dtf
/DataDisk/T1/tibero2/tbdata/undo001.dtf
/DataDisk/T1/tibero2/tbdata/usr001.dtf
/DataDisk/T1/tibero2/tbdata/syssub001.dtf

4 rows selected.

 .passwd 파일을 복사하여 해당 경로로 붙여 넣으니 sys 유저로 로그인하는 것을 확인할 수 있습니다. sys 유저로 접속하여 Data File의 이름을 조회하였습니다. 설치 과정에서 credb.sql에 설정한 파일들이 경로에 맞게 출력되었습니다.

 

 이제 Mount 모드에서 컨트롤 파일 확인하는 Test를 해보겠습니다. Normal 모드로 접속하려면 위에서 조회한 4가지 파일과 Redo Log 파일이 꼭 있어야 합니다. 하나라도 없으면 Normal 모드로 접근할 수 없습니다.


간단히 usr001.dtf라는 Data File을 지우는 Test

 

 모든 파일이 완벽히 있는 경로에서 Data File 1개를 지우고 Normal 모드로 티베로 인스턴스를 기동 시켜보겠습니다.

SQL> q!
Disconnected.
[tibero@T1:/DataDisk/T1/tibero2]$ tbdown

Tibero instance terminated (NORMAL mode).

[tibero@T1:/DataDisk/T1/tibero2]$ ps -ef | grep tbsvr
tibero   27374 18629  0 11:46 pts/1    00:00:00 grep --color=auto tbsvr

  #tbdown, tbboot를 하고 항상 ps 명령어로 프로세스가 정상 다운, 기동되었는지 확인
  
[tibero@T1:/DataDisk/T1/tibero2]$ ls -l tbdata2
total 710168
-rw------- 1 tibero dba  22822912 Jul 14 11:23 c1.ctl
-rw------- 1 tibero dba  22822912 Jul 14 11:23 c2.ctl
drwx------ 2 tibero dba        70 Jul 13 16:56 java
-rw------- 1 tibero dba  52428800 Jul 14 11:22 log01.log
-rw------- 1 tibero dba  52428800 Jul 14 11:23 log11.log
-rw------- 1 tibero dba  52428800 Jul 14 11:22 log21.log
-rw------- 1 tibero dba  52428800 Jul 14 11:23 syssub001.dtf
-rw------- 1 tibero dba 104857600 Jul 14 11:23 system001.dtf
-rw------- 1 tibero dba 104857600 Jul 13 16:46 temp001.dtf
-rw------- 1 tibero dba 209715200 Jul 14 11:23 undo001.dtf
-rw------- 1 tibero dba  52428800 Jul 14 11:23 usr001.dtf

[tibero@T1:/DataDisk/T1/tibero2]$ cp tbdata2/*.dtf tbdata
[tibero@T1:/DataDisk/T1/tibero2]$ cp tbdata2/*.log tbdata
[tibero@T1:/DataDisk/T1/tibero2]$ cd tbdata

  #tbdata2에 형성한 모든 데이터베이스 파일을 tbdata로 복사

[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ ll
total 710168
-rw------- 1 tibero dba  22822912 Jul 14 11:34 c1.ctl
-rw------- 1 tibero dba  22822912 Jul 14 11:34 c2.ctl
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log01.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log11.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log21.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 syssub001.dtf
-rw------- 1 tibero dba 104857600 Jul 14 11:48 system001.dtf
-rw------- 1 tibero dba 104857600 Jul 14 11:48 temp001.dtf
-rw------- 1 tibero dba 209715200 Jul 14 11:48 undo001.dtf
-rw------- 1 tibero dba  52428800 Jul 14 11:48 usr001.dtf
[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ rm usr001.dtf

  #완벽한 상태에서 인위적으로 usr001.dtf 파일을 삭제

[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ ll
total 658968
-rw------- 1 tibero dba  22822912 Jul 14 11:34 c1.ctl
-rw------- 1 tibero dba  22822912 Jul 14 11:34 c2.ctl
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log01.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log11.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log21.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 syssub001.dtf
-rw------- 1 tibero dba 104857600 Jul 14 11:48 system001.dtf
-rw------- 1 tibero dba 104857600 Jul 14 11:48 temp001.dtf
-rw------- 1 tibero dba 209715200 Jul 14 11:48 undo001.dtf
[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ tbboot
Change core dump dir to /tibero/edu/tibero6/bin/prof.
Listener port = 8629

********************************************************
* Critical Warning : Raise svmode failed. The reason is
*   TBR-1024 :  Database needs media recovery: open failed(/DataDisk/T1/tibero2/tbdata/usr001.dtf).
*   Current server mode is MOUNT.
********************************************************


Tibero 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.
Tibero instance started suspended at MOUNT mode.

  #usr001.dtf 파일이 없어서 오류남........... 마운트 모드로 열림.

 필수 파일 중 하나인 Data File이 없기 때문에 Normal 모드로 기동 되지 않고, Mount 모드로 티베로 인스턴스가 기동 되었습니다.


로그 파일 삭제 후 기동 Test

[tibero@T1:/DataDisk/T1/tibero2/tbdata2]$ tbdown

Tibero instance terminated (NORMAL mode).

[tibero@T1:/DataDisk/T1/tibero2/tbdata2]$ ps -ef | grep tbsvr
tibero   27902 18629  0 11:51 pts/1    00:00:00 grep --color=auto tbsvr

[tibero@T1:/DataDisk/T1/tibero2/tbdata2]$ cp usr001.dtf /DataDisk/T1/tibero2/tbdata

  #usr001.dtf를 디렉터리에 복사하여 복원

[tibero@T1:/DataDisk/T1/tibero2]$ ll
total 0
drwxr-xr-x 2 tibero dba   6 Jul 13 15:59 arch
drwxr-xr-x 2 tibero dba 198 Jul 14 11:53 tbdata
drwxr-xr-x 3 tibero dba 210 Jul 13 16:56 tbdata2
[tibero@T1:/DataDisk/T1/tibero2]$ cd tbdata
[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ ll
total 710168
-rw------- 1 tibero dba  22822912 Jul 14 11:34 c1.ctl
-rw------- 1 tibero dba  22822912 Jul 14 11:34 c2.ctl
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log01.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log11.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log21.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 syssub001.dtf
-rw------- 1 tibero dba 104857600 Jul 14 11:48 system001.dtf
-rw------- 1 tibero dba 104857600 Jul 14 11:48 temp001.dtf
-rw------- 1 tibero dba 209715200 Jul 14 11:48 undo001.dtf
-rw------- 1 tibero dba  52428800 Jul 14 11:53 usr001.dtf

  #이번에는 로그파일 하나 삭제하고 기동해봄.

[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ rm log21.log
[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ tbboot
Change core dump dir to /tibero/edu/tibero6/bin/prof.
Listener port = 8629

********************************************************
* Critical Warning : Raise svmode failed. The reason is
*   TBR-1042 :  Unable to read log member file in group 2, member -1 (), block 15346467.
*   Current server mode is MOUNT.
********************************************************


Tibero 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.
Tibero instance started suspended at MOUNT mode.

  #역시 오류 발생으로 Mount 모드로 부팅

 Redo Log File 중 1개를 삭제하여 normal 모드로 부팅해보았습니다. Control File까지 읽을 수 있으나 log file을 찾을 수 없다는 에러 메시지와 함께 Mount Mode로 부팅되었습니다.

 


Temp 파일 삭제 후 기동 Test

[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ tbdown

Tibero instance terminated (NORMAL mode).

[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ ps -ef | grep tbsvr
tibero   28346 18629  0 11:54 pts/1    00:00:00 grep --color=auto tbsvr

...#디렉터리 이동은 생략

[tibero@T1:/DataDisk/T1/tibero2/tbdata2]$ cp log21.log /DataDisk/T1/tibero2/tbdata

...#디렉터리 이동은 생략

[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ ll
total 710168
-rw------- 1 tibero dba  22822912 Jul 14 11:34 c1.ctl
-rw------- 1 tibero dba  22822912 Jul 14 11:34 c2.ctl
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log01.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 log11.log
-rw------- 1 tibero dba  52428800 Jul 14 11:55 log21.log
-rw------- 1 tibero dba  52428800 Jul 14 11:48 syssub001.dtf
-rw------- 1 tibero dba 104857600 Jul 14 11:48 system001.dtf
-rw------- 1 tibero dba 104857600 Jul 14 11:48 temp001.dtf
-rw------- 1 tibero dba 209715200 Jul 14 11:48 undo001.dtf
-rw------- 1 tibero dba  52428800 Jul 14 11:53 usr001.dtf

  #3번째로 temp 관련 데이터파일을 삭제해봄

[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ rm temp001.dtf
[tibero@T1:/DataDisk/T1/tibero2/tbdata]$ tbboot
Change core dump dir to /tibero/edu/tibero6/bin/prof.
Listener port = 8629

Tibero 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.
Tibero instance started up (NORMAL mode).

  #temp 관련 파일은 없어도 노말모드로 기동됨.
  #에러도 나지 않음
  #다시 조회해봄 => temp001.dtf는 다시 나옴 => 임시파일

 Data File, Redo Log File이 아닌 Temp File은 필수 파일이 아니고 Control File을 기동 하게 되면 생성되는 임시파일입니다. 그래서 temp 파일을 지우고 tbboot를 하게 되면 Mount Mode가 아닌 Normal Mode로 기동 되게 됩니다.

 


결론 : 티베로 인스턴스가 Normal 모드로 기동되려면 Data File, Redo Log File, Control File은 무조건 존재해야 합니다. 그러나 임시파일인 Temp File은 없어도 Normal Mode로 기동 되며 티베로 인스턴스 기동시 Control File 오픈 시 새로 생성되게 됩니다.

반응형