]]>mysql启用查询日志http://www.aygfsteel.com/anchor110/articles/422425.html一败涂?/dc:creator>一败涂?/author>Sun, 25 Jan 2015 07:21:00 GMThttp://www.aygfsteel.com/anchor110/articles/422425.htmlhttp://www.aygfsteel.com/anchor110/comments/422425.htmlhttp://www.aygfsteel.com/anchor110/articles/422425.html#Feedback0http://www.aygfsteel.com/anchor110/comments/commentRss/422425.htmlhttp://www.aygfsteel.com/anchor110/services/trackbacks/422425.html1、查看mysql server的命令行启动参数Q显C如下:
"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" "--defaults-file=C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" "-uroot" "-p" 2、修Ҏ定配|文件C:\ProgramData\MySQL\MySQL Server 5.6\my.iniQ在[[mysqld]下添加如下配|:
]]>MySQL错误Another MySQL daemon already running with the same unix socket. http://www.aygfsteel.com/anchor110/articles/417875.html一败涂?/dc:creator>一败涂?/author>Fri, 12 Sep 2014 08:53:00 GMThttp://www.aygfsteel.com/anchor110/articles/417875.htmlhttp://www.aygfsteel.com/anchor110/comments/417875.htmlhttp://www.aygfsteel.com/anchor110/articles/417875.html#Feedback0http://www.aygfsteel.com/anchor110/comments/commentRss/417875.htmlhttp://www.aygfsteel.com/anchor110/services/trackbacks/417875.html原因Q?br />mysql异常停止?br /> 解决办法Q?br />把mysql.sock的修改,如:
mysql> desc video_info_streamtypes; +------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(255) | NO | MUL | NULL | | | type | varchar(255) | NO | | NULL | | | timelength | double | NO | | NULL | | | size | double | NO | | NULL | | | videoId | int(11) | NO | MUL | NULL | | +------------+--------------+------+-----+---------+----------------+
其中video_info_streamtypes的videoId为外键关联video_info表的id?br />现需要删除video_info_streamtypes中找不到对应video_info表中数据的记录,语句如下Q?br /> delete from video_info_streamtypes where not exists (select * from video_info where video_info.id=video_info_streamtypes.videoId )
]]>mysql大数据量下修改表l构的方?/title>http://www.aygfsteel.com/anchor110/articles/361152.html一败涂?/dc:creator>一败涂?/author>Thu, 13 Oct 2011 07:17:00 GMThttp://www.aygfsteel.com/anchor110/articles/361152.htmlhttp://www.aygfsteel.com/anchor110/comments/361152.htmlhttp://www.aygfsteel.com/anchor110/articles/361152.html#Feedback1http://www.aygfsteel.com/anchor110/comments/commentRss/361152.htmlhttp://www.aygfsteel.com/anchor110/services/trackbacks/361152.html请勿使用以下方式Q?br />
alter table video_names add column type VARCHAR(255) NOT NULL, add index(type)
原因是: l过实际试Q表数据量是800多万条,q行上述语句Ӟ几个时执行不完?br />
正确方式Q?br />1、创Z个新表tmp_names 2、执行insert into tmp_names(****) select ***** from video_name; 3、删除video_names 4、重命名tmp_name为video_names;语句为rename table tmp_names to video_names;
]]>如何取出oracle中某个表的最后修Ҏ?/title>http://www.aygfsteel.com/anchor110/articles/343249.html一败涂?/dc:creator>一败涂?/author>Thu, 20 Jan 2011 01:58:00 GMThttp://www.aygfsteel.com/anchor110/articles/343249.htmlhttp://www.aygfsteel.com/anchor110/comments/343249.htmlhttp://www.aygfsteel.com/anchor110/articles/343249.html#Feedback1http://www.aygfsteel.com/anchor110/comments/commentRss/343249.htmlhttp://www.aygfsteel.com/anchor110/services/trackbacks/343249.htmlselect last_ddl_time
from user_objects
where object_name='TABLE_NAME'
and object_type='table';
]]>mysql修改密码的方?/title>http://www.aygfsteel.com/anchor110/articles/338546.html一败涂?/dc:creator>一败涂?/author>Sat, 20 Nov 2010 06:33:00 GMThttp://www.aygfsteel.com/anchor110/articles/338546.htmlhttp://www.aygfsteel.com/anchor110/comments/338546.htmlhttp://www.aygfsteel.com/anchor110/articles/338546.html#Feedback0http://www.aygfsteel.com/anchor110/comments/commentRss/338546.htmlhttp://www.aygfsteel.com/anchor110/services/trackbacks/338546.htmlmysql> update mysql.user set password=PASSWORD('123456') where User='root';
mysql> flush privileges;
授权: GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY '123456';
create or replace procedure viva_session_proc is
begin
DECLARE
inactiveCount NUMBER;
activeCount NUMBER;
begin
select count(*) into inactiveCount from v$session where status='INACTIVE';
select count(*) into activeCount from v$session where status='ACTIVE';
insert into pmsuser.viva_session(inactive,active)
values(inactiveCount,activeCount);
end;
end viva_session_proc;
2、表I间数据的取得,代码Q?br />
create or replace procedure viva_tablespace_proc is
begin
insert into pmsuser.viva_tablespace(tablespace_name,total_mb,used_mb,used_pct)
select
total.tablespace_name,
round(total.MB, 2) as Total_MB,round(total.MB - free.MB, 2) as Used_MB,
round((1- free.MB / total.MB) *100, 2) ||'%' as Used_Pct
from (select tablespace_name, sum(bytes) /1024/1024 as MB
from dba_free_space
group by tablespace_name) free,
(select tablespace_name, sum(bytes) /1024/1024 as MB
from dba_data_files
group by tablespace_name) total
where free.tablespace_name = total.tablespace_name;
]]>Oracle性能监控脚本(注:转蝲于http://www.vcmy.com/article/2006-3-21/194-1.htm)http://www.aygfsteel.com/anchor110/articles/336909.html一败涂?/dc:creator>一败涂?/author>Wed, 03 Nov 2010 03:22:00 GMThttp://www.aygfsteel.com/anchor110/articles/336909.htmlhttp://www.aygfsteel.com/anchor110/comments/336909.htmlhttp://www.aygfsteel.com/anchor110/articles/336909.html#Feedback0http://www.aygfsteel.com/anchor110/comments/commentRss/336909.htmlhttp://www.aygfsteel.com/anchor110/services/trackbacks/336909.html1. 监控事例的等?
select event,sum(decode(wait_Time,0,0,1)) "Prev",
sum(decode(wait_Time,0,1,0)) "Curr",count(*) "Tot"
from v$session_Wait
group by event order by 4;
2. 回滚D늚争用情况
select name, waits, gets, waits/gets "Ratio"
from v$rollstat a, v$rollname b
where a.usn = b.usn;
3. 监控表空间的 I/O 比例
select df.tablespace_name name,df.file_name "file",f.phyrds pyr,
f.phyblkrd pbr,f.phywrts pyw, f.phyblkwrt pbw
from v$filestat f, dba_data_files df
where f.file# = df.file_id
order by df.tablespace_name;
4. 监控文gpȝ?I/O 比例
select substr(a.file#,1,2) "#", substr(a.name,1,30) "Name",
a.status, a.bytes, b.phyrds, b.phywrts
from v$datafile a, v$filestat b
where a.file# = b.file#;
5.在某个用户下找所有的索引
select user_indexes.table_name, user_indexes.index_name,uniqueness, column_name
from user_ind_columns, user_indexes
where user_ind_columns.index_name = user_indexes.index_name
and user_ind_columns.table_name = user_indexes.table_name
order by user_indexes.table_type, user_indexes.table_name,
user_indexes.index_name, column_position;
6. 监控 SGA 的命中率
select a.value + b.value "logical_reads", c.value "phys_reads",
round(100 * ((a.value+b.value)-c.value) / (a.value+b.value)) "BUFFER HIT RATIO"
from v$sysstat a, v$sysstat b, v$sysstat c
where a.statistic# = 38 and b.statistic# = 39
and c.statistic# = 40;
7. 监控 SGA 中字典缓冲区的命中率
select parameter, gets,Getmisses , getmisses/(gets+getmisses)*100 "miss ratio",
(1-(sum(getmisses)/ (sum(gets)+sum(getmisses))))*100 "Hit ratio"
from v$rowcache
where gets+getmisses <>0
group by parameter, gets, getmisses;
select sum(pinhits-reloads)/sum(pins) "hit radio",sum(reloads)/sum(pins) "reload percent"
from v$librarycache;
9. 昄所有数据库对象的类别和大小
select count(name) num_instances ,type ,sum(source_size) source_size ,
sum(parsed_size) parsed_size ,sum(code_size) code_size ,sum(error_size) error_size,
sum(source_size) +sum(parsed_size) +sum(code_size) +sum(error_size) size_required
from dba_object_size
group by type order by 2;
10. 监控 SGA 中重做日志缓存区的命中率Q应该小?%
SELECT name, gets, misses, immediate_gets, immediate_misses,
Decode(gets,0,0,misses/gets*100) ratio1,
Decode(immediate_gets+immediate_misses,0,0,
immediate_misses/(immediate_gets+immediate_misses)*100) ratio2
FROM v$latch WHERE name IN ('redo allocation', 'redo copy');
11. 监控内存和硬盘的排序比率Q最好它小?.10Q增?sort_area_size
SELECT name, value FROM v$sysstat WHERE name IN ('sorts (memory)', 'sorts (disk)');
12. 监控当前数据库谁在运行什么SQL语句
SELECT osuser, username, sql_text from v$session a, v$sqltext b
where a.sql_address =b.address order by address, piece;
13. 监控字典~冲?
SELECT (SUM(PINS - RELOADS)) / SUM(PINS) "LIB CACHE" FROM V$LIBRARYCACHE;
SELECT (SUM(GETS - GETMISSES - USAGE - FIXED)) / SUM(GETS) "ROW CACHE" FROM V$ROWCACHE;
SELECT SUM(PINS) "EXECUTIONS", SUM(RELOADS) "CACHE MISSES WHILE EXECUTING" FROM V$LIBRARYCACHE;
后者除以前?此比率小?%,接近0%为好?
SELECT SUM(GETS) "DICTIONARY GETS",SUM(GETMISSES) "DICTIONARY CACHE GET MISSES"
FROM V$ROWCACHE
14. 找ORACLE字符?
select * from sys.props$ where name='NLS_CHARACTERSET';
15. 监控 MTS
select busy/(busy+idle) "shared servers busy" from v$dispatcher;
此值大?.5Ӟ参数需加大
select sum(wait)/sum(totalq) "dispatcher waits" from v$queue where type='dispatcher';
select count(*) from v$dispatcher;
select servers_highwater from v$mts;
servers_highwater接近mts_max_serversӞ参数需加大
16. 片E度
select tablespace_name,count(tablespace_name) from dba_free_space group by tablespace_name
having count(tablespace_name)>10;
alter tablespace name coalesce;
alter table name deallocate unused;
create or replace view ts_blocks_v as
select tablespace_name,block_id,bytes,blocks,'free space' segment_name from dba_free_space
union all
select tablespace_name,block_id,bytes,blocks,segment_name from dba_extents;
select * from ts_blocks_v;
select tablespace_name,sum(bytes),max(bytes),count(block_id) from dba_free_space
group by tablespace_name;
查看片E度高的?
SELECT segment_name table_name , COUNT(*) extents
FROM dba_segments WHERE owner NOT IN ('SYS', 'SYSTEM') GROUP BY segment_name
HAVING COUNT(*) = (SELECT MAX( COUNT(*) ) FROM dba_segments GROUP BY segment_name);
17. 表、烦引的存储情况?
select segment_name,sum(bytes) space,count(*) ext_quan from dba_extents where
tablespace_name='&tablespace_name' and segment_type='TABLE' group by tablespace_name,segment_name;
select segment_name,count(*) from dba_extents where segment_type='INDEX' and owner='&owner'
group by segment_name;
]]>Oracle查询表空间用情况(l典)Q注Q{载于http://www.examda.com/oracle/zixun/hangye/20090802/093845216.htmlQ?/title>http://www.aygfsteel.com/anchor110/articles/336815.html一败涂?/dc:creator>一败涂?/author>Tue, 02 Nov 2010 08:12:00 GMThttp://www.aygfsteel.com/anchor110/articles/336815.htmlhttp://www.aygfsteel.com/anchor110/comments/336815.htmlhttp://www.aygfsteel.com/anchor110/articles/336815.html#Feedback0http://www.aygfsteel.com/anchor110/comments/commentRss/336815.htmlhttp://www.aygfsteel.com/anchor110/services/trackbacks/336815.html--查询表空间用情?/strong>
SELECT UPPER(F.TABLESPACE_NAME) "表空间名",
D.TOT_GROOTTE_MB "表空间大?M)",
D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已用空?M)",
TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,2),'990.99') || '%' "使用?,
F.TOTAL_BYTES "I闲I间(M)",
F.MAX_BYTES "最大块(M)"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,
ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES
FROM SYS.DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F,
(SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY 1 --查询表空间的free space
select tablespace_name,
count(*) as extends,
round(sum(bytes) / 1024 / 1024, 2) as MB,
sum(blocks) as blocks
from dba_free_space
group by tablespace_name; --查询表空间的d?/strong>
select tablespace_name, sum(bytes) / 1024 / 1024 as MB
from dba_data_files
group by tablespace_name; --查询表空间用率
select total.tablespace_name,
round(total.MB, 2) as Total_MB,
round(total.MB - free.MB, 2) as Used_MB,
round((1 - free.MB / total.MB) * 100, 2) || '%' as Used_Pct
from (select tablespace_name, sum(bytes) / 1024 / 1024 as MB
from dba_free_space
group by tablespace_name) free,
(select tablespace_name, sum(bytes) / 1024 / 1024 as MB
from dba_data_files
group by tablespace_name) total
where free.tablespace_name = total.tablespace_name;
]]>Oracle错误QORA-01033(注:转蝲于http://www.cnblogs.com/zaspring/archive/2009/05/20/1472740.html)http://www.aygfsteel.com/anchor110/articles/334639.html一败涂?/dc:creator>一败涂?/author>Tue, 12 Oct 2010 06:09:00 GMThttp://www.aygfsteel.com/anchor110/articles/334639.htmlhttp://www.aygfsteel.com/anchor110/comments/334639.htmlhttp://www.aygfsteel.com/anchor110/articles/334639.html#Feedback0http://www.aygfsteel.com/anchor110/comments/commentRss/334639.htmlhttp://www.aygfsteel.com/anchor110/services/trackbacks/334639.html错误~码QORA-01033: ORACLE initialization or shutdown in progress
SQL*Plus: Release 9.2.0.1.0 - Production on 星期?5?20 22:07:45 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
q接?
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production