Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column

 

Column

1. Check the current path of the data file
Anchor
1.PathCheck
1.PathCheck


The verification method differs depending on the disk tablespace and the memory tablespace, so they need to be checked separately. Use the query below to check and write down the output result.

  • Data file path of disk tablespace

    Code Block
    titleAll the Altibase server versions
    languagesql
    -- Output the disk tablespace name and data file path and name.
    set linesize 1024
    set colsize 100
    SELECT T.NAME TBS_NAME, D.NAME DATAFILE
      FROM V$DATAFILES D, V$TABLESPACES T
     WHERE D.SPACEID = T.ID
     ORDER BY D.SPACEID, D.ID ;
  • Path to checkpoint image file in memory tablespace

    Code Block
    titleHow to check in Altibase version 5 or later
    languagesql
    -- For in-memory tablespaces, only check the tablespace name and path can be checked.
    set linesize 1024
    set colsize 100
    SELECT TBS.NAME TBS_NAME,
           MEM_PATH.CHECKPOINT_PATH DATAFILE
      FROM V$TABLESPACES TBS,
           V$MEM_TABLESPACE_CHECKPOINT_PATHS MEM_PATH
     WHERE MEM_PATH.SPACE_ID = TBS.ID
     ORDER BY TBS_NAME, DATAFILE;
    Code Block
    titleHow to check in Altibase version 4
    languagesql
    $ grep MEM_DB_DIR $ALTIBASE_HOME/conf/altibase.properties | sort -u

2. Stop the Altibase server


  • The Altibase server must be stopped as the user needs to physically move the data files.

    Code Block
    languagebash
      # Altibase server stop command
    $ server stop 
    
      # How to check the Altibase server process
    $ ps -ef | grep 'altibase -p' | grep -v grep

3. Change the data file default path


  • The data file default path refers to the path where the data file will be located if the user specifies only the data file name without specifying a path when creating a tablespace or adding a data file.
  • Do this if the user also needs to change the default path when working with data file path change.
  • Set in the altibase.properties file, find the MEM_DB_DIR, DEFAULT_DISK_DB_DIR properties, and change the default path.

    Code Block
    languagebash
      # Property names differ depending on the disk and memory tablespaces.
      # Find the properties MEM_DB_DIR, DEFAULT_DISK_DB_DIR in the altibase.properties file and change the default path. 
    $ egrep 'MEM_DB_DIR|DEFAULT_DISK_DB_DIR' $ALTIBASE_HOME/conf/altibase.properties
    MEM_DB_DIR          = ?/dbs # Memory DB Directory
    DEFAULT_DISK_DB_DIR = ?/dbs # Disk   DB Directory

4. Copy the physical data file path


  • Copy all data files and memory checkpoint image files located in the path identified in "1. Check the current path of the data file" to the path the user wants to change.

    Code Block
    titlecp 수행 예
    languagebash
       # 시스템 디스크 테이블스페이스의 데이터 파일은 *.dbf 형식으로 생성되고 
       # 사용자 디스크 테이블스페이스의 데이터 파일은 테이블스페이스 생성 시 사용자 지정대로 생성됩니다. 
    $ cp -p /home/altibase_home/dbs_old_path/*.dbf /home/altibase_home/dbs_new_path/*.dbf
    
       # 메모리 체크포인트 이미지 파일 이름 형식은 메모리테이블스페이스이름_#_# 입니다. 
    $ cp -p /home/altibase_home/dbs_old_path/SYS_MEM* /home/altibase_home/dbs_new_path/SYS_MEM*
  • 파일 수 및 파일 크기를 비교하여 정상적으로 복사되었는지 확인합니다.

    Code Block
    languagebash
       # Compare the number of files
    $ ls -l /old_path/* | wc -l
    $ ls -l /new_path/* | wc -l 
    
       # Compare the size of files
    $ du -sk /old_path/*
    $ du -sk /new_path/*
  • Change the original path to another name.

    When starting the Altibase server, avoid the possibility of reading the original file and change the original path to a different name for the backup of the original file.

    Code Block
    languagebash
    $ mv /old_path /old_path_backup

5. Start the Altibase server as a control stage


  • After connecting to the iSQL with sysdba privileges

    Code Block
    languagesql
    $is -silent -sysdba
    [ERR-910FB : Connected to idle instance]
    iSQL(sysdba)> STARTUP CONTROL
  • Start as a control stagewstage

    Code Block
    languagesql
    iSQL(sysdba)> STARTUP CONTROL
    Connecting to the DB server.... Connected.
    TRANSITION TO PHASE : PROCESS
    TRANSITION TO PHASE : CONTROL
    Command executed successfully.
    iSQL(sysdba)> 

6. Execute the data file path change DDL


The disk data file and memory checkpoint image file path information are stored in the log anchor file. Execute the DDL statement to change the information known to the log anchor.

  • How to change the disk data file path

    The ALTER DATABASE statement is repeated as many times as the number of all data files checked in "1. Check the current path of data files". The user must enter the same file name by changing only the path.

    Code Block
    languagesql
    iSQL(sysdba)> ALTER DATABASE RENAME DATAFILE
    '/old_path/system001.dbf'  TO '/new_path/system001.dbf';
    Alter success.
  • Check the disk data file change path

    Make sure the path has been changed correctly.

    Code Block
    languagesql
    # Output the disk tablespace name and data file path and name.
    set linesize 1024
    set colsize 100
    SELECT T.NAME TBS_NAME, D.NAME DATAFILE
      FROM V$DATAFILES D, V$TABLESPACES T
     WHERE D.SPACEID = T.ID
     ORDER BY D.SPACEID, D.ID ;
  • Change the memory checkpoint image file path 

    1. Repeat the ALTER TABLESPACE statement as many as the number of memory tablespaces checked in "Check the current path of the data file". In this case, only the old and new paths are used without specifying a file name.

    Code Block
    titleAltibase version 5 or later
    languagesql
    iSQL(sysdba)> ALTER TABLESPACE memory_tablespace_name RENAME CHECKPOINT PATH 
    '/old_path' TO '/new_path';
    
    
    Example)
    iSQL(sysdba)> ALTER TABLESPACE SYS_TBS_MEM_DIC RENAME CHECKPOINT PATH 
    '/home/altibase_home/dbs_old_path' TO '/home1/altibase_home/dbs_new_path';
    Alter success.
    iSQL(sysdba)> ALTER TABLESPACE USER_MEM_TBS RENAME CHECKPOINT PATH 
    '/home/altibase_home/dbs_old_path' TO '/home1/altibase_home/dbs_new_path';
    Alter success.
    Code Block
    titleAltibase 4 버전
    languagebash
    # Altibase 4 버전의 경우 DDL 작업이 필요하지 않습니다. 
    # altibase.properties 파일에서 MEM_DB_DIR 프로퍼티 값을 변경 후 저장합니다. 
    
    $ cd $ALTIBASE_HOME/conf/
    $ vi altibase.properties 
  • How to check the memory checkpoint image file change path

    Code Block
    titleHow to check in Altibase 5 or later version
    languagesql
    -- For in-memory tablespaces, the tablespace name and path can be checked.
    set linesize 1024
    set colsize 100
    SELECT TBS.NAME TBS_NAME,
           MEM_PATH.CHECKPOINT_PATH DATAFILE
      FROM V$TABLESPACES TBS,
           V$MEM_TABLESPACE_CHECKPOINT_PATHS MEM_PATH
     WHERE MEM_PATH.SPACE_ID = TBS.ID
     ORDER BY TBS_NAME, DATAFILE;

7. Start the Altibase server as a service stage

 


Execute while connected to the iSQL with sysdba privilege.

 

Code Block
languagesql
iSQL(sysdba)> startup
The database server is already up and running.
TRANSITION TO PHASE : META
...Omitted...
--- STARTUP Process SUCCESS ---
Command executed successfully.
iSQL(sysdba)> 

...