Unix style commandos in perl script OEM agent 10.2.05

Hi,
Is it possible to execute unix style command's like ps on a Windows server? Looking at the perl scripts in $OEM_AGENT/sysman/emd/scripts I see unix style command's. Is OEM converting those command's to Windows equivalents?
I've a perl script which has to be run against Linux and Windows servers and I'm hoping the agent will execute those Unix command (it is only a ps command) on a Windows machine.
regards,
Ivan

Ivan,
Have you considered using Cygwin?
http://www.cygwin.com
Regards,
- Loc

Similar Messages

  • Unix Perl Script To verify a Up and Running Database on Different Server

    Unix Perl Script To verify a Up and Running Database on Different Server
    Hi
    can any one please tell me a solution to verify a Up and Running Database on Different Server other than the one where we run the unix perl script? The perl script should check if the database is running else it must exit.
    Thanks much
    Kiran

    The other best solution would be Enterprise Manager, load the EM on the other machine and install oracle intelligent agent on all the boxes where oracle is running and problem solved.
    FTP is only a File Transfer Protocol, you can upload/download the files but cant execute them.
    Apart from EM the best way is load oracle client and make connection to all the databases.
    AND There are some free oracle monitoring software available I dont know much about them but one is NAGIO (if I am not wrong), try that if you want.
    BTW whats the problem in monitoring the boxes from the same physical box, means just schedule a script using cron on the same physical box where oracle is to either make connection using SQLPLUS or check the processes using "ps" command and if there is anything wrong then send alert from that box only. In this way there is no need to maintain a central monitoring server.
    Daljit Singh

  • Perl script and unix users

    Hi, I have a perl script that connects to a regular users account, using DBI/DBD::Oracle. It works fine is the UNIX user is in the oinstall group, but if its in oracle, dba or neither it gives me the following error:
    DBI connect('orcl','xxxxxxx',...) failed: ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin) at /terida/opt/smarthost/updatedatabases.pl line 15
    I'm guessing here that Perl DBD::Oracle needs access to a specific file in the oracle installation perhaps ? I'm also gonna wager that letting it live in the oinstall group is not recommended..
    Tips?
    Thanks

    For people running into ORA-24327 errors with DBD::Oracle: the underlying cause is often a missing hostname, but the ORA-24327 error message is misleading. I've submitted a patch for DBD::Oracle to trap and report errors like this in OCIServerAttach, which will hopefully make it into the 1.29 release.
    https://rt.cpan.org/Public/Bug/Display.html?id=68958
    Marc

  • Can an Applet call a Perl script that performs Unix file commands?

    Hi,
    I would like my applet to move a Unix file from one directory to another. (Both directories and the file are on the same server as the applet).
    In my applet I have code that calls (I think) a Perl script through a URL connection and passes the name of the file that needs to be moved:
    URL urlMove = new URL("http://myserver.com/cgi-bin/fileMove.pl?" + fileToMove);
    URLConnection urlConn = urlMove.openConnection();
    In the cgi-bin I have a perl script (fileMove.pl) that performs the move:
    #!/usr/bin/perl
    use CGI qw(:standard);
    $pfile = $ENV{?QUERY_STRING?};
    $cmd = ?mv stageArea/$pfile $pfile?;
    system $cmd;
    The Perl script works fine when I call it directly from Internet Explorer, but when I call the script from the Applet the file is not moved. Am I doing something wrong?

    Got it to work!
    Changed the Java code to:
    URL urlMove = new URL("http://myserver.com/cgi-bin/fileMove.pl?" + fileToMove);
    urlMove.openConnection();
    InputStream moveStream = urlMove.openStream();
    and in the Perl script added the line:
    print "Content-Type: text/html\n\n";
    The applet running my a PC is now effortlessly moving files on the unix server, wahoo.
    Aside: I also found that my applet web server and the files the applet reads/writes do not have to be on the same machine. In the applet's cgi-bin directory I created a "link" to the networked unix directory where the image files are actually located. I really expected the Applet I/O Security to complain, but it work like a charm. Go figure.

  • Perl script using perldap under unix

    Hi,
    I've got a perl script (used by a UTC instance) which runs on windows NT and which use the perldap API.
    I'm trying to install it on Solaris with the Directory Server 5.1 SP2 and the Meta Directory 5.1 installed.
    When i use the nsperl located in ../iplanet/servers/lib/nsPerl5.005_03, the script works.
    But when i use it with the nsperl located in sunone/servers/bin/utc50/admin/bin (which is used by the UTC instance) it doesn't work.
    The error message is :
    Can't locate loadable object for module Mozilla::LDAP::API in @INC (@INC contains: /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/sun4-solaris /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/site_perl/sun4-solaris /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/site_perl . /LOCAL/nsPerl5.004_04/lib/sun4-solaris /LOCAL/nsPerl5.004_04/lib /LOCAL/nsPerl5.004_04/lib/site_perl/sun4-solaris /LOCAL/nsPerl5.004_04/lib/site_perl .) at /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/sun4-solaris/Mozilla/LDAP/Utils.pm line 29
    BEGIN failed--compilation aborted at /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/sun4-solaris/Mozilla/LDAP/Utils.pm line 29, <GEN0> chunk 26.
    BEGIN failed--compilation aborted at /var/cyril/sunone/servers/lib/nsPerl5.004_04/lib/sun4-solaris/Mozilla/LDAP/Conn.pm line 32, <GEN0> chunk 26.
    Does anybody know how to do to avoid this problem ?
    Thanks a lot.

    The message indicates PerLDAP is not installed into that Perl library. You could install, but do you need to really? If you need to run PerLDAP Metadirectory scripts, then maybe this would be the only way. But I would check with support - this may not be supported - changing the Perl install with Metadirectory. But they should be able to tell you how. If you don't need to run the PerLDAP Meta-scripts, then just use a seperate Perl install from the ones that come with the Sun servers. We use #!/usr/local/bin/perl.

  • Can't open perl script "/opatch.pl": No such file or directory

    After installed Oracle 9.2.04 and applied patch p3006854, p3948480 and p4188455 on Linux AS4, I found that I can not start agent. If I execute "agentctl start", oracle will through our error like:
    Starting Oracle Intelligent Agent.../u01/app/oracle/product/9.2.0/bin/dbsnmpwd: line 156: 1855 Segmentation fault nohup $ORACLE_HOME/bin/dbsnmp $*
    $DBSNMP_WDLOGFILE 2>&1/u01/app/oracle/product/9.2.0/bin/dbsnmpwd: line 156: 1868 Segmentation fault nohup $ORACLE_HOME/bin/dbsnmp $* >>$DBSNMP_WDLOGFILE 2>&1
    /u01/app/oracle/product/9.2.0/bin/dbsnmpwd: line 156: 1880 Segmentation fault nohup $ORACLE_HOME/bin/dbsnmp $* >>$DBSNMP_WDLOGFILE 2>&1
    /u01/app/oracle/product/9.2.0/bin/dbsnmpwd: line 156: 1892 Segmentation fault nohup $ORACLE_HOME/bin/dbsnmp $* >>$DBSNMP_WDLOGFILE 2>&1
    I searched Internet and some article said p3238244 is needed. So I started to install it. At the very beginning, the error is "Can not find ../oui/OraInstall.jar". I found this file in "../oui/jlib" and copy it to "../oui". Then I run "opatch apply" and the error is "Can't open perl script "/opatch.pl": No such file or directory". This time I can not find much similiar information from google.
    Any idea?
    PS: I changed path of inventory during the installation to "/henry/cwdata" ($ORACLE_HOME=/henry/app/oracle/product/9.2). Will this action cause the error below? What is the usage of inventory path exactly?
    Much appreciated!
    Henry

    Below is my env and .bash_profile.
    [oracle@henrylinux lib]$ env
    SSH_AGENT_PID=2814
    HOSTNAME=henrylinux
    SHELL=/bin/bash
    TERM=xterm
    HISTSIZE=1000
    NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
    GTK_RC_FILES=/etc/gtk/gtkrc:/home/oracle/.gtkrc-1.2-gnome2
    WINDOWID=39880874
    OLDPWD=/home/oracle
    ORACLE_OWNER=oracle
    USER=oracle
    LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;0 1:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.b tm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31: *.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:* .bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;3 5:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
    ORACLE_SID=ora92
    GNOME_KEYRING_SOCKET=/tmp/keyring-BckaCh/socket
    ORACLE_BASE=/henry/app/oracle
    SSH_AUTH_SOCK=/tmp/ssh-nsWlKX2762/agent.2762
    KDEDIR=/usr
    SESSION_MANAGER=local/henrylinux:/tmp/.ICE-unix/2762
    GDN_LANG=en_US
    MAIL=/var/spool/mail/oracle
    DESKTOP_SESSION=default
    PATH=/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/oracle/ bin:/henry/app/oracle/product/9.2/bin:/henry/app/oracle/product/9.2/Apache/Apach e/bin:
    INPUTRC=/etc/inputrc
    PWD=/henry/app/oracle/product/9.2/ctx/lib
    THREADS_FLAG=native
    LANG=en_US.UTF-8
    LC=en_US
    ORACLE_TERM=xterm
    GDMSESSION=default
    SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
    HOME=/home/oracle
    SHLVL=2
    LD_ASSUME_KERNEL=2.4.19
    GNOME_DESKTOP_SESSION_ID=Default
    LOGNAME=oracle
    LC_CTYPE=zh_CN.GB2312
    CLASSPATH=/henry/app/oracle/product/9.2/JRE:/henry/app/oracle/product/9.2/jlib:/ henry/app/oracle/product/9.2/rdbms/jlib:/henry/app/oracle/product/9.2/network/jl ib
    DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Z7HVMAC8Dh
    LESSOPEN=|/usr/bin/lesspipe.sh %s
    ORA_NLS33=/henry/app/oracle/product/9.2/ocommon/nls/admin/data
    DISPLAY=:0.0
    ORACLE_HOME=/henry/app/oracle/product/9.2
    G_BROKEN_FILENAMES=1
    COLORTERM=gnome-terminal
    XAUTHORITY=/home/oracle/.Xauthority
    _=/usr/bin/env
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi
    # User specific environment and startup programs
    PATH=$PATH:$HOME/bin
    export ORACLE_BASE=/henry/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/9.2
    export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:/sbin
    export ORACLE_OWNER=oracle
    export ORACLE_SID=ora92
    export ORACLE_TERM=xterm
    export LD_ASSUME_KERNEL=2.4.19
    export THREADS_FLAG=native
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
    export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
    export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
    export DISPLAY=:0
    export LANG=en_US
    export GDN_LANG=en_US
    export LC=en_US
    export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
    export LC_CTYPE=zh_CN.GB2312
    export PATH
    unset USERNAME

  • Shell or perl script from OS command_Sender File Channel

    Hi All,
    I am trying to execute a perl script from the File Sender Channel(NFS), OS command Before Message Processing. The script works fine if i run it from the shell. But when PI calls the script,  the script does not get executed. The audit logs mention that the OS command has been called.
    I tried using:
    1) /<fullpath>perlScript.pl /<fullpath>filename.dat
    2) perl /<fullpath>perlScript.pl /<fullpath>filename.dat
    Both these commands work fine when i execute them on the shell.
    I am on solaris and PI 7.0. The permission for the perl script and input files are all 777.
    FYI.. i am using this perl script to transpose a complex file and make it # delimited file.
    I have already read the blogs for OS command and executed some sample scenarios successfully.
    I tried to call a shell script that does the same functionality as the perl script. Even that does not work.
    Also, wrote a shell script to call the perl script inside it. No luck.
    eg:
    touch /fullpath>/create_before.dat
    perl /<fullpath>perlScript.pl /<fullpath>filename.dat
    touch /<fullpath>/create_after.dat
    In this case, the create_before.dat and create_after.dat is getting created but the perl is not called. I know this because i cant see the output files of the perl script.
    Regards,
    Balaji
    Edited by: Balaji M on Oct 30, 2008 2:36 PM

    Hi,
    The problem is fixed. The shell or perl both have logic to transpose a non industry starndard file to the delimited file which PI can use an FCC to pick up.
    This was the fix:
    we need to mention the shell the script is going to be run in.
    In the shell script we mentioned --> *#!/usr/bin/bash* as the first line
    normally, when we use the command -- which bash on the unix command prompt, it tells us the path for the bash used.
    another option --> #!/usr/bin/ksh
    again, on the command prompt -- which ksh command will tell us what ksh is being used.
    If the script is a simple one that does copy or move commands, i believe we need not use the commands above. But is a good practice to have them in the script.
    Regards,
    Balaji
    Edited by: Balaji M on Nov 3, 2008 4:38 PM

  • Under a GUI, I need to run a perl script, how to do this?

    Hi - I am writing a GUI for my clients and one of the things my program must do is run a perl script. I am able to run perl.exe but it seems like perl.exe is not running the script. I also tried to put the perl script in a batch file and then call the batch file from my java GUI program. I still get the same issue of just perl.exe running but thats not running the script. My last attempt was to write a small class to test if perl.exe can run the script under a command line. I got the perl.exe to run the perl script but how do I but implement that class in my GUI if my test class needs a command line? How can I run a command line in my GUI so the perl script can be run.
    The Runtime.getRuntime.exec(RunPerlScript) is not working like I want it.
    I also tried Runtime r = Runtime.getRuntime();
    Process p = r.exec(RunPerlScript);
    How can I run the MS-DOS prompt from my program if the Runtime Environment is running already. The Runtime Environment seems to not allow another prompt to be opened and from there I can run the perl script manually or automatically from my program.
    What does the "cmd /c start..." or "c:\\windows\\command.com..." do? I have seen that in the forum but it doesn't seem to be running the perl script. The perl.exe runs, but not the perl script. I need anyones help desperately. Damn microsoft, why did they remove completely the functionality of DOS. I have a feeling my program will run perfectly under a UNIX environment, because I needed to do was open another shell. Thats what I need in windows!
    Thank you for your help.
    Seigot

    hi
    I am working on this perl scripts do run on GUI's well the process command is fine try java 1.3 it works fine. if u need more help let me know
    all the best

  • Geany Trouble: Compiling Perl Scripts (and general Perl questions)

    I'm brand new to Perl because I hear it's one of the best and so far I've found that it is.  I used to program a little C++ here and there and a while ago taught myself python but I'd have to say Perl is better than both of them.  At any rate, that's neither here nor there.  I use Geany and love it, so I didn't see a reason to switch to something new for Perl.  Unfortunately I'm having some trouble with compiling.  Geany flat out refuses to.  I looked around and didn't find anything on here or in the wiki or on the Ubuntu forums other than one person who said to replace the compile command with the execute command. 
    So, do I even need to compile my Perl scripts or is there something else I'm missing?
    On a somewhat related note, the same user on the Ubuntu forums said that at the top of the code there should be:
    #!/usr/bin/perl -w
    I'm curious if I need the "-w" or what it even does since as of right now I have
    #!/usr/bin/perl
    and executing the program poses no problems.
    Any help is greatly appreciated,
    --Wes

    Well, for one, perl is not a compiled language. You can if you want to, but it gains you few benefits. Google for "perl compiler" if you really must.
    As for the second, do you know how the shebang line works in unix, and do you know what the -w option does for perl? The answer should reveal itself to you.
    Make sure you "use strict;", it will catch many errors.

  • Amateur with perl script

    Trying to use the small perl script referred to in the message down below to send mail from the command line using unix mail. Any advice about what the error message immediately below refers to will be appreciated.
    "smtp.mac.com" is not exported by the Net::SMTP module
    Can't continue after import errors at myprogram.pl line 5
    BEGIN failed--compilation aborted at myprogram.pl line 5.
    Bill, below is a good example of how to do it with the perl script method. I use my verizon smtp server (outgoing.verizon.net) to send the mail. I haven't been able to use the postfix server on my own Mac to do it. Maybe someone can help us learn how to do that.
    http://members.toast.net/strycher/perl/examplenetsmtp.htm
    Boyd

    I suggest that you find a better
    source of information. I was finally able to make the
    date_r method work in this example but I had to write
    my own tz_offset function.
    I agree, I'd find a better example somewhere. Looking at that page, I'm fairly certain that those examples are simply taken out of much larger scripts without regard to whether they'd actually run as written.
    And the date_r subroutine is just plain odd, if you ask me. I'm not sure why he'd go to the trouble of writing it like that when he could do it with two lines of code. Unless he can't use POSIX on Windows...
    First, he'd just have to add
    <pre class="command">use POSIX qw(strftime);</pre>to the top of his script, then he could get the date/time formatted more or less like he had it with this:
    <pre class="command">my $date = strftime("%A, %e %B %Y %T %z", localtime(time));</pre>I'm not sure about the time zone offset being "-500" and not "-0500", which is more what I'm used to seeing.
    This page has a more straightforward explanation and example of how to use Net::SMTP. Just go through it down to just before "Other Neat Stuff with Net::SMTP."
    charlie

  • How to install and configure OEM agent in VCS cluster

    Hi there,
    I would like install 11g OEM agent for SUN SPARC OS for two node VCS cluster. OEM repository is residing in another server.
    Database (to be configured) is running on one node of VCS cluster, but it will be able to failover other server for any issues.
    I have downloaded the agent for sparc and planning to do the silent install.
    Could you please give me the steps to configure both nodes of the cluster including the parameters which need to be changed in the response file?
    Thanks in advance.
    Regards

    We are using OEM agents on VCS clusters. Some options are to 1) fail-over the agent with the database; 2) manually inform OEM that an instance has moved using emcli relocate_targets; 3) use VCS to relocate_targets through a fail-over script. Since our databases don't move much we have been using option 2 but are now testing option 3.
    Doug

  • Rman/PERL scripts errors

    I am trying to automate the backups and disk maintenence on a test machine using a "Host Command" in the 10g EM environment. If I run the script from the command on the target host the scripts completes successfully.
    This is the script:
    ORACLE_HOME=/u01/app/oracle/product/9.2.0
    export ORACLE_HOME
    ORACLE_SID=coeusdba.
    export ORACLE_SID
    rman <<EOF
    connect target sys<password>@coeusdba;
    connect catalog <user>/<password>@recv;
    replace script coeusdba_full_bkp { 
    allocate channel Channel1 type disk format '/u03/orabkp/coeusdba/b_%u_%p_%c';
    backup
    ( database include current controlfile );
    backup ( archivelog all delete input );
    run { execute script coeusdba_full_bkp;}
    EOF
    /u01/app/oracle/product/9.2.0/dbs/scripts/coeusdba_new.sh
    exit
    When I execute the same script from a 10g EM "Host Command" job the script fails at the PERL command step with the following output:
    Recovery Manager: Release 9.2.0.7.0 - Production
    Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
    RMAN>
    RMAN>
    connected to target database: COEUSDBA (DBID=1916078485)
    RMAN>
    RMAN>
    connected to recovery catalog database
    RMAN> 2> 3> 4> 5> 6> 7> 8>
    replaced script coeusdba_full_bkp
    RMAN>
    RMAN>
    executing script: coeusdba_full_bkp
    allocated channel: Channel1
    channel Channel1: sid=10 devtype=DISK
    Starting backup at NOV-01-2005 10:32:32
    channel Channel1: starting full datafile backupset
    channel Channel1: specifying datafile(s) in backupset
    including current controlfile in backupset
    input datafile fno=00006 name=/u02/oradata/coeusdba/users01.dbf
    input datafile fno=00002 name=/u03/oradata/coeusdba/undotbs01.dbf
    input datafile fno=00004 name=/u03/oradata/coeusdba/index01.dbf
    input datafile fno=00005 name=/u03/oradata/coeusdba/tools01.dbf
    input datafile fno=00007 name=/u03/oradata/coeusdba/xdb01.dbf
    input datafile fno=00001 name=/u02/oradata/coeusdba/system01.dbf
    input datafile fno=00003 name=/u02/oradata/coeusdba/drsys01.dbf
    channel Channel1: starting piece 1 at NOV-01-2005 10:32:33
    channel Channel1: finished piece 1 at NOV-01-2005 10:33:28
    piece handle=/u03/orabkp/coeusdba/b_3rh2l4q1_1_1 comment=NONE
    channel Channel1: backup set complete, elapsed time: 00:00:55
    Finished backup at NOV-01-2005 10:33:28
    Starting backup at NOV-01-2005 10:33:29
    current log archived
    channel Channel1: starting archive log backupset
    channel Channel1: specifying archive log(s) in backup set
    input archive log thread=1 sequence=49 recid=200 stamp=573215609
    channel Channel1: starting piece 1 at NOV-01-2005 10:33:32
    channel Channel1: finished piece 1 at NOV-01-2005 10:33:33
    piece handle=/u03/orabkp/coeusdba/b_3sh2l4rr_1_1 comment=NONE
    channel Channel1: backup set complete, elapsed time: 00:00:02
    channel Channel1: deleting archive log(s)
    archive log filename=/u04/arch/coeusdba/1_49.dbf recid=200 stamp=573215609
    Finished backup at NOV-01-2005 10:33:35
    Starting Control File and SPFILE Autobackup at NOV-01-2005 10:33:35
    piece handle=/u04/orabkp/coeusdba/ctl_file_bkps/c-1916078485-20051101-00 comment=NONE
    Finished Control File and SPFILE Autobackup at NOV-01-2005 10:33:38
    released channel: Channel1
    RMAN>
    RMAN>
    Recovery Manager complete.
    syntax error at /u01/app/oracle/product/9.2.0/EM10g_1/perl/lib/5.6.1/warnings.pm line 306, near "{^"
    syntax error at /u01/app/oracle/product/9.2.0/EM10g_1/perl/lib/5.6.1/warnings.pm line 311, near "{^"
    BEGIN failed--compilation aborted at /u01/app/oracle/product/9.2.0/EM10g_1/perl/lib/5.6.1/English.pm line 38.
    BEGIN failed--compilation aborted at /u01/app/oracle/product/9.2.0/dbs/scripts/rmanc.pl line 20
    Is anyone having this problem in 10g and if so , can you provide me with some insight with respect to resolution?

    The .sh script calls a perl script that parses the output of the report obsolete command in rman and deletes the obsolete datasets from disk. This shell completes from the command line with no errors. Here is the .sh and the perl script. Like I said the odd thing is that this shell executes successfully from the command line. Thanks for your interest in looking at this.
    cat coeusdba_new.sh
    /u01/app/oracle/product/9.2.0/dbs/scripts/rmanc.pl target sys/<password>@coeusdba catalog rmantest/<password>@recv redundancy 2
    rmanc.$ cat rmanc.pl
    #!/usr/bin/perl -w
    # NAME
    # rmanc.pl - delete obsolete backups and copies
    # DESCRIPTION
    # This perl script automates deletion of obsolete datafilecopies and
    # backup pieces. It uses perl strin manipulation to process the output of the RMAN
    # "report obsolete" command and creates rm commands to delete the files
    # NOTES
    # Some customization is necessary.
    # Adapted from Oracle 8i rman1.sh Unix shell script.
    # benmalek 03/08/2003 - Modified to delete backup sets and datafilecopies only
    # Does not touch backup records.
    use strict;
    #use English;
    #$ENV{ORACLE_OWNER}='oracle';
    #$ENV{ORACLE_HOME}='/disk01/app/oracle/product/9.2.0';
    $ENV{NLS_DATE_FORMAT}='DD-MON-YYYY:HH24:MI:SS';
    &PrintEnv;
    sub Usage {
    my ($arg1, @arg2) = @_;
    my $base_name = `basename $0`;
    chop($base_name);
    CASE: {
    if (!defined($arg1)) {last CASE; }
    if ($arg1 =~ /\S/) {print ("\nUnknown argument or incorrect value for: $arg1\n\n"); last CASE; }
    my $example1 = 'rmanc.pl target sys/orclpass@orcl catalog rman/rmanpass@rec redundancy 5';
    my $example2 = 'rmanc.pl target sys/orclpass@orcl nocatalog redundancy 5';
    my $usage_txt =
    " Usage: $base_name [option] ...
    option: [target CNCTSTR] [catalog CNCTSTR | nocatalog] [params 'PARMS'] [redundancy NUMBER]
    Option Description
    target CNCTSTR Connect to the target db using CNCTSTR.
    catalog CNCTSTR Connect to catalog db using CNCTSTR.
    nocatalog Don't use a recovery catalog.
    parms 'PARMS' Use PARMS string for SBT_TAPE maintenance channel.
    You can use single or double quotes depending on
    your needs. In the rman script, single-quotes
    will be used.
    redundancy NUMBER Set redundancy of backups to NUMBER.
    The catalog or nocatalog option must be specified. All others are optional
    The target option must also be specified
    Examples:
    $example1
    $example2 ";
    print ("$usage_txt \n");
    die "Exiting subroutine 'Usage'.\n";
    # Initialize default connect string variables:
    my $target=""; # force user to supply target option
    my $catalog=""; # force user to supply catalog option;
    my $parms="";
    my $redun=""; # force user to supply redundancy option;
    # process target and catalog arguments
    my $args = @ARGV;
    while ( $args > 0 ) {
    ARGS: {
    if (($ARGV[0] eq "target") && defined($ARGV[1]))
    {$target="$ARGV[0] $ARGV[1]"; shift(@ARGV); last ARGS;}
    if (($ARGV[0] eq "catalog" || $ARGV[0] eq "rcvcat") && defined($ARGV[1]))
    { $catalog="$ARGV[0] $ARGV[1]"; shift(@ARGV); last ARGS;}
    if ($ARGV[0] eq "nocatalog") { $catalog="$ARGV[0]"; last ARGS;}
    if (($ARGV[0] eq "parms") && defined($ARGV[1])) { $parms = "$ARGV[0] $ARGV[1]"; shift(@ARGV); last ARGS;}
    if (($ARGV[0] eq "redundancy") && defined($ARGV[1]) && !($ARGV[1] =~ /\D/))
    {$redun=$ARGV[1]; shift(@ARGV); last ARGS;}
    &Usage($ARGV[0]);
    shift(@ARGV);
    $args= @ARGV;
    if ((!defined($catalog) || $catalog eq "") || (!defined($target) || $target eq "") || (!defined($redun) || $redun eq "" )) {&Usage;}
    #print (" target=$target \n catalog=$catalog \n parms=$parms \n redundancy=$redun\n");
    # Get a list of obsolete disk files to delete:
    my @rman_out=`rman $target $catalog << EOF
    report obsolete redundancy=$redun device type disk;
    exit;
    EOF`;
    # debug
    print ("############################################\n");
    print ("Output of REPORT OBSOLETE REDUNDANCY=$redun\n");
    print @rman_out;
    print ("############################################\n");
    #my $command = `rman $target $catalog << EOF
    # report obsolete redundancy=$redun device type disk;
    # exit;
    # EOF"
    #open (RMAN, "$command |" );
    #my @rman_out=<RMAN>;
    # Extract the names of the obsolete files to delete
    my $line;
    my @files;
    my @dates;
    my @pieces;
    foreach $line (@rman_out) {
    if (($line =~ /Backup Piece/) && ($line =~ /\S/)) {
    my @fields=split (/\s+/, $line);
    my $nelem=@fields;
    push(@pieces, $fields[$nelem-3]);
    push(@dates, $fields[$nelem-2]);
    push(@files, $fields[$nelem-1]);
    # Verify files exists
    my $i=0;
    foreach $line (@files) {
    if (-e $line) {
    print ("Deleting backup piece or file copy: $pieces[$i] $dates[$i] $line\n");
    system("rm $line");
    } else {
    # print ("file $line does not exist. \n");
    $i = $i + 1;
    sub PrintEnv{
    my $var;
    foreach $var (sort keys %ENV) {
    print "$var: \"$ENV{$var}\".\n"
    pl

  • Oracle restart for OEM Agent

    Hello ,
    Is there any command in Oracle restart to register OEM agent to Oracle restart such that the AGENT can be stopped/started as part of the Oracle restart process when ever the server is rebooted.
    Thanks
    Venkat

    Hi,
    Do you mean register the agent in the repository or start the agent when the server it is installed on starts up ?
    There's this : http://docs.oracle.com/cd/B19306_01/server.102/b15658/strt_stp.htm#BGBFHGAJ
    So have a script read the /etc/oratab, locate the agent home, and run it's startup from that.
    Should work, someone probably has a better idea but that one seems reasonable.

  • Grid Control Perl Scripts Causing 100% CPU

    I have a Grid installation on a cluster of three databases. It periodically shows that the CPU is at 100%. When I check, it is a number of Perl scripts that are executed by the agent.
    Killing the Perl scripts returns CPU usage back to normal. The operating system is Red Hat, and the databases and clusterware Oracle 10.2.0.4.
    Anyone have experience with this. I've looked on Metalink, but haven't seen anything.
    Thanks,
    John

    I nearly fell off my chair laughing at the ludicrous suggestion of bouncing the box!!!
    When you say: Grid installation on a cluster of three databases
    What do you mean?!
    Grid control monitoring 3 rac databases?
    Grid control with a rac database as its repository?
    Version of Grid control?!

  • OEM agent restarts frequently

    Hi,
    I have an OEM agent monitoring RAC database,agent is getting restarted 2-3 times a day.
    Agent:10gR5 with latest PSU
    OMS:10gR5 PSU4
    OS: Solaris 5.10
    Agent log shows below error
    emagent.trc
    2011-08-23 00:13:53,462 Thread-26796 ERROR scheduler: Collection rac_database:dbname:aq_monitoring_alerts has not finished in 721 minutes (allowed: 720).
    Exiting agent.
    2011-08-23 00:13:53,711 Thread-26796 ERROR : Signalled to Exit with status 3. Hung collection
    2011-08-23 00:13:53,748 Thread-1 ERROR main: EMAgent abnormal terminating
    2011-08-23 00:14:10,558 Thread-1 WARN upload: Merging leftover data file named rawdata3.dat
    2011-08-23 00:14:10,687 Thread-1 WARN upload: Merging leftover data file named rawdata4.dat
    2011-08-23 00:14:10,810 Thread-1 WARN upload: Merging leftover data file named rawdata5.dat
    2011-08-23 00:14:10,945 Thread-1 WARN upload: Merging leftover data file named rawdata6.dat
    2011-08-23 00:14:11,136 Thread-1 WARN command: Job Subsystem Timeout set at 600 seconds
    2011-08-23 00:14:11,350 Thread-1 WARN upload: Upload manager has no Failure script: disabled
    emagent.nohup
    (pid=17814): emagent now exiting abnormally - exiting abnormally Consult '.trc' and '.log' files.
    ----- Tue Aug 23 17:04:14 2011::Checking status of EMAgent : 17814 -----
    ----- Tue Aug 23 17:04:24 2011::Checking status of EMAgent : 17814 -----
    ----- Tue Aug 23 17:04:24 2011::EMAgent exited at Tue Aug 23 17:04:24 2011 with return value 3. -----
    ----- Tue Aug 23 17:04:24 2011::EMAgent has requested a restart. Will be restarted. -----
    ----- Tue Aug 23 17:04:25 2011::Restarting EMAgent. -----
    ----- Tue Aug 23 17:04:32 2011::Agent Launched with PID 22499 at time Tue Aug 23 17:04:32 2011 -----
    ----- Tue Aug 23 17:04:32 2011::Execing EMAgent process is taking longer than expected 120 secs. -----
    ----- Tue Aug 23 17:04:32 2011::Time elapsed between Launch of Watchdog process and execing EMAgent is 149662 secs -----
    (pid=22499): starting emagent version 10.2.0.5.0
    (pid=22499): emagent started successfully
    Thanks in advance....

    On June the 8'th last year you had the same issue with a 10.2.0.4 agent. See EM agent restarts with error host_storage has not finished in 721 minutes (
    Did you ever solve that one?
    I think it is best to create a Service Request.
    Eric

Maybe you are looking for

  • Importing Addresses in Address book from text file

    Hello all, I am attempting to import my address books from Microsoft Outlook into the Address book on the Macintosh. More specifically, I have several distribution lists under Outlook that I use to send out various newsletters from where I work. Thes

  • No error, just doesn't transfer purchases.

    I keep trying to transfer my purchases from my iPad to my computer for backup and the iPad says "Sync in Progress" and iTunes shows the names of the items and acts like it is working through them but nothing actually transfers. Other than the items n

  • Bridge CS5 Win Batch Rename sets milliseconds to 000

    Am using BridgeCS5 (Windows7) to Batch Rename (either during download from Lexar Card Reader using Bridge, or during download from Canon 7D with Cable via Bridge- or to batch rename files already in a folder within Bridge) when I use YYYYMMDD_HHMMSS_

  • OCP Success kit Delivery

    Hi, I cleared exam 1Z0-851(Oracle certified Professional Java SE 6 Programmer) on 26th September, 2011. I came to know that I will receive OCP kit after 4-6 month from exam date. Certview is showing status as "1st Shipment" and created on 28th Novemb

  • ISight with iMovie HD

    i posted this and response was to post here: sorry, but trying to figure this out NOW!....on my second eggnog .....thanks! iSight with iMovie HD Posted: Dec 20, 2006 1:57 PM Reply Email this is my first attempt at using iMovie-and i iSight camera>sea