初始化数据库,设置大小写不敏感

大小写不敏感解析

大小写敏感,适合于迁移Oracle数据库

大小写不敏感,适合于迁移MySQL和SQL Server数据库

PG模式只能设置大小写敏感

因为旧系统的数据库使用MySQL,所以进仓库数据库需要使用大小写不敏感

现有数据库分析

第1步:金仓数据库安装目录

切换至用户kingbase,并切换到当前金仓数据库的安装目录

[kingbase@xxx kdb]$ pwd
/home/kingbase/kdb

第2步:分析当前目录信息

[kingbase@xxx kdb]$ ls -1
ClientTools
data1
doc
install
Interface
KESRealPro
KingbaseHA
license.dat
logfile
Server
SupTools
Uninstall

data1 为当前数据库的数据目录,连接数据库之前需要启动数据库服务。

启动数据库时,需指定数据所在的文件夹。

如果没有启动服务,使用可视化工具连接数据库时会报错。

第3步:启动数据库

[kingbase@xxx kdb]$ ./Server/bin/sys_ctl -D data1/ -l logfile start
waiting for server to start.... done
server started

启动数据库服务,指定数据目录为data1。此时可视化工具可以成功连接

 

第4步:查看大小写敏感

[kingbase@xxx kdb]$ ./Server/bin/ksql -p 54321 -U system test
ksql (V8.0)
Type "help" for help.

test=# show enable_ci;
 enable_ci
-----------
 off
(1 row)

 连接test数据库后,发现默认大小写敏感。

注:没有命令可以直接修改大小写敏感,只有重新初始化DB。

(纯属个人理解,如果错了请帮忙指正)

初始化数据库(大小写不敏感)

第1步:停止当前服务

退出数据库连接,并停止当前数据库服务。

[kingbase@xxx kdb]$ ./Server/bin/ksql -p 54321 -U njtq test
ksql (V8.0)
Type "help" for help.

test=# exit

[kingbase@xxx kdb]$ ./Server/bin/sys_ctl -D data1/ -l logfile stop
waiting for server to shut down.... done
server stopped

第2步:初始化数据库

[kingbase@xxx kdb]$ ./Server/bin/initdb -U system -W -D data2/ -E UTF8 --enable-ci
The files belonging to this database system will be owned by user "kingbase".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".

The comparision of strings is case-insensitive.
Data page checksums are disabled.

Enter new superuser password:
Enter it again:

creating directory data2 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Shanghai
creating configuration files ... ok
Begin setup encrypt device
initializing the encrypt device ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
create security database ... ok
load security database ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing sys_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    ./Server/bin/sys_ctl -D data2/ -l logfile start

-U 用户名 -W 密码 -D 数据存放目录 -E 编码格式 --enable-ci 设置不敏感

初始化过程中会要求输入密码

初始化成功后,当前目录会创建文件夹data2

[kingbase@xxx kdb]$ ls -1
ClientTools
data1
data2
doc
install
Interface
KESRealPro
KingbaseHA
license.dat
logfile
Server
SupTools
Uninstall

第3步:启动化数据库(data2)

[kingbase@xxx kdb]$ ./Server/bin/sys_ctl -D data2/ -l logfile start
waiting for server to start.... done
server started

第4步:查看大小写敏感

[kingbase@xxx kdb]$ ./Server/bin/ksql -p 54321 -U system test
ksql (V8.0)
Type "help" for help.

test=# show enable_ci;
 enable_ci
-----------
 on
(1 row)

此时,大小写的值为on,表示不敏感。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值