select count(distinct a.user_name),count(distinct a.invest_id) from base_data_login_info a where a.str_day <= '20160304' and a.str_day >= '20160301' and a.channel_idin (select channel_rlat from tb_user_channel a, tb_channel_info b where a.channel_id = b.channel_id and a.user_id = 5002) and a.platform = a.platform
看一下这个sql返回多少行,结果秒杀,瞬间就出结果了
1 2 3 4 5 6
select count(*) from base_data_login_info@agent a where a.str_day <= '20160304' and a.str_day >= '20160301' and a.channel_idin (select channel_rlat from tb_user_channel a, tb_channel_info b where a.channel_id = b.channel_id and a.user_id = 5002) and a.platform = a.platform
45122行 之后单独跑
1 2 3 4 5 6
select count(distinct a.user_name),count( a.invest_id) from base_data_login_info a where a.str_day <= '20160304' and a.str_day >= '20160301' and a.channel_idin (select channel_rlat from tb_user_channel a, tb_channel_info b where a.channel_id = b.channel_id and a.user_id = 5002) and a.platform = a.platform
或
1 2 3 4 5 6
select count( a.user_name),count(distinct a.invest_id) from base_data_login_info a where a.str_day <= '20160304' and a.str_day >= '20160301' and a.channel_idin (select channel_rlat from tb_user_channel a, tb_channel_info b where a.channel_id = b.channel_id and a.user_id = 5002) and a.platform = a.platform
select a.city, a.agent_id, a.username, a.real_name, phone, zgy_name, login_count, user_count, count(distinct b.invest_id) user_invested, sum(b.order_amount / 100) invest_amount from (select a.city, a.agent_id, a.username, a.real_name, -- 业主姓名 a.phone, -- 业主手机号 d.real_name zgy_name, -- 所属专管员 count(distinct case when c.str_day <= '20160821' then c.login_name end) login_count, count(distinct case when c.str_day <= '20160821' then decode(c.status, 1, c.invest_id, null) end) user_count from (select agent_id, city, username, real_name, phone from agent.TB_AGENT_INFO where agent_id in (SELECT agent_id FROM (SELECT distinct * FROM TB_CHANNEL_INFO t START WITH t.CHANNEL_ID in (select CHANNEL_ID from TB_USER_CHANNEL where USER_ID = 596) CONNECT BY PRIOR t.CHANNEL_ID = t.PARENT_CHANNEL_ID) WHERE agent_id IS NOT NULL)) a left join oss_user_station e on a.agent_id = e.agent_id and e.user_type = 0 left join tb_user_zgy d on e.username = d.username left join act.tb_user_agent_relat c on a.agent_id = c.agent_id group by a.city, a.username, a.real_name, a.phone, d.real_name, a.agent_id) a left join (select invest_id, order_amount, agent_id, str_day from agent.base_data_invest_info where str_day >= '20150801'and str_day<='20160821') b on a.agent_id = b.agent_id group by a.city, a.agent_id, a.username, a.real_name, a.phone, a.zgy_name, a.login_count, a.user_count 这个查询可以看成两部分,第一部分一堆小表关联的a和唯一的一个大表再做关联
select (sysdate-a.logon_time)*24*60 minutes, a.username, a.BLOCKING_INSTANCE, a.BLOCKING_SESSION, a.program, a.machine, a.osuser, a.status, a.sid, a.serial#, a.event, a.p1, a.p2, a.p3, a.sql_id, a.sql_child_number, b.sql_text from v$sessiona, v$sql b where a.sql_address = b.address and a.sql_hash_value = b.hash_value and a.sql_child_number=b.child_number and a.event not in ('SQL*Net message from client','Space Manager: slave idle wait') -- and a.username like '%USERNAME%' order by 1 desc;
在查执行计划
1
Select * from table(dbms_xplan.display_cursor('91prd0dh0bs8d',0,'ALL'));
# Site title:Fan() subtitle: description: author:adba'sblog language:zh-CN timezone:Asia/Shanghai
# URL ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' url:http://yoursite.com root:/Fandb.github.io permalink::year/:month/:day/:title/ permalink_defaults:
# Writing new_post_name::title.md# File name of new posts default_layout:post titlecase:false# Transform title into titlecase external_link:true# Open external links in new tab filename_case:0 render_drafts:false post_asset_folder:false relative_link:false future:true highlight: enable:true line_number:true auto_detect:true tab_replace:
# Home page setting # path: Root path for your blogs index page. (default = '') # per_page: Posts displayed per page. (0 = disable pagination) # order_by: Posts order. (Order by date descending by default) index_generator: path:'' per_page:6 order_by:-date
# Category & Tag default_category:uncategorized category_map: tag_map:
# Date / Time format ## Hexo uses Moment.js to parse and display date ## You can customize the date format as defined in ## http://momentjs.com/docs/#/displaying/format/ date_format:YYYY-MM-DD time_format:HH:mm:ss
# Pagination ## Set per_page to 0 to disable pagination per_page:10 pagination_dir:page
$ hexo g #完整命令为hexo generate,用于生成静态文件 $ hexo s #完整命令为hexo server,用于启动服务器,主要用来本地预览 $ hexo d #完整命令为hexo deploy,用于将本地文件发布到github上 $ hexo n #完整命令为hexo new,用于新建一篇文章
[root@test2 ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE <none> <none> abdf7c1b7a63 2 weeks ago 1.266 GB <none> <none> 3690474eb5b4 11 months ago 0 B
修改tag
1 2 3 4 5
[root@test2 ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE <none> <none> abdf7c1b7a63 2 weeks ago 1.266 GB <none> <none> 3690474eb5b4 11 months ago 0 B [root@test2 ~]# docker tag abdf7c1b7a63 docker.io/percona/pmm-server:1.2.0
2.docker容器无法启动 no such file or directory statusCode=404
vi /etc/grub.conf # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-LogVol00 # initrd /initrd-[generic-]version.img #boot=/dev/sda default=1 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (3.10.107-1.el6.elrepo.x86_64) root (hd0,0) kernel /vmlinuz-3.10.107-1.el6.elrepo.x86_64 ro root=/dev/mapper/VolGroup-LogVol00 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=VolGroup/LogVol00 rd_NO_DM rhgb quiet numa=off elevator=deadline initrd /initramfs-3.10.107-1.el6.elrepo.x86_64.img title CentOS (2.6.32-358.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/VolGroup-LogVol00 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=VolGroup/LogVol00 rd_NO_DM rhgb quiet numa=off elevator=deadline initrd /initramfs-2.6.32-358.el6.x86_64.img 现在title CentOS (3.10.107-1.el6.elrepo.x86_64)在 0 号位置,所以将 default=1改为default=0 重启os
This container does not run, it simply exists to make sure you retain all PMM data when you upgrade to a newer pmm-server image. Do not remove or re-create this container, unless you intend to wipe out all PMM data and start over.
[root@iZbp1igpeohje7z5ugkdr9Z log]# pmm-admin check-network PMM Network Status
Server Address | xx.xx.xx.xx Client Address | xx.xx.xx.xx
* System Time NTP Server (0.pool.ntp.org) | 2017-09-28 15:44:39 +0800 CST PMM Server | 2017-09-28 07:44:38 +0000 GMT PMM Client | 2017-09-28 15:44:39 +0800 CST PMM Server Time Drift | OK PMM Client Time Drift | OK PMM Client to PMM Server Time Drift | OK
* Connection: Client --> Server -------------------- ------- SERVER SERVICE STATUS -------------------- ------- Consul API OK Prometheus API OK Query Analytics API OK
[root@test2 ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 69195dca404b percona/pmm-server:1.5.2"/opt/entrypoint.sh"28 hours ago Exited (128) 6 minutes ago 0.0.0.0:80->80/tcp, 443/tcp pmm-server 094c63bd911b percona/pmm-server:1.5.2"/bin/true"28 hours ago pmm-data [root@test2 ~]# docker start 69195dca404b Error response from daemon: Cannot start container 69195dca404b: Error getting container 69195dca404bc607fa12a9cd6436a9786a71dcf226a0e4c1d6bf0b9879a14f03 from driver devicemapper: Error mounting '/dev/mapper/docker-253:0-6947028-69195dca404bc607fa12a9cd6436a9786a71dcf226a0e4c1d6bf0b9879a14f03' on '/var/lib/docker/devicemapper/mnt/69195dca404bc607fa12a9cd6436a9786a71dcf226a0e4c1d6bf0b9879a14f03': device or resource busy Error: failed to start containers: [69195dca404b]
umount /var/lib/docker/devicemapper/mnt/69195dca404bc607fa12a9cd6436a9786a71dcf226a0e4c1d6bf0b9879a14f03 [root@test2 ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 69195dca404b percona/pmm-server:1.5.2"/opt/entrypoint.sh"28 hours ago Exited (128) 8 minutes ago 0.0.0.0:80->80/tcp, 443/tcp pmm-server 094c63bd911b percona/pmm-server:1.5.2"/bin/true"28 hours ago pmm-data [root@test2 ~]# docker start 69195dca404b 69195dca404b [root@test2 ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 69195dca404b percona/pmm-server:1.5.2"/opt/entrypoint.sh"28 hours ago Up 5 seconds 0.0.0.0:80->80/tcp, 443/tcp pmm-server 094c63bd911b percona/pmm-server:1.5.2"/bin/true"28 hours ago pmm-data
If any slave is dead at this stage, terminating the script for safety reasons(If any slave is dead, MHA can not recover the dead slave, of course). 开启监控时任何slave发生故障都会导致监控退出,MHA并不能修复从库