<em id="0a85b"><option id="0a85b"></option></em>

<abbr id="0a85b"></abbr>

      <nobr id="0a85b"></nobr>
        <tr id="0a85b"></tr>
        9久久伊人精品综合,亚洲一区精品视频在线,成 人免费va视频,国产一区二区三区黄网,99国产精品永久免费视频,亚洲毛片多多影院,精品久久久无码人妻中文字幕,无码国产欧美一区二区三区不卡
        學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 > Linux下通過script命令記錄數(shù)據(jù)庫操作教程

        Linux下通過script命令記錄數(shù)據(jù)庫操作教程

        時間: 志藝942 分享

        Linux下通過script命令記錄數(shù)據(jù)庫操作教程

          對DBA而言,經(jīng)常碰到升級數(shù)據(jù)庫或是apply patch,以及有些時候需要運(yùn)行大量的腳本。對于這些操作我們希望現(xiàn)在在屏幕同時又輸出的文件以備后續(xù)查詢過程中曾經(jīng)丟失的步驟或錯誤。接下來是小編為大家收集的Linux下通過script 命令記錄數(shù)據(jù)庫操作教程,希望能幫到大家。

          Linux下通過script 命令記錄數(shù)據(jù)庫操作教程

          1、script命令描述

          復(fù)制代碼

          代碼如下:

          script命令會記錄所有的操作到文件同時在屏幕上輸出,直到終止登陸的會話,或使用CRTL+D,或使用exit退出則停止記錄。

          這個命令對于數(shù)據(jù)庫的升級或是重要設(shè)置的情形下使用可以用于后續(xù)查詢操作成功或失敗。

          用法: $ script [upgrade.log]

          如果未指定日志文件名的情形,自動生成日志文件名為typescript。

          如果需要輸出到已經(jīng)存在的日志文件,則使用 -a 參數(shù),再接已經(jīng)存在日志文件名。

          如果需要在輸出到日志文件的同時,也可以查看日志文件的內(nèi)容,可以使用 -f 參數(shù)。

        < p># script 幫助描述

          robin@SZDB:~> man script

          NAME

          script - make typescript of terminal session

        < p>SYNOPSIS

          script [-a] [-c COMMAND] [-f] [-q] [-t] [file]

        < 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> 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> Options: < p> -a Append the output to file or typescript, retaining the prior contents. < 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> -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> -q Be quiet. < 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命令用法示例

          復(fù)制代碼

          代碼如下:

          a、script命令后接日志文件名

          robin@SZDB:~> script test_logfile.log #啟用script

          Script started, file is test_logfile.log

        < p> .................#中間操作省略

          robin@SZDB:~> exit #停止script

          exit

          Script done, file is test_logfile.log

        < p>#查看剛剛生成的日志文件

          robin@SZDB:~> more test_logfile.log

          Script started on Fri 26 Apr 2013 05:45:23 PM CST

          robin@SZDB:~> sid

          bash: sid: command not found

          robin@SZDB:~> . ~/.bash_profile

          robin@SZDB:~> sid

          ORA_CRS_HOME=/opt/oracle/product/10gR2/crs

          ORACLE_PATH=.:/users/robin/dba_scripts/custom/sql

          ORA_ASM_HOME=/opt/oracle/product/10gR2/asm

          ORACLE_SID=SYBO2SZ

          ORACLE_BASE=/users/oracle

          ORACLE_HOME=/users/oracle/OraHome10g

          robin@SZDB:~> sql

        < p>SQL*Plus: Release 10.2.0.3.0 - Production on Fri Apr 26 17:46:12 2013 < p>Copyright (c) 1982, 2006, Oracle. All Rights Reserved. < p>Error accessing PRODUCT_USER_PROFILE

          Warning: Product user profile information not loaded!

          You may need to run PUPBLD.SQL as SYSTEM

        < p>Connected to:

          Oracle Database 10g Release 10.2.0.3.0 - 64bit Production

        < p>goex_admin@SYBO2SZ> alter session set current_schema=scott; < p>Session altered. < p>goex_admin@SYBO2SZ> select * from dept; < p> DEPTNO DNAME LOC

          ---------- -------------- -------------

          10 ACCOUNTING NEW YORK

          20 RESEARCH DALLAS

          30 SALES CHICAGO

          40 OPERATIONS BOSTON

        < p>goex_admin@SYBO2SZ> exit

          Disconnected from Oracle Database 10g Release 10.2.0.3.0 - 64bit Production

          robin@SZDB:~> exit

          exit

        < p>Script done on Fri 26 Apr 2013 05:46:32 PM CST < p>b、script 命下直接跟腳本名的示例

          robin@SZDB:~> script -c retval.sh

          Script started, file is typescript

          7788 SCOTT ANALYST 7566 19870419 00:00:00 3100 20

          Script done, file is typescript

        < p>#被執(zhí)行的shell腳本的內(nèi)容

          # Author : Robinson

          # Blog : http://blog.csdn.ner/robinson_0612

        < p>robin@SZDB:~> more ~/dba_scripts/custom/bin/retval.sh

          #!/bin/bash

          RETVAL=`sqlplus -silent scott/tiger <

          SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF

          SELECT * FROM emp WHERE ename='SCOTT';

          EXIT;

          EOF`

          if [ -z "$RETVAL" ]; then

          echo "No rows returned from database"

          exit 0

          else

          echo $RETVAL


        看了“Linux下通過script 命令記錄數(shù)據(jù)庫操作教程”還想看:

        1.怎么備份遠(yuǎn)程mysql數(shù)據(jù)庫的腳本文件

        2.在Windows環(huán)境下訪問linux中MySQL數(shù)據(jù)庫的配置

        2835756 主站蜘蛛池模板: 国产日韩精品一区二区在线观看播放 | 少妇熟女久久综合网色欲| 小13箩利洗澡无码视频免费网站 | 亚洲免费的福利片| 麻豆国产97在线 | 中国| 亚洲人成网线在线播放VA| 99国产精品自在自在久久 | 超碰伊人久久大香线蕉综合| 性无码专区无码| 亚洲中文久久精品无码照片 | 69天堂人成无码免费视频| 亚洲精品中文av在线| 人妻少妇看a片偷人精品视频| 亚洲第一区二区三区av| 久久a级片| 青青草成人免费自拍视频| 日韩伦人妻无码| 久久av色欲av久久蜜桃网| 蜜桃在线一区二区三区| 日韩一区二区三区三级| 国产在线精品一区二区夜色| 少妇高潮太爽了在线观看| 美女爽到高潮嗷嗷嗷叫免费网站| 毛茸茸性xxxx毛茸茸毛茸茸| 国产第一页浮力影院入口| 日韩在线观看中文字幕一区二区| 亚洲欧美日韩成人综合一区| 亚洲理论电影在线观看| 2021国产精品视频网站| 欧美日韩在线亚洲综合国产人| 国产一区二区三区亚洲精品| 性欧美巨大乳| 国产蜜臀精品一区二区三区| 女人香蕉久久毛毛片精品| 国产黄色三级三级看三级| 年轻女教师hd中字3| 人妻夜夜爽天天爽三区麻豆av| 国产精品久久久久久无毒不卡| 日本伊人色综合网| 国产精品无码午夜福利| 无码一区二区三区av在线播放|