位置: 编程技术 - 正文
推荐整理分享Linux下通过script 命令记录(数据库)操作步骤,希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!
1、script命令描述
复制代码代码如下:script命令会记录所有的操作到文件同时在屏幕上输出,直到终止登陆的会话,或使用CRTL+D,或使用exit退出则停止记录。这个命令对于数据库的升级或是重要设置的情形下使用可以用于后续查询操作成功或失败。用法: $ script [upgrade.log]如果未指定日志文件名的情形,自动生成日志文件名为typescript。如果需要输出到已经存在的日志文件,则使用 -a 参数,再接已经存在日志文件名。如果需要在输出到日志文件的同时,也可以查看日志文件的内容,可以使用 -f 参数。</p><p># script 帮助描述robin@SZDB:~> man scriptNAME script - make typescript of terminal session</p><p>SYNOPSIS script [-a] [-c COMMAND] [-f] [-q] [-t] [file]</p><p>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).</p><p> 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.</p><p> Options:</p><p> -a Append the output to file or typescript, retaining the prior contents.</p><p> -c COMMAND Run the COMMAND rather than an interactive shell. This makes it easy for a script to capture the output of a pro- gram that behaves differently when its stdout is not a tty.</p><p> -f Flush output after each write. This is nice for telecooperation: One person does `mkfifo foo; script -f foo' and another can supervise real-time what is being done using `cat foo'.</p><p> -q Be quiet.</p><p> -t Output timeing data to standard error. This data contains two fields, separated by a space. The first field indi- cates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays.
2、script命令用法示例
复制代码代码如下:a、script命令后接日志文件名robin@SZDB:~> script test_logfile.log #启用scriptScript started, file is test_logfile.log</p><p> .................#中间操作省略 robin@SZDB:~> exit #停止scriptexitScript done, file is test_logfile.log</p><p>#查看刚刚生成的日志文件robin@SZDB:~> more test_logfile.log Script started on Fri Apr :: PM CSTrobin@SZDB:~> sid bash: sid: command not foundrobin@SZDB:~> . ~/.bash_profilerobin@SZDB:~> sidORA_CRS_HOME=/opt/oracle/product/gR2/crsORACLE_PATH=.:/users/robin/dba_scripts/custom/sqlORA_ASM_HOME=/opt/oracle/product/gR2/asmORACLE_SID=SYBO2SZORACLE_BASE=/users/oracleORACLE_HOME=/users/oracle/OraHomegrobin@SZDB:~> sql </p><p>SQL*Plus: Release .2.0.3.0 - Production on Fri Apr :: </p><p>Copyright (c) , , Oracle. All Rights Reserved.</p><p>Error accessing PRODUCT_USER_PROFILEWarning: Product user profile information not loaded!You may need to run PUPBLD.SQL as SYSTEM</p><p>Connected to:Oracle Database g Release .2.0.3.0 - bit Production</p><p>goex_admin@SYBO2SZ> alter session set current_schema=scott;</p><p>Session altered.</p><p>goex_admin@SYBO2SZ> select * from dept;</p><p> DEPTNO DNAME LOC---------- -------------- ------------- ACCOUNTING NEW YORK RESEARCH DALLAS SALES CHICAGO OPERATIONS BOSTON</p><p>goex_admin@SYBO2SZ> exitDisconnected from Oracle Database g Release .2.0.3.0 - bit Productionrobin@SZDB:~> exitexit</p><p>Script done on Fri Apr :: PM CST </p><p>b、script 命下直接跟脚本名的示例robin@SZDB:~> script -c retval.shScript started, file is typescript SCOTT ANALYST :: Script done, file is typescript</p><p>#被执行的shell脚本的内容# Author : Robinson# Blog : more ~/dba_scripts/custom/bin/retval.sh#!/bin/bashRETVAL=`sqlplus -silent scott/tiger <<EOFSET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFFSELECT * FROM emp WHERE ename='SCOTT';EXIT;EOF`if [ -z "$RETVAL" ]; then echo "No rows returned from database" exit 0else echo $RETVALfi
Linux系统鲜为人知的大内幕介绍 据国外媒体报道,Linux似乎没有得到人们充分的爱戴。苹果的OSX和微软的Windows等操作系统一直是人们关注的重点,但事实上,免费且是开放源的Linux操作
Linux系统中的gdb程序调试工具的命令知识介绍 在Linux系统中有许多的命令程序来辅助系统的正常和方便运行,那么其中在系统中有着一个叫做gdb命令的程序,那么我们今天就来了解下关于gdb命令的知
Linux下SSH Session复制功能实现方法 特别感谢阿干同学的邮件分享。详细方法复制代码代码如下:Linux/mac下,在$HOME/.ssh/config中加入Host*ControlMasterautoControlPatha/tmp/ssh-%r@%h/a至此只要第一次SSH登
标签: Linux下通过script 命令记录(数据库)操作步骤
本文链接地址:https://www.jiuchutong.com/biancheng/360578.html 转载请保留说明!友情链接: 武汉网站建设