Monthly Archives: June 2011
Shortcuts in linux shell
常用快捷键: 光标移动 Ctrl+a 移动到行首 Ctrl+e 移动到行尾 Ctrl+左右箭头 以单词为单位移动光标(在ssh secure client中不生效) Esc+b 移动到当前单词的开头 Esc+f 移动到当前单词的结尾 删除 Ctrl+d 删除当前光标字母 Ctrl+h 删除当前光标之前的字母 Ctrl+u 删除至行首 Ctrl+k 删除至行首 Ctrl+w 删除至所在单词第一个字母 Alt-BACKSPACE 类似Ctrl+w,往前删除至于第一个非字母的字符 复制和粘贴,包括鼠标操作 Ctrl+y 粘贴上面删除操作的内容 双击鼠标左键 复制 单机鼠标中键 粘贴 其它编辑操作 Ctrl+x+u 还原上次操作 Ctrl-_ 作用同上,注意是下划线, Alt+r 还原对当前命令行的所有操作 Ctrl+x+x 在当前光标和行首进行切换 Alt+u 将当前光标至单词尾转换为大写 Alt+l 将当前光标至单词尾转换为小写 Alt+c 将当前光标至单词尾转换为首字母大写 Ctrl+t 交互当前光标和前字母 Esc+t 交互当前光标所在单词和前单词 查找 [...]
[转]手工释放linux内存
原文地址:手工释放linux内存——/proc/sys/vm/drop_caches 当在Linux下频繁存取文件后,物理内存会很快被用光,当程序结束后,内存不会被正常释放,而是一直作为caching。这个问题,貌似有不少人在问,不过都没有看到有什么很好解决的办法。那么我来谈谈这个问题。 一、通常情况 先来说说free命令: 引用 [root@server ~]# free -m total used free shared buffers cached Mem: 249 163 86 0 10 94 -/+ buffers/cache: 58 191 Swap: 511 0 511 其中: 引用 total 内存总数 used 已经使用的内存数 free 空闲的内存数 shared 多个进程共享的内存总额 buffers Buffer Cache和cached Page Cache 磁盘缓存的大小 -buffers/cache 的内存数:used – buffers – cached +buffers/cache 的内存数:free + [...]
Different ways to shutdown Oracle database
10g关于shutdown的官方文档:Shutting Down a Database 使用下面任意一种SHUTDOWN方法后: No new connections are allowed, nor are new transactions allowed to be started. SHUTDOWN = SHUTDOWN NORMAL Before the database is shut down, the database waits for all currently connected users to disconnect from the database. SHUTDOWN IMMEDIATE Any uncommitted transactions are rolled back. (If long uncommitted transactions exist, this [...]
A test of migrated row and chained row
概念说明 行链接:记录在插入的时候由于长度大于一个数据块的大小,被拆分放到多个数据块中。特别是当表中含有CLOB或BLOG字段的时候容易发生这样的情况。 行迁移:记录在更新时,在原有的数据块中找不到足够的空间,此时记录的内容保存到另外数据块,原数据块保留一个指向新数据库的链接,这样做是为了保持记录的rowid不变。如果发生大量的行迁移,需要核实表的PCTFREE参数是否太小。 创建每行长度超过db_block_size的表,模拟行迁移和行链接 SYS@orcl>show parameter db_block_size NAME TYPE VALUE ———————————— ———– —————————— db_block_size integer 8192 SYS@orcl>create table t_large(a char(2000), b char(2000), c char(2000), d char(2000), e char(2000)); Table created. SYS@orcl>insert into t_large values (’1′,’1′,’1′,’1′,’1′); 1 row created. SYS@orcl>insert into t_large values (’2′,’2′,’2′,’2′,’2′); 1 row created. SYS@orcl>insert into t_large values (’3′,’3′,’3′, null, null); 1 [...]
Oracle audit test
一、修改系统参数,打开审计功能 SYS@orcl>show parameter audit; NAME TYPE VALUE ———————————— ———– —————————— audit_file_dest string /opt/ora10g/oracle/product/10. 2.0/db_1/admin/orcl/adump audit_sys_operations boolean FALSE audit_syslog_level string audit_trail string NONE SYS@orcl>alter system set audit_trail = db_extended scope=spfile; System altered. –Restart the database. SYS@orcl>show parameter audit; NAME TYPE VALUE ———————————— ———– —————————— audit_file_dest string /opt/ora10g/oracle/product/10. 2.0/db_1/admin/orcl/adump audit_sys_operations boolean FALSE audit_syslog_level string audit_trail string DB_EXTENDED [...]
A test of using logminer to restore data
设置日期格式,方便查看log文件的日期相关字段 SYS@orcl>alter session set NLS_DATE_FORMAT = ‘yyyy-mm-dd hh24:mi:ss’ SYS@orcl>alter session set NLS_TIME_STAMP_FORMAT = ‘yyyy-mm-dd hh24:mi:ss 查看redo log文件相关信息 SYS@orcl>archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination /opt/oralog Oldest online log sequence 5 Next log sequence to archive 7 Current log sequence 7 SYS@orcl>select * from v$log; GROUP# THREAD# SEQUENCE# BYTES MEMBERS [...]
Use sql profile to modify excution plan without changing sql text
测试表及索引: ADAM@orcl>desc t Name Null? Type ———————————————- ——– ——- N NUMBER ADAM@orcl>select index_name, column_name from user_ind_columns where table_name = ‘T’; INDEX_NAME COLUMN_NAME —————————— —————————— IND_T N ADAM@orcl>select * from t; N ———- 1 50 20 100 10 500 501 查看执行计划的脚本p2 select * from table(dbms_xplan.display_cursor) 原始语句及执行计划,使用的是index scan ADAM@orcl>select * from t where n = 1; N [...]
Prerequisites to use dbms_xplan.display_cursor
Make sure the current use has been granted select privilege on v$sql, v$sql_plan, v$session. SYS@orcl>grant select on v_$sql to plustrace; SYS@orcl>grant select on v_$sql_plan to plustrace; SYS@orcl>grant select on v_$session to plustrace; SYS@orcl>grant plustrace to adam; Make sure set parameter serveroutput to off, otherwise you will the following errors: PLAN_TABLE_OUTPUT ——————————————————————- SQL_ID 9babjv8yq8ru3, child number [...]
How to resolve error SP2-0618 on using set autotrace
Create role plustrace SYS@orcl>@?/sqlplus/admin/plustrce.sql SYS@orcl>select role from dba_roles where role like ‘P%’; ROLE —————————— PLUSTRACE Grant it to user SYS@orcl>grant plustrace to adam; Grant succeeded.
Diffrence between v$segstat and v$segment_statistics
Recently I found there are 2 similar performance views in Oracle: V$SEGSTAT and V$SEGMENT_STATISTICS, Are they same in contents? Here are the structure of those 2 tables: search@WEBDB>desc v$segstat Name Null? Type —————————————————————– ——– ————- TS# NUMBER OBJ# NUMBER DATAOBJ# NUMBER STATISTIC_NAME VARCHAR2(64) STATISTIC# NUMBER VALUE NUMBER search@WEBDB>desc v$segment_statistics Name Null? Type —————————————————————– ——– ————- [...]