Skip to content

Instantly share code, notes, and snippets.

@zyjibmcn
zyjibmcn / db2-temporary-tablespace
Created September 30, 2017 00:03
db2 临时表空间不足的问题
最近从生产库dump一个几十万的表,import到本地库时,排序查询会报以下错误:
A temporary table could not be created because there is no available system temporary table space that has a compatible page size.. SQLCODE=-1585, SQLSTATE=54048, DRIVER=3.63.123
解决办法:
db2 "create bufferpool ibmdefault8k IMMEDIATE SIZE 5000 PAGESIZE 16K"
db2 "CREATE TEMPORARY TABLESPACE mytmptbs PAGESIZE 16K MANAGED BY SYSTEM USING ('/home/db2inst1/tmp_tbs1') EXTENTSIZE 32 PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT16K OVERHEAD 24.10 TRANSFERRATE 0.90 DROPPED TABLE RECOVERY OFF"
@zyjibmcn
zyjibmcn / gist:a6b480415101a9392e6e8b241f0f2941
Last active December 26, 2016 03:13
mysql 安装配置问题
1. root登录mysql出错
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
由于需要注意5.7.* 之后的版本,需要找到初始密码,登录后修改密码:
```
$ sudo grep 'temporary password' /var/log/mysqld.log
$ mysql -uroot -p
@zyjibmcn
zyjibmcn / generate-ssh-key-cert
Created November 16, 2016 02:59
generate-ssh-key-cert
openssl req -x509 -newkey rsa:1024 -keyout logstash.key -out logstash.crt -days 365 -nodes
@zyjibmcn
zyjibmcn / gist:f4b75e0b07d138a69240e5cbc9f1f696
Last active September 21, 2016 03:37
Create CA Signed SSL Certificates
Creating an SSL Certificate and Certificate Key
```
bash$ openssl req -x509 -new -out $HOST.crt -keyout $HOST.key -days 365
```
Creating an SSL Certificate Signing Request
```
bash$ openssl req -new -key $HOST.key -out $HOST.csr
```
@zyjibmcn
zyjibmcn / spark-dev
Last active August 28, 2016 14:51
Spark Beginners' Guide
1. download eclipse IDE for scala from http://scala-ide.org/
2. install sbt from http://www.scala-sbt.org to build scala
@zyjibmcn
zyjibmcn / gist:c05f05908d00e5539277ae550085a748
Created August 14, 2016 14:43
db2 grant user with permission
GRANT DBADM WITH DATAACCESS WITH ACCESSCTRL ON DATABASE TO USER new_user;
@zyjibmcn
zyjibmcn / gist:eff46d3587032b6d4977301e60527204
Created August 14, 2016 08:38
Change Schema Names in DB2
1. Issue "db2move <dbname> export". This will create several files, including a db2move.lst file, in your current directory.
2. Change the existing schema name with new schema name with ":1,$ s/<SEARCH>/<REPLACE>/g" in db2move.lst.
3. Issue "db2move <dbname> import" (to import the data into the tables.)
@zyjibmcn
zyjibmcn / git-create-empty-branch.md
Created July 22, 2016 06:28
git-create-empty-branch
git checkout --orphan newbranch
git rm -rf .

touch .gitignore
git commit -m "create an empty newbranch"
git push -u origin newbranch
@zyjibmcn
zyjibmcn / curl-with-authentication.md
Last active July 21, 2016 06:37
curl - 访问protected APIs

=== 适用于基于cookie的SSO保护的resources

访问一个auth-basic页面,保存cookies到文件

curl --insecure --user "username:password" --cookie-jar api_token.txt https://hostname/auth-basic

使用已获取的cookie (ltpa_token2)访问API

@zyjibmcn
zyjibmcn / sed-usage.md
Last active June 2, 2016 05:22
linux sed - remove multiple lines comment block

=== remove single line comment

   eg: <!-- -->
   
   sed -i '/<!--.*-->/ d' file

===