使用Linux下script工具记录Oracle输出Oracle认证考试
文章作者 100test 发表时间 2010:03:13 16:11:33
来源 100Test.Com百考试题网
在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"