更新时间:2024-03-07 GMT+08:00
分享

以Oracle为源设置GaussDB数据库GUC参数

Oracle为源库迁移到GaussDB时,可以设置目标库GaussDB的GUC参数,来增强Oracle迁移到GaussDB的兼容性,迁移涉及的GUC参数和影响范围可参见表表1

GaussDB数据库提供了许多运行参数,配置这些参数可以影响数据库系统的行为。在修改这些参数时请确保用户理解了这些参数对数据库的影响,否则可能会导致无法预料的结果。可参考云数据库GaussDB GUC参数使用说明。

表1 Oracle迁移至GaussDB设置的GUC参数

兼容A行为配置项

兼容性配置项

兼容性配置项名字

支持的数据库

是否建议打开

参数详情参考

behavior_compat_options

display_leading_zero

浮点数显示配置项-小数点前0显示

主备版/分布式

主备版:参数详情

分布式:参数详情

end_month_calculate

add_months函数计算逻辑配置项

主备版/分布式

bind_procedure_searchpath

未指定模式名的存储过程中的数据库对象的搜索路径配置项。

主备版/分布式

correct_to_number

控制to_number()结果兼容性的配置项

主备版/分布式

unbind_divide_bound

控制对整数除法的结果进行范围校验

主备版/分布式

convert_string_digit_to_numeric

字符串转换为numeric配置项

主备版/分布式

return_null_string

控制函数lpad()和rpad()结果为空字符串''的显示配置项。

主备版/分布式

merge_update_multi

控制在使用MERGE INTO ... WHEN MATCHED THEN UPDATE和INSERT ... ON DUPLICATE KEY UPDATE,当目标表中一条目标数据与多条源数据冲突时UPDATE行为。

主备版/分布式

plstmt_implicit_savepoint

控制存储过程中更新语句的执行是否拥有独立的子事务。

主备版/分布式

hide_tailing_zero

numeric显示配置项。

主备版/分布式

rownum_type_compat

控制ROWNUM的类型。

主备版

aformat_null_test

控制rowtype类型判空逻辑。

主备版/分布式

aformat_regexp_match

控制正则表达式函数的匹配行为。

主备版/分布式

compat_cursor

控制隐式游标状态兼容行为。

主备版

proc_outparam_override

控制存储过程出参的重载行为。

主备版/分布式

proc_implicit_for_loop_variable

控制存储过程中FOR_LOOP查询语句行为。

主备版

allow_procedure_compile_check

控制制存储过程中select语句和open cursor语句的编译检查。

主备版

plsql_security_definer

创建存储过程时默认为定义者权限。

主备版/分布式

plpgsql_dependency

创建函数,存储过程,包支持未定义的对象,可以新建成功。

主备版

plsql_compile_check_options

plsql_expression_check

开启plsql_expression_check参数,需要同时开启plpgsql_dependency参数。

503.1主备版本

a_format_version

10C

数据库平台兼容性行为配置项

主备版/分布式

a_format_dev_version

S1

数据库平台迭代小版本兼容性行为配置项。

503.0主备版/分布式

S2

数据库平台迭代小版本兼容性行为配置项。

503.1主备版/分布式

S3

数据库平台迭代小版本兼容性行为配置项。

503.2主备版/分布式

sql_beta_feature

a_style_coerce

影响decode函数

主备版/分布式

GaussDB 3.1企业版使用s1;GaussDB 3.2企业版使用s2;GaussDB 3.3企业版使用s3;版本号对应参考自建GaussDB内核版本号与UGO界面显示GaussDB版本号对应关系

参数设置:

操作步骤

  • 主备版
  1. 连接上GaussDB数据库,切换至GaussDB的安装用户下。

    su - omm

    "omm"为示例用户,切换时以实际安装用户为准。

  2. 执行以下命令,设置参数

    gs_guc reload -Z coordinator -Z datanode -N all -I all -c "behavior_compat_options='bind_procedure_searchpath,truncate_numeric_tail_zero,plsql_security_definer,proc_outparam_override,aformat_null_test,rownum_type_compat,allow_procedure_compile_check,proc_implicit_for_loop_variable,plstmt_implicit_savepoint,end_month_calculate,disable_rewrite_nesttable,plpgsql_dependency,display_leading_zero,correct_to_number,unbind_divide_bound,convert_string_digit_to_numeric,hide_tailing_zero,return_null_string,aformat_regexp_match,compat_cursor,enable_funcname_with_argsname,tableof_elem_constraints,merge_update_multi'";

    gs_guc reload -Z coordinator -Z datanode -N all -I all -c "plsql_compile_check_options='plsql_expression_check'";

    GaussDB 3.1企业版以及以后版本生效。

    gs_guc reload -Z coordinator -Z datanode -N all -I all -c "a_format_version='10c'";

    gs_guc reload -Z coordinator -Z datanode -N all -I all -c "a_format_dev_version='s4'";

    GaussDB 3.1企业版使用s1,GaussDB 3.2企业版使用s2,GaussDB 3.1企业版使用s3,GaussDB 8.0企业版使用s4。版本号对应参考自建GaussDB内核版本号与UGO界面显示GaussDB版本号对应关系

  • 分布式
  1. 连接上GaussDB数据库,切换至GaussDB的安装用户下。

    su - omm

    "omm"为示例用户,切换时以实际安装用户为准。

  2. 执行以下命令设置参数。

    gs_guc reload -Z coordinator -Z datanode -N all -I all -c "behavior_compat_options='bind_procedure_searchpath,truncate_numeric_tail_zero,plsql_security_definer,proc_outparam_override,aformat_null_test,plstmt_implicit_savepoint,end_month_calculate,disable_rewrite_nesttable,display_leading_zero,correct_to_number,unbind_divide_bound,convert_string_digit_to_numeric,hide_tailing_zero,return_null_string,aformat_regexp_match,enable_funcname_with_argsname,tableof_elem_constraints,merge_update_multi'";

    gs_guc reload -Z coordinator -Z datanode -N all -I all -c "a_format_version='10c'";

    gs_guc reload -Z coordinator -Z datanode -N all -I all -c "a_format_dev_version='s4'";

    503.0版本使用s1,503.1版本使用s2,503.2版本使用s3,505.0版本使用s4。版本号对应参考自建GaussDB内核版本号与UGO界面显示GaussDB版本号对应关系

分享:

GaussDB数据库设置GUC参数对迁移的影响 所有常见问题

more