分类 Database 下的文章

Oracle正则表达式

正则表达式简介

正则表达式,又称规则表达式。(英语:Regular Expression,在代码中常简写为regex、regexp或RE),计算机科学的一个概念。正则表通常被用来检索、替换那些符合某个模式(规则)的文本。

正则表达式是对字符串(包括普通字符(例如,a 到 z 之间的字母)和特殊字符(称为“元字符”))操作的一种逻辑公式,就是用事先定义好的一些特定字符、及这些特定字符的组合,组成一个“规则字符串”,这个“规则字符串”用来表达对字符串的一种过滤逻辑。正则表达式是一种文本模式,模式描述在搜索文本时要匹配的一个或多个字符串。

正则表达式具体描述

QQ图片20170922221302.png

- 阅读剩余部分 -

Mysqld_multi Stop Bug

最近在做mysqld_multi管理多实例的时候,发现stop不了节点
这是什么原因呢?
多实例相关配置如下:

[mysqld_multi]  
mysqld     = /usr/local/mysql/bin/mysqld_safe  
mysqladmin = /usr/local/mysql/bin/mysqladmin
log = /usr/local/mysql/mysqld_multi.log
user       = root
password   = shunzi

[mysqld3306]  
socket     = /data/mysql3306/tmp/mysql3306.sock
port       = 3306  
user       = mysql

pid-file   = /data/mysql3306/mysql3306.pid  
datadir    = /data/mysql3306/data
tmpdir     = /data/mysql3306/tmp

[mysqld3307]  
socket     = /data/mysql3307/tmp/mysql3307.sock
port       = 3307  
user       = mysql

pid-file   = /data/mysql3307/mysql3307.pid  
datadir    = /data/mysql3307/data
tmpdir     = /data/mysql3307/tmp

- 阅读剩余部分 -

EXP-00091:Exporting questionable statistics

今天在oracle上做exp导出的时候报exp-00091;
查了下是服务端跟客户端的字符集不一致导致的

服务端字符集查询SQL:

select userenv('language') from dual;

执行过程如下:

E:\data>exp userid=mig/mig tables=T_CUSTOMER,T_PHONE,T_CUSTOMER_PHONE
 file=e:\data\pub.dump  log=e:\data\pub.log buffer=40960000 grants=n indexes=n t
riggers=n constraints=n

Export: Release 11.2.0.4.0 - Production on Tue Aug 29 15:50:24 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in UTF8 character set and UTF8 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
Note: grants on tables/views/sequences/roles will not be exported
Note: indexes on tables will not be exported
Note: constraints on tables will not be exported

About to export specified tables via Conventional Path ...
. . exporting table                   T_CUSTOMER    1320672 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table                      T_PHONE    1869331 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table             T_CUSTOMER_PHONE    1869331 rows exported
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.

E:\data>echo $NLS_LANG
$NLS_LANG

E:\data>echo %NLS_LANG%
AMERICAN_AMERICA.UTF8

E:\data>set NLS_LANG=AMERICAN_AMERICA.AL32UTF8

E:\data>exp userid=mig/mig tables=T_CUSTOMER,T_PHONE,T_CUSTOMER_PHONE
 file=e:\data\pub.dump  log=e:\data\pub.log buffer=40960000 grants=n indexes=n t
riggers=n constraints=n

Export: Release 11.2.0.4.0 - Production on Tue Aug 29 15:55:25 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in AL32UTF8 character set and UTF8 NCHAR character set
Note: grants on tables/views/sequences/roles will not be exported
Note: indexes on tables will not be exported
Note: constraints on tables will not be exported

About to export specified tables via Conventional Path ...
. . exporting table                   T_CUSTOMER    1320672 rows exported
. . exporting table                      T_PHONE    1869331 rows exported
. . exporting table             T_CUSTOMER_PHONE    1869331 rows exported
Export terminated successfully without warnings.

E:\data>

最后提一下,utf8跟al32utf8字符集是不一样的,好吧,mark一下!

记一次Redis集群搭建

最近同事需要搭建一套redis集群做测试,完了给我一台机器,让我搭建一下。本着学习的目的,果断搞起。
期间踩了好多坑,特此记录一下,过程如下:
OS版本是:Centos 6.6 x86_64
redis版本是:redis-3.2.4

安装依赖包

yum -y install gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel gcc-c++ automake autoconf

- 阅读剩余部分 -

[Warning] Aborted connection 162746 to db: (Got an error reading communication packets)

这几天发现VPS上的mysql数据库告警日志里报了很多如下错误:

2017-04-10 05:37:49 14557 [Warning] Aborted connection 162746 to db: 'bigbiglife' user: 'bigbiglife' host: 'localhost' (Got an error reading communication packets)

虽然不是大问题,但是对于处女座的我,不能忍!

我这个问题可能是PHP连接MySQL后超过wait_timeout设置的时间限制被kill后造成的。
详情可以看https://dev.mysql.com/doc/refman/5.7/en/communication-errors.html

- 阅读剩余部分 -

Title - Artist
0:00