﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-毒菇求Buy-随笔分类-SQL</title><link>http://www.cnitblog.com/alsan/category/120.html</link><description>Not now, when?</description><language>zh-cn</language><lastBuildDate>Wed, 05 Oct 2011 10:07:38 GMT</lastBuildDate><pubDate>Wed, 05 Oct 2011 10:07:38 GMT</pubDate><ttl>60</ttl><item><title>MySQLDriverCS中文乱码问题</title><link>http://www.cnitblog.com/alsan/archive/2006/05/09/10249.html</link><dc:creator>毒菇求Buy</dc:creator><author>毒菇求Buy</author><pubDate>Tue, 09 May 2006 04:58:00 GMT</pubDate><guid>http://www.cnitblog.com/alsan/archive/2006/05/09/10249.html</guid><wfw:comment>http://www.cnitblog.com/alsan/comments/10249.html</wfw:comment><comments>http://www.cnitblog.com/alsan/archive/2006/05/09/10249.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/alsan/comments/commentRss/10249.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/alsan/services/trackbacks/10249.html</trackback:ping><description><![CDATA[
		<p style="FONT-SIZE: 12px; FONT-FAMILY: Verdana">MySql数据库已经完全改为UTF8了，在phpMyAdmin及MySql-Front中都可以正确显示及插入。但在C#中读取数据时就出现了乱码。<br /><br />在查看了网上的文章后，说加了"set names utf8"或"set name gb2312"就可以，但因为我的表中有varchar及longtext字段，结果发现当用"set names utf8"时，varchar的字段乱码。相反，用"set names gb2312"时longtext字段内容乱码。<br /><br />搞了半天，无任何突破。改用MySQL Connector .net，什么都没有加，一切正常了。<br /><br />初步看了一下MySQLDriverCS的源码，看来是读取char及varchar字段时只是简单的读取内容，而没有按encoding设置，所以返回的数据会乱码。</p>
<img src ="http://www.cnitblog.com/alsan/aggbug/10249.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/alsan/" target="_blank">毒菇求Buy</a> 2006-05-09 12:58 <a href="http://www.cnitblog.com/alsan/archive/2006/05/09/10249.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Sql Server数据库被置疑后解决方法</title><link>http://www.cnitblog.com/alsan/archive/2006/02/18/6686.html</link><dc:creator>毒菇求Buy</dc:creator><author>毒菇求Buy</author><pubDate>Fri, 17 Feb 2006 22:06:00 GMT</pubDate><guid>http://www.cnitblog.com/alsan/archive/2006/02/18/6686.html</guid><wfw:comment>http://www.cnitblog.com/alsan/comments/6686.html</wfw:comment><comments>http://www.cnitblog.com/alsan/archive/2006/02/18/6686.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/alsan/comments/commentRss/6686.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/alsan/services/trackbacks/6686.html</trackback:ping><description><![CDATA[<P style="FONT-SIZE: 12px; FONT-FAMILY: Verdana">现象：数据库Log日志太大了，shrink不掉。于是想把数据库文件卸下来，删除log，再附加上。附加失败。<BR>提示错误：<BR>服务器: 消息 1813，级别 16，状态 2，行 1<BR>未能打开新数据库 'metadb'。CREATE DATABASE 将终止。<BR>设备激活错误。物理文件名 'd:\metadb.LDF' 可能有误。<BR>环境:MSSQL SERVER 2000 企业版</P>
<P style="FONT-SIZE: 12px; FONT-FAMILY: Verdana">解决过程：<BR>1.建一个新库newdb<BR>2.停掉数据库。删除新库的log文件,讲metadb.mdf覆盖newdb.mdf。<BR>3.启动数据库服务器。数据库newdb的状态为“置疑”。<BR>4. 允许对系统目录直接修改<BR>use master<BR>go<BR>sp_configure 'allow updates',1<BR>go <BR>reconfigure with override<BR>go<BR>update sysdatabases set status=-32768 where dbid=DB_ID('newdb')<BR>5．重建log<BR>dbcc rebuild_log('newdb','C:\Program Files\Microsoft SQL Server\MSSQL\Data\newdb_log.ldf')<BR>6.dbcc检查<BR>dbcc checkdb('newdb')<BR>7.设置数据库为正常状态<BR>sp_dboption 'newdb','dbo use only','false'<BR>8 不允许对系统目录直接修改<BR>sp_configure 'allow updates',0<BR>go <BR>reconfigure with override<BR>go</P><img src ="http://www.cnitblog.com/alsan/aggbug/6686.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/alsan/" target="_blank">毒菇求Buy</a> 2006-02-18 06:06 <a href="http://www.cnitblog.com/alsan/archive/2006/02/18/6686.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MSSQL数据库日志清理</title><link>http://www.cnitblog.com/alsan/archive/2006/02/18/6685.html</link><dc:creator>毒菇求Buy</dc:creator><author>毒菇求Buy</author><pubDate>Fri, 17 Feb 2006 21:59:00 GMT</pubDate><guid>http://www.cnitblog.com/alsan/archive/2006/02/18/6685.html</guid><wfw:comment>http://www.cnitblog.com/alsan/comments/6685.html</wfw:comment><comments>http://www.cnitblog.com/alsan/archive/2006/02/18/6685.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/alsan/comments/commentRss/6685.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/alsan/services/trackbacks/6685.html</trackback:ping><description><![CDATA[<P style="FONT-SIZE: 12px; FONT-FAMILY: Verdana">日志文件满而造成SQL数据库无法写入文件时，可用两种方法：&nbsp;<BR>一种方法：清空日志。&nbsp;<BR>1．打开查询分析器，输入命令&nbsp;<BR>DUMP&nbsp;TRANSACTION&nbsp;数据库名&nbsp;WITH&nbsp;NO_LOG&nbsp;<BR>2.再打开企业管理器--右键你要压缩的数据库--所有任务--收缩数据库--收缩文件--选择日志文件--在收缩方式里选择收缩至XXM,这里会给出一个允许收缩到的最小M数,直接输入这个数,确定就可以了。&nbsp;<BR><BR>另一种方法有一定的风险性，因为SQL&nbsp;SERVER的日志文件不是即时写入数据库主文件的，如处理不当，会造成数据的损失。&nbsp;<BR>1、备份数据库(以防万一)<BR>2、分离数据库&nbsp;企业管理器－＞服务器－＞数据库－＞右键－＞分离数据库&nbsp;<BR>3、删除LOG文件&nbsp;<BR>4、附加数据库&nbsp;企业管理器－＞服务器－＞右键－＞附加数据库&nbsp;<BR>此法生成新的LOG，大小只有500多K。&nbsp;<BR><BR>注意：建议使用第一种方法。&nbsp;<BR><BR>如果以后,不想要它变大。&nbsp;<BR>SQL2000下使用：&nbsp;<BR>在数据库上点右键-&gt;属性-&gt;选项-&gt;故障恢复-模型-选择-简单模型。&nbsp;<BR>或用SQL语句：&nbsp;<BR>alter&nbsp;database&nbsp;数据库名&nbsp;set&nbsp;recovery&nbsp;simple&nbsp;<BR><BR>另外，Truncate&nbsp;log&nbsp;on&nbsp;checkpoint(此选项用于SQL7.0，SQL&nbsp;2000中即故障恢复模型选择为简单模型)当执行CHECKPOINT&nbsp;命令时如果事务日志文件超过其大小的70%&nbsp;则将其内容清除在开发数据库时时常将此选项设置为True&nbsp;Auto&nbsp;shrink定期对数据库进行检查当数据库文件或日志文件的未用空间超过其大小的25%时，系统将会自动缩减文件使其未用空间等于25%&nbsp;当文件大小没有超过其建立时的初始大小时不会缩减文件缩减后的文件也必须大于或等于其初始大小对事务日志文件的缩减只有在对其作备份时或将Truncate&nbsp;log&nbsp;on&nbsp;checkpoint&nbsp;选项设为True&nbsp;时才能进行。&nbsp;<BR><BR>注意：一般立成建立的数据库默认属性已设好，但碰到意外情况使数据库属性被更改，请用户清空日志后，检查数据库的以上属性，以防事务日志再次充满</P><img src ="http://www.cnitblog.com/alsan/aggbug/6685.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/alsan/" target="_blank">毒菇求Buy</a> 2006-02-18 05:59 <a href="http://www.cnitblog.com/alsan/archive/2006/02/18/6685.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我的my.cnf</title><link>http://www.cnitblog.com/alsan/archive/2005/06/12/354.html</link><dc:creator>毒菇求Buy</dc:creator><author>毒菇求Buy</author><pubDate>Sun, 12 Jun 2005 07:45:00 GMT</pubDate><guid>http://www.cnitblog.com/alsan/archive/2005/06/12/354.html</guid><wfw:comment>http://www.cnitblog.com/alsan/comments/354.html</wfw:comment><comments>http://www.cnitblog.com/alsan/archive/2005/06/12/354.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/alsan/comments/commentRss/354.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/alsan/services/trackbacks/354.html</trackback:ping><description><![CDATA[<P style="FONT-SIZE: 12px; FONT-FAMILY: Verdana">[mysqld]<BR>datadir=/var/lib/mysql<BR>socket=/var/lib/mysql/mysql.sock<BR>default-character-set=utf8<BR>thread_stack=128<BR><BR>[mysql.server]<BR>user=mysql<BR><BR>[safe_mysqld]<BR>pid-file=/var/lib/mysql/mysql.pid<BR></P><img src ="http://www.cnitblog.com/alsan/aggbug/354.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/alsan/" target="_blank">毒菇求Buy</a> 2005-06-12 15:45 <a href="http://www.cnitblog.com/alsan/archive/2005/06/12/354.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>FC3安装MySQL 5</title><link>http://www.cnitblog.com/alsan/archive/2005/06/12/352.html</link><dc:creator>毒菇求Buy</dc:creator><author>毒菇求Buy</author><pubDate>Sun, 12 Jun 2005 07:44:00 GMT</pubDate><guid>http://www.cnitblog.com/alsan/archive/2005/06/12/352.html</guid><wfw:comment>http://www.cnitblog.com/alsan/comments/352.html</wfw:comment><comments>http://www.cnitblog.com/alsan/archive/2005/06/12/352.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/alsan/comments/commentRss/352.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/alsan/services/trackbacks/352.html</trackback:ping><description><![CDATA[<P style="FONT-SIZE: 12px; FONT-FAMILY: Verdana">FC3自带的MySQL版本太低了， 想升级到MySQL 5，所以从管方网站下载了最新的RPM，心谂RPM应该省事了吧？结果在启动时总是说不能连接server。将所有新装的rpm都删除，从新安装FC3自带的版本也不行，重启再试，还是不行。<BR><BR>正感到绝望的时候，谂起apt-get。心想，用apt-get升级一下，可能就可以搞掂。OK，去！<BR><BR>先将现存的所有mysql*包删除，再用apt-get upgrade更新所有包，再用apt-get install mysql及mysql-server，再用apt-get remove mysql及mysql-server再从新安装MySQL 5的RPM，service mysql start，BINGO！nice to see you again.</P><img src ="http://www.cnitblog.com/alsan/aggbug/352.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/alsan/" target="_blank">毒菇求Buy</a> 2005-06-12 15:44 <a href="http://www.cnitblog.com/alsan/archive/2005/06/12/352.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql消除Asked for 196608 thread stack, but got 126976的方法</title><link>http://www.cnitblog.com/alsan/archive/2005/06/12/353.html</link><dc:creator>毒菇求Buy</dc:creator><author>毒菇求Buy</author><pubDate>Sun, 12 Jun 2005 07:44:00 GMT</pubDate><guid>http://www.cnitblog.com/alsan/archive/2005/06/12/353.html</guid><wfw:comment>http://www.cnitblog.com/alsan/comments/353.html</wfw:comment><comments>http://www.cnitblog.com/alsan/archive/2005/06/12/353.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/alsan/comments/commentRss/353.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/alsan/services/trackbacks/353.html</trackback:ping><description><![CDATA[<P style="FONT-SIZE: 12px; FONT-FAMILY: Verdana">消去这个问题 Asked for 196608 thread stack, but got 126976 最简单的方法是在my.cnf的[mysqld]中加入thread_stack=128K 重启即可 </P><img src ="http://www.cnitblog.com/alsan/aggbug/353.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/alsan/" target="_blank">毒菇求Buy</a> 2005-06-12 15:44 <a href="http://www.cnitblog.com/alsan/archive/2005/06/12/353.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我的smb.conf</title><link>http://www.cnitblog.com/alsan/archive/2005/06/12/346.html</link><dc:creator>毒菇求Buy</dc:creator><author>毒菇求Buy</author><pubDate>Sun, 12 Jun 2005 07:38:00 GMT</pubDate><guid>http://www.cnitblog.com/alsan/archive/2005/06/12/346.html</guid><wfw:comment>http://www.cnitblog.com/alsan/comments/346.html</wfw:comment><comments>http://www.cnitblog.com/alsan/archive/2005/06/12/346.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/alsan/comments/commentRss/346.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/alsan/services/trackbacks/346.html</trackback:ping><description><![CDATA[<P style="FONT-SIZE: 12px; FONT-FAMILY: Verdana">[global]<BR>workgroup = ALSANHOMENET<BR>netbios name = smbsvr<BR>server string = My samba server<BR>log file = /var/log/samba/%m.log<BR>username map = /etc/samba/smbusers<BR>password server = none<BR>max log size = 50<BR>smb passwd file = /etc/samba/smbpasswd<BR>load printers = yes<BR>printing = cups<BR>printcup name = cups<BR>print command = lp c -d%p -oraw; rm %s<BR>use client driver = yes<BR><BR>[home]<BR>path = /home/%u<BR>browseable = yes<BR>writeable = yes<BR>create mask = 777<BR>directory mask = 777<BR><BR>[public]<BR>path = /home/public<BR>guest ok = yes<BR>writeable = yes<BR>valid users = @public_users<BR>create mask = 777<BR>directory mask = 777<BR><BR>[cdrom]<BR>path = /mnt/cdrom<BR>guest ok = yes<BR>browseable = yes<BR><BR>[printers]<BR>comment = All printers<BR>path = /var/spool/samba<BR>printable = yes<BR>browseable = no<BR>guest ok = yes<BR>use client driver = yes<BR>create mode = 0777<BR>public = yes<BR><BR>[color670]<BR>comment = Epson Stylus Color 670<BR>path = /var/spool/samba<BR>read only = no<BR>guest ok = yes<BR>printable = yes<BR>printing = cups<BR>printer name = color670</P><img src ="http://www.cnitblog.com/alsan/aggbug/346.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/alsan/" target="_blank">毒菇求Buy</a> 2005-06-12 15:38 <a href="http://www.cnitblog.com/alsan/archive/2005/06/12/346.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Installing MySQL on Other Unix-Like Systems</title><link>http://www.cnitblog.com/alsan/archive/2005/06/12/333.html</link><dc:creator>毒菇求Buy</dc:creator><author>毒菇求Buy</author><pubDate>Sun, 12 Jun 2005 07:20:00 GMT</pubDate><guid>http://www.cnitblog.com/alsan/archive/2005/06/12/333.html</guid><wfw:comment>http://www.cnitblog.com/alsan/comments/333.html</wfw:comment><comments>http://www.cnitblog.com/alsan/archive/2005/06/12/333.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/alsan/comments/commentRss/333.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/alsan/services/trackbacks/333.html</trackback:ping><description><![CDATA[<P style="FONT-SIZE: 12px; FONT-FAMILY: Verdana">shell&gt; groupadd mysql<BR>shell&gt; useradd -g mysql mysql<BR>shell&gt; cd /usr/local<BR>shell&gt; gunzip &lt; <VAR>/path/to/mysql-VERSION-OS</VAR>.tar.gz | tar xvf -<BR>shell&gt; ln -s <VAR>full-path-to-mysql-VERSION-OS</VAR> mysql<BR>shell&gt; cd mysql<BR>shell&gt; scripts/mysql_install_db --user=mysql<BR>shell&gt; chown -R root&nbsp; .<BR>shell&gt; chown -R mysql data<BR>shell&gt; chgrp -R mysql .<BR>shell&gt; bin/mysqld_safe --user=mysql &amp;<BR>shell&gt; chkconfig --add mysql<BR><BR>gunzip &lt; /path/...可以改成<BR>tar zxvf mysql-VERSION-OS.tar.gz<BR><BR>但解出的目录会在现时目录下。</P><img src ="http://www.cnitblog.com/alsan/aggbug/333.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/alsan/" target="_blank">毒菇求Buy</a> 2005-06-12 15:20 <a href="http://www.cnitblog.com/alsan/archive/2005/06/12/333.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>