停止空想

老张的空中之家

存档于 ‘数据库’ 分类

如何直接从shell调用sqlite3命令

作者:admin 发表时间:三月 - 16 - 2009

官方的例子如下

Using sqlite3 in a shell script

One way to use sqlite3 in a shell script is to use “echo” or “cat” to generate a sequence of commands in a file, then invoke sqlite3 while redirecting input from the generated command file. This works fine and is appropriate in many circumstances. But as an added convenience, sqlite3 allows a single SQL command to be entered on the command line as a second argument after the database name. When the sqlite3 program is launched with two arguments, the second argument is passed to the SQLite library for processing, the query results are printed on standard output in list mode, and the program exits. This mechanism is designed to make sqlite3 easy to use in conjunction with programs like “awk”. For example:

sqlite3 ex1 'select * from tbl1' |
awk '{printf "<tr><td>%s<td>%s\n",$1,$2 }'
<tr><td>hello<td>10
<tr><td>goodbye<td>20
$

阅读全文 »

Popularity: 47% [?]

类别:sqlite3

Oracle的临时文件号在系统中的标识

作者:admin 发表时间:三月 - 11 - 2009

今天发现系统中有大量的direct path read 等待事件,
SID P1 P1TEXT P2 P2TEXT P3 P3TEXT
———- ———- ———- ———- ———- ———- ———-
1142 2006 file number 75847 first dba 31 block cnt

473 2006 file number 40163 first dba 15 block cnt

458 2006 file number 59333 first dba 15 block cnt
阅读全文 »

Popularity: 24% [?]

类别:Oracle

无数次的执行dual…

作者:admin 发表时间:二月 - 25 - 2009

dual是一个oracle表。具体用处不说了。这里聊聊有用的。

客户的一个系统,60分钟statspack采样,发现select count(*) from dual 在这段时间共执行6,775,149次,平均每秒执行1800次。而每次执行该语句逻辑读3个——巨大的消耗。

阅读全文 »

Popularity: 31% [?]

类别:Oracle