摘要:
ALTER SESSION SET STATISTICS_LEVEL=ALL; 再运行SQL 或者在SQL语句中加HINT: SELECT /*+ GATHER_PLAN_STATISTICS */ .... SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR 阅读全文
posted @ 2020-04-01 13:28
屠魔的少年
阅读(117)
评论(0)
推荐(0)
摘要:
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('SQL_ID',SQL_CHILD_NUMBER)); 一般 SQL_CHILD_NUMBER 为0 。 正在运行的抓'SQL_ID',SQL_CHILD_NUMBER select a.sid,a.eve 阅读全文
posted @ 2020-04-01 13:27
屠魔的少年
阅读(80)
评论(0)
推荐(0)
摘要:
首先 EXPLAIN PLAN FOR SQL_TEXT; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY); 或者 select * from table(dbms_xplan.display(null,null,'advanced')); 显示高级执行计划 SELE 阅读全文
posted @ 2020-04-01 13:26
屠魔的少年
阅读(604)
评论(0)
推荐(0)
摘要:
利用AUTOTRACE查看执行计划 注意:AUTOTRACE 所查询的执行计划并不是真实的执行计划,是CBO预估的。从PLAN_TABLE出来的 SQL> set autot 用法: SET AUTOT[RACE] {OFF | ON | TRACE[ONLY]} [EXP[LAIN]] [STAT 阅读全文
posted @ 2020-04-01 13:25
屠魔的少年
阅读(99)
评论(0)
推荐(0)
摘要:
查看数据分布 select owner,count(*) from test group by owner order by 2 desc; 查看列的基数和选择性 统计信息不准确 (运行下面的SQL首先应该能检查该表的 segment_size 有多大,如果segment_size超过超过SGA的b 阅读全文
posted @ 2020-04-01 13:24
屠魔的少年
阅读(151)
评论(0)
推荐(0)
摘要:
select a.column_name, b.num_rows, a.num_nulls, a.num_distinct Cardinality, round(a.num_distinct / b.num_rows * 100, 2) selectivity, a.histogram, a.num 阅读全文
posted @ 2020-04-01 13:22
屠魔的少年
阅读(68)
评论(0)
推荐(0)
摘要:
查看统计信息的过期原因 select table_owner, table_name, inserts, updates, deletes, timestamp from all_tab_modifications where table_owner = 'SCOTT' and table_name 阅读全文
posted @ 2020-04-01 13:21
屠魔的少年
阅读(119)
评论(0)
推荐(0)
摘要:
BEGIN DBMS_STATS.GATHER_TABLE_STATS(ownname => 'TAB_OWNER', tabname => 'TAB_NAME', estimate_percent => 根据表大小设置, method_opt => 'for all columns size re 阅读全文
posted @ 2020-04-01 13:20
屠魔的少年
阅读(74)
评论(0)
推荐(0)
摘要:
将内存中的信息刷新到基表中,否则无法判断表是否过期 DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO; 阅读全文
posted @ 2020-04-01 13:18
屠魔的少年
阅读(74)
评论(0)
推荐(0)
摘要:
查看统计信息是否过期: DML 超过了 10% 都会过期 begin exec dbms_stats.flush_database_monitoring_info; end; / select owner, table_name name, object_type, stale_stats, las 阅读全文
posted @ 2020-04-01 13:17
屠魔的少年
阅读(185)
评论(0)
推荐(0)
摘要:
多个表关联或者有视图套视图,快速检查SQL语句中所有的表统计信息是否过期 现有如下SQL: select * from emp e,dept d where e.deptno=d.deptno; 先用explain plan for命令,在plan_table中生成SQL的执行计划: SQL> ex 阅读全文
posted @ 2020-04-01 13:16
屠魔的少年
阅读(139)
评论(0)
推荐(0)
摘要:
查看表采样率 SELECT owner, table_name, num_rows, sample_size, trunc(sample_size / num_rows * 100) estimate_percent FROM DBA_TAB_STATISTICS WHERE owner='SCOT 阅读全文
posted @ 2020-04-01 13:15
屠魔的少年
阅读(99)
评论(0)
推荐(0)
摘要:
查看收集统计信息的时间间隔 select owner, table_name, partition_name, subpartition_name, stats_update_time, stats_update_time - lag(stats_update_time, 1, null) over 阅读全文
posted @ 2020-04-01 13:14
屠魔的少年
阅读(192)
评论(0)
推荐(0)
摘要:
查询 TOP 50 INSERTS,UPDATES,DELETES 的表,也就是查看系统核心表 原理:一个系统的核心表会经常insert/update/delete。 跑下面脚本一定要在收集统计信息之前。 sys.mon_mods$ 记录还未FLUSH到mon_mods_all$的信息 (注意:该表 阅读全文
posted @ 2020-04-01 13:13
屠魔的少年
阅读(96)
评论(0)
推荐(0)
摘要:
自动收集执行计划 此只收集过期的统计信息。 可以放到linux crontab里,每隔一天运行一次。 DECLARE CURSOR STALE_TABLE IS SELECT OWNER, SEGMENT_NAME, CASE WHEN SIZE_GB < 0.5 THEN 30 WHEN SIZE 阅读全文
posted @ 2020-04-01 13:12
屠魔的少年
阅读(81)
评论(0)
推荐(0)
摘要:
单独对索引收集统计信息 BEGIN DBMS_STATS.GATHER_INDEX_STATS(ownname => 'SCOTT', indname => 'IDX_T_STATS_ID'); END; / 阅读全文
posted @ 2020-04-01 13:11
屠魔的少年
阅读(134)
评论(0)
推荐(0)
摘要:
查看必须创建索引的列 以下脚本依赖统计信息的准确性: select column_name, num_rows, Cardinality, selectivity, histogram, num_buckets, 'Consider create index on this column' as n 阅读全文
posted @ 2020-04-01 13:09
屠魔的少年
阅读(87)
评论(0)
推荐(0)
摘要:
1. 连接sqlplus 创建一个表 SQL> conn liang/chengce243 Connected. QL> create table T8 as select * from user_objects; Table created. SQL> select count(*) from T 阅读全文
posted @ 2020-04-01 12:11
屠魔的少年
阅读(501)
评论(0)
推荐(0)
摘要:
生成测试表 conn liang/chengce243 create table tab_01(id int,name VARCHAR2(128)); insert into tab_01 select OBJECT_ID,OBJECT_NAME from dba_objects where row 阅读全文
posted @ 2020-04-01 12:05
屠魔的少年
阅读(296)
评论(0)
推荐(0)
摘要:
生成测试表 conn liang/chengce243 create table tab_01(id int,name VARCHAR2(128)); insert into tab_01 select OBJECT_ID,OBJECT_NAME from dba_objects where row 阅读全文
posted @ 2020-04-01 12:02
屠魔的少年
阅读(222)
评论(0)
推荐(0)
摘要:
生成测试表 conn liang/chengce243 create table tab_01(id int,name VARCHAR2(128)); insert into tab_01 select OBJECT_ID,OBJECT_NAME from dba_objects where row 阅读全文
posted @ 2020-04-01 12:01
屠魔的少年
阅读(234)
评论(0)
推荐(0)
摘要:
生成测试表 conn liang/chengce243 create table tab_01(id int,name VARCHAR2(128)); insert into tab_01 select OBJECT_ID,OBJECT_NAME from dba_objects where row 阅读全文
posted @ 2020-04-01 11:59
屠魔的少年
阅读(245)
评论(0)
推荐(0)
摘要:
将Oracle数据库设置为归档模式 alter system set log_archive_dest_1="location=/data/oracle/arch" scope=both; shutdown immediate; startup mount; alter database archi 阅读全文
posted @ 2020-04-01 11:56
屠魔的少年
阅读(279)
评论(0)
推荐(0)
摘要:
修改用户家目录 usermod -d /usr/newfolder -u uid username 先查看用户uid id ftpuser uid=1013(ftpuser) gid=1018(ftpuser) groups=1018(ftpuser) usermod -d /ftpdata/ftp 阅读全文
posted @ 2020-04-01 11:49
屠魔的少年
阅读(573)
评论(0)
推荐(0)
摘要:
am_tally2模块用于某些数对系统进行失败的ssh登录尝试后锁定用户帐户。 此模块保留已尝试访问的计数和过多的失败尝试。 pam_tally2模块有两个部分,一个是pam_tally2.so,另一个是pam_tally2。 它是基于PAM模块上,并且可以被用于检查和调节计数器文件。 它可以显示用 阅读全文
posted @ 2020-04-01 11:48
屠魔的少年
阅读(4758)
评论(0)
推荐(0)
摘要:
1、使用passwd命令锁定与解锁账号 [root@rhel7 ~]# passwd -l testuser -l 锁定 Locking password for user testuser. passwd: Success [root@rhel7 ~]# passwd -S testuser 查看 阅读全文
posted @ 2020-04-01 11:46
屠魔的少年
阅读(763)
评论(0)
推荐(0)
Linux用户密码过期 FAILED to authorize user with PAM (Authentication token is no longer valid; new one req)
摘要:
执行crontab [root@FMPVZABBIX mysql_backup]# tail -f /var/log/cron Jul 16 14:12:01 FMPVZABBIX crond[13308]: (root) PAM ERROR (Authentication token is no 阅读全文
posted @ 2020-04-01 11:44
屠魔的少年
阅读(1688)
评论(0)
推荐(0)
摘要:
创建用户: useradd testuser echo "mypasswd" | passwd --stdin testuser 编辑文件 /etc/sudoers 或者使用 visudo 命令 (建议使用这种方法) 添加如下一行即可: testuser ALL=(ALL) ALL 阅读全文
posted @ 2020-04-01 11:43
屠魔的少年
阅读(1173)
评论(0)
推荐(0)
摘要:
/etc/hosts添加 192.168.56.85 testdb1 192.168.56.86 testdb2 生成互信文件,输入如下命令,一路回车就行 ssh-keygen cd ~/.ssh cat id_rsa.pub > authorized_keys chmod 600 * cd ~/ 阅读全文
posted @ 2020-04-01 11:42
屠魔的少年
阅读(516)
评论(0)
推荐(0)
摘要:
The tables below list the major and minor Red Hat Enterprise Linux updates, their release dates, and the kernel versions that shipped with them. Red H 阅读全文
posted @ 2020-04-01 11:40
屠魔的少年
阅读(3226)
评论(0)
推荐(0)
摘要:
[root@testdb ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE="Ethernet" BOOTPROTO="static" DEFROUTE="yes" NAME="ens33" UUID="a3b14c44-2134-4ab 阅读全文
posted @ 2020-04-01 11:39
屠魔的少年
阅读(224)
评论(0)
推荐(0)
摘要:
列出系统所有服务 systemctl list-units --all --type=service 阅读全文
posted @ 2020-04-01 11:38
屠魔的少年
阅读(3739)
评论(0)
推荐(0)
摘要:
今天发现一台服务器的home空间满了,于是要清空没用的文件,当我删除文件后,发现可用空间没有变化os:centos4.7现象:发现当前磁盘空间使用情况:[root@ticketb ~]# df -hFilesystem Size Used Avail Use% Mounted on/dev/sda1 阅读全文
posted @ 2020-04-01 11:37
屠魔的少年
阅读(257)
评论(0)
推荐(0)
摘要:
1. 添加了磁盘后查看,没有刷新出来 [root@node /]# fdisk -l Disk /dev/sda: 17.2 GB, 17179869184 bytes 255 heads, 63 sectors/track, 2088 cylinders Units = cylinders of 阅读全文
posted @ 2020-04-01 11:35
屠魔的少年
阅读(599)
评论(0)
推荐(0)
摘要:
du -ah --max-depth=1 / 阅读全文
posted @ 2020-04-01 11:34
屠魔的少年
阅读(1464)
评论(0)
推荐(0)
摘要:
[root@mysqlmaster mysql]# bash system_summary # Aspersa System Summary Report ############################## Date | 2015-03-12 07:55:19 UTC (local TZ: 阅读全文
posted @ 2020-04-01 11:32
屠魔的少年
阅读(222)
评论(0)
推荐(0)
摘要:
10201_database_linux_x86_64.cpio.gz 文件,解压方法如下: 1. gunzip 10201_database_linux_x86_64.cpio.gz 得到10201_database_linux_x86_64.cpio文件 2. cpio -idmv <10201 阅读全文
posted @ 2020-04-01 11:31
屠魔的少年
阅读(754)
评论(0)
推荐(0)
摘要:
永久修改主机名 CentOS 7.X之前修改文件: /etc/sysconfig/network 临时修改主机名: hostname testdb CentOS 7.X 修改文件: /etc/hostname CentOS 7.X 也可以用此命令: hostnamectl set-hostname 阅读全文
posted @ 2020-04-01 11:30
屠魔的少年
阅读(237)
评论(0)
推荐(0)
摘要:
lscpu # 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理CPU个数 cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l # 查看每个 阅读全文
posted @ 2020-04-01 10:56
屠魔的少年
阅读(389)
评论(0)
推荐(0)
摘要:
改成阿里云源1、备份mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/ CentOS 5wget -O /etc/ 阅读全文
posted @ 2020-04-01 10:47
屠魔的少年
阅读(176)
评论(0)
推荐(0)
浙公网安备 33010602011771号