본문 바로가기

카테고리 없음

ORACLE 11g DATAGUARD CREATE STANDBY DATABASE (with different memory size) v1.0

ORACLE 11g DATAGUARD CREATE STANDBY DATABASE (with different memory size)

 

Date

Ver

Etc.

11.07.11

 

 

 

 

 

 

 

 

 

 

1.    Create Standby Database (Different Memory Size)

 

앞서 다음의 내용을 가정한다.

 

l  Primary / Standby 는 동일한 redhat release version 이며 Physical Ram, File System 구성 모두 동일하다.

 

<DG1>

 

l  기존 Primary Database DB Name, Instance Name DG1 이다.

l  DG1 3G memory_max_target 값으로 가져간다.

l  DG1 memory 관련 Parameter 는 변경할 수 없다.

l  DG1 tmpfs 4G 를 사용한다.

l  Standby Database 의 추가는 RMAN 을 사용한다.

 

 

<DG2>

 

l  새로 추가할 Standby Database Instance Name DG2 로 가져간다.

l  DG2 tmpfs 2G 가 할당되어 있다.

l  DG2 initDG2.ora 에는 다음의 내용만 정의한다.

 

db_name=DG1

db_unique_name=DG2

 

 

2.    Create Standby Database using RMAN Script

Standby Database 를 추가하기 위한 RMAN Script 는 다음과 같다.

 

connect auxiliary system/oracle@dg2

run {                                                                                                                                                                                                                                                                                                                                                     

        duplicate target database for standby from active database                                                                                                                                                                                                                                                                                        

        dorecover                                                                                                                                                                                                                                                                                                                                         

        spfile                                                                                                                                                                                                                                                                                                                                            

        parameter_value_convert 'dg1','dg2'                                                                                                                                                                                                                                                                                                               

        set db_unique_name='dg2'                                                                                                                                                                                                                                                                                                                          

        set control_files='/u01/app/oracle/oradata/DG2/control01.ctl', '/u01/app/oracle/flash_recovery_area/DG2/control02.ctl'

        set db_file_name_convert='/u01/app/oracle/oradata/DG1','/u01/app/oracle/oradata/DG2'

        set log_file_name_convert='/u01/app/oracle/oradata/DG1','/u01/app/oracle/oradata/DG2'

        set cluster_database='FALSE'                                                                                                                                                                                                                                                                                                                      

        set fal_client='dg2'                                                                                                                                                                                                                                                                                                                              

        set fal_server='dg1'                                                                                                                                                                                                                                                                                                                              

        set log_archive_dest_1='location=/u01/app/oracle/oradata/DG2/arc'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

        set log_archive_dest_2='service=dg1 LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=dg1'

        set log_archive_config='dg_config=(dg1,dg2)'                                                                                                                                                                                                                                                                                                      

        set service_names='dg1';                                                                                                                                                                                                                                                                                                                          

        sql "alter system archive log current";                                                                                                                                                                                                                                                                                                           

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;                                                                                                                                                                                                                                                                                        

}

 

위 스크립트를 보면 메모리 사이즈에 대한 부분은 하나도 없다.

아래 Practice 를 들어가기 전에 rman script 를 수행하기 전 필요한 모든 과정을 마쳤다.

 

3.    Practice

<memory setting 없이 수행>

 

Oracle instance shut down

 

connected to auxiliary database (not started)

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of Duplicate Db command at 07/11/2011 17:28:08

RMAN-03015: error occurred in stored script Memory Script

RMAN-04014: startup failed: ORA-00845: MEMORY_TARGET not supported on this system

 

RMAN> **end-of-file**

 

RMAN-04015 에러가 발생하면서 수행이 중단되었다. 해당 시스템 (DG2) 에서 MEMORY_TARGET 지원이 안된다는 내용이다.

 

dg1@/home/oracle>oerr rman 4014

4014, 1, "startup failed: %s"

// *Cause:  The database failed to startup.

// *Action: The cause of the failure is included in the error message.

//          Correct the cause of the failure and retry the startup command.

dg1@/home/oracle>oerr ora 845

00845, 00000, "MEMORY_TARGET not supported on this system"

// *Cause: The MEMORY_TARGET parameter was not supported on this operating system or /dev/shm was not sized correctly on Linux.

// *Action: Refer to documentation for a list of supported operating systems. Or, size /dev/shm to be at least the SGA_MAX_SIZE on each Oracle instance running on the system.

 

앞서 확인한 메시지의 에러넘버를 조회한 결과 리눅스의 /dev/shm 이 적절하게 셋팅 되어 있지 않은 경우에 대해 언급되어 있다.

 

Starting ORACLE instance (normal)

WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least 3187671040 bytes. /dev/shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is 2071035904 and used is 0 bytes. Ensure that the mount point is /dev/shm for this directory.

memory_target needs larger /dev/shm

 

위의 내용은 DG2 alert log 이다. /dev/shm file system 이 최소 3040M 이상이어야 한다고 언급되어 있다. 말미에도 더 큰 /dev/shm 이 필요하다고 언급되어 있다.

 

여기서의 3040M 이란 수치는 DG1 memory_max_target 과 동일한 크기이다. 이를 통해 RMAN 을 통한 과정중 memory 에 대한 setting Primary 와 동일하게 가져감을 알 수 있다.

 

DG2 /dev/shm 을 조회해 보았다.

 

dg2@/u01/app/oracle/diag/rdbms/dg2/DG2/trace>df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda1              26G   11G   13G  46% /

tmpfs                 2.0G     0  2.0G   0% /dev/shm

 

2G 가 할당되어 있는 것을 알 수 있다.

 

여기서 갈림길이다.

Primary Database DG1 memory_max_target 을 줄이던가 Standby Database DG2 를 변경하던가 둘중에 하나이다.

 

DG1 에는 변경을 가하지 않는다고 가정했기 때문에 DG2 를 변경해야 한다. DG2 /dev/shm 2기가로 가정했고 이는 변경하지 못한다고 가정한다.

 

그렇다면 남은 방법은 DB 단의 변경이며 parameter file 을 변경하던가 RMAN script 를 수정하던가 둘중에 하나이다.

 

<init parameter memory setting 을 추가>

Parameter file memory_max_target 에 대한 내용을 추가하였다.

db_name=DG1

db_unique_name=DG2

memory_max_target=1900M

 

다시 RMAN Script 를 수행해 보았다. (수행전의 준비과정은 생략한다.)

 

contents of Memory Script:

{

   sql clone "alter system set  db_unique_name =

 ''dg2'' comment=

 '''' scope=spfile";

   sql clone "alter system set  control_files =

 ''/u01/app/oracle/oradata/DG2/control01.ctl'', ''/u01/app/oracle/flash_recovery_area/DG2/control02.ctl'' comment=

 '''' scope=spfile";

   sql clone "alter system set  db_file_name_convert =

 ''/u01/app/oracle/oradata/DG1'', ''/u01/app/oracle/oradata/DG2'' comment=

 '''' scope=spfile";

   sql clone "alter system set  log_file_name_convert =

 ''/u01/app/oracle/oradata/DG1'', ''/u01/app/oracle/oradata/DG2'' comment=

 '''' scope=spfile";

   sql clone "alter system set  cluster_database =

 FALSE comment=

 '''' scope=spfile";

   sql clone "alter system set  fal_client =

 ''dg2'' comment=

 '''' scope=spfile";

   sql clone "alter system set  fal_server =

 ''dg1'' comment=

 '''' scope=spfile";

   sql clone "alter system set  log_archive_dest_1 =

 ''location=/u01/app/oracle/oradata/DG2/arc'' comment=

 '''' scope=spfile";

   sql clone "alter system set  log_archive_dest_2 =

 ''service=dg1 LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=dg1'' comment=

 '''' scope=spfile";

   sql clone "alter system set  log_archive_config =

 ''dg_config=(dg1,dg2)'' comment=

 '''' scope=spfile";

   sql clone "alter system set  service_names =

 ''dg1'' comment=

 '''' scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script

 

==중략==

 

connected to auxiliary database (not started)

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of Duplicate Db command at 07/11/2011 18:00:27

RMAN-03015: error occurred in stored script Memory Script

RMAN-04014: startup failed: ORA-00845: MEMORY_TARGET not supported on this system

 

RMAN> **end-of-file**

 

위의 Memory script 부분을 보면 memory 에 대한 부분이 없다. 또 결과적으로 앞서 아무 값도 셋팅하지 않은 경우와 동일한 에러를 리턴하고 중단되었다.

 

Standby Database 의 상황은 spfile 이 생성된 상태로 이를 가지고 pfile 을 생성해 조회해 보았다. (dg2 momory_target 문제로 nomount 가 불가능한 상태이다.)

 

*.log_file_name_convert='/u01/app/oracle/oradata/DG1','/u01/app/oracle/oradata/DG2'

*.memory_max_target=3183476736

*.memory_target=1655701504

 

memory_max_target 값이 3G 가 잡혀있다. DG2 Parameter file 에 설정한 Memory 값은 무의미 함을 알 수 있다.

 

<RMAN Script memory setting 을 추가>

 

RMAN Script 의 다음의 내용을 추가한다.

set service_names='dg1'

set memory_max_target="1800m";                                                                                                                                                                                                                                                                                                                          

sql "alter system archive log current";

 

다음은 스크립트를 수정해 수행한 결과 중 Memory Script 부분을 발췌한 내용이다.

 

contents of Memory Script:

{

==중략==

   sql clone "alter system set  service_names =

 ''dg1'' comment=

 '''' scope=spfile";

   sql clone "alter system set  memory_max_target =

 1800m comment=

 '''' scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

}

 

Memory Script memory_max_target 항목을 확인하였다. 이후 Standby database 가 이상없이 정상적으로 추가되었다.

 

4.    Conclusion

Memory 가 다른(작은) 장비를 Standby Database 로 추가할 때는 다음을 고려한다.

- Primary Database Memory Setting 변경이 가능한지? (현실적으로 어렵다.)

- Standby Database Physical RAM 확장(Primary Database 만큼) 이 가능한지

 

위 요구사항이 불가능하다면 Stanby database 의 환경에 맞게 Memory 를 수정하는 방법이 있으며 이는 RMAN 을 이용하는 경우 set 명령을 사용해 간단히 변경이 가능하다.