2011年6月11日星期六

Expert Oracle Database Architecture读书笔记之Setting Up Environment

Setting Up login File
  SQL*Plus allows us to setup a login.sql file, a script that is executed each and every time we 
start SQL*Plus. Further, it allows us to set an environment variable, SQLPATH, so that it can find this 
login.sql script, no matter what directory it is in. 

define _editor=vi 
set serveroutput on size 1000000 
set trimspool on 
set long 5000 
set linesize 100 
set pagesize 9999 
column plan_plus_exp format a80 
column global_name new_value gname 
set termout off 
define gname=idle 
column global_name new_value gname 
select lower(user) || '@' || substr( global_name, 1, decode( dot, 0, length(global_name), 
dot-1) ) global_name 
from (select global_name, instr(global_name,'.') dot from global_name ); 
set sqlprompt '&gname> ' 
set termout on 

Setting up Autotrace in SQL*Plus
Initial Setup 
This is what I like to do to get AUTOTRACE working: 
•  cd [ORACLE_HOME]/rdbms/admin 
•  log into SQL*Plus as SYSTEM 
•  run @utlxplan 
•  run CREATE PUBLIC SYNONYM PLAN_TABLE FOR PLAN_TABLE; 
•  run GRANT ALL ON PLAN_TABLE TO PUBLIC; 
You can replace the GRANT TO PUBLIC with some user if you want. By making it public, you let anyone trace using SQL*Plus (not a bad thing, in my opinion). This prevents every user from having to install their own plan table. The alternative is for you to run @utlxplan in every schema from which you want to use AUTOTRACE. 
The next step is creating and granting the PLUSTRACE role: 
•  cd [ORACLE_HOME]/sqlplus/admin 
•  log into SQL*Plus as SYS or AS SYSDBA 
•  run @plustrce 
•  run GRANT PLUSTRACE TO PUBLIC; 
Again, you can replace PUBLIC in the GRANT command with some user if you want.

Controlling the Report 
•  SET AUTOTRACE OFF - No AUTOTRACE report is generated. This is the default. 
•  SET AUTOTRACE ON EXPLAIN - The AUTOTRACE report shows only the optimizer execution path. 
•  SET AUTOTRACE ON STATISTICS - The AUTOTRACE report shows only the SQL statement execution statistics. 
•  SET AUTOTRACE ON - The AUTOTRACE report includes both the optimizer execution path and the 
SQL statement execution statistics. 
•  SET AUTOTRACE TRACEONLY - Like SET AUTOTRACE ON, but suppresses the printing of the user's query output, if any. 

Database Statistic Name
Description
recursive calls
Number of recursive calls generated at both the user and system level. Oracle maintains tables used for internal processing. When Oracle needs to make a change to these tables, it internally generates an internal SQL statement, which in turn generates a recursive call.
db block gets
Number of times a CURRENT block was requested.
consistent gets
Number of times a consistent read was requested for a block.
physical reads
Total number of data blocks read from disk. This number equals the value of "physical reads direct" plus all reads into buffer cache.
redo size
Total amount of redo generated in bytes.
bytes sent via SQL*Net to client
Total number of bytes sent to the client from the foreground processes.
bytes received via SQL*Net from client
Total number of bytes received from the client over Oracle Net.
SQL*Net roundtrips to/from client
Total number of Oracle Net messages sent to and received from the client.
sorts (memory)
Number of sort operations that were performed completely in memory and did not require any disk writes.
sorts (disk)
Number of sort operations that required at least one disk write.
rows processed
Number of rows processed during the operation.

针对以上3个概念进行的说明解释及关系如下:
1、DB Block Gets(当前请求的块数目)
当前模式块意思就是在操作中正好提取的块数目,而不是在一致性读的情况下而产生的块数。正常的情况下,一个查询提取的块是在查询开始的那个时间点上存在的数据块,当前块是在这个时刻存在的数据块,而不是在这个时间点之前或者之后的数据块数目。

2、Consistent Gets(数据请求总数在回滚段Buffer中的数据一致性读所需要的数据块)
这里的概念是在处理你这个操作的时候需要在一致性读状态上处理多少个块,这些块产生的主要原因是因为由于在你查询的过程中,由于其他会话对数据块进行操作,而对所要查询的块有了修改,但是由于我们的查询是在这些修改之前调用的,所以需要对回滚段中的数据块的前映像进行查询,以保证数据的一致性。这样就产生了一致性读。

3、Physical Reads(物理读)
就是从磁盘上读取数据块的数量,其产生的主要原因是:
1、 在数据库高速缓存中不存在这些块
2、 全表扫描
3、 磁盘排序

它们三者之间的关系大致可概括为:
逻辑读指的是Oracle从内存读到的数据块数量。一般来说是'consistent gets' + 'db block gets'。当在内存中找不到所需的数据块的话就需要从磁盘中获取,于是就产生了'phsical reads'。



Explain plan

  An explain plan is a representation of the access path that is taken when a query is executed within Oracle.

 Query processing can be divided into 7 phases:
 [1] Syntactic - checks the syntax of the query
 [2] Semantic - checks that all objects exist and are accessible
 [3] View Merging - rewrites query as join on base tables as opposed to using views
 [4] Statement Transformation - rewrites query transforming some complex constructs into simpler ones
       where appropriate (e.g. subquery unnesting, in/or transformation)
 [5] Optimization - determines the optimal access path for the query to take. With the Rule Based
      Optimizer (RBO) it uses a set of heuristics to determine access path. With the Cost Based
      Optimizer (CBO) we use statistics to analyze the relative costs of accessing objects.
 [6] QEP Generation
 [7] QEP Execution
 (QEP = Query Evaluation Plan)

 Steps [1]-[6] are handled by the parser.
 Step [7] is the execution of the statement.

 Explain Plan一般按缩进长度来判断,缩进最大的最先执行,如果有2行缩进一样,那么就先执行上面的。

OPERATION and OPTIONS Values Produced by EXPLAIN PLAN

Operation
Option
Description
AND-EQUAL
.
Operation accepting multiple sets of rowids, returning the intersection of the sets, eliminating duplicates. Used for the single-column indexes access path.
BITMAP
CONVERSION
TO ROWIDS converts bitmap representations to actual rowids that can be used to access the table.
FROM ROWIDS converts the rowids to a bitmap representation.
COUNT returns the number of rowids if the actual values are not needed.
BITMAP
INDEX
SINGLE VALUE looks up the bitmap for a single key value in the index.
RANGE SCAN retrieves bitmaps for a key value range.
FULL SCAN performs a full scan of a bitmap index if there is no start or stop key.
BITMAP
MERGE
Merges several bitmaps resulting from a range scan into one bitmap.
BITMAP
MINUS
Subtracts bits of one bitmap from another. Row source is used for negated predicates. Can be used only if there are nonnegated predicates yielding a bitmap from which the subtraction can take place. An example appears in "Viewing Bitmap Indexes with EXPLAIN PLAN".
BITMAP
OR
Computes the bitwise OR of two bitmaps.
BITMAP
AND
Computes the bitwise AND of two bitmaps.
BITMAP
KEY ITERATION
Takes each row from a table row source and finds the corresponding bitmap from a bitmap index. This set of bitmaps are then merged into one bitmap in a following BITMAP MERGE operation.
CONNECT BY
.
Retrieves rows in hierarchical order for a query containing a CONNECT BY clause.
CONCATENATION
.
Operation accepting multiple sets of rows returning the union-all of the sets.
COUNT
.
Operation counting the number of rows selected from a table.
COUNT
STOPKEY
Count operation where the number of rows returned is limited by the ROWNUM expression in the WHERE clause.
DOMAIN INDEX
.
Retrieval of one or more rowids from a domain index. The options column contain information supplied by a user-defined domain index cost function, if any.
FILTER
.
Operation accepting a set of rows, eliminates some of them, and returns the rest.
FIRST ROW
.
Retrieval of only the first row selected by a query.
FOR UPDATE
.
Operation retrieving and locking the rows selected by a query containing a FOR UPDATE clause.
HASH
GROUP BY
Operation hashing a set of rows into groups for a query with a GROUP BY clause.
HASH JOIN
(These are join operations.)
.
Operation joining two sets of rows and returning the result. This join method is useful for joining large data sets of data (DSS, Batch). The join condition is an efficient way of accessing the second table.
Query optimizer uses the smaller of the two tables/data sources to build a hash table on the join key in memory. Then it scans the larger table, probing the hash table to find the joined rows.
HASH JOIN
ANTI
Hash (left) antijoin
HASH JOIN
SEMI
Hash (left) semijoin
HASH JOIN
RIGHT ANTI
Hash right antijoin
HASH JOIN
RIGHT SEMI
Hash right semijoin
HASH JOIN
OUTER
Hash (left) outer join
HASH JOIN
RIGHT OUTER
Hash right outer join
INDEX
(These are access methods.)
UNIQUE SCAN
Retrieval of a single rowid from an index.
INDEX
RANGE SCAN
Retrieval of one or more rowids from an index. Indexed values are scanned in ascending order.
INDEX
RANGE SCAN DESCENDING
Retrieval of one or more rowids from an index. Indexed values are scanned in descending order.
INDEX
FULL SCAN
Retrieval of all rowids from an index when there is no start or stop key. Indexed values are scanned in ascending order.
INDEX
FULL SCAN DESCENDING
Retrieval of all rowids from an index when there is no start or stop key. Indexed values are scanned in descending order.
INDEX
FAST FULL SCAN
Retrieval of all rowids (and column values) using multiblock reads. No sorting order can be defined. Compares to a full table scan on only the indexed columns. Only available with the cost based optimizer.
INDEX
SKIP SCAN
Retrieval of rowids from a concatenated index without using the leading column(s) in the index. Introduced in Oracle9i. Only available with the cost based optimizer.
INLIST ITERATOR
.
Iterates over the next operation in the plan for each value in the IN-list predicate.
INTERSECTION
.
Operation accepting two sets of rows and returning the intersection of the sets, eliminating duplicates.
MERGE JOIN
(These are join operations.)
.
Operation accepting two sets of rows, each sorted by a specific value, combining each row from one set with the matching rows from the other, and returning the result.
MERGE JOIN
OUTER
Merge join operation to perform an outer join statement.
MERGE JOIN
ANTI
Merge antijoin.
MERGE JOIN
SEMI
Merge semijoin.
MERGE JOIN
CARTESIAN
Can result from 1 or more of the tables not having any join conditions to any other tables in the statement. Can occur even with a join and it may not be flagged as CARTESIAN in the plan.
CONNECT BY
.
Retrieval of rows in hierarchical order for a query containing a CONNECT BY clause.
MAT_VIEW REWITE ACCESS
(These are access methods.)
FULL
Retrieval of all rows from a materialized view.
MAT_VIEW REWITE ACCESS
SAMPLE
Retrieval of sampled rows from a materialized view.
MAT_VIEW REWITE ACCESS
CLUSTER
Retrieval of rows from a materialized view based on a value of an indexed cluster key.
MAT_VIEW REWITE ACCESS
HASH
Retrieval of rows from materialized view based on hash cluster key value.
MAT_VIEW REWITE ACCESS
BY ROWID RANGE
Retrieval of rows from a materialized view based on a rowid range.
MAT_VIEW REWITE ACCESS
SAMPLE BY ROWID RANGE
Retrieval of sampled rows from a materialized view based on a rowid range.
MAT_VIEW REWITE ACCESS
BY USER ROWID
If the materialized view rows are located using user-supplied rowids.
MAT_VIEW REWITE ACCESS
BY INDEX ROWID
If the materialized view is nonpartitioned and rows are located using index(es).
MAT_VIEW REWITE ACCESS
BY GLOBAL INDEX ROWID
If the materialized view is partitioned and rows are located using only global indexes.
MAT_VIEW REWITE ACCESS
BY LOCAL INDEX ROWID
If the materialized view is partitioned and rows are located using one or more local indexes and possibly some global indexes.
Partition Boundaries:
The partition boundaries might have been computed by:
A previous PARTITION step, in which case the PARTITION_START and PARTITION_STOP column values replicate the values present in the PARTITION step, and the PARTITION_ID contains the ID of the PARTITION step. Possible values forPARTITION_START and PARTITION_STOP are NUMBER(n), KEYINVALID.
The MAT_VIEW REWRITE ACCESS or INDEX step itself, in which case the PARTITION_ID contains the ID of the step. Possible values for PARTITION_START and PARTITION_STOP are NUMBER(n), KEYROW REMOVE_LOCATION (MAT_VIEW REWRITEACCESS only), and INVALID.
MINUS
.
Operation accepting two sets of rows and returning rows appearing in the first set but not in the second, eliminating duplicates.
NESTED LOOPS
(These are join operations.)
.
Operation accepting two sets of rows, an outer set and an inner set. Oracle compares each row of the outer set with each row of the inner set, returning rows that satisfy a condition. This join method is useful for joining small subsets of data (OLTP). The join condition is an efficient way of accessing the second table.
NESTED LOOPS
OUTER
Nested loops operation to perform an outer join statement.
PARTITION
.
Iterates over the next operation in the plan for each partition in the range given by the PARTITION_START and PARTITION_STOP columns. PARTITION describes partition boundaries applicable to a single partitioned object (table or index) or to a set of equi-partitioned objects (a partitioned table and its local indexes). The partition boundaries are provided by the values of PARTITION_START and PARTITION_STOP of the PARTITION. Refer to Table 19-1 for valid values of partition start/stop.
PARTITION
SINGLE
Access one partition.
PARTITION
ITERATOR
Access many partitions (a subset).
PARTITION
ALL
Access all partitions.
PARTITION
INLIST
Similar to iterator, but based on an IN-list predicate.
PARTITION
INVALID
Indicates that the partition set to be accessed is empty.
PX ITERATOR
BLOCK,CHUNK
Implements the division of an object into block or chunk ranges among a set of parallel slaves
PXCOORDINATOR
.
Implements the Query Coordinator which controls, schedules, and executes the parallel plan below it using parallel query slaves. It also represents a serialization point, as the end of the part of the plan executed in parallel and always has aPX SEND QC operation below it.
PX PARTITION
.
Same semantics as the regular PARTITION operation except that it appears in a parallel plan
PX RECEIVE
.
Shows the consumer/receiver slave node reading repartitioned data from a send/producer (QC or slave) executing on a PX SEND node. This information was formerly displayed into the DISTRIBUTION column. See Table 19-2.
PX SEND
QC(RANDOM), HASHRANGE
Implements the distribution method taking place between two parallel set of slaves. Shows the boundary between two slave sets and how data is repartitioned on the send/producer side (QC or side. This information was formerly displayed into the DISTRIBUTION column. See Table 19-2.
REMOTE
.
Retrieval of data from a remote database.
SEQUENCE
.
Operation involving accessing values of a sequence.
SORT
AGGREGATE
Retrieval of a single row that is the result of applying a group function to a group of selected rows.
SORT
UNIQUE
Operation sorting a set of rows to eliminate duplicates.
SORT
GROUP BY
Operation sorting a set of rows into groups for a query with a GROUP BY clause.
SORT
JOIN
Operation sorting a set of rows before a merge-join.
SORT
ORDER BY
Operation sorting a set of rows for a query with an ORDER BY clause.
TABLE ACCESS
(These are access methods.)
FULL
Retrieval of all rows from a table.
TABLE ACCESS
SAMPLE
Retrieval of sampled rows from a table.
TABLE ACCESS
CLUSTER
Retrieval of rows from a table based on a value of an indexed cluster key.
TABLE ACCESS
HASH
Retrieval of rows from table based on hash cluster key value.
TABLE ACCESS
BY ROWID RANGE
Retrieval of rows from a table based on a rowid range.
TABLE ACCESS
SAMPLE BY ROWID RANGE
Retrieval of sampled rows from a table based on a rowid range.
TABLE ACCESS
BY USER ROWID
If the table rows are located using user-supplied rowids.
TABLE ACCESS
BY INDEX ROWID
If the table is nonpartitioned and rows are located using index(es).
TABLE ACCESS
BY GLOBAL INDEX ROWID
If the table is partitioned and rows are located using only global indexes.
TABLE ACCESS
BY LOCAL INDEX ROWID
If the table is partitioned and rows are located using one or more local indexes and possibly some global indexes.
Partition Boundaries:
The partition boundaries might have been computed by:
A previous PARTITION step, in which case the PARTITION_START and PARTITION_STOP column values replicate the values present in the PARTITION step, and the PARTITION_ID contains the ID of the PARTITION step. Possible values forPARTITION_START and PARTITION_STOP are NUMBER(n), KEYINVALID.
The TABLE ACCESS or INDEX step itself, in which case the PARTITION_ID contains the ID of the step. Possible values for PARTITION_START and PARTITION_STOP are NUMBER(n), KEYROW REMOVE_LOCATION (TABLE ACCESS only), and INVALID.
UNION
.
Operation accepting two sets of rows and returns the union of the sets, eliminating duplicates.
VIEW
.
Operation performing a view's query and then returning the resulting rows to another operation.






rlwrap安装使用

  Windows操作系统上,当在DOS命令窗口中运行SQL*Plus的时候,可以使用向上,向下键来跳回之前已经执行过的SQL语句.你可以根据需要修改他们,然后按Enter键重新提交执行.然而,当在Linux Shell中运行SQL*Plus的时候,并不提供浏览历史命令行的功能.为了在Linux中达到同样的目的,你可以安装rlwrap,这个程式本身是个Shell,可以运行任何你提供给它的命令包括参数,并添加命令历史浏览功能.The rlwrap program is under the GPL license.

一:安装readline
OS的安装光盘里提供了readline包.
[root@oracle11g ~]# rpm -Uvh readline*
error: Failed dependencies: libtermcap-devel is needed by readline-devel-5.1-1.1.i386.rpm
[root@oracle11g ~]# rpm -Uvh libtermcap-devel-2.0.8-46.1.i386.rpm
[root@oracle11g ~]# rpm -Uvh readline*
[root@oracle11g ~]# rpm -Uvh readline-devel-5.1-1.1.i386.rpm

二:安装rlwrap
Download:
http://utopia.knoware.nl/~hlub/uck/rlwrap/
[root@oracle11g ~]# tar -zxvf rlwrap-0.37.tar.gz
[root@oracle11g ~]# cd rlwrap-0.37
[root@oracle11g rlwrap-0.37]# ./configure
[root@oracle11g rlwrap-0.37]# make
[root@oracle11g rlwrap-0.37]# make install
[root@oracle11g rlwrap-0.37]# rlwrap

在.bash_profile里面添加下面命令
[oracle@oracle11g rlwrap-0.30]#emacs /home/oracle/.bash_profile

alias sqlplus='rlwrap sqlplus'

2011年6月9日星期四

emacs快捷键

C = Control
M = Meta = Alt|Esc
Del = Backspace

基本快捷键(Basic)
C-x C-f "find"文件, 即在缓冲区打开/新建一个文件
C-x C-s 保存文件
C-x C-w 使用其他文件名另存为文件
C-x C-v 关闭当前缓冲区文件并打开新文件
C-x i 在当前光标处插入文件
C-x b 新建/切换缓冲区
C-x C-b 显示缓冲区列表
C-x k 关闭当前缓冲区
C-z 挂起emacs
C-X C-c 关闭emacs

光标移动基本快捷键(Basic Movement)
C-f 后一个字符
C-b 前一个字符
C-p 上一行
C-n 下一行
M-f 后一个单词
M-b 前一个单词
C-a 行首
C-e 行尾
C-v 向下翻一页
M-v 向上翻一页
M-< 到文件开头
M-> 到文件末尾

编辑(Editint)
M-n 重复执行后一个命令n次
C-u 重复执行后一个命令4次
C-u n 重复执行后一个命令n次
C-d 删除(delete)后一个字符
M-d 删除后一个单词
Del 删除前一个字符
M-Del 删除前一个单词
C-k 移除(kill)一行

C-Space 设置开始标记 (例如标记区域)
C-@ 功能同上, 用于C-Space被操作系统拦截的情况
C-w 移除(kill)标记区域的内容
M-w 复制标记区域的内容
C-y 召回(yank)复制/移除的区域/行
M-y 召回更早的内容 (在kill缓冲区内循环)
C-x C-x 交换光标和标记

C-t 交换两个字符的位置
M-t 交换两个单词的位置
C-x C-t 交换两行的位置
M-u 使从光标位置到单词结尾处的字母变成大写
M-l 与M-u相反
M-c 使从光标位置开始的单词的首字母变为大写

重要快捷键(Important)
C-g 停止当前运行/输入的命令
C-x u 撤销前一个命令
M-x revert-buffer RETURN (照着这个输入)撤销上次存盘后所有改动
M-x recover-file RETURN 从自动存盘文件恢复
M-x recover-session RETURN 如果你编辑了几个文件, 用这个恢复

在线帮助(Online-Help)
C-h c 显示快捷键绑定的命令
C-h k 显示快捷键绑定的命令和它的作用
C-h l 显示最后100个键入的内容
C-h w 显示命令被绑定到哪些快捷键上
C-h f 显示函数的功能
C-h v 显示变量的含义和值
C-h b 显示当前缓冲区所有可用的快捷键
C-h t 打开emacs教程
C-h i 打开info阅读器
C-h C-f 显示emacs FAQ
C-h p 显示本机Elisp包的信息

搜索/替换(Seach/Replace)
C-s 向后搜索
C-r 向前搜索
C-g 回到搜索开始前的位置(如果你仍然在搜索模式中)
M-% 询问并替换(query replace)

Space或y 替换当前匹配
Del或n 不要替换当前匹配
. 仅仅替换当前匹配并退出(替换)
, 替换并暂停(按Space或y继续)
! 替换以下所有匹配
^ 回到上一个匹配位置
RETURN或q 退出替换

使用正则表达式(Regular expression)搜索/替换
可在正则表达式中使用的符号:
^ 行首
$ 行尾
. 单个字符
.* 任意多个(包括没有)字符
\< 单词开头
\> 单词结尾
[] 括号中的任意一个字符(例如[a-z]表示所有的小写字母)

M C-s RETURN 使用正则表达式向后搜索
M C-r RETURN 使用正则表达式向前搜索
C-s 增量搜索
C-s 重复增量搜索
C-r 向前增量搜索
C-r 重复向前增量搜索
M-x query-replace-regexp 使用正则表达式搜索并替换

窗口命令(Window Commands)
C-x 2 水平分割窗格
C-x 3 垂直分割窗格
C-x o 切换至其他窗格
C-x 0 关闭窗格
C-x 1 关闭除了光标所在窗格外所有窗格
C-x ^ 扩大窗格
M-x shrink-window 缩小窗格
M C-v 滚动其他窗格内容
C-x 4 f 在其他窗格中打开文件
C-x 4 0 关闭当前缓冲区和窗格
C-x 5 2 新建窗口(frame)
C-x 5 f 在新窗口中打开文件
C-x 5 o 切换至其他窗口
C-x 5 0 关闭当前窗口

书签命令(Bookmark commands)
C-x r m 在光标当前位置创建书签
C-x r b 转到书签
M-x bookmark-rename 重命名书签
M-x bookmark-delete 删除书签
M-x bookmark-save 保存书签
C-x r l 列出书签清单

d 标记等待删除
Del 取消删除标记
x 删除被标记的书签
r 重命名
s 保存列表内所有书签
f 转到当前书签指向的位置
m 标记在多窗口中打开
v 显示被标记的书签(或者光标当前位置的书签)
t 切换是否显示路径列表
w 显示当前文件路径
q 退出书签列表

M-x bookmark-write 将所有书签导出至指定文件
M-x bookmark-load 从指定文件导入书签

Shell
M-x shell 打开shell模式
C-c C-c 类似unix里的C-c(停止正在运行的程序)
C-d 删除光标后一个字符
C-c C-d 发送EOF
C-c C-z 挂起程序(unix下的C-z)
M-p 显示前一条命令
M-n 显示后一条命令

DIRectory EDitor (dired)
C-x d 打开dired
C(大写C) 复制
d 标记等待删除
D 立即删除
e或f 打开文件或目录
g 刷新当前目录
G 改变文件所属组(chgrp)
k 从屏幕上的列表里删除一行(不是真的删除)
m 用*标记
n 光标移动到下一行
o 在另一个窗格打开文件并移动光标
C-o 在另一个窗格打开文件但不移动光标
P 打印文件
q 退出dired
Q 在标记的文件中替换
R 重命名文件
u 移除标记
v 显示文件内容
x 删除有D标记的文件
Z 压缩/解压缩文件
M-Del 移除标记(默认为所有类型的标记)
~ 标记备份文件(文件名有~的文件)等待删除
# 标记自动保存文件(文件名形如#name#)等待删除
*/ 用*标记所有文件夹(用C-u */n移除标记)
= 将当前文件和标记文件(使用C-@标记而不是dired的m标记)比较
M-= 将当前文件和它的备份比较
! 对当前文件应用shell命令
M-} 移动光标至下一个用*或D标记的文件
M-{ 移动光标至上一个用*或D标记的文件
% d 使用正则表达式标记文件等待删除
% m 使用正则表达式标记文件为*
+ 新建文件夹
> 移动光标至后一个文件夹
< 移动光标至前一个文件夹
s 切换排序模式(按文件名/日期)

或许把这个命令归入这一类也很合适:
M-x speedbar 打开一个独立的目录显示窗口

Telnet
M-x telnet 打开telnet模式
C-d 删除后一个字符或发送EOF
C-c C-c 停止正在运行的程序(和unix下的C-c类似)
C-c C-d 发送EOF
C-c C-o 清除最后一个命令的输出
C-c C-z 挂起正在运行的命令
C-c C-u 移除前一行
M-p 显示前一条命令

Text
只能在text模式里使用
M-s 使当前行居中
M-S 使当前段落居中
M-x center-region 使被选中的区域居中

宏命令(Macro-commands)
C-x ( 开始定义宏
C-x ) 结束定义宏
C-x e 运行最近定义的宏
M-n C-x e 运行最近定义的宏n次
M-x name-last-kbd-macro 给最近定义的宏命名(用来保存)
M-x insert-kbd-macro 将已命名的宏保存到文件
M-x load-file 载入宏

编程(Programming)
M C-\ 自动缩进光标和标记间的区域
M-m 移动光标到行首第一个(非空格)字符
M-^ 将当前行接到上一行末尾处
M-; 添加缩进并格式化的注释
C, C++和Java模式
M-a 移动光标到声明的开始处
M-e 移动光标到声明的结尾处
M C-a 移动光标到函数的开始处
M C-e 移动光标到函数的结尾处
C-c RETURN 将光标移动到函数的开始处并标记到结尾处
C-c C-q 根据缩进风格缩进整个函数
C-c C-a 切换自动换行功能
C-c C-d 一次性删除光标后的一串空格(greedy delete)

为了实现下面的一些技术, 你需要在保存源代码的目录里运行"etags
*.c *.h *.cpp"(或者源代码的其他的扩展名)
M-.(点) 搜索标签
M-x tags-search ENTER 在所有标签里搜索(使用正则表达式)
M-,(逗号) 在tags-search里跳至下一个匹配处
M-x tags-query-replace 在设置过标签的所有文件里替换文本

GDB(调试器)
M-x gdb 在另一个的窗格中打开gdb

版本控制(Version Control)
C-x v d 显示当前目录下所有注册过的文件(show all registered files in this dir)
C-x v = 比较不同版本间的差异(show diff between versions)
C-x v u 移除上次提交之后的更改(remove all changes since last checkin)
C-x v ~ 在不同窗格中显示某个版本(show certain version in different window)
C-x v l 打印日志(print log)
C-x v i 标记文件等待添加版本控制(mark file for version control add)
C-x v h 给文件添加版本控制文件头(insert version control header into file)
C-x v r 获取命名过的快照(check out named snapshot)
C-x v s 创建命名的快照(create named snapshot)
C-x v a 创建gnu风格的更改日志(create changelog file in gnu-style)