<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>futuremix &#187; データベース</title>
	<atom:link href="http://futuremix.org/category/database/feed" rel="self" type="application/rss+xml" />
	<link>http://futuremix.org</link>
	<description>津田ふみかの日記・言想風景改め未来模景。 Remix The Future.</description>
	<lastBuildDate>Thu, 18 Mar 2010 16:40:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XREA で phpMyAdmin にログインできない</title>
		<link>http://futuremix.org/2010/03/1045-access-denied-for-user-phpmyadmin</link>
		<comments>http://futuremix.org/2010/03/1045-access-denied-for-user-phpmyadmin#comments</comments>
		<pubDate>Fri, 05 Mar 2010 12:30:49 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[xrea]]></category>

		<guid isPermaLink="false">http://futuremix.org/?p=3155</guid>
		<description><![CDATA[
  XREA で管理画面から phpMyAdmin にログインしようとすると、以下のように #1045 Access denied for user phpmyadmin というメッセージが出てログインできないというト [...]]]></description>
			<content:encoded><![CDATA[<p>
  <a href="http://www.xrea.com/">XREA</a> で管理画面から phpMyAdmin にログインしようとすると、以下のように <q>#1045 Access denied for user phpmyadmin</q> というメッセージが出てログインできないというトラブルがありました。
</p>
<div class="screenshot">
  <a href="http://futuremix.org/2010/03/1045-access-denied-for-user-phpmyadmin/phpmyadmin_password-error" rel="attachment wp-att-3156"><img src="http://futuremix.org/wp-content/uploads/2010/03/phpmyadmin_password-error-500x278.jpg" alt="" title="phpMyAdmin パスワードが異なっている時に出るエラー画面" width="500" height="278" class="alignnone size-medium wp-image-3156" /></a>
</div>
<p>
この現象は以前からよく報告されています。原因は、XREA の管理画面の記述がわかりにくいところにあると思います。XREA の管理画面には次のような記載があります。
</p>
<div class="screenshot">
<a href="http://futuremix.org/2010/03/1045-access-denied-for-user-phpmyadmin/xrea-phpmyadmin-id-password" rel="attachment wp-att-3157"><img src="http://futuremix.org/wp-content/uploads/2010/03/xrea-phpmyadmin-id-password-499x153.png" alt="" title="XREA の管理画面での phpMyAdmin 利用時のわかりにくい記述" width="499" height="153" class="alignnone size-medium wp-image-3157" /></a>
</div>
<p>
 この画面には「ページ入室の際はログ閲覧画面の認証パスワード(ユーザー名:*****,パスワード:****))をご利用下さい。」と書かれていますが、これは phpMyAdmin のログインパスワードでありません。次のような Basic 認証のダイアログボックスで入力する ID、パスワードのことです。
</p>
<div class="screenshot">
  <a href="http://futuremix.org/2010/03/1045-access-denied-for-user-phpmyadmin/xrea-log-basic-auth-dialog" rel="attachment wp-att-3158"><img src="http://futuremix.org/wp-content/uploads/2010/03/xrea-log-basic-auth-dialog-500x167.png" alt="" title="XREA の log ディレクトリにアクセスすると表示されるダイアログ" width="500" height="167" class="alignnone size-medium wp-image-3158" /></a>
</div>
<p>
  このダイアログボックスに入力するパスワードが、XREA の管理画面に書かれているパスワードです。phpMyAdmin にログインする際のパスワードは MySQL のパスワードですので異なります。特に管理画面から「自動」のリンクで飛んだときには Basic 認証のダイアログが飛ばされますので、わかりにくいと思います。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2010/03/1045-access-denied-for-user-phpmyadmin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS 5.4 で Oracle 対応 PHP の RPM</title>
		<link>http://futuremix.org/2009/11/centos-54-oracle-php-oci8-rpm</link>
		<comments>http://futuremix.org/2009/11/centos-54-oracle-php-oci8-rpm#comments</comments>
		<pubDate>Wed, 11 Nov 2009 13:00:54 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[データベース]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[RPM]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://futuremix.org/2009/11/centos-54-oracle-php-oci8-rpm</guid>
		<description><![CDATA[
  以前書いたCentOS 5.2 での Oracle 対応 PHP の RPM の改訂版です。今回は CentOS 5.4 (32bit版) のマシンで試しました。なお、Oracle instant Client は [...]]]></description>
			<content:encoded><![CDATA[<p>
  以前書いた<a href="http://futuremix.org/2008/08/centos-oracle-php-rpm-spec-patch">CentOS 5.2 での Oracle 対応 PHP の RPM</a> の改訂版です。今回は CentOS 5.4 (32bit版) のマシンで試しました。なお、Oracle instant Client は 11.x ではなく 10.2.0.4 を利用しました。
</p>
<p>
  CentOS 5.x では、PHP 5.1.6 をベースにしています。手順としては Oracle Instant Client をインストールし、CentOS の PHP の SRPM をダウンロードし、SPEC ファイルを編集し、ビルドという手順になります。
</p>
<h3>Oracle Instant Client の インストール</h3>
<p>
  Oracle Instant Client 10.2.0.4 の RPM をダウンロードします。ダウンロードには OTN の登録が必要です。ここでは Linux x86版(32bit版)の 10.2.0.4 の RPM をダウンロードします。最低限、oracle-instantclient-basic と oracle-instantclient-devel のパッケージはインストールが必要です。jdbc ドライバは不要です。
</p>
<p>
  次に /etc/ld.so.conf.d/oracle-instant-client.conf というファイルを作成し、ライブラリパスを追加します。
</p>
<pre class="command">
# echo '/usr/lib/oracle/10.2.0.4/client/lib/' &gt;&gt; /etc/ld.so.conf.d/oracle-instant-client.conf
</pre>
<p>
  64bit 版の場合は次のようになります。
</p>
<pre class="command">
# echo '/usr/lib/oracle/10.2.0.4/client64/lib/' &gt;&gt; /etc/ld.so.conf.d/oracle-instant-client.conf
</pre>
<p>
  ライブラリパスを再読込します。
</p>
<pre class="command">
# ldconfig
</pre>
<p>
  いまは PHP をビルドするのが目的なので、Oracle データベースへの接続確認は割愛します。
</p>
<h3>PHP の SRPM のダウンロード</h3>
<p>
  なぜか yumdownloader コマンドではうまく行かなかったので、理化学研究所のミラーから直接ダウンロードしました。
</p>
<pre class="command">
  wget http://ftp.riken.go.jp/Linux/centos/5.4/os/SRPMS/php-5.1.6-23.2.el5_3.src.rpm
</pre>
<p>
  この RPM をインストールすると、/usr/src/redhat/SPECS/ に php.spec ファイルが置かれます。また、/usr/src/redhat/SOURCES/ 配下にビルドに必要な PHP のソースファイルと、各種パッチファイルや設定ファイルなどが置かれます。
</p>
<h3>パッチファイルのダウンロード</h3>
<p>
  <a href="/downloads/php-5.1.6-oci8conf.patch">php-5.1.6-oci8conf.patch</a> をダウンロードして SOURCES ディレクトリに配置してください。Oracle が提供する SRPM や、<a href="http://remi.collet.free.fr/files/php-5.2.5-oci8conf.patch">他のパッチ</a>を元に、私が作ったものです。
</p>
<h3>SPEC ファイルの編集</h3>
<p>
  こちらも、oci8 のために変更が必要です。変更箇所が多いので、<a href="/downloads/php.spec.516_23_2">php.spec (php-5.1.6.23.2.el5_3 用 32bit)</a>に置きました。これをダウンロードして php.spec と差し替えてください。変更点は diff を取ればわかると思います。64bit 環境では、ライブラリパスを <code>/usr/lib/oracle/%{ociver}/client/lib</code> から <code>/usr/lib/oracle/%{ociver}/client64/lib</code> に変更する必要があります。
</p>
<h3>RPM のビルド</h3>
<pre class="command">
  $ rpmbuild -ba php.spec &#45;-target i686  &#45;-define 'oracle 1'
</pre>
<p>
  開発ライブラリなどがないと、コンパイルエラーとなります。事前に php.spec の BuildRequires セクションに書かれている RPM 群を yum コマンドでインストールしておきましょう。bzip2-devel, curl-devel, libstdc++-devel などです。
</p>
<pre class="command">
  # yum install bzip2-devel curl-devel libstdc++-devel
</pre>
<p>
  ビルドにはかなり時間がかかります。RPM ファイルは上記の例では /usr/src/redhat/RPMS/i686/ に配置されます。 php-oci8-5.1.6-23.2.ora.i686.rpm というファイルが PHP の OCI8 関数のモジュールを含んだ RPM です。 このモジュールを含む PHP の RPM をインストールしたら Apache を再起動します。phpinfo() コマンドで oci8 パッケージが有効になっていることを確認してみてください。
</p>
<div class="screenshot">
  <img src="http://futuremix.org/wp-content/uploads/2009/11/phpinfo-php-oci8-500x485.png" alt="phpinfo() で OCI8関数が有効になった状態を確認する" title="phpinfo() で OCI8関数が有効になった状態を確認する" width="500" height="485" class="alignnone size-medium wp-image-2934" />
</div>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2009/11/centos-54-oracle-php-oci8-rpm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle で SQL 文の実行時間を測定する</title>
		<link>http://futuremix.org/2009/08/oracle-sql-time</link>
		<comments>http://futuremix.org/2009/08/oracle-sql-time#comments</comments>
		<pubDate>Thu, 27 Aug 2009 22:00:33 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://futuremix.org/?p=2762</guid>
		<description><![CDATA[
  Oracle の SQL*Plus 上でSQL の実行にかかった時間を測定する方法です。


SQL&#62; set timing on


  これで SQL を実行すれば、最後に経過時間が表示されます。


S [...]]]></description>
			<content:encoded><![CDATA[<p>
  Oracle の SQL*Plus 上でSQL の実行にかかった時間を測定する方法です。
</p>
<pre class="command">
SQL&gt; set timing on
</pre>
<p>
  これで SQL を実行すれば、最後に経過時間が表示されます。
</p>
<pre class="command">
SQL&gt; select table_name from user_tables; <span class="comment">//計測したいSQL</span>
<samp>～(略)～
135行が選択されました

経過: 00:00:03.06</samp>
</pre>
<p>
  ただし、ここでの経過時間は結果の表示時間も含んでますので、実際の実行時間だけを求めたい場合は、事前に <kbd>set autotrace traceonly statistics</kbd> として、結果の表示を抑制した方がよいでしょう。このコマンドは <kbd>set autotrace trace stat</kbd> と略せますので、まとめると次のようになります。
</p>
<pre class="command">
SQL&gt; set timing on
SQL&gt; set autotrace trace stat
SQL&gt; select table_name from user_tables; <span class="comment">//計測したいSQL</span>
135行が選択されました

経過: 00:00:03.06
統計 ～(略)～</samp>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2009/08/oracle-sql-time/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OleDb で DB_E_BADORDINAL(0&#215;80040E55)　エラー</title>
		<link>http://futuremix.org/2009/08/oledb-db_e_badordinal-error</link>
		<comments>http://futuremix.org/2009/08/oledb-db_e_badordinal-error#comments</comments>
		<pubDate>Mon, 03 Aug 2009 12:00:23 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[データベース]]></category>
		<category><![CDATA[OleDb]]></category>

		<guid isPermaLink="false">http://futuremix.org/?p=2672</guid>
		<description><![CDATA[
  


  C# のプログラムで OeDB で &#8220;DB_E_BADORDINAL(0&#215;80040E55)&#8221; のエラーが発生。調べるたところパラメータードクエリで、必要以上のパラメータ [...]]]></description>
			<content:encoded><![CDATA[<div class="thumb">
  <img src="http://futuremix.org/wp-content/uploads/2009/08/DB_E_BADORDINAL.png" alt="" width="200" height="200" class="alignnone size-full wp-image-2675" />
</div>
<p>
  C# のプログラムで OeDB で &#8220;DB_E_BADORDINAL(0&#215;80040E55)&#8221; のエラーが発生。調べるたところパラメータードクエリで、必要以上のパラメータを add していました。
</p>
<p>
  反対にパラメータが不足しているときは &#8220;DB_E_PARAMNOTOPTIONAL(0&#215;80040E10)&#8221; が出ます。
</p>
<p>
  条件によってパラメータ数が変わるクエリを投げているときなどは気をつけましょう。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2009/08/oledb-db_e_badordinal-error/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle で SQL の実行計画からインデックス使用の有無を調べる</title>
		<link>http://futuremix.org/2009/08/oracle-sql-explain-plan</link>
		<comments>http://futuremix.org/2009/08/oracle-sql-explain-plan#comments</comments>
		<pubDate>Mon, 03 Aug 2009 09:00:14 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[データベース]]></category>

		<guid isPermaLink="false">http://futuremix.org/?p=2665</guid>
		<description><![CDATA[
  Oracle である問い合わせのクエリが、インデックスを使っているかどうか確認するときの方法です。よく知られているものですがツールが無くて SQL*Plus だけで対応しなければならないとき用にメモしておきます。
 [...]]]></description>
			<content:encoded><![CDATA[<p>
  Oracle である問い合わせのクエリが、インデックスを使っているかどうか確認するときの方法です。よく知られているものですがツールが無くて SQL*Plus だけで対応しなければならないとき用にメモしておきます。
</p>
<h3>１. PLAN_TABLE 表を作成</h3>
<p>
  初回のみこの作業が必要になります。SQL*Plus  でDBに接続し utlxplan.sql ファイルを実行します。
</p>
<pre class="command">
  SQL&gt; @%ORACLE_HOME%\rdbms\admin\utlxplan.sql
</pre>
<p>
  Oracle クライアントのインストールオプションによっては、このファイルは存在しないかもしれません。管理者インストールならおそらく入っていると思います。utlxplan.sql 既に PLAN_TABLE が作成されていればこの作業は不要です。
</p>
<h3>2. EXPLAIN PLAN FOR SELECT ～ で実行計画を取得</h3>
<p>
  実行計画を調べたい問い合わせ文の SQL に &#8220;EXPLAIN PLAN FOR &#8221; を付加して実行します。
</p>
<pre class="command">
  SQL&gt; EXPLAIN PLAN FOR SELECT * FROM employee WHERE id = 100;
  <samp>解析されました。</samp>
</pre>
<h3>３.取得した実行計画を表示</h3>
<p>
 utlxpls.sql ファイルを実行します。
</p>
<pre class="command">
  SQL&gt; @%ORACLE_HOME%\rdbms\admin\utlxpls.sql
  <samp>PLAN_TABLE_OUT_PUT
  | TABLE ACCESS BY INDEX ROWID | employee    |   1 |  27 |
  |  INDEX UNIQUE SCAN          | pk_employee |   1 |     |
  </samp>
</pre>
<p>
  この結果で、INDEX UNIQUE SCAN があれば、問い合わせにはユニークスキャンが行なわれ1行取得していることがわかります。
</p>
<pre class="command">
  <samp>PLAN_TABLE_OUT_PUT
  | TABLE ACCESS FULL     | employee   |     |     |
  </samp>
</pre>
<p>
  上記のように表示されるときは、インデックスは使われていないことが分かります。
</p>
<h3>実行計画の削除</h3>
<p>
  取得した実行計画の解析結果が不要になったら、PLAN_TABLE を切り捨てておきます。
</p>
<pre class="command">
  SQL&gt; TRUNCATE TABLE plan_table;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2009/08/oracle-sql-explain-plan/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracleのキャッシュをクリアする方法</title>
		<link>http://futuremix.org/2009/02/oracle-flush-shared-pool-and-buffer-cache</link>
		<comments>http://futuremix.org/2009/02/oracle-flush-shared-pool-and-buffer-cache#comments</comments>
		<pubDate>Sat, 31 Jan 2009 22:00:21 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://futuremix.org/?p=2217</guid>
		<description><![CDATA[共有プール（SHARED POOL）をクリアする

  定期的にシャットダウンできないような状態で運用しているオラクルサーバは、共有プールのメモリ断片化 によりパフォーマンスが低下することがあります。そのような場合、Or [...]]]></description>
			<content:encoded><![CDATA[<h3>共有プール（SHARED POOL）をクリアする</h3>
<p>
  定期的にシャットダウンできないような状態で運用しているオラクルサーバは、共有プールのメモリ断片化 によりパフォーマンスが低下することがあります。そのような場合、Oracle を再起動しなくても、次の方法で 共有プールのキャッシュをクリアできます。
</p>
<pre class="command">
  ALTER SYSTEM FLUSH SHARED_POOL;
</pre>
<p>
  共有プールからすべてのデータをクリアします。 共有プールにはデータディクショナリのキャッシュ情報や、SQL文、パッケージ、実行計画などが格納されています。
</p>
<p>
  ただし、コマンド実行後は、実行中の SQL の再解析が実行されて一時的に遅くなる可能性があります。また、シーケンスオブジェクトのキャッシュもクリアされるので欠番が発生します。
</p>
<h3>データベース・バッファ・キャッシュのクリア</h3>
<p>
  Oracle 9i では使えません。Oracle 10g 以降でのみ利用できる方法です。性能検証の際にバッファ・キャッシュに格納されたデータブロックを追い出すためにいちいち再起動する必要がなくなりました。
</p>
<pre class="command">
  ALTER SYSTEM FLUSH BUFFER_CACHE ;
</pre>
<p>
  すべてのバッファ・キャッシュがクリアされます。気をつけなければいけないのは、同一インスタンス上で実行中の全てのSQLに影響します。パフォーマンス測定などの開発・テスト環境でのみ使用しましょう。
</p>
<p>
   SYSDBA 権限で実行します。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2009/02/oracle-flush-shared-pool-and-buffer-cache/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle サーバの再起動（終了・起動）手順</title>
		<link>http://futuremix.org/2009/01/oracle-server-shutdown-and-startup</link>
		<comments>http://futuremix.org/2009/01/oracle-server-shutdown-and-startup#comments</comments>
		<pubDate>Fri, 30 Jan 2009 22:00:45 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://futuremix.org/?p=2211</guid>
		<description><![CDATA[
  Oracle サーバの手作業による再起動手順です。Windows 2003 Server 上の Oracle 9i Standard での方法です。

オラクルの停止

  サーバのコマンドプロンプトで、SYS 権 [...]]]></description>
			<content:encoded><![CDATA[<p>
  Oracle サーバの手作業による再起動手順です。Windows 2003 Server 上の Oracle 9i Standard での方法です。
</p>
<h3>オラクルの停止</h3>
<p>
  サーバのコマンドプロンプトで、SYS 権限のユーザで SQLPLUS に入ります。
</p>
<pre class="command">
  C:\&gt; SQLPLUS "SYS/*** AS SYSDBA"
</pre>
<p>
 *** はパスワードです。「～に接続されました。」と出ます。次にシャットダウンを実行します。
</p>
<pre class="command">
  SQL&gt; shutdown immediate
  <samp>ORACLEインスタンスがシャットダウンされました。</samp>
</pre>
<p>
  <kbd>immediate</kbd> を指定したときは接続中のセッションを全て切断します。トランザクションは全てロールバックされます。<kbd>transactional</kbd> を指定すると、トランザクション終了後にすべてのセッションを切断して再起動します。すべてのセッションが切断されるのを待ってから DB を終了したい場合は、<kbd>normal</kbd> を指定します。
</p>
<p>
  ここで、正常にシャットダウンしない場合、次のように強制終了することもできます。
</p>
<pre class="command">
SQL&gt; shutdown abort
<samp>ORACLEインスタンスがシャットダウンされました。</samp>
</pre>
<p>
  <kbd>abort</kbd> を指定した場合は、実行中のトランザクションはロールバックされない状態で切断されます。一応、次回起動時にクラッシュリカバリが自動的に実行されてロールフォワード／ロールバックされるので、データの整合性は保たれるということですが、場合によっては整合性が失われないとも限りません。やはり最後の手段です。自己責任でお願いいたします。
</p>
<h3>オラクルの起動</h3>
<p>
  次は起動です。Oralce の起動は「停止」→NOMOUNT → MOUNT → OPEN の４段階の状態があります。通常は <kbd>startup</kbd>コマンドで、停止から OPEN 状態に一気に移行できます。
</p>
<pre class="command">
  SQL&gt; startup
<samp>ORACLEインスタンスが起動しました。
Total System Global Area 1134311410 bytes
Fixed Size                   458148 bytes
Variable Size             379258410 bytes
Database Buffers         2358411072 bytes
Redo Buffers               36955800 bytes
データベースがマウントされました。
データベースがオープンされました。</samp>
</pre>
<p>
  （上記の数値は環境によって異なります。また、適当な値に書き換えています。）
</p>
<p>
  ここで、データベースを作成したり、起動時にメンテナンスを実施する必要がある場合は、マウントせずに起動することもできます。
</p>
<pre class="command">
 SQL&gt; starup nomount;
</pre>
<p>
  この場合は、alter database で、手作業でマウントします。
</p>
<pre class="command">
  SQL&gt; alter database mount;
  <samp>データベースが変更されました。</samp>
</pre>
<p>
  この状態ではまだマウントされただけでオープンされていません。オープンするには、次のように実行します。
</p>
<pre class="command">
  SQL&gt; alter database open;
  <samp>データベースが変更されました。</samp>
</pre>
<p>
  データベースを読み取り専用モードでオープンしたい場合は、read only 句を付けて open します。
</p>
<pre class="command">
  SQL&gt; alter database open read only;
  <samp>データベースが変更されました。</samp>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2009/01/oracle-server-shutdown-and-startup/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL の正規表現による置換</title>
		<link>http://futuremix.org/2008/12/postgresql-regexp_replace</link>
		<comments>http://futuremix.org/2008/12/postgresql-regexp_replace#comments</comments>
		<pubDate>Thu, 04 Dec 2008 11:06:14 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/?p=1552</guid>
		<description><![CDATA[
  PostgreSQL は以前から like 演算子の代わりに ~ 演算子で正規表現検索ができました。Version 8.1 からは、regexp_replace 関数で、正規表現による置換もできるようになっています [...]]]></description>
			<content:encoded><![CDATA[<p>
  PostgreSQL は以前から like 演算子の代わりに ~ 演算子で正規表現検索ができました。Version 8.1 からは、regexp_replace 関数で、正規表現による置換もできるようになっています。
</p>
<pre class="code">
  SELECT file_name, regexp_replace(file_name, '(^.*_)([0-9]+)(U_.*$)', '\\2') FROM table_name WHERE file_name ~ '(^.*_)([0-9]+)(U_.*$)';
<samp>
file_name               | regexp_replace
------------------------+----------------
hoge_030914U_A01.jpg    | 030914
foo_bar_152528U_B03.jpg | 152528
test123_4317U_X_YZ.png  | 4317
</samp>
</pre>
<p>
  こんな感じで正規表現の一部を利用した表示ができます。\1, \2, ……は、正規表現中の ( ) にマッチした内容です。バックスラッシュを表わすために、SQL 中ではさらに \ を加えて、\\1,\\2, ……のようになります。UPDATE 文でも利用できます。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2008/12/postgresql-regexp_replace/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PostgreSQL 8.1 でデータベースのサイズを取得する</title>
		<link>http://futuremix.org/2008/08/postgresql-pg_database_size-function</link>
		<comments>http://futuremix.org/2008/08/postgresql-pg_database_size-function#comments</comments>
		<pubDate>Sun, 24 Aug 2008 22:15:36 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/?p=1475</guid>
		<description><![CDATA[
  PostgreSQL でチューニング等のためにデータベースのサイズを取得するには、contrib/dbsize の database_size 関数を使うのが一般的です。ところが最近の PostgreSQL では、 [...]]]></description>
			<content:encoded><![CDATA[<p>
  PostgreSQL でチューニング等のためにデータベースのサイズを取得するには、contrib/dbsize の database_size 関数を使うのが一般的です。ところが最近の PostgreSQL では、この関数が見あたりません。調べたところ PostgreSQL 8.1 から、contrib から本体の方に移され、関数名が変わったようです。
</p>
<pre class="command">
 SELECT * FROM pg_database_size('dbname');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2008/08/postgresql-pg_database_size-function/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apache 起動直後に PHP で ORA-00911 エラーが発生</title>
		<link>http://futuremix.org/2008/08/ora-00911-error-occurred-after-resterted-apache</link>
		<comments>http://futuremix.org/2008/08/ora-00911-error-occurred-after-resterted-apache#comments</comments>
		<pubDate>Wed, 20 Aug 2008 11:57:40 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[データベース]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://futuremix.org/?p=1464</guid>
		<description><![CDATA[
  Apache 起動直後に PHP から Oracle に接続すると、ORA-00911 エラーが発生することがあります。


ORA-00911: invalid character in hogehoge.php [...]]]></description>
			<content:encoded><![CDATA[<p>
  Apache 起動直後に PHP から Oracle に接続すると、ORA-00911 エラーが発生することがあります。
</p>
<pre class="log">
ORA-00911: invalid character in hogehoge.php on line X
</pre>
<p>
  しかし、SQL には誤りはなく sqlplus で実行できますし、しばらく時間が経過すると、Apache + PHP 上でもエラーかでなくなります。PHP のコード中では
</p>
<pre class="code">
putenv("NLS_LANG=Japanese_Japan.UTF8");
</pre>
<p>
として、<var>NLS_LANG</var>の値を設定していますが、どうもこの設定が反映されないようです。いろいろ調べると、apache の起動スクリプト中で環境変数を設定すればよいということでした。
</p>
<p>
  /etc/rc.d/init.d/httpd を直接編集しても良いのですが、Red Hat 系(Fedora や CentOS) では、それは避けた方が良さそうです。起動スクリプト中では /etc/sysconfig/httpd がユーザが編集するファイルとして読み込まれ、実行されますので、こちらに記述します。
</p>
<pre class="command">
# vi  /etc/sysconfig/httpd
</pre>
<pre class="config">
export NLS_LANG=Japanese_Japan.UTF8
</pre>
<p>
  これで Apache を再起動後すれば、起動直後でも NLS_LANG の値が有効になっており、エラーは発生しなくなりました。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2008/08/ora-00911-error-occurred-after-resterted-apache/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sun が MySQL を買収へ</title>
		<link>http://futuremix.org/2008/01/sun-mysql</link>
		<comments>http://futuremix.org/2008/01/sun-mysql#comments</comments>
		<pubDate>Wed, 16 Jan 2008 23:21:28 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[企業・合併・買収]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SUN]]></category>

		<guid isPermaLink="false">http://futuremix.org/2008/01/sun-mysql</guid>
		<description><![CDATA[
  ITmediaの記事から。Sun Microsystems が MySQL を買収するとのこと。MySQL は IPO の噂もありましたが、Sun に買収されました。


  買収したのが Oracle でなくてよ [...]]]></description>
			<content:encoded><![CDATA[<p>
  <a href="http://www.itmedia.co.jp/news/articles/0801/17/news005.html">ITmediaの記事</a>から。Sun Microsystems が MySQL を買収するとのこと。MySQL は <abbr title="Initial Public Offering">IPO</abbr> の噂もありましたが、Sun に買収されました。
</p>
<p>
  買収したのが Oracle でなくてよかったと思いますが、Sun は過去に Cobalt を買収して失敗したりしているので、今回もそのようなことにならないか心配です。あと MySQL には Intel、SAP、Red Hat などが投資していましたが、今後の関係がどうなるのか興味深いところ。
</p>
<p>
  また「Sun」という色が付くことで嫌がる <abbr title="Open Source Software">OSS</abbr> 支持者が、PostgreSQL や Firebird に流れることも予想されますね。LAMP から LAPP への流れが加速するかもしれません。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2008/01/sun-mysql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL : InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes</title>
		<link>http://futuremix.org/2007/09/mysql-innodb-logfile-size</link>
		<comments>http://futuremix.org/2007/09/mysql-innodb-logfile-size#comments</comments>
		<pubDate>Sat, 15 Sep 2007 14:46:51 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/2007/09/mysql-innodb-logfile-size</guid>
		<description><![CDATA[
  いままで MySQL は何のチューニングもしなかったのでいろいろいじっていたら MySQL が起動しなくなりました。エラーログ (/var/log/mysql.log )を見ると次のようなエラーが


InnoDB [...]]]></description>
			<content:encoded><![CDATA[<p>
  いままで MySQL は何のチューニングもしなかったのでいろいろいじっていたら MySQL が起動しなくなりました。エラーログ (/var/log/mysql.log )を見ると次のようなエラーが
</p>
<pre class="log">
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 33554432 bytes!
[ERROR] Can't init databases
[ERROR] Aborting
</pre>
<p>
  InnoDB のログファイルのデフォルトは 5M ですが、これを 32M ほどに設定し直したところ、ファイルサイズが設定と違うという理由でエラーとなっているようです。自動的に再作成はしてくれないようですので、ログファイルを削除してから MySQL を起動すれば大丈夫でした。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2007/09/mysql-innodb-logfile-size/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL メモリ食いつぶし</title>
		<link>http://futuremix.org/2007/09/mysql-2</link>
		<comments>http://futuremix.org/2007/09/mysql-2#comments</comments>
		<pubDate>Sat, 15 Sep 2007 13:29:43 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[データベース]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/2007/09/mysql-2</guid>
		<description><![CDATA[
  水曜日・本日と、MySQL がメモリを食いつぶして当サイトへのアクセスができない状態に陥りました。アクセスされた方には閲覧できずご迷惑をお掛けしました。


  対処しようにもコンソールからもなかなかログインできず [...]]]></description>
			<content:encoded><![CDATA[<p>
  水曜日・本日と、MySQL がメモリを食いつぶして当サイトへのアクセスができない状態に陥りました。アクセスされた方には閲覧できずご迷惑をお掛けしました。
</p>
<p>
  対処しようにもコンソールからもなかなかログインできず、手こずりました。top 込まんとでは mysql が仮想メモリの 80% 以上を使っていたので間違いなく MySQL が何らかの理由で仮想メモリを食いつぶしたのだと思います。スワップしまくりでした。
</p>
<p>
  mysqld を停止して（Timeout で失敗しましたが）、swapoff -a としてスワップ領域も開放しました。</p>
<p>
  原因は調査中なのですが特に DoS ということはなさそうなので、先頃リリースされた MySQL のアップデート版 RPM をインストールしたせいではないかと考えています。が、どこかのスパムボットによる絨毯爆撃の可能性も考えられるため、とりあえず Apache のパラメータをいじって同時接続数を減らしたりはしてみました。単にメモリ不足なのかもしれませんが。どうなることやら。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2007/09/mysql-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL で You can&#8217;t specify target table ～ for update in FROM clause エラー</title>
		<link>http://futuremix.org/2007/08/mysql-update-with-subquery</link>
		<comments>http://futuremix.org/2007/08/mysql-update-with-subquery#comments</comments>
		<pubDate>Sat, 18 Aug 2007 22:00:51 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/2007/08/mysql-update-with-subquery</guid>
		<description><![CDATA[
  MySQL で Update 文の中でサブクエリを使うと、You can&#8217;t specify target table ～ for update in FROM clause というエラーメッセージが出 [...]]]></description>
			<content:encoded><![CDATA[<p>
  MySQL で Update 文の中でサブクエリを使うと、<em>You can&#8217;t specify target table ～ for update in FROM clause</em> というエラーメッセージが出ることがあります。サブクエリの中で更新するテーブルを読んでいるような場合に発生します。たとえば
</p>
<pre class="command">
  update temp_table set num = (select max(num) +1 from temp_table) where num=1;
  <samp>ERROR 1093 (HY000): You can't specify target table 'temp_table' for update in FROM clause</samp>
</pre>
<p>
  PostgreSQL や Oracle ではこのようなエラーは起きずに更新が完了します。対処方法としてはテンポラリテーブルを使うか MySQL をやめること。テンポラリテーブルも同一クエリ内では2回以上使えなかったりと制限があります。
</p>
<p>
  MySQL はちょっと凝ったことをしようとすると途端にできなくなるので、本当に困ります。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2007/08/mysql-update-with-subquery/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL メモ</title>
		<link>http://futuremix.org/2007/07/mysql</link>
		<comments>http://futuremix.org/2007/07/mysql#comments</comments>
		<pubDate>Sat, 28 Jul 2007 22:00:27 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/2007/07/mysql</guid>
		<description><![CDATA[
  MySQL の知っていると便利なコマンドや、PostgreSQL, Oracle との違いのメモです。

データベースの作成
root ユーザで mysql のコンソールに入り、CREATE DATABASE コマ [...]]]></description>
			<content:encoded><![CDATA[<p>
  MySQL の知っていると便利なコマンドや、PostgreSQL, Oracle との違いのメモです。
</p>
<h3>データベースの作成</h3>
<p>root ユーザで mysql のコンソールに入り、CREATE DATABASE コマンドを実行。</p>
<pre class="command">
# mysql -u root
mysql&gt; CREATE DATABASE db_name;
</pre>
<h3>ユーザの作成</h3>
<p>Oracle や PostgreSQL と異なり、CREATE USER 文ではなく GRANT 文で作成する。</p>
<pre class="command">
mysql&gt; GRANT ALL PRIVILEGES ON db_name.* TO user_name@localhost IDENTIFIED BY "*********";
</pre>
<h3>データベースの一覧</h3>
<pre class="command">
mysql&gt; SHOW DATABASES;
</pre>
<h3>データベースの選択</h3>
<p>mysql コンソールに入ってから使うデータベースを指定したり、切り替える場合。</p>
<pre class="command">
mysql&gt; &#x5c;u db_name;
</pre>
<h3>テーブルの一覧</h3>
<pre class="command">
mysql&gt; SHOW TABLES;
</pre>
<h3>テーブルの詳細情報</h3>
<pre class="command">
mysql&gt; DESC table_name;
</pre>
<h3>データベースのダンプ</h3>
<p>データベースの内容をファイルに出力</p>
<pre class="command">
$ mysqldmp -u user_name -p db_name | gzip > db.dump.gz
</pre>
<h3>データベースのリストア</h3>
<pre class="command">
$ zcat db.dump.gz | mysql -u user_name -p db_name
</pre>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2007/07/mysql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpPgAdmin 4.0.1 から 4.1.1 への移行</title>
		<link>http://futuremix.org/2007/04/phppgadmin-rpm</link>
		<comments>http://futuremix.org/2007/04/phppgadmin-rpm#comments</comments>
		<pubDate>Sun, 22 Apr 2007 10:12:42 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[データベース]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/2007/04/phppgadmin-rpm</guid>
		<description><![CDATA[
  phpPgAdmin を 4.0.1 から 4.1.1 にバージョンアップしました。その際の注意点です。


  4.0.1 のときは phpPgAdmin のサイトから入手できるサードパーティ製 RPM を利用し [...]]]></description>
			<content:encoded><![CDATA[<p>
  <a href="http://phppgadmin.sourceforge.net/">phpPgAdmin</a> を 4.0.1 から 4.1.1 にバージョンアップしました。その際の注意点です。
</p>
<p>
  4.0.1 のときは phpPgAdmin のサイトから入手できるサードパーティ製 <abbr title="RPM Package Manager">RPM</abbr> を利用していましたが、4.1.1 では Fedora Extras の RPM を利用しました。そのためか、インストール先のディレクトリや設定ファイルの場所がかなり違うのでとまどいました。サーバは Cent OS 4 で試しました。
</p>
<h3>設定ファイルの場所の変更</h3>
<p>
  4.0.1 までは /var/www/html/phpPgAdmin/conf/ ディレクトリに設定ファイルが配置されます。4.1.1 の RPM では /etc/phpPgAdmin/ に設置されるようになっており、Red Hat 系のお約束（設定ファイルを /etc/ に配置する）を守っています。/usr/share/phpPgAdmin/conf/ ディレクトリからはシンボリックリンクで設定ファイルにリンクされています。（ディレクトリのシンボリックリンクでないところがミソ）
</p>
<p>
  これはセキュリティ上のメリットもあって、設定ファイルのバックアップを .old とか .php.bak とか、.~php のような拡張子で保存してしまうと、/var/www/html/phpPgAdmin/ 配下では閲覧できる状態になります。
</p>
<p>
  しかし /etc/ に分離されていれば不用意にバックアップファイルを置いてもアクセス可能な状態にはなりません。バックアップファイルにはシンボリックリンクが張られていないためです。
</p>
<h3>phpPgAdmin のコンテンツの場所</h3>
<p>
  4.0.1 以前は /var/www/html/phpPgAdmin/ に配置されていましたが、4.1.1 では /usr/share/phpPgAdmin/ に変更されています。古いディレクトリが残っていると動作がおかしくなることがあるので削除するか移動しておきましょう。
</p>
<h3>Apache 用の設定ファイルの追加</h3>
<p>
  また関連して、Apache 用の設定ファイル /etc/httpd/conf.d/phpPgAdmin.conf が追加されています。ですので httpd.conf を編集する必要はありません。初期状態では 127.0.0.1 からのアクセスしか許可していませんので、設定を追加する必要があります。
</p>
<pre class="config">
Alias /phpPgAdmin /usr/share/phpPgAdmin

&lt;Location /phpPgAdmin&gt;
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
    <kbd>Allow from 192.168.1.0/24 #追加</kbd>
    Allow from ::1
&lt;/Location&gt;
</pre>
<p>
  設定ファイルを保存して Apache の再起動（設定の再読込）をすれば、 http://ServerName/phpPgAdmin の URL でアクセス可能になります。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2007/04/phppgadmin-rpm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL で時間の差を取って返す</title>
		<link>http://futuremix.org/2007/04/postgresql-timestamp-sql</link>
		<comments>http://futuremix.org/2007/04/postgresql-timestamp-sql#comments</comments>
		<pubDate>Fri, 20 Apr 2007 15:55:43 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/2007/04/postgresql-timestamp-sql</guid>
		<description><![CDATA[
  PostgreSQL は時間が柔軟に扱えるので SQL だけでロジックを済ませられることも多く便利な点の一つです。


  たとえば timestamp with time zone 型の last_access_ [...]]]></description>
			<content:encoded><![CDATA[<p>
  PostgreSQL は時間が柔軟に扱えるので SQL だけでロジックを済ませられることも多く便利な点の一つです。
</p>
<p>
  たとえば timestamp with time zone 型の last_access_time に最終アクセス日が格納されているとして、現在より1時間以内にアクセスしたデータを取り出すときは</p>
<pre class="code">
  SELECT * FROM <var>tablename</var> WHERE now() - last_access_time < '01:00';
</pre>
<p>
  とすれば OK です。5分であれば、
</p>
<pre class="code">
  SELECT * FROM <var>tablename</var> WHERE now() - last_access_time < '5 minutes';
</pre>
<p>
  のような指定もできます。1週間であれば、
</p>
<pre class="code">
  SELECT * FROM <var>tablename</var> WHERE now() - last_access_time < '1 week';
</pre>
<p>
  のようにも指定できますし、 <code>7 days</code> にしても OK です。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2007/04/postgresql-timestamp-sql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress でコメント・トラックバック受付停止の一括設定方法</title>
		<link>http://futuremix.org/2007/03/trackback-spam-sql</link>
		<comments>http://futuremix.org/2007/03/trackback-spam-sql#comments</comments>
		<pubDate>Sat, 31 Mar 2007 08:45:00 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[データベース]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/2007/03/trackback-spam-sql</guid>
		<description><![CDATA[
  WordPress ではトラックバック（ピンバック）を受け付けないように設定することができますが、オプション設定画面の「ディスカッション設定」で「他のウェブログからのリンク通知を許可する (ピンバックとトラックバッ [...]]]></description>
			<content:encoded><![CDATA[<p>
  WordPress ではトラックバック（ピンバック）を受け付けないように設定することができますが、オプション設定画面の「ディスカッション設定」で「他のウェブログからのリンク通知を許可する (ピンバックとトラックバック)」のチェックを外しても、これまでに投稿した記事はトラックバックを受け付けた状態のままです。
</p>
<p>これは各記事の「ピンを許可」のチェックの方が優先されるためですので、既存の記事へのトラックバックを拒否したいのであれば、過去の記事の「ピンを許可」のチェックを外す必要があります。記事数が多い場合はいちいち設定できませんので、MySQL にログインして、SQL で一括変換するのが良いと思います。</p>
<pre class="code">
mysql&gt; UPDATE wp_posts SET ping_status='closed';
<samp>Query OK, 52 rows affected (0.00 sec)
Rows matched: 50  Changed: 50  Warnings: 0</samp>

mysql&gt; SELECT COUNT(ping_status), ping_status FROM wp_posts GROUP BY ping_status;
<samp>+&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;+&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;+
| count(ping_status) | ping_status |
+&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;+&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;+
|                 50 | closed      |
+&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;+&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;+
1 row in set (0.00 sec)</samp>
</pre>
<p>元に戻すときは &#8216;closed&#8217; の代わりに &#8216;open&#8217; を指定します。コメントの場合は ping_status のところを comment_status にしましょう。コミットも忘れずに。</p>
<pre class="code">
mysql&gt; UPDATE wp_posts SET comment_status='closed';
</pre>
<p>別の方法もあるかもしれませんが、SQL を使える人ならばこういう方法を知っておけば色々応用が利くと思います。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2007/03/trackback-spam-sql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>続・Oracle Instant Client を使って PHP をコンパイル</title>
		<link>http://futuremix.org/2005/05/php-oracle-rebuild</link>
		<comments>http://futuremix.org/2005/05/php-oracle-rebuild#comments</comments>
		<pubDate>Fri, 06 May 2005 11:52:19 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[データベース]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[RPM]]></category>

		<guid isPermaLink="false">http://futuremix.org/2005/05/php-oracle-rebuild</guid>
		<description><![CDATA[
  以前、Oracle Instant Client を使って PHP をコンパイルという記事を書きました。これは、Red Hat Enterprise Linux （正確にはクローンの White Box でしたが） [...]]]></description>
			<content:encoded><![CDATA[<p>
  以前、<a href="/2005/01/oracle-instant-client-php">Oracle Instant Client を使って PHP をコンパイル</a>という記事を書きました。これは、Red Hat Enterprise Linux （正確にはクローンの White Box でしたが）にて、PHP の Oracle 関数を利用できるように再構築する方法を書いたものです。
</p>
<p>
  当時のバージョンでは、<a href="http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html">Oracle Instant Client</a> を使う場合、SPEC ファイルを書き換え、パッチを当てる必要がありましたが、この度リリースされた php-4.3.2-23.ent.src.rpm からは、パッチが取り込まれたのでその必要はなくなりました。素晴らしい!!
</p>
<p>
  RHEL3 で試した限りでは、次のようにすれば OK でした。<a href="/2004/12/oracle-instant-client-linux">Oracle Instant Client パッケージのインストール</a>が済んでいることが前提です。
</p>
<h3>パッケージのダウンロード</h3>
<pre class="code">
  # up2date --get-source php
</pre>
<p>
  RHEL で、<abbr title="Red Hat Network">RHN</abbr> に加入しているのであれば、これだけでソースパッケージが /var/spool/up2date にダウンロードされます。クローンのディストリビューションの場合は、それぞれの FTP サーバなどから入手しましょう。
</p>
<h3>パッケージの再構築</h3>
<p>
  基本的には <kbd>--define 'oracle 1'</kbd> をつけて再構築するだけです。たとえば、
</p>
<pre class="code">
  # rpmbuild --rebuild --target i686 --define 'oracle 1' php-4.3.2-23.ent.src.rpm
</pre>
<p>
  のようになります。できあがった RPM ファイルは /usr/src/redhat/RPMS/i686 の下にできます。これをインストールすれば、Oracle 関数も使えます。ほとんどの環境では、mbstring オプションも有効になっています。
</p>
<p>
  パッケージの構築に当たっては、普段つかわないパッケージ群のインストールが必要になります。たとえば mysql とか unixODBC-devel などです。さらに要求されませんが、flex パッケージと sendmail が無い環境でパッケージを作ってしまうと、一部の関数が使えなくなってしまいますので注意しましょう。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2005/05/php-oracle-rebuild/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PostgreSQL の Boolean 型の判定</title>
		<link>http://futuremix.org/2005/01/pg_boolean</link>
		<comments>http://futuremix.org/2005/01/pg_boolean#comments</comments>
		<pubDate>Mon, 10 Jan 2005 07:51:34 +0000</pubDate>
		<dc:creator>津田 ふみか</dc:creator>
				<category><![CDATA[データベース]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://futuremix.org/2005/01/pg_boolean</guid>
		<description><![CDATA[
  PostgreSQL には Boolean 型というのがありますが、WHERE 句での判定方法が通常と違うためにはまってしまいました。忘れないようにメモしておきます。


  肯定の時は


  カラム名 = TR [...]]]></description>
			<content:encoded><![CDATA[<p>
  PostgreSQL には Boolean 型というのがありますが、WHERE 句での判定方法が通常と違うためにはまってしまいました。忘れないようにメモしておきます。
</p>
<p>
  肯定の時は
</p>
<pre class="code">
  カラム名 = TRUE
  カラム名 = FALSE
</pre>
<p>
  でよいのですが、否定の時は、
</p>
<pre class="code">
  カラム名 IS NOT TRUE
  カラム名 IS NOT FALSE
</pre>
<p>
  のようにしなければならないようです。 &lt;&gt; や != だと正しい結果になりませんでした。</p>
]]></content:encoded>
			<wfw:commentRss>http://futuremix.org/2005/01/pg_boolean/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
