[HPADM] SUMMARY: RE: How to extract lines from a file using sed without using line numbers.

From: Latone, Philip (PLatone_at_miracosta.edu)
Date: 12/18/03

  • Next message: Kazakin, Leon: "[HPADM] Sybase and shared memory"
    Date: Thu, 18 Dec 2003 08:32:48 -0800
    To: <hpux-admin@dutchworks.nl>
    
    

    Thanks for all the suggestions. Just about everyone had a different approach. This one by Edi worked right out of the box. Thanks again.
     
    Hi Philip,

    It's almost impossible unless create a small script, because by default sed will scan all occurence of the patterns which will result getting the two portions in your case.
    Try a small script containing 3 lines below, or just run it from command line:

    # echo $(grep -n -e "STARTUP NOMOUNT" -e "# End of tempfile additions" filename | cut -f1 -d: | head -2) | read begin end
    # end=$(($end - 1))
    # sed -n "$begin,${end}p" filename

    Regards,
    Edi Cahyadi

    -----Original Message-----
    From: Latone, Philip
    Sent: Wednesday, December 17, 2003 6:04 PM
    To: Hpux-Admin (hpux-admin@dutchworks.nl)
    Subject: How to extract lines from a file using sed without using line numbers.

    Hello Admins,
     
    I need to extract lines from a file. I can't count lines. I don't know how many there will be, and the number could change. I need to extract only the portion in red. The first line will be always be STARTUP NOMOUNT and the last line will be always be # End of tempfile additions. The first and last lines just described are not unique as they show up again in the bottom half of the file.
     
    begin file.............
    Dump file /home/oracle/admin/EP88DMO/udump/ep88dmo_ora_11039.trc

    Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production

    With the Partitioning option

    JServer Release 9.2.0.1.0 - Production

    ORACLE_HOME = /home/oracle/product/9.2.0

    System name: HP-UX

    Node name: iceman

    Release: B.11.11

    Version: U

    Machine: 9000/800

    Instance name: EP88DMO

    Redo thread mounted by this instance: 1

    Oracle process number: 9

    Unix process pid: 11039, image: oracle@iceman (TNS V1-V3)

    *** SESSION ID:(8.12070) 2003-12-17 15:03:56.528

    *** 2003-12-17 15:03:56.528

    # The following are current System-scope REDO Log Archival related

    # parameters and can be included in the database initialization file.

    #

    # LOG_ARCHIVE_DEST=''

    # LOG_ARCHIVE_DUPLEX_DEST=''

    #

    # LOG_ARCHIVE_FORMAT=%t_%s.dbf

    # REMOTE_ARCHIVE_ENABLE=TRUE

    # LOG_ARCHIVE_MAX_PROCESSES=2

    # STANDBY_FILE_MANAGEMENT=MANUAL

    # STANDBY_ARCHIVE_DEST=?/dbs/arch

    # FAL_CLIENT=''

    # FAL_SERVER=''

    #

    # LOG_ARCHIVE_DEST_1='LOCATION=/home/oracle/product/9.2.0/dbs/arch'

    # LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'

    # LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM SYNC'

    # LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'

    # LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED'

    # LOG_ARCHIVE_DEST_STATE_1=ENABLE

    #

    # Below are two sets of SQL statements, each of which creates a new

    # control file and uses it to open the database. The first set opens

    # the database with the NORESETLOGS option and should be used only if

    # the current versions of all online logs are available. The second

    # set opens the database with the RESETLOGS option and should be used

    # if online logs are unavailable.

    # The appropriate set of statements can be copied from the trace into

    # a script file, edited as necessary, and executed when there is a

    # need to re-create the control file.

    #

    # Set #1. NORESETLOGS case

    #

    # The following commands will create a new control file and use it

    # to open the database.

    # Data used by the recovery manager will be lost. Additional logs may

    # be required for media recovery of offline data files. Use this

    # only if the current version of all online logs are available.

    STARTUP NOMOUNT

    CREATE CONTROLFILE REUSE DATABASE "EP88DMO" NORESETLOGS NOARCHIVELOG

    -- SET STANDBY TO MAXIMIZE PERFORMANCE

    MAXLOGFILES 8

    MAXLOGMEMBERS 4

    MAXDATAFILES 256

    MAXINSTANCES 1

    MAXLOGHISTORY 453

    LOGFILE

    GROUP 1 (

    '/u01/oradata/EP88DMO/log1a.dbf',

    '/u02/oradata/EP88DMO/log1b.dbf'

    ) SIZE 20M

    -- STANDBY LOGFILE

    DATAFILE

    '/u04/oradata/EP88DMO/system01.dbf',

    '/u08/oradata/EP88DMO/wawork.dbf'

    CHARACTER SET WE8ISO8859P15

    ;

    # Recovery is required if any of the datafiles are restored backups,

    # or if the last shutdown was not normal or immediate.

    RECOVER DATABASE

    # Database can now be opened normally.

    ALTER DATABASE OPEN;

    # Commands to add tempfiles to temporary tablespaces.

    # Online tempfiles have complete space information.

    # Other tempfiles may require adjustment.

    ALTER TABLESPACE PSTEMP ADD TEMPFILE '/u05/oradata/EP88DMO/pstemp01.dbf'

    SIZE 524288000 REUSE AUTOEXTEND OFF;

    # End of tempfile additions.

    #

    # Set #2. RESETLOGS case

    #

    # The following commands will create a new control file and use it

    # to open the database.

    # The contents of online logs will be lost and all backups will

    # be invalidated. Use this only if online logs are damaged.

    STARTUP NOMOUNT

    CREATE CONTROLFILE REUSE DATABASE "EP88DMO" RESETLOGS NOARCHIVELOG

    -- SET STANDBY TO MAXIMIZE PERFORMANCE

    MAXLOGFILES 8

    MAXLOGMEMBERS 4

    MAXDATAFILES 256

    MAXINSTANCES 1

    MAXLOGHISTORY 453

    LOGFILE

    GROUP 1 (

    '/u01/oradata/EP88DMO/log1a.dbf',

    '/u02/oradata/EP88DMO/log1b.dbf'

    ) SIZE 20M

    -- STANDBY LOGFILE

    DATAFILE

    '/u04/oradata/EP88DMO/system01.dbf',

    '/u08/oradata/EP88DMO/wawork.dbf'

    CHARACTER SET WE8ISO8859P15

    ;

    # Recovery is required if any of the datafiles are restored backups,

    # or if the last shutdown was not normal or immediate.

    RECOVER DATABASE USING BACKUP CONTROLFILE

    # Database can now be opened zeroing the online logs.

    ALTER DATABASE OPEN RESETLOGS;

    # Commands to add tempfiles to temporary tablespaces.

    # Online tempfiles have complete space information.

    # Other tempfiles may require adjustment.

    ALTER TABLESPACE PSTEMP ADD TEMPFILE '/u05/oradata/EP88DMO/pstemp01.dbf'

    SIZE 524288000 REUSE AUTOEXTEND OFF;

    # End of tempfile additions.

    #

     

    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
    

  • Next message: Kazakin, Leon: "[HPADM] Sybase and shared memory"

    Relevant Pages

    • [HPADM] How to extract lines from a file using sed without using line numbers.
      ... # parameters and can be included in the database initialization file. ... The first set opens ... # the current versions of all online logs are available. ... # Commands to add tempfiles to temporary tablespaces. ...
      (HP-UX-Admin)
    • Re: DROP A DATABASE - urgent help please
      ... > i need to drop a database asap as i cannot mount the oracle instance. ... > control file to trace, i copied said trace file and edited it to ... Edit your current init.ora file named with the old db_name value to ...
      (comp.databases.oracle.server)
    • Re: Are we screwed??
      ... > names, etc, he tried to open the database and got some control file ... > SID in the control file, ... > file to trace. ...
      (comp.databases.oracle.server)
    • DROP A DATABASE - urgent help please
      ... i need to drop a database asap as i cannot mount the oracle instance. ... ORA-01103 database mydb2 in control file is not mydb ...
      (comp.databases.oracle.server)
    • Re: Are we screwed??
      ... No error messages in your whole post ... Apparently after changing the init.ora and directory names, etc, he tried to open the database and got some control file consistancy error. ... he could not backup the control file to trace. ...
      (comp.databases.oracle.server)