shell script to generate the redologs

I'm working on RMAN in the test environment.

because there in no generation of redo or very minor redo generation. I want to write a shell script that runs through cron tasks after a certain time and generate recovery logs. What I want to do to test the RMAN backup of the archivelogs mechanism and also the confirmation of the removal of the archivelogs by rman;

write a script, but it does not redo logs


#! / bin/sh
export ORACLE_HOME=/opt/dev/oracle/db/tech_st/11.1.0
CD $ORACLE_HOME
. ./TEST_testing.env

sqlplus / as sysdba

SQL 'alter system switch logfile;

/

output


When I run the sqlplus script is connected but alter system switch logfile does not run.


Please guide me. can I run the sql via such script commands or not. In addition, take a look at script as well.

Published by: user13376823 on February 16, 2011 17:06

Do you mean that you need to switch redo logs so that the archives are generated?

If Yes... Why reinvent the wheel?

Oracle already has a parameter (ARCHIVE_LAG_TARGET) for this purpose.

Tags: Database

Similar Questions

  • Pass the Shell script variable to the plsql block

    Hello
    I have a shell script and pass the parameter of Shell script in a PLSQL block, I use the code but impossible to get any result, below
    Can someone help me with this issue?

    Shell script: test.sh


    * #! / bin/sh *.

    var1 = $1

    SQLPLUS = 'sqlplus-s ".
    Login = "gmisowner/gmisowner1".

    day ='$SQLPLUS $LOGON < < ++
    set the position
    Set feedback off

    Start
    select count () from mis_ref_codes where ref_description = & var1; *

    end;

    "exit";
    ++`

    echo $day

    Execution at the command prompt: >./test.sh Underline
    returns nothing

    1. I was hoping the count (*) in the number of lines in him select statement is stored in the day, but nothing returned as output of the plsql block
    the select statement above is an example, but I'll have to run a much larger plsql block

    I have syntactically doing something wrong? Please suggest

    Published by: Camilla January 14, 2012 12:35

    First of all you needget get rid of anonymous PL/SQL block:

    var1=$1
    
    SQLPLUS="sqlplus -s"
    LOGON="gmisowner/gmisowner1"
    
    day=`$SQLPLUS $LOGON <<++
    set heading off
    set feedback off
    select count(*) from mis_ref_codes where ref_description=&var1;
    exit;
    ++`
    echo $day
    

    But it still does not work. Your SQL * more script a proxy & var1. It has nothing to do with shel environment variable var1. That is why SQL * PLus prompts you to enter the value just after she readings

    Select count (*) in the mis_ref_codes where ref_description = &var1;

    And since you redirected input to your script, you must put value of var1, which isn't what you want, right? So what you need is:

    dev > # I'll set $1 to X
    dev > set X
    dev > var1 = $1
    dev > SQLPLUS = 'sqlplus-s ".
    dev > login = ' / '.
    dev > ='$SQLPLUS $LOGON < < EOF
    > set position
    > leave your comments
    > set verify off
    > select ' Have a nice day! "twice where dummy ="$var1 ";
    > "exit";
    > EOF'
    dev > echo $day
    Good day!
    dev >

    SY.

    Published by: Solomon Yakobson on 13 January 2012 15:17

  • Script to generate the sys files os trail audit report

    Hello

    We have a large database, where 1000 bone trail files are generated every day.   Except sys, we get all the information lo - Gin of dba_audit_trail.

    But the listener wants the audit information sys too.

    It is very difficult to manually move all the files in the operating system. I tried to make a script to generate a report. But I do not succeed until now.

    If you have any of you have used or by using a similar script to generate a report of os audit .aud file sys. Please provide that.

    Also let me if there is another way to collect audit sys information easily.

    Thanks and greetings

    Marou

    Hi berang,.

    I wrote an article (http://www.dbarj.com.br/en/2014/10/retrieve-oracle-sysdba-audit-os-files-inside-table/) explaining exactly how to do it using the external Table with preprocessor function.

    Why don't you take a look and fit the need? I hope you enjoy.

    Kind regards

    Rodrigo

  • Script to generate the report to PAHO are / s

    Hello

    I've been looking around for a script, but I can't seem to find what I'm looking for. I would like something that would be lifted all VM would generate a report CSV which show the use of the IOPS / s by VM and all of the clusters and data warehouses (all).

    I just want to be able to assess what VM is particularly taxing our storage arrays.

    Any help or pointers in the right direction would be appreciated.

    Thank you!

    You mean something like this?

    It collects the IOPS for the full Eve and send the result by e-mail

    $metrics = "disk.numberwrite.summation","disk.numberread.summation"$finish = Get-Date -Hour 0 -Minute 0 -Second 0$start = $finish.AddDays(-1)$report = @()
    
    $vms = Get-VM | where {$_.PowerState -eq "PoweredOn"}$stats = Get-Stat -Stat $metrics -Entity $vms -Start $start -Finish $finish$interval = $stats[0].IntervalSecs
    
    $lunTab = @{}foreach($ds in (Get-Datastore -VM $vms | where {$_.Type -eq "VMFS"})){  $ds.ExtensionData.Info.Vmfs.Extent | %{    $lunTab[$_.DiskName] = $ds.Name  }}
    
    $report = $stats | Group-Object -Property {$_.Entity.Name},Instance | %{  $readStat = $_.Group |    where{$_.MetricId -eq "disk.numberread.summation"} |    Measure-Object -Property Value -Average -Maximum  $writeStat = $_.Group |    where{$_.MetricId -eq "disk.numberwrite.summation"} |    Measure-Object -Property Value -Average -Maximum  New-Object PSObject -Property @{    VM = $_.Values[0]    Start = $start    Finish = $finish    Disk = $_.Values[1]    IOPSWriteMax = [math]::Round($writeStat.Maximum/$interval,0)    IOPSWriteAvg = [math]::Round($writeStat.Average/$interval,0)    IOPSReadMax = [math]::Round($readStat.Maximum/$interval,0)    IOPSReadAvg = [math]::Round($readStat.Average/$interval,0)    Datastore = $lunTab[$_.Values[1]]  }}
    
    Send-MailMessage -Subject "IOPS Report" -From [email protected] `  -To [email protected] -SmtpServer mail.lucd.info `  -BodyAsHtml -Body ($report | Select VM,Start,Finish,Disk,Datastore,IOPSWriteAvg,    IOPSWriteMax,IOPSReadAvg,IOPSReadMax | ConvertTo-Html | Out-String)
    
  • shell script to determine the width of the file, size, resolution cs5 js

    I use a Script of Michael L Hale (core.quickMetadata "that uses" xmp.getProperty "and the bridge") to determine the size and the resolution of files without having to open or place.

    Unfortunately, it fails with some files (non-Photoshop generated bitmaps, seems).

    (PDF, I treat differently altogether to avoid the problem determination pages pdf counties and potential problems with PDFs containing different size pages.)

    "None of you do not know if and how you can reach resolution with" app.system "in CS5, the height, the width of the files?

    I may have come across before, but is unable to locate such a thread currently.

    Thanks for any input.

    The following 2 options that you can use if you want to clear all information in text file then analyze js. You could see if one of these contain the data that you are after?

    #target bridge
    
    var foo = File('~/Desktop/SomeFile.tif');
    
    getAllXMLSIPS(foo);
    
    //getMetaDataMDLS(foo)
    
    function getAllXMLSIPS(f) {
         if (f instanceof File && f.exists) {
              var shellString = "sips --getProperty allxml ";
              shellString += f.fsName;
              shellString += ' > ~/Documents/StdOut.txt';
              app.system(shellString);
         }
    }
    
    function getMetaDataMDLS(f) {
         if (f instanceof File && f.exists) {
              var shellString = "/usr/bin/mdls ";
              shellString += f.fsName;
              shellString += ' > ~/Documents/StdOut.txt';
              app.system(shellString);
         }
    }
    
  • PowerCli script to generate the report for the VM and ESXi model

    Hello

    I'm trying to generate a report for the virtual machines to a domain controller that includes the operating system, Cluster and host of brand and model of ESXi, but for some reason any the ESXi info does not come through. Any help is greatly appreciated.

    Get-data center 'TEST ' |

    Get - vm |

    WHERE-object {$_.} PowerState - eq "Receptor"} |

    Select Name, @{N = "OS"; e = {$_.}} Extensiondata.Guest.GuestFullName}},

    @{N = "Cluster"; E={$_. VMHost.Parent}},

    @{N = 'Esxi model'; E = {Get-VMHost - VM $_.} VM | {{Select model}}

    The virtual machine has the properties of the host.  For your information "Model ESXi" use $_. VMhost.Model, $_ is the current information for pipeline for the virtual machine.  You did for the section "cluster".

  • Call the OBIEE Unix Shell Script

    Hi all

    Is it possible to make a call to a Unix Shell Script with the framework of the Action of OBIEE.

    Thanks in advance

    I don't think, but we can go for it instead side BI. Try to transfer the same features side shell script so that the script can identify your report using the tail of the log nqquery and execute the rest of your lines in shell script.

    This can done and works as expected. If you identify your report instead of this long logical query at all with my suggestion that you can go for a little keyword.

    Score pls help if

  • Why the sql statement was extucted twice in shell script?

    I tried to test the rac load balancing using the shell script depending on suse 10 + oracle 10g rac.
    oracle@SZDB:~> more load_balance.sh
    #!/bin/bash
    for i in {1..20}
    do
    echo $i
    sqlplus -S system/oracle@ORA10G <<EOF
    select instance_name from v\$instance;
    /
    EOF
    sleep 1
    done
    exit 0
    After run the shell script, I got the result to follow.
    oracle@SZDB:~> ./load_balance.sh
    1
    
    INSTANCE_NAME
    ----------------
    ora10g2
    
    INSTANCE_NAME
    ----------------
    ora10g2
    
    2
    
    INSTANCE_NAME
    ----------------
    ora10g1
    
    INSTANCE_NAME
    ----------------
    ora10g1
    
    3
    
    INSTANCE_NAME
    ----------------
    ora10g1
    
    INSTANCE_NAME
    ----------------
    ora10g1
    Seem that the sql statement was run twice in each loop. If you help please take a look. Thanks in advance.

    Robinson

    Because you have one; and one.

  • Put 'do shell script' multi-line with comments

    I would like to integrate a Bash in Applescript script, as it is on several lines with comments.

    The only documentation useful, that I can find is tn2065, but as far as I can see, it does not say how.

    What is the correct syntax?

    Maybe I'm missing something, but you can just write your script bash as a text object and passing to the shell script:

    game of longBashCommand to "# some relevant comments.

    CD /somedir

    / bin/something - foobar

    # one other comment here

    / bin/Gisèle

    ' # one other comment.

    the shell script longBashCommand

    The trickiest part is perhaps the need to escape some characters such as quotation marks in the command shell.

  • Script Automator for the DATE and TIME stamped record

    Hi all

    I'm not a scripter, but are in need of a DATE and time-STAMPED folder (or file) I would like to put on my desktop and have updated automatically so that I can use this tool to quickly see if a backup external (or internal) is current. probably I could also use it to quickly find out how /old/ a backup is.

    for now, I do this manually if I want to quickly verify that a backup works by creating a "date named folder" on the desktop - such as '-2016 03 26 "."» so I can quickly see if a backup I just ran ran.

    I have a lot of backups (internal, external, off site, etc.) and it would be super useful for me to have.

    I consider the name of the folder to be customizable (potentially) in case I need to change it, but a good default would be "-YEAR MONTH DAY" so that I could see easily when this backup has been but also I name my files in this way so they can appear in chronological order "."

    is anyone able to help me with something like that or suggest another forum for cross-post this?

    Thank you

    Jon

    Hello

    Create the the ""new folder " action, like this:"

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

    Drag and drop the 'Shell Script' variable in the "name:" field.

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

    Double click on the variable in the "name:" field:

    Copy and paste this text in the field 'Script ':

    date "+%Y %m %d"
    
  • AppleScript and shell scripts

    I'm on Mac OS X 10.11.2 and have problems with AppleScript and shell scripting.

    The following script is a cutting of a larger project:

    Tell application "Finder".

    the value the_MePath (path for me)

    the value the_MeCont (the_MePath container) as string

    tell the end

    the value of the_MeCont (text 1 thru-2) the_MeContShell

    -normally isn't here!

    the value the_MePara (the_MeCont & "STH - C Para WAV_48k_24.txt")

    the value the_Parameters (opening for access file the_MePara with permission to write)

    write ("WAV\r24\r48000\r48k\r") the_Parameters

    Close access the_Parameters

    -normally isn't here!

    -destined to be there!

    -the value the_MePara (shell script 'find' & city form the_MeContShell POSIX path & "-iname" "Para STH - C *'")

    the value the_Parameters (opening for access file the_MePara)

    the value the_ParaList (read the the_MePara file)

    Close access the_Parameters

    paragraph 1 of the value userFormat the_ParaList

    paragraph 2 of the the_ParaList the value userBitDepth

    paragraph 3 of the the_ParaList the value userSampleRate

    paragraph 4 of the the_ParaList the value shortSampleRate

    The lines between the "-normally isn't there!"-lines fills a file in the directory of the AppleScript with the data.

    So now the file is there.

    If I remove these lines and enable the line below "-intended to be here! ', the shell should find this file.

    What I get, then, is a mistake:

    "Fehler beim Zugriff auf das Netzwerk." error number - 5000 file "/ users/shared/_AppleScript development/_Archiv Sniplets/STH-C Para WAV_48k_24.txt" to "class fsrf".

    to "open for access file the_MePara.

    Any ideas, anyone?

    Kind regards...

    ... Maik

    Hello

    Remove the end of file before the_MePara.

    the_MePara contains a posix path type path--> "/ users/shared/_AppleScript development/_Archiv Sniplets/STH-C Para WAV_48k_24.txt.

    You can use the file on the path of type HFS --> ' StartupDiskName:Users: shared: _AppleScript development: _Archiv Sniplets:STH - C Para WAV_48k_24.txt.

    Information:

    The script didn't need to open and close the access when the script to read-only.

    Use this line only--> the value the_ParaList to read the_MePara

  • script for generating data

    Hello

    get DDL package, we find the script to create a table.

    Is it possible to find a script to generate the same data?

    Thank you.

    John Stegeman wrote:

    SQL Developer can create a script to "insert" with the results of a query. Just run your query, right-click in the grid of results and choose 'export' - from there you can choose the format "Insert", and you'll get a script with instructions insert containing your data.

    I just made this in SQL Developer

    Select / * Insert * / * from emp;

    or

    Select / * csv * / * from emp;

    ..

    There is much more

    And press F5. This feature is very convenient!

  • Shell script to catch DB

    Hi all

    I have oracle DB in Amazon EC2. This DB will go down and I have to make every day.

    I want to write a shell script that checks the State of the DB and do.

    The things I do is

    Log in as root
    Su - oracle

    sqlplus
    user name:
    PWD:

    If DB is down, it shows error.

    So I'll do it again
    Log in as root
    . / stopPageview
    Su - oracle
    sqlplus
    user name: sys as sysdba
    PWD:

    the judgment
    startup

    output
    output
    . / startPageview

    How automatically using shell script?

    Published by: 969707 on January 9, 2013 04:36

    #! / bin/bash
    #
    # /etc/init.d/oracledb
    #
    # Startup script execution for the Oracle Listener and instance level
    # It relies on information on/etc/oratab

    # These are the paths for our basic installation
    export ORACLE_BASE = / opt/oracle
    export ORACLE_HOME=/opt/oracle/product/11.1.0/db_1
    Export ORACLE_OWNR = oracle
    export PATH = $PATH: $ORACLE_HOME/bin

    If [! f $ORACLE_HOME/bin/dbstart - o! d $ORACLE_HOME]
    then
    echo "Oracle startup: cannot start.
    Output 1
    FI

    case '$1' in
    implementation)
    # Start a listener and oracle instance
    echo - n "starting from Oracle:
    known $ORACLE_OWNR - c "start ORACLE_HOME/bin/lsnrctl $".
    known $ORACLE_OWNR-c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME.
    touch/var/lock/oracle
    echo 'OK '.
    ;;
    stop)
    # Stop listener and oracle instance
    echo - n "" shutdown Oracle: "."
    "judgment of $ORACLE_HOME/bin/lsnrctl" known $ORACLE_OWNR - c
    known $ORACLE_OWNR-c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME.
    RM-f/var/lock/oracle
    echo 'OK '.
    ;;
    reload | restart)
    $0 stop
    starting at $ 0
    ;;
    *)
    echo "use:" basename $0' start | stop | restart | reload. "
    Output 1
    ESAC

    Exit 0

    also use link below to create start & stop the database...
    http://www.Oracle-base.com/articles/Linux/automating-database-startup-and-shutdown-on-Linux.php
    http://www.exzilla.NET/docs/instance/StartupNshutdownWithshell.php

    *****************************************
    Best regards
    Shishir Tekade.
    My Blog: http://shishirtekade.blogspot.com

  • Password Oracle symbol # does not not in shell script

    I have the shell script that exports the database schema. My Userid password export subscription contains #. Shell script is throwing error. If we have the password without this character, then it works fine. How do we use the password in shell script to perform this task?

    $ORACLE_HOME/bin/expdp system/test #test = userid parfile test.par dumpfile = test.dmp =

    I tried to use double-quotes and apostrophes for this password... but it still does not. any help is appreciated.

    Please post the contents of test.par.

    You can try to run before running EXPDP:

    drop table SYSTEM.EXP_DEVDB06;
    

    Edited by: P. Forstmann on 27 Jan. 2010 17:46

    Edited by: P. Forstmann on 27 Jan. 2010 17:47

  • shell script for oracle alert.log file

    Hi gurus,

    I want to write the shell script to know the last timing 10 stop of the database of the alerts log file. I'm working on oracle 9i.

    Could someone please advice on that.

    Thanks in advance

    Kind regards
    Shaan

    Published by: Shaan_dmp on January 5, 2009 13:27

    Published by: Shaan_dmp on January 5, 2009 13:28

    Use awk. I have not at hand a 9i but here is a very simple version for 10g XE

    My awk file (line numbers for the notes below - don't include them):

    01:BEGIN { prevline = "";} 02:03:/Completed: alter database close/ {print prevline,FS,$0;}04:05:{prevline = $0;}
    

    The command line and the results (from my alert log 300 k)

    $ awk -f alert.awk.txt alert_xe.logFri Apr 11 18:08:40 2008   Completed: alter database close normalFri May 16 18:53:21 2008   Completed: alter database close normalTue May 20 17:28:23 2008   Completed: alter database close normalThu Jul 17 19:08:52 2008   Completed: alter database close normalFri Aug 15 15:12:48 2008   Completed: alter database close normalWed Nov 05 08:52:59 2008   Completed: alter database close normalFri Nov 14 16:36:03 2008   Completed: alter database close normalTue Dec 09 10:46:23 2008   Completed: alter database close normalMon Jan 05 11:12:22 2009   Completed: alter database close normal
    

    What it means:

    (1) section START line 01 defines the variable to contain the previous line
    (2) the /search chain / line 03 search marker in the file for a stop, and then performs the requested action (print the time that was in the previous line and then this line; use FS (the field to the awk - space normally separator) as a separator
    (3) on line 05 is a statement that we do on each line - is remembered in case it is the timestamp for the closure.

    Now, you can include several cases corner for closures by adding several models of research etc. For more information, google for examples of awk.

    AWK is really good at this sort of thing!

    HTH

    Nigel cordially

Maybe you are looking for

  • Effect of transition zoom at 01:32.

    Someone knows how to achieve this transition zoom in FCPX starting at 01:32. Any help would be amazing! https://www.YouTube.com/watch?v=1WJ8Twi3KSY

  • What is the different between firefox "Sync Key" and "key recovery"?

    The problem is: I can't get my data from server. I have my key to 'Sync', and I used it several times before, but now Firefox says its wrong. Are 'sync key' and two 'recovery key' names to a single key or its two different keys?

  • New iChat account?

    I'm trying to help my mother.  (She is in Minnesota, I'm at the Japan). She is using Snow Leopard. She needs a new account to connect to iChat. How is it more easily possible? The option "get an iChat account" within iChat would apparently not for hi

  • I need a part number for a dv9000 series audio connection motherboard Intel... Please.

    I have a HP dv9723cl that I finally gave up on due to some problems with the motherboard that no one seemed to have ideas for. Well, I bought a replacement motherboard, but accidentally bought a motherboard Intel instead of card mother AMD that was o

  • What can I do to correct an error of ipconfig?

    I had internet connectivity problems and tried to solve the problem.  I tried to run ipconfig from the command prompt and get the following error message: An internal error has occurred.  A device attached to the system does not work.Additional infor