使用Linux下script工具记录Oracle输出
2012-01-10 13:27
435 查看
在Linux下使用Oracle数据库时,很多时候我们想记录输出信息,当然有很多方法可以选择,但是这里我想说的是script工具。
在Linux下有一个script工具,可以将当前终端会话中的所有输入输出结果捕获到一个指定的文件里。
看一下这个工具的man输出:
[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,不过缺省一般不带
原文地址: http://www.eygle.com/archives/2008/06/linux_script_oracle.html
在Linux下有一个script工具,可以将当前终端会话中的所有输入输出结果捕获到一个指定的文件里。
看一下这个工具的man输出:
[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,不过缺省一般不带
原文地址: http://www.eygle.com/archives/2008/06/linux_script_oracle.html
相关文章推荐
- Linux 下记录工具(history,screen,script)使用
- linux忘记密码,使用星号密码查看器,查看SSH工具记录的密码
- Linux环境下Oracle exp/imp导出导入工具的使用
- linux平台下的oracle自动备份案例(使用exp工具)
- [转] Linux Oracle下sqlplus无法使用命令退格删除和历史记录的解决方法(使用rlwrap)
- 使用script命令记录Linux终端会话 scriptreplay回放
- Linux常用进程管理工具的使用--我的学习记录
- [记录]在Linux中Oracle安装成功后,首次启动使用时,会出现的一些问题总结和解决办法
- 使用linux logrotate工具清理oracle listener日志
- Linux中通过script命令那个记录屏幕的输出
- 【Linux学习 】Linux使用Script命令来记录并回放终端会话
- 实战hadoop海量数据处理系列02 番外篇: 在linux上使用hql执行工具 | hive排错记录
- Linux下批量管理工具pssh使用记录
- (工具类)Linux笔记之终端日志记录工具script
- linux使用工具记录
- Oracle诊断工具RDA使用记录
- 【转】Linux下Oracle sqlplus无法使用命令退格删除和历史记录的解决方法(使用rlwrap)
- Linux中通过script命令那个记录屏幕的输出
- 在Linux下使用script命令记录数据库操作
- Linux Oracle下sqlplus无法使用命令退格删除和历史记录的解决方法(使用rlwrap)