本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
Amazon RDS for Db2 使用三種類型的參數:資料庫管理員組態參數、登錄變數和資料庫組態參數。您可以透過參數群組管理前兩種類型,並透過rdsadmin.update_db_param預存程序管理最後一個類型。
根據預設, RDS for Db2 資料庫執行個體使用 Db2 資料庫和資料庫執行個體專用的資料庫參數群組。此參數群組包含 的參數 IBM Db2 資料庫引擎,特別是資料庫管理員組態參數和登錄檔變數。如需使用參數群組的詳細資訊,請參閱 的參數組 RDS。
RDS for Db2 資料庫組態參數會設定為您所選儲存引擎的預設值。如需 Db2 參數的詳細資訊,請參閱 中的 Db2 資料庫組態參數
檢視參數群組中的參數
資料庫管理員組態參數和登錄變數是在參數群組中設定。您可以使用 AWS Management Console、 AWS CLI或 來檢視特定 Db2 RDS 版本的資料庫管理員組態參數和登錄變數API。
檢視資料庫參數群組的參數值
-
登入 AWS Management Console 並在 開啟 Amazon RDS主控台https://console.aws.amazon.com/rds/
。 -
在導覽窗格中,選擇 Parameter groups (參數群組)。
資料庫參數群組隨即會出現在清單中。
-
選擇參數群組的名稱,以查看其參數清單。
您可以執行 來檢視 Db2 版本的資料庫管理員組態參數和登錄變數 describe-engine-default-parameters 命令。為 --db-parameter-group-family
選項指定下列其中一個值:
-
db2-ae-11.5
-
db2-se-11.5
例如,檢視 的參數 Db2 Standard Edition 11.5,執行下列命令:
aws rds describe-engine-default-parameters --db-parameter-group-family db2-se-11.5
此命令會產生類似下列範例的輸出:
{
"EngineDefaults": {
"Parameters": [
{
"ParameterName": "agent_stack_sz",
"ParameterValue": "1024",
"Description": "You can use this parameter to determine the amount of memory that is allocated by Db2 for each agent thread stack.",
"Source": "engine-default",
"ApplyType": "static",
"DataType": "integer",
"AllowedValues": "256-32768",
"IsModifiable": false
},
{
"ParameterName": "agentpri",
"ParameterValue": "-1",
"Description": "This parameter controls the priority given to all agents and to other database manager instance processes and threads by the operating system scheduler. This priority determines how CPU time is allocated to the database manager processes, agents, and threads relative to other processes and threads running on the machine.",
"Source": "engine-default",
"ApplyType": "static",
"DataType": "integer",
"AllowedValues": "1-99",
"IsModifiable": false
},
...
]
}
}
僅列出 的可修改參數 Db2 Standard Edition 11.5,執行下列命令:
用於 Linux, macOS、 或 Unix:
aws rds describe-engine-default-parameters \ --db-parameter-group-family db2-se-11.5 \ --query 'EngineDefaults.Parameters[?IsModifiable==`true`].{ParameterName:ParameterName, DefaultValue:ParameterValue}'
用於 Windows:
aws rds describe-engine-default-parameters ^ --db-parameter-group-family db2-se-11.5 ^ --query 'EngineDefaults.Parameters[?IsModifiable==`true`].{ParameterName:ParameterName, DefaultValue:ParameterValue}'
若要檢視資料庫參數群組的參數值,請使用 DescribeDBParameters
操作搭配下列必要參數。
-
DBParameterGroupName
使用 Db2 命令檢視所有參數
您可以使用 Db2 命令檢視資料庫管理員組態參數、資料庫組態參數和登錄檔變數的設定。
檢視設定
-
連線至您的 Db2 資料庫。在下列範例中,將
database_name
、master_username
和 取代master_password
為您的資訊。db2 "connect to
database_name
usermaster_username
usingmaster_password
" -
尋找支援的 Db2 版本。
db2 "select service_level, fixpack_num from table(sysproc.env_get_inst_info()) as instanceinfo"
-
檢視特定 Db2 版本的參數。
-
執行下列命令來檢視資料庫管理員組態參數:
db2 "select cast(substr(name,1,24) as varchar(24)) as name, case when value_flags = 'NONE' then '' else value_flags end flags, cast(substr(value,1,64) as varchar(64)) as current_value from sysibmadm.dbmcfg order by name asc with UR"
-
執行下列命令來檢視所有資料庫組態參數:
db2 "select cast(substr(name,1,24) as varchar(24)) as name, case when value_flags = 'NONE' then '' else value_flags end flags, cast(substr(value,1,64) as varchar(64)) as current_value from table(db_get_cfg(null)) order by name asc, member asc with UR"
-
執行下列命令來檢視目前設定的登錄變數:
db2 "select cast(substr(reg_var_name,1,50) as varchar(50)) as reg_var_name, cast(substr(reg_var_value,1,50) as varchar(50)) as reg_var_value, level from table(env_get_reg_variables(null)) order by reg_var_name,member with UR"
-
修改參數群組中的參數
您可以使用 AWS Management Console、 AWS CLI或 RDS 修改自訂參數群組中的資料庫管理員組態參數和登錄變數API。如需詳細資訊,請參閱RDSAmazon資料庫執行個體的資料庫參數群。
修改資料庫管理員組態參數和登錄檔變數
-
建立自訂參數群組。如需建立資料庫參數群組的詳細資訊,請參閱在 Amazon RDS Amazon 中創建數據庫參數組。
-
修改該自訂參數群組中的參數。如需修改參數群組的詳細資訊,請參閱 修改 Amazon RDS Amazon 數據庫參數組中的參數。
修改資料庫管理員組態參數和登錄檔變數
-
執行 來建立自訂參數群組 create-db-parameter-group 命令。
包含下列必要選項:
-
--db-parameter-group-name
– 您要建立之參數群組的名稱。 -
--db-parameter-group-family
– Db2 引擎版本和主要版本。有效值:db2-se-11.5
、db2-ae-11.5
。 -
--description
– 此參數群組的描述。
如需建立資料庫參數群組的詳細資訊,請參閱在 Amazon RDS Amazon 中創建數據庫參數組。
-
-
修改您透過執行 建立的自訂參數群組中的參數 modify-db-parameter-group 命令。
包含下列必要選項:
-
--db-parameter-group-name
– 您建立的參數群組名稱。 -
--parameters
– 參數更新的參數名稱、值和應用程式方法陣列。
如需修改參數群組的詳細資訊,請參閱 修改 Amazon RDS Amazon 數據庫參數組中的參數。
-
修改資料庫管理員組態參數和登錄檔變數
-
使用 建立自訂資料庫參數群組 CreateDBParameterGroup 操作。
包含下列必要參數:
-
DBParameterGroupName
-
DBParameterGroupFamily
-
Description
如需建立資料庫參數群組的詳細資訊,請參閱在 Amazon RDS Amazon 中創建數據庫參數組。
-
-
使用 修改您建立的自訂參數群組中的參數 ModifyDBParameterGroup 操作。
包含下列必要參數:
-
DBParameterGroupName
-
Parameters
如需修改參數群組的詳細資訊,請參閱 修改 Amazon RDS Amazon 數據庫參數組中的參數。
-
使用 Db2 命令修改資料庫組態參數
您可以使用 Db2 命令修改資料庫組態參數。
修改資料庫組態參數
-
連線至
rdsadmin
資料庫。在下列範例中,將master_username
和 取代master_password
為您的資訊。db2 "connect to rdsadmin user
master_username
usingmaster_password
" -
呼叫
rdsadmin.update_db_param
預存程序來變更資料庫組態參數。如需詳細資訊,請參閱rdsadmin.update_db_param。db2 "call rdsadmin.update_db_param( '
database_name
', 'parameter_to_modify
', 'changed_value
')"