登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

SeaRiver Blog

实力才是你一生最好的依靠!

 
 
 

日志

 
 

使用Linux下script工具记录Oracle输出  

2009-07-25 09:10:26|  分类: Oracle |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
[oracle@jumper oracle]$ which script
/usr/bin/script
[oracle@jumper oracle]$ man script
SCRIPT(1)                BSD General Commands Manual                SCRIPT(1)

NAME
    script - make typescript of terminal session

SYNOPSIS
    script [-a] [-f] [-q] [-t] [file]

DESCRIPTION
    Script makes a typescript of everything printed on your terminal.  It is
    useful for students who need a hardcopy record of an interactive session
    as proof of an assignment, as the typescript file can be printed out
    later with lpr(1).

    If the argument file is given, script saves all dialogue in file.  If no
    file name is given, the typescript is saved in the file typescript.

当然最重要的是看一下实际效果。

在记录操作前执行 script 命令开始记录,最后输入 exit 退出记录,中间的所有操作都会被记录下来,以下是一个测试过程,中间步骤被省略:
[oracle@jumper oracle]$ script
Script started, file is typescript
[oracle@jumper oracle]$ sqlplus "/ as sysdba"
<...ignore operation here...>
[oracle@jumper oracle]$ exit
Script done, file is typescript

现在让我们来看看记录文件typescript中记录了什么内容:
[oracle@jumper oracle]$ cat typescript
Script started on Thu 26 Jun 2008 07:56:18 AM CST
[oracle@jumper oracle]$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Thu Jun 26 07:56:24 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production

SQL> set linesize 120
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

Session altered.

SQL> col status for a8
SQL> col group# for 999999
SQL> select * from v$log;

GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS  FIRST_CHANGE# FIRST_TIME
------- ---------- ---------- ---------- ---------- --- -------- ------------- -------------------
      1          1        14    1048576          1 YES INACTIVE    1.9008E+10 2008-06-23 00:42:36
      3          1        15    1048576          1 YES INACTIVE    1.9008E+10 2008-06-25 14:29:37
      4          1        13    1048576          1 YES INACTIVE    1.9008E+10 2008-06-20 14:56:12
      5          1        16    1048576          1 NO  CURRENT    1.9008E+10 2008-06-25 15:58:38

SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
[oracle@jumper oracle]$
[oracle@jumper oracle]$ exit

Script done on Thu 26 Jun 2008 07:57:38 AM CST


这个工具是不是很有用途呢?
当然还有更强悍的 scriptreplay 工具可以replay script,不过缺省一般不带,不说了。

-The End-

原文: http://www.eygle.com/archives/2008/06/linux_script_oracle.html

  评论这张
 
阅读(614)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018