About the parameter modification of Dameng DM8 database

The parameter file in Dream 8 is dm.ini, which can be edited manually or automatically synchronized after modification in the database, similar to the integrated oracle pfile plus spfile function.

To view the parameters, you can use the v$dm_ini or v$parameter view, in which you can query the parameter value, the value in the file, the value in the session, and the parameter type. Of course, you can also use the function package provided by DM8 to query SF_GET_PARA_VALUE, SF_GET_PARA_DOUBLE_VALUE, SF_GET_PARA_STRING_VALUE.

SQL>  select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='TIMER_TRIG_CHECK_INTERVAL';

行号     PARA_NAME                 PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------------------- ---------- ---------- ---------- ---------
1          TIMER_TRIG_CHECK_INTERVAL 60         60         60         SYS

The parameters in Dream 8 can be divided into the following types:
1. READ ONLY: manual parameter, which means that the server cannot be modified during operation;
2. IN FILE: static parameter, only ini files can be modified;
3. SYS and SESSION: Dynamic parameters, ini files and memory can be modified at the same time, among them, SYS system-level parameters;

SQL> select distinct para_type from v$dm_ini;

行号     PARA_TYPE
---------- ---------
1          READ ONLY
2          SYS
3          IN FILE
4          SESSION

已用时间: 7.713(毫秒). 执行号:2016.
SQL> 

Static: It can be modified dynamically, and the modification will take effect after restarting the server.
Dynamic: It can be dynamically modified, and it will take effect immediately after modification. Dynamic parameters are divided into session level and system level. After the session-level parameters are modified, the new parameter values ​​will only affect the newly created sessions, and the previously created sessions will not be affected; the modification of the system-level parameters will affect all sessions.
Manual: It cannot be modified dynamically. You must modify the dm.ini parameter file manually, and then restart to take effect.

1. Method to modify parameters:
1. SP_SET_PARA_VALUE (scope int, paraname varchar(256), value int64)
This process is used to modify integer static configuration parameters and dynamic configuration parameters. The SCOPE parameter is 1 means that the parameter value is modified in both the memory and the INI file. At this time, only dynamic configuration parameters can be modified. The parameter 2 means that only the configuration parameters are modified in the INI file. At this time, it can be used to modify the static configuration parameters and the dynamic configuration parameters.
2, SP_SET_PARA_DOUBLE_VALUE (scope int, paraname varchar(8187), value double)
This process is used to modify floating-point static Configuration parameters and dynamic configuration parameters. The SCOPE parameter is 1 means that the parameter value is modified in both the memory and the INI file. At this time, only dynamic configuration parameters can be modified. The parameter 2 means that only the configuration parameters can be modified in the INI file. At this time, it can be used to modify the static configuration parameters and the dynamic configuration parameters.
3. SP_SET_PARA_STRING_VALUE()
This process is used to modify the string-type static configuration parameters and dynamic configuration parameters. The SCOPE parameter is 1 means that the parameter value is modified in both the memory and the INI file. At this time, only dynamic configuration parameters can be modified. The parameter 2 means that only the configuration parameters can be modified in the INI file. At this time, it can be used to modify static configuration parameters and dynamic configuration parameters.
4. SF_SET_SYSTEM_PARA_VALUE (paraname varchar(256), value int64\double\varchar(256), deferred int, scope int64 )
This process is used to modify the static configuration parameters or dynamic configuration parameters of the system integer, double, and varchar. DEFERRED parameter, 0 means that the modified parameters of the current session take effect immediately, and 1 means that the current session does not take effect, and will take effect afterwards. The default is 0. The SCOPE parameter is 1 means that the parameter value is modified in both the memory and the INI file. At this time, only dynamic configuration parameters can be modified. A parameter of 2 means that the configuration parameters are only modified in the INI file. At this time, it can be used to modify the static configuration parameters and the dynamic configuration parameters.
5. SF_SET_SESSION_PARA_VALUE (paraname varchar(8187), value bigint)
sets the value of a session-level INI parameter. The parameter value set is only valid for this session.
6. ALTER SYSTEM SET'parameter name' ='parameter value' [DEFERRED] [MEMORY|BOTH|SPFILE];
parameter name: it can be static parameter, system parameter sys, session parameter session; DEFERRED can only be used for dynamic parameters. After DEFERRED is specified, the parameter value will take effect after a delay, and will not take effect for the current session, but only for the newly created session. The default is to take effect immediately, for both the current session and the newly created session. [MEMORY|BOTH|SPFILE] Specify the effective location. Among them, MEMORY only modifies the value in memory; SPFILE modifies only the value in file_value; BOTH modifies both. By default, it is MEMORY. For static parameters, only SPFILE can be specified.
7. ALTER SESSION SET'parameter name' ='parameter value' [PURGE]; the
parameter name refers to the dynamic session-level parameter name. [PURGE] refers to whether to clean up the execution plan. The set value is only valid for the current session. When the PURGE option is included, all execution plans saved by the server will be cleared.

2. The modification methods corresponding to different parameter types are as follows:
1. READ ONLY:
Manually edit dm.ini. It is recommended to edit after closing the database. Experiments have proved that the open state of the database can also be edited, and it will take effect after restarting the database.

The following is the process of manually editing the parameter UTHR_FLAG in dm.ini to 1

SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='UTHR_FLAG';

行号     PARA_NAME PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- --------- ---------- ---------- ---------- ---------
1          UTHR_FLAG 0          0          0          READ ONLY

编辑dm.ini,修改UTHR_FLAG=1(步骤不做展示)

再次查看该参数发现FILE_VALUE已经变成了1,说明已经手动在ini文件中进行了修改。
SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='UTHR_FLAG';

行号     PARA_NAME PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- --------- ---------- ---------- ---------- ---------
1          UTHR_FLAG 0          0          1          READ ONLY

重启数据库后再次查看参数情况,参数已经修改过来了。

SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='UTHR_FLAG';

行号     PARA_NAME PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- --------- ---------- ---------- ---------- ---------
1          UTHR_FLAG 1          1          1          READ ONLY

2. INFILE: After
modification, restart to take effect, use SP_SET_PARA_VALUE (modify integer type, scope selection 2), SP_SET_PARA_STRING_VALUE (modify string type, scope selection 2)
or use ALTER SYSTEM SET'parameter name' ='parameter value' [DEFERRED] [MEMORY|BOTH|SPFILE];

The following is the process of modifying the LOG_POOL_SIZE parameter using the function package and SQL statement

SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='LOG_POOL_SIZE';

行号     PARA_NAME     PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------- ---------- ---------- ---------- ---------
1          LOG_POOL_SIZE 256        256        256        IN FILE

已用时间: 5.489(毫秒). 执行号:1994.
SQL> SP_SET_PARA_VALUE (2, 'LOG_POOL_SIZE',512);
DMSQL 过程已成功完成
已用时间: 5.059(毫秒). 执行号:1995.
SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='LOG_POOL_SIZE';

行号     PARA_NAME     PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------- ---------- ---------- ---------- ---------
1          LOG_POOL_SIZE 256        256        512        IN FILE

已用时间: 5.251(毫秒). 执行号:1996. 
SQL> alter system set 'LOG_POOL_SIZE'=256 SPFILE;
DMSQL 过程已成功完成
已用时间: 7.322(毫秒). 执行号:1997.
SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='LOG_POOL_SIZE';

行号     PARA_NAME     PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------- ---------- ---------- ---------- ---------
1          LOG_POOL_SIZE 256        256        256        IN FILE

已用时间: 4.881(毫秒). 执行号:1998.
SQL> 

3. Session: SF_SET_SESSION_PARA_VALUE (modify the current session, other sessions are invalid), SP_SET_PARA_VALUE, SP_SET_PARA_DOUBLE_VALUE, SP_SET_PARA_STRING_VALUE (), modify the session level parameters can not take effect on the previous connection session, you can choose the future connection and restart the database after the database is effective.
Or ALTER SESSION SET'parameter name' ='parameter value' [PURGE];

The following uses different function packages and SQL statements to modify the value of the SORT_BUF_SIZE parameter

SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='SORT_BUF_SIZE';

行号     PARA_NAME     PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------- ---------- ---------- ---------- ---------
1          SORT_BUF_SIZE 200        50         50         SESSION

已用时间: 5.214(毫秒). 执行号:1999.
SQL> SF_SET_SESSION_PARA_VALUE('SORT_BUF_SIZE',100);
DMSQL 过程已成功完成
已用时间: 0.664(毫秒). 执行号:2000.
SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='SORT_BUF_SIZE';

行号     PARA_NAME     PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------- ---------- ---------- ---------- ---------
1          SORT_BUF_SIZE 200        100        50         SESSION

已用时间: 4.578(毫秒). 执行号:2001.
SQL> SP_SET_PARA_VALUE(1,'SORT_BUF_SIZE',400);
DMSQL 过程已成功完成
已用时间: 5.093(毫秒). 执行号:2002.
SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='SORT_BUF_SIZE';

行号     PARA_NAME     PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------- ---------- ---------- ---------- ---------
1          SORT_BUF_SIZE 400        400        400        SESSION

已用时间: 4.592(毫秒). 执行号:2003.
SQL> 
SQL> alter session set 'SORT_BUF_SIZE'=50;
DMSQL 过程已成功完成
已用时间: 0.508(毫秒). 执行号:2004.
SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='SORT_BUF_SIZE';

行号     PARA_NAME     PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------- ---------- ---------- ---------- ---------
1          SORT_BUF_SIZE 400        50         400        SESSION

4. SYS: Dynamic parameters, you can use the SF_SET_SYSTEM_PARA_VALUE function to modify, so you don’t need to consider the integer, floating point, string issues (of course, you can also use other function packages)
or use ALTER SYSTEM SET'parameter name' ='parameter value' [ DEFERRED] [MEMORY|BOTH|SPFILE];

The following uses the function package and sql statement to modify the value of the TIMER_TRIG_CHECK_INTERVAL parameter

SQL> select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='TIMER_TRIG_CHECK_INTERVAL';

行号     PARA_NAME                 PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------------------- ---------- ---------- ---------- ---------
1          TIMER_TRIG_CHECK_INTERVAL 60         60         60         SYS

已用时间: 6.113(毫秒). 执行号:2010.
SQL>  SF_SET_SYSTEM_PARA_VALUE ('TIMER_TRIG_CHECK_INTERVAL',30,0,1);
DMSQL 过程已成功完成
已用时间: 4.139(毫秒). 执行号:2012.
SQL>  select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='TIMER_TRIG_CHECK_INTERVAL';

行号     PARA_NAME                 PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------------------- ---------- ---------- ---------- ---------
1          TIMER_TRIG_CHECK_INTERVAL 30         30         30         SYS

已用时间: 7.826(毫秒). 执行号:2013.
SQL> ALTER SYSTEM SET 'TIMER_TRIG_CHECK_INTERVAL' =60 DEFERRED BOTH;
DMSQL 过程已成功完成
已用时间: 5.345(毫秒). 执行号:2014.
SQL>  select PARA_NAME,para_value,SESS_VALUE,FILE_VALUE,para_type from v$dm_ini where para_name='TIMER_TRIG_CHECK_INTERVAL';

行号     PARA_NAME                 PARA_VALUE SESS_VALUE FILE_VALUE PARA_TYPE
---------- ------------------------- ---------- ---------- ---------- ---------
1          TIMER_TRIG_CHECK_INTERVAL 60         60         60         SYS

已用时间: 4.293(毫秒). 执行号:2015.
SQL> 

3. Summary
Although DM8 has many ways to modify parameters, and DM8 itself has more parameters, there are not many parameters that often need to be modified in daily operation and maintenance.
The parameters of READ ONLY and IN FILE can be modified directly by editing the dm.ini file, and then restart the database to take effect. So there is no need to consider which function package should be used.
For sys parameters, you can use the SF_SET_SESSION_PARA_VALUE function package to avoid considering the problems of integer, floating point, and character types.
For session parameters, the SF_SET_SESSION_PARA_VALUE function is generally used to modify the current session.
In most cases, the use of SP_SET_PARA_VALUE can deal with daily operation and maintenance work.
Of course, for students who are used to being compatible with Oracle operation and maintenance, using alter system/session is also a good choice.

Guess you like

Origin blog.csdn.net/weixin_50334974/article/details/108776379