摘要: 不知道翻译成零宽断言是否合适,但是看到一些中文资料是这么叫的。 反正就是(?=...)、(?!...)、(?<=...)、(?<!...) 这4种形式。 根据查询的方向,可以分为 look ahead 和look behind 根据匹配的类型,可以分为positive 和negative 以上两两组 阅读全文
posted @ 2020-05-08 14:16 张不正 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 主要是利用hive提供的transform语句。 1.编写python脚本,python脚本数据如下(参考:https://dwgeek.com/hive-udf-using-python-use-python-script-into-hive-example.html/): #!/usr/bin/ 阅读全文
posted @ 2020-04-09 15:59 张不正 阅读(3863) 评论(0) 推荐(1) 编辑
摘要: select t1.inst_id,t1.sid,t1.serial#,t1.username,t2.spid 系统进程id from gv$session t1 full join gv$process t2 on t2.addr=t1.paddr and t2.inst_id=t1.inst_i 阅读全文
posted @ 2020-03-29 17:00 张不正 阅读(1635) 评论(0) 推荐(0) 编辑
摘要: 一般这种情况发生在,session被kill掉,但是客户端与服务端的连接还在,这种情况process不会被PMON进程回收。这种情况需要完全断掉客户端的进程或者在服务端kill掉操作系统级的进程。 查询这些process的语句为: select * from gv$process where (in 阅读全文
posted @ 2020-03-29 16:54 张不正 阅读(665) 评论(0) 推荐(0) 编辑
摘要: RAC突然告警,客户端尝试连接时会报:ORA-12520: TNS:listener could not find available handler for requested type of server 错误。 现整理解决过程,以便于后续遇到此问题时快速处理。 1. 登入服务器,使用sqlpl 阅读全文
posted @ 2020-03-29 00:59 张不正 阅读(2710) 评论(0) 推荐(0) 编辑
摘要: 经参考网上的资料,该问题是 Oracle 11.2.0.4.0 版本的一个Bug。 参考:https://stackoverflow.com/questions/27347982/selecting-from-dba-tablespace-usage-metrics-causes-ora-1000 阅读全文
posted @ 2020-03-28 23:53 张不正 阅读(397) 评论(0) 推荐(0) 编辑
摘要: 原理,通过kill连接对应的进程来kill所有session。执行命令如下: ps -ef | grep LOCAL=NO | grep -v grep | awk '{print $2}' |xargs kill -9 阅读全文
posted @ 2020-03-27 17:46 张不正 阅读(543) 评论(0) 推荐(0) 编辑
摘要: 主要使用pyhive包。 使用linux中的普通账号,venv环境。python版本 3.6.4。 ldap认证需要sasl包,在安装sasl包的时候因为机器中没有g++编译器,导致无法安装。因为我使用的普通账号,没法给服务器安装g++编译器,解决的方案是在另一台机器中安装sasl,将安装完成后生成 阅读全文
posted @ 2020-03-27 16:29 张不正 阅读(1223) 评论(0) 推荐(0) 编辑
摘要: 试题如上图。暴力破解的思想就是生成所有结果集,验证结果集中每个结果针对10道题是否正确。当10道题均正确表示找到了正确答案。 代码如下: 1 #!/bin/bash 2 # -*- coding: utf-8 -*- 3 4 import itertools,time 5 from collecti 阅读全文
posted @ 2020-03-21 21:52 张不正 阅读(457) 评论(0) 推荐(0) 编辑
摘要: #!/bin/python# -*- coding: utf-8 -*-from hdfs.ext.kerberos import KerberosClientimport requests,csv,timeclient=KerberosClient('http://x.x.x.x:50070',m 阅读全文
posted @ 2020-03-13 16:42 张不正 阅读(3885) 评论(0) 推荐(0) 编辑
摘要: 环境: fiddler 搭建本地代理,代理地址为 127.0.0.1:8888 python 版本:3.6.7 requests 版本:2.21.0 1. 执行的测试python脚本为: requests.get('http://localhost:5000/test',proxies={'http 阅读全文
posted @ 2020-03-01 20:49 张不正 阅读(1037) 评论(0) 推荐(0) 编辑
摘要: 因为月份和年之间是12进制的,以下lambda表达式可以一步计算出某年月变化n个月后的年月,代码如下: (lambda yearmonth,deltamonth:yearmonth//100*100+(deltamonth+yearmonth%100-1)//12*100+(deltamonth+y 阅读全文
posted @ 2020-02-29 00:42 张不正 阅读(517) 评论(0) 推荐(0) 编辑
摘要: 当存储格式为parquet 且 字段类型为 timestamp 且 数据用hive执行sql写入。 这样的字段在使用impala读取时会少8小时。建议存储为sequence格式或者将字段类型设置为string。 参考: https://www.cloudera.com/documentation/e 阅读全文
posted @ 2020-02-27 16:21 张不正 阅读(2206) 评论(0) 推荐(0) 编辑
摘要: 若向hive表添加字段,通常会使用下面这种语句 alter table default.testparquet add columns(c8 string); 但是对于分区表来说, 1. 若新建的分区在添加字段之前,新加的字段不会被加到已有分区中。 2. 若新建的分区在添加字段之后,新的分区会继承表 阅读全文
posted @ 2019-12-24 15:29 张不正 阅读(2600) 评论(0) 推荐(0) 编辑
摘要: pyinstaller看起来并不会将动态链接库自动打包,所以我们需要告诉pyinstaller要打包哪些动态链接库,步骤如下(假设python文件名为 oracletest.py): 1. 使用pyinstaller -F oracletest.py 打包后会生成一个oracletest.spec文 阅读全文
posted @ 2019-12-11 09:51 张不正 阅读(1835) 评论(0) 推荐(0) 编辑
摘要: 解决的方案是利用pyinstaller的hook特性,步骤如下: 1.在项目目录新建hooks目录,目录中新建hooks-scrapy.py 文件,文件内容如下: from PyInstaller.utils.hooks import collect_submodules, collect_data 阅读全文
posted @ 2019-12-11 09:27 张不正 阅读(3298) 评论(0) 推荐(1) 编辑
摘要: 1. logger是分层级的,root是所有logger的祖先。 2. root这个logger在执行logging.warning() 等一系列方法和basicConfig()的时候才会被初始化handler, 否则该logger是没有handler的。 3.使用类似logging.getLogg 阅读全文
posted @ 2019-11-29 00:01 张不正 阅读(330) 评论(0) 推荐(0) 编辑
摘要: select t1.tablespace_name,curr_b/1024/1024/1024,max_b/1024/1024/1024,case when max_b<>0 then curr_b/max_b end from(select tablespace_name,sum(case whe 阅读全文
posted @ 2019-11-15 12:47 张不正 阅读(308) 评论(0) 推荐(0) 编辑
摘要: set hive.execution.engine=spark;set hive.exec.parallel=true;set hive.exec.parallel.thread.number=8;set hive.exec.compress.intermediate=true;set hive.i 阅读全文
posted @ 2019-11-11 11:01 张不正 阅读(2983) 评论(0) 推荐(0) 编辑
摘要: 目前找到的是以下方式,但是这种方式在表的数据量比较大的时候效率会比较慢。 select to_char(scn_to_timestamp(max(ora_rowscn)),'YYYY-MM-DD HH24:MI:SS') from user1.testtable 以上。 阅读全文
posted @ 2019-10-14 15:57 张不正 阅读(9930) 评论(0) 推荐(0) 编辑
返回顶部