大小写敏感控制参数。可以通过SF_GET_CASE_SENSITIVE_FLAG()函数查询。
SQL> select SF_GET_CASE_SENSITIVE_FLAG(); 行号 SF_GET_CASE_SENSITIVE_FLAG() ---------- ---------------------------- 1 10表示不敏感,系统会将大写字母全部转为小写再比较;1表示敏感,小写的标识符应用""括起,否则被系统自动转换为大写。
简单来讲,CASE_SENSITIVE=0时,双引号也无法起到大小写敏感作用;CASE_SENSITIVE=1时,使用双引号来保证严格大小写敏感,和Oracle行为一致。
当:CASE_SENSITIVE=1时。
表名大小写测试(无引号)
create table t_case_test ( id int, name varchar(20) ); select * from t_case_test;--成功 select * from T_CASE_TEST;--成功 select * from "t_case_test";--报错 select * from "T_CASE_TEST";--成功实际测试,只有"t_case_test"测试报错。符合CASE_SENSITIVE=1时的预期。
SQL> create table t_case_test ( id int, name varchar(20) );2 3 4 操作已执行 已用时间: 66.490(毫秒). 执行号:3406. SQL> select * from t_case_test; 未选定行 已用时间: 5.404(毫秒). 执行号:3407. SQL> select * from T_CASE_TEST; 未选定行 已用时间: 3.601(毫秒). 执行号:3408. SQL> select * from "t_case_test"; select * from "t_case_test"; 第1 行附近出现错误[-2106]:无效的表或视图名[t_case_test]. 已用时间: 2.035(毫秒). 执行号:0. SQL> select * from "T_CASE_TEST"; 未选定行 已用时间: 3.604(毫秒). 执行号:3409. SQL>表名大小写测试(带引号)
drop table t_case_test; create table "t_case_test" ( id int, name varchar(20) ); select * from t_case_test;--报错 select * from T_CASE_TEST;--报错 select * from "t_case_test";--成功 select * from "T_CASE_TEST";--报错实际测试:如果大小写敏感,当建表使用双引号时,查询也必须带有双引号且要完全一致。
SQL> create table "t_case_test" ( id int, name varchar(20) );2 3 4 操作已执行 已用时间: 9.916(毫秒). 执行号:3419. SQL> select * from t_case_test; select * from t_case_test; 第1 行附近出现错误[-2106]:无效的表或视图名[T_CASE_TEST]. 已用时间: 1.957(毫秒). 执行号:0. SQL> select * from T_CASE_TEST; select * from T_CASE_TEST; 第1 行附近出现错误[-2106]:无效的表或视图名[T_CASE_TEST]. 已用时间: 1.763(毫秒). 执行号:0. SQL> select * from "t_case_test"; 未选定行 已用时间: 4.052(毫秒). 执行号:3420. SQL> select * from "T_CASE_TEST"; select * from "T_CASE_TEST"; 第1 行附近出现错误[-2106]:无效的表或视图名[T_CASE_TEST]. 已用时间: 2.054(毫秒). 执行号:0.字段名大小写测试(无引号)
drop table "t_case_test"; create table t_case_test ( id int, userName varchar(20) ); select id, username from t_case_test;--成功 select id, USERNAME from t_case_test;--成功 select id, userName from t_case_test;--成功实际测试:
SQL> create table t_case_test ( id int, userName varchar(20) );2 3 4 操作已执行 已用时间: 14.031(毫秒). 执行号:3412. SQL> select id, username from t_case_test; 未选定行 已用时间: 3.763(毫秒). 执行号:3413. SQL> select id, USERNAME from t_case_test; 未选定行 已用时间: 3.719(毫秒). 执行号:3414. SQL> select id, userName from t_case_test; 未选定行 已用时间: 2.613(毫秒). 执行号:3415.字段名(带双引号)
drop table t_case_test; create table t_case_test ( id int, "userName" varchar(20), "UserAge" int ); select id, userName from t_case_test;--报错 select id, "userName" from t_case_test;--成功 select id, USERNAME from t_case_test;--报错 select id, "USERNAME" from t_case_test;--报错实际测试:
SQL> create table t_case_test ( id int, "userName" varchar(20), "UserAge" int );2 3 4 5 操作已执行 已用时间: 9.033(毫秒). 执行号:3422. SQL> select id, userName from t_case_test;--报错 select id, userName from t_case_test;--报错 第1 行附近出现错误[-2111]:无效的列名[USERNAME]. 已用时间: 3.372(毫秒). 执行号:0. SQL> select id, "userName" from t_case_test;--成功 未选定行 已用时间: 3.279(毫秒). 执行号:3423. SQL> select id, USERNAME from t_case_test;--报错 select id, USERNAME from t_case_test;--报错 第1 行附近出现错误[-2111]:无效的列名[USERNAME]. 已用时间: 1.674(毫秒). 执行号:0. SQL> select id, "USERNAME" from t_case_test;--报错 select id, "USERNAME" from t_case_test;--报错 第1 行附近出现错误[-2111]:无效的列名[USERNAME]. 已用时间: 2.057(毫秒). 执行号:0.新初始化CASE_SENSITIVE=0的库,重复以上测试。
#dmdba用户执行 dminit PATH=/dm/datatest PAGE_SIZE=16 SYSDBA_PWD=DMdba_123 SYSAUDITOR_PWD=DMauditor_123 SYSSSO_PWD=DMsysso_123 CASE_SENSITIVE=0 PORT_NUM=5336 DB_NAME=DMBMG #root用户执行 ./dm_service_installer.sh -t dmserver -dm_ini /dm/datatest/DMBMG/dm.ini -p DMBMG #执行完启动数据库 [dmdba@localhost bin]$ ./DmServiceDMBMG start Starting DmServiceDMBMG: [ OK ] #进库查询大小写敏感性 disql SYSDBA/DMdba_123@127.0.0.1:5336 SQL> select SF_GET_CASE_SENSITIVE_FLAG(); 行号 SF_GET_CASE_SENSITIVE_FLAG() ---------- ---------------------------- 1 0 已用时间: 2.835(毫秒). 执行号:67601.表名大小写测试(无引号)
drop table t_case_test; create table t_case_test ( id int, name varchar(20) ); select * from t_case_test;--成功 select * from T_CASE_TEST;--成功 select * from "t_case_test";--成功 select * from "T_CASE_TEST";--成功实际测试均可以成功,"t_case_test"也能查到
SQL> create table t_case_test ( id int, name varchar(20) );2 3 4 操作已执行 已用时间: 413.344(毫秒). 执行号:67602. SQL> select * from t_case_test; 未选定行 已用时间: 134.961(毫秒). 执行号:67603. SQL> select * from T_CASE_TEST; 未选定行 已用时间: 14.708(毫秒). 执行号:67604. SQL> select * from "t_case_test"; 未选定行 已用时间: 4.638(毫秒). 执行号:67605. SQL> select * from "T_CASE_TEST"; 未选定行 已用时间: 14.039(毫秒). 执行号:67606. SQL>表名大小写测试(带引号)
drop table t_case_test; create table "t_case_test" ( id int, name varchar(20) ); select * from t_case_test; select * from T_CASE_TEST; select * from "t_case_test"; select * from "T_CASE_TEST";实际测试也是均可以成功
SQL> create table "t_case_test" ( id int, name varchar(20) );2 3 4 操作已执行 已用时间: 24.325(毫秒). 执行号:67608. SQL> select * from t_case_test; 未选定行 已用时间: 55.193(毫秒). 执行号:67609. SQL> select * from T_CASE_TEST; 未选定行 已用时间: 13.178(毫秒). 执行号:67610. SQL> select * from "t_case_test"; 未选定行 已用时间: 3.944(毫秒). 执行号:67611. SQL> select * from "T_CASE_TEST"; 未选定行 已用时间: 11.733(毫秒). 执行号:67612.字段名大小写测试(无引号)
drop table t_case_test; create table t_case_test ( id int, userName varchar(20) ); select id, username from t_case_test; select id, USERNAME from t_case_test; select id, userName from t_case_test;实际测试,均可以成功
SQL> create table t_case_test ( id int, userName varchar(20) );2 3 4 操作已执行 已用时间: 18.164(毫秒). 执行号:67614. SQL> select id, username from t_case_test; 未选定行 已用时间: 13.156(毫秒). 执行号:67615. SQL> select id, USERNAME from t_case_test; 未选定行 已用时间: 13.663(毫秒). 执行号:67616. SQL> select id, userName from t_case_test; 未选定行 已用时间: 12.227(毫秒). 执行号:67617.字段名(带双引号)
drop table t_case_test; create table t_case_test ( id int, "userName" varchar(20), "UserAge" int ); select id, userName from t_case_test; select id, "userName" from t_case_test; select id, USERNAME from t_case_test; select id, "USERNAME" from t_case_test;实际测试,均可以成功
SQL> create table t_case_test ( id int, "userName" varchar(20), "UserAge" int );2 3 4 5 操作已执行 已用时间: 19.962(毫秒). 执行号:67619. SQL> select id, userName from t_case_test; 未选定行 已用时间: 23.667(毫秒). 执行号:67620. SQL> select id, "userName" from t_case_test; 未选定行 已用时间: 14.698(毫秒). 执行号:67621. SQL> select id, USERNAME from t_case_test; 未选定行 已用时间: 3.654(毫秒). 执行号:67622. SQL> select id, "USERNAME" from t_case_test; 未选定行 已用时间: 15.573(毫秒). 执行号:67623.数据库测完后,可以先停库。
[dmdba@localhost bin]$ ./DmServiceDMBMG stop Stopping DmServiceDMBMG: [ OK ]注销服务
[root@localhost root]# ./dm_service_uninstaller.sh -n DmServiceDMBMG 是否删除服务(DmServiceDMBMG)?(Y/y:是 N/n:否): Y Removed /etc/systemd/system/multi-user.target.wants/DmServiceDMBMG.service. 删除服务文件(/usr/lib/systemd/system/DmServiceDMBMG.service)完成 删除服务(DmServiceDMBMG)完成删除数据库目录,节省空间资源。
[dmdba@localhost dm]$ rm -rf datatest社区地址
https://eco.dameng.com