오라클 8 버전까지는 기본적으로 pfile을 사용했지만, 9 버전부터는 spfile을 사용한다. 만약 pfile과 spfile을 모두 사용한다면 spfile을 먼저 로딩하게 된다.

그러면 show parameter를 사용하여 spfile을 사용하고 있는지 확인해 보자.

SQL> SHOW parameter spfile
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/11.2.0
                                                 /xe/dbs/spfileXE.ora

 

그러면 spfile 기준으로 알아보자.


1. 파라미터 변경

일단 파라미터 조회 방법을 알아보자. (혹은 v$parameter 조회)

SQL> show parameter processes
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     0
db_writer_processes                  integer     1
gcs_server_processes                 integer     0
global_txn_processes                 integer     1
job_queue_processes                  integer     4
log_archive_max_processes            integer     4
processes                            integer     100

pfile의 경우 initXXX.ora 파일을 직접 수정하면 되지만 spfile은 alter system set 명령을 사용해야 한다.

SQL> ALTER system SET processes=150;
ALTER system SET processes=150
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

문제가 생긴 것 같다. scope을 spfile로 지정하여 다시 alter 해 보자. scope에 대해서는 뒤에서 다시 설명하려고 한다.

SQL> ALTER system SET processes=150 scope=spfile;
 
System altered.

alert 로그에도 잘 기록되어 있다.

Thu Jul 07 13:52:56 2016
ALTER SYSTEM SET processes=150 SCOPE=SPFILE;

이제 다시 processes 파라미터를 확인해 보자.

SQL> show parameter processes
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     0
db_writer_processes                  integer     1
gcs_server_processes                 integer     0
global_txn_processes                 integer     1
job_queue_processes                  integer     4
log_archive_max_processes            integer     4
processes                            integer     100

런타임으로 바뀐 것 같지는 않다. spfile의 변화를 확인해 보자.

$ ls -l /u01/app/oracle/product/11.2.0/xe/dbs/spfileXE.ora
-rw-r----- 1 oracle dba 2560 Jul  7 13:52 /u01/app/oracle/product/11.2.0/xe/dbs/spfileXE.ora

그럼 DB를 재기동한 후 다시 확인해 보자.

SQL> show parameter processes
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     0
db_writer_processes                  integer     1
gcs_server_processes                 integer     0
global_txn_processes                 integer     1
job_queue_processes                  integer     4
log_archive_max_processes            integer     4
processes                            integer     150

드디어 processes 파라미터가 150으로 바뀌었음을 알 수 있다.

 

2. scope

위에서 alter system set 시 잠시 scope에 대한 이야기를 했다. scope의 종류는 다음과 같다.

  • memory = 현재 인스턴스에만 적용하고 spfile을 수정하지 않는다.
  • spfile = 현재 인스턴스에는 적용하지 않고 spfile만 수정한다.
  • both = 현재 인스턴스에도 적용하고 spfile도 수정한다.

하지만 모든 파라미터에 다 사용할 수 있는 것은 아니다. 예를 들어 위에서 예로 든 process의 경우는 memory 범위로 alter 할 수 없다.

SQL> ALTER system SET processes=100 scope=memory;
ALTER system SET processes=100 scope=memory
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

 

3. v$parameter

SQL> desc v$parameter
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 NUM                                                NUMBER
 NAME                                               VARCHAR2(80)
 TYPE                                               NUMBER
 VALUE                                              VARCHAR2(4000)
 DISPLAY_VALUE                                      VARCHAR2(4000)
 ISDEFAULT                                          VARCHAR2(9)
 ISSES_MODIFIABLE                                   VARCHAR2(5)
 ISSYS_MODIFIABLE                                   VARCHAR2(9)
 ISINSTANCE_MODIFIABLE                              VARCHAR2(5)
 ISMODIFIED                                         VARCHAR2(10)
 ISADJUSTED                                         VARCHAR2(5)
 ISDEPRECATED                                       VARCHAR2(5)
 ISBASIC                                            VARCHAR2(5)
 DESCRIPTION                                        VARCHAR2(255)
 UPDATE_COMMENT                                     VARCHAR2(255)
 HASH                                               NUMBER

 

4. XE 주의사항

파라미터 중 db_cache_size를 변경해 보려고 한다.

SQL> SHOW parameter db_cache_size
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_cache_size                        big INTEGER 0

아래와 같이 64M로 바꿔보자.

SQL> ALTER system SET db_cache_size=64M;
 
System altered.

DB를 재기동! 그런데....

SQL> startup
ORA-47500: XE edition memory parameter invalid OR NOT specified

여기서부터는 ORA-47500을 해결하기 위한 삽질이 계속되었다. (많은 시간이 흐른다....)

그리고 다음과 같은 버그 리포트 발견.

2.4 Linux x64 Bugs

This section lists known Linux x64 bugs for this release.

2.4.1 Bug 11738319

DB STARTUP FAILS WITH GENERIC ORA-47500 WITH DB_CACHE_SIZE;NEED BETTER DIAGNOSIS

If two init.ora parameters that Oracle does not support in XE are specified in the database, startup fails with the generic error message:

ORA-47500: XE edition memory parameter invalid or not specified

Cause:

An invalid parameter or a value more than the maximum allowed for memory was specified. These two parameters are not supported: use_indirect_buffers and db_cache_size.

Workaround:

Use allowed parameter or reduce memory size or upgrade to Standard or Enterprise edition.

Instead of db_cache_size, use sga_target or memory_target. There is no substitution for use_indirect_buffers.

XE 버전에서는 db_cache_size를 사용할 수 없다.

일단 파라미터 수정을 위해 아래와 같이 pfile을 생성한다.

SQL> CREATE pfile='/u01/app/oracle/product/11.2.0/xe/dbs/initXE.ora' FROM spfile='/u01/app/oracle/product/11.2.0/xe/dbs/spfileXE.ora';
 
File created.

 그리고 나서 아래 라인 삭제.

*.db_cache_size=67108864

그리고 다시 정상 기동 성공했다.

SQL> startup pfile=/u01/app/oracle/product/11.2.0/xe/dbs/initXE.ora
ORACLE instance started.
 
Total System Global Area  417546240 bytes
Fixed Size                  2227080 bytes
Variable Size             390071416 bytes
Database Buffers           20971520 bytes
Redo Buffers                4276224 bytes
Database mounted.
Database opened.

 

작성중.