Perl Script to Verify a Database is up and running

Hi there,
Can any one suggest a way how to verify if the database is up and running from unix using a perl script? If not ,ofcourse the script will fail. Getting the following error ..
ERROR: ORA-12203: TNS:unable to connect to destination
Any suggestions are most valuable to me.
Thank you,
Kiran

Cant we test it with any user other than sysdba? Yes..
$dbh = DBI->connect("dbi:Oracle:", 'some_user', 'password') or die "Connect E
rror $DBI::errstr\n";
can we add this in the existing perl scripts? yes you can but DBI and DBD::Oracle need to be added to perl
How to execute this? Create a script with your perl code and make it executable e.g. chmod 700 myscript.pl
How do we know we have DBI module is present to use it? Once you create a script and try to execute it you will get errors on your use DBI statement.
DB server and unix should be on the same machine right? In this example yes... But you can connect to any db through sqlnet using the tnsnames or with DBI you can do dynamic connections as well. So it will completly bypass tnsnames.ora.
I would strongly suggest looking at "programming the Perl DBI"
HTH
Frank

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 unable to do database call

    Hi,
    Below program is doing nothing, simply hanging. Same program is running fine in other servers. All perl modules are installed.
    bash-3.2$ cat test.pl
    #!/usr/local/git/bin/perl -w
    use strict;
    use DBI;
    my $db = DBI->connect("DBI:Oracle:<DB>",'<Username>','<password>') or die "Could not connect to the database pxrpam". DBI->errstr;
    $db->{AutoCommit} = 0;
    $db->{RaiseError} = 1;
    $db->{ora_check_sql} = 0;
    $db->{RowCacheSize} = 16;
    my $SEL = "select count(*) from test_table";
    my $sth = $db->prepare($SEL);
    print "If you see this, parse phase succeeded without a problem.\n";
    $sth->execute();
    print "If you see this, execute phase succeeded without a problem.\n";
    my $count = $db->selectrow_array ($SEL);
    printf ("Count = %d\n",$count);
    END {
    $db->disconnect if defined($db);
    bash-3.2$
    bash-3.2$
    bash-3.2$ /usr/local/git/bin/perl test.pl
    *^Crl+C*
    bash-3.2$
    I am very new to the perl scripting. I am not having any idea how to debug this. Please help me.
    Thanks in advance!
    Thanks
    Asif

    I don't see anything obviously wrong but you could put a couple more print statements in there, one at the beginning and one after the connect.
    Also it isn't clear to me that this is the best forum. Although the forum title isn't clear I think this is a java forum. Your question is perhaps best address in a general Oracle (database) forum.

  • I have perl scripts that I want to be able to run with my iplanet web server 6.0. How can I make it work in Windows NT? (Because I have no problem when I use it with Linux).

     

    Hi Melanie,
    In order to run a PERL script under Windows NT the iPlanet Web Server needs to know where to find the PERL interpreter.
    follow these steps :
    1) Make sure Windows NT knows what a .pl file is. In file Manager click on file and choose associate from the menu. Check the "files with extension" drop-down list for pl - if it exists verify that it is pathed to your perl.exe. If it is not already on the list click the "New Type" button. In the Filetype box put pl. Choose open from the Action drop-down list. In the Command box specify the full path to your perl.exe interpreter (Make sure to use short filenames, rather than long filenames.) Click the OK button. Then click the Close button in the main Associate dialog box. Double click a .pl file to test - it should automatically launch the PERL interpreter and feed it your .pl file.
    2) Create a directory to contain your .pl scripts.
    ~server_root\shell-cgi is a good choice.
    or \cgi-bin\
    NOTE: Make very sure that this directory is NOT part of the document root, it should have it's own directory (preferably at the same level of the docroot).
    3) In the Admin Server select Programs.
    4) Choose CGI directory (normally) or WinCGI directory or ShellCGI Directory depending on ur choice from the Programs menu.
    5) Put the URL Prefix you would like to map to your Shell-CGI directory into the URL Prefix field.
    6) Put the full path to your Shell-CGI directory in the Shell CGI directory field.
    7) Click OK.
    8) The save and apply changes page will display your changes and give you the opportunity to verify them. If they are correct click the Save and Apply button. If not Click the Undo button and go back to step 4.
    (9)You can then call your .pl scripts directly by referencing the directory mapping that you have just created. For example:
    http://my.server.whatever/shell-cgi/ myscript.pl
    this should work now.
    If not Pls Mail me.
    regards
    T.Raghulan
    [email protected]

  • Database is up and running but when I connect as oracle it's idle?

    Hi experts,
    I have a strange kind of problem. I installed Oracle10 on UNIX.
    When I connect to the Database remotely I am on a perfect working database but when I am connected directly on the machine via Oracle user, and run SQLPLUS I am connected to an idle instance. Also I can not startup this instance because I of 'ORA-01102: cannot mount database in EXCLUSIVE mode'.
    when I run SQLPLUS useing the '@' condition I am connected correctly.
    I checked SID settings and so on but it looks fine. I also only have one instance installed (I hope!).
    Any ideas?
    Thanks
    Flo

    Hi,
    I run the suggested ceckes and attached you my results below:
    Please note that I had to replace the hostname/passwords due to security reasons with a spaceholder. (;
    oracle@] /home/oracle > cat /etc/oratab
    root@<Host>_ECR: / > ps -ef | grep ECR
    oracle 278554 1 0 15:04:58 - 0:00 ora_q001_ECR
    oracle 319680 1 0 15:04:59 - 0:00 oracleECR (LOCAL=NO)
    root 397390 1634448 0 09:19:33 pts/0 0:00 grep ECR
    oracle 418028 1 0 15:04:43 - 0:00 ora_dbw0_ECR
    oracle 495674 1 0 17:03:21 - 0:00 ora_dbw0_ECR
    oracle 499716 1 0 15:04:43 - 0:00 ora_psp0_ECR
    oracle 569560 1 0 15:04:48 - 0:00 ora_qmnc_ECR
    oracle 577564 1 0 15:05:46 - 0:00 oracleECR (LOCAL=NO)
    oracle 639186 1 0 Apr 21 - 0:13 /oracle/ECR/102_64/bin/tnslsnr LEAlistener -inherit
    oracle 1437730 1 0 09:09:57 - 0:00 oracleECR (LOCAL=NO)
    oracle 1450066 1 0 17:03:21 - 0:06 ora_pmon_ECR
    oracle 1470680 1 0 15:04:43 - 0:02 ora_smon_ECR
    oracle 1491084 1 0 15:04:43 - 0:10 ora_mmnl_ECR
    oracle 1503234 1 0 17:03:21 - 0:00 ora_mmnl_ECR
    oracle 1519658 1 0 17:03:21 - 0:00 ora_psp0_ECR
    oracle 1552454 1 0 15:04:43 - 0:04 ora_mmon_ECR
    oracle 1560652 1 0 15:04:43 - 0:00 ora_mman_ECR
    oracle 1573098 1 0 17:03:21 - 0:00 ora_mmon_ECR
    oracle 1589450 1 0 17:03:21 - 0:00 ora_smon_ECR
    oracle 1605798 1 0 15:04:43 - 0:00 ora_lgwr_ECR
    oracle 1609876 1 0 15:04:43 - 0:08 ora_pmon_ECR
    oracle 1613844 1 0 17:03:21 - 0:00 ora_lgwr_ECR
    oracle 1630416 1 0 15:04:48 - 0:00 ora_arc1_ECR
    oracle 1638450 1 0 15:04:58 - 0:00 ora_q000_ECR
    oracle 1646726 1 0 15:04:48 - 0:00 ora_arc0_ECR
    oracle 1654972 1 0 15:06:15 - 0:13 oracleECR (LOCAL=NO)
    oracle 1659008 1 0 17:03:21 - 0:00 ora_mman_ECR
    oracle 1675264 1 0 09:09:22 - 0:00 oracleECR (LOCAL=NO)
    oracle 1683528 1 0 17:03:21 - 0:00 ora_reco_ECR
    oracle 1687780 1 0 15:04:43 - 0:00 ora_reco_ECR
    oracle 1712132 1 0 17:03:21 - 0:00 ora_ckpt_ECR
    oracle 1777898 1 0 15:04:43 - 0:03 ora_ckpt_ECR
    =========================================================
    # This file is used by ORACLE utilities. It is created by root.sh
    # and updated by the Database Configuration Assistant when creating
    # a database.
    # A colon, ':', is used as the field terminator. A new line terminates
    # the entry. Lines beginning with a pound sign, '#', are comments.
    # Entries are of the form:
    # $ORACLE_SID:$ORACLE_HOME:<N|Y>:
    # The first and second fields are the system identifier and home
    # directory of the database respectively. The third filed indicates
    # to the dbstart utility that the database should , "Y", or should not,
    # "N", be brought up at system boot time.
    # Multiple entries with the same $ORACLE_SID are not allowed.
    ECR:/oracle/ECR/102_64:N
    *:/oracle/ECR/102_64:N
    ->When I checked oratab it had no entries, so I added the ORACLE_HOME
    =========================================================
    oracle@] /home/oracle > tnsping ECR_<Host>.world
    TNS Ping Utility for IBM/AIX RISC System/6000: Version 10.2.0.2.0 - Production on 08-MAY-2008 09:15:26
    Copyright (c) 1997, 2005, Oracle. All rights reserved.
    Used parameter files:
    /ixos/sw/config/oracle/sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = <Host>) (Port = 9027))) (CONNECT_DATA = (SE
    RVICE_NAME = ECR_<Host>.world) (INSTANCE_NAME = ECR)))
    OK (10 msec)
    =========================================================
    Below you can see my problem...
    oracle@] /home/oracle > sqlplus system/****@ECR_<Host>.world
    SQL*Plus: Release 10.2.0.2.0 - Production on Thu May 8 09:16:51 2008
    Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning and Data Mining options
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning and Data Mining options
    oracle@] /home/oracle > sqlplus system/****
    SQL*Plus: Release 10.2.0.2.0 - Production on Thu May 8 09:17:05 2008
    Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
    ERROR:
    ORA-01033: ORACLE initialization or shutdown in progress
    Enter user-name:

  • Changing the OS local time while the database is Up and Running

    Hi,
    Will there be any bad effect if I change the OS local time of my servers while the database and application is up and running?
    Why do I need to do this? because the database is RAC configured and I want to avoid "brain-split" because of discrepancies
    in the local time of DB Servers.
    NTP is not yet implemented so I am to adjust the time manually for each servers.
    BTW, I am using database 10gR2 (10.2.0.4) and EBS application (11.5.10.2). My nodes are running in Linux 4, 2.6.9-42ELsmp x86_64.
    Regards,
    Jay A

    But my very concern right now is if there will be negative effect on the data or timestamp in the datafiles of the database
    because I change the local time of the server while the database is running.Change time, that make time in database is changed. and you are changing time at milliseconds. you won't see affect.
    we should worry different time between servers more than time changing
    you can use ntpdate to query time different from server before.
    # ntpdate -q ntp.server.org
    http://linux.die.net/man/1/ntpdate

  • Database is getting and running very slow

    Hi All,
    I am working with a bank.
    Our PROD database gets hang everytime and we have restart the database everytime whenever it gets hung.
    Whenever we run EOD, It takes 18 hrs to complete.
    Database version: 9.2.0.4
    I have pasted statspack report below.
    Snap Id Snap Time Sessions Curs/Sess Comment
    Begin Snap: 105 07-Jun-11 14:19:01 268 16.7
    End Snap: 106 07-Jun-11 14:22:56 290 17.5
    Elapsed: 3.92 (mins)
    Cache Sizes (end)
    ~~~~~~~~~~~~~~~~~
    Buffer Cache: 3,072M Std Block Size: 8K
    Shared Pool Size: 400M Log Buffer: 5,120K
    Load Profile
    ~~~~~~~~~~~~ Per Second Per Transaction
    Redo size: 113,840.43 11,452.27
    Logical reads: 13,517.63 1,359.86
    Block changes: 734.60 73.90
    Physical reads: 4,553.60 458.09
    Physical writes: 22.31 2.24
    User calls: 137.71 13.85
    Parses: 176.87 17.79
    Hard parses: 5.42 0.54
    Sorts: 33.91 3.41
    Logons: 1.93 0.19
    Executes: 395.18 39.75
    Transactions: 9.94
    % Blocks changed per Read: 5.43 Recursive Call %: 89.13
    Rollback per transaction %: 72.82 Rows per Sort: 19.67
    Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Buffer Nowait %: 99.50 Redo NoWait %: 100.00
    Buffer Hit %: 66.31 In-memory Sort %: 100.00
    Library Hit %: 98.48 Soft Parse %: 96.94
    Execute to Parse %: 55.24 Latch Hit %: 99.03
    Parse CPU to Parse Elapsd %: 82.12 % Non-Parse CPU: 95.73
    Shared Pool Statistics Begin End
    Memory Usage %: 94.76 95.87
    % SQL with executions>1: 49.23 50.37
    % Memory for SQL w/exec>1: 55.86 57.57
    Top 5 Timed Events
    ~~~~~~~~~~~~~~~~~~ % Total
    Event Waits Time (s) Ela Time
    db file scattered read 105,673 610 37.94
    db file sequential read 64,554 604 37.55
    SQL*Net message from dblink 822 115 7.15
    CPU time 114 7.09
    buffer busy waits 15,554 78 4.83
    Wait Events for DB: FCRLIVE Instance: fcrlive Snaps: 105 -106
    -> s - second
    -> cs - centisecond - 100th of a second
    -> ms - millisecond - 1000th of a second
    -> us - microsecond - 1000000th of a second
    -> ordered by wait time desc, waits desc (idle events last)
    Avg
    Total Wait wait Waits
    Event Waits Timeouts Time (s) (ms) /txn
    db file scattered read 105,673 0 610 6 45.2
    db file sequential read 64,554 0 604 9 27.6
    SQL*Net message from dblink 822 0 115 140 0.4
    buffer busy waits 15,554 0 78 5 6.7
    db file parallel write 310 0 44 143 0.1
    log file sync 1,070 3 39 37 0.5
    log file parallel write 1,052 1,052 2 2 0.5
    latch free 728 567 1 1 0.3
    control file parallel write 76 0 1 8 0.0
    direct path read (lob) 14 0 0 25 0.0
    SQL*Net more data to client 12,222 0 0 0 5.2
    db file parallel read 1 0 0 8 0.0
    SQL*Net break/reset to clien 44 0 0 0 0.0
    control file sequential read 112 0 0 0 0.0
    SQL*Net message to dblink 822 0 0 0 0.4
    SQL*Net more data from dblin 71 0 0 0 0.0
    undo segment extension 36 35 0 0 0.0
    SQL*Net message from client 25,539 0 54,417 2131 10.9
    wakeup time manager 8 8 240 30000 0.0
    SQL*Net more data from clien 1,602 0 0 0 0.7
    SQL*Net message to client 25,569 0 0 0 10.9
    Background Wait Events for DB: FCRLIVE Instance: fcrlive Snaps: 105 -106
    -> ordered by wait time desc, waits desc (idle events last)
    Avg
    Total Wait wait Waits
    Event Waits Timeouts Time (s) (ms) /txn
    db file parallel write 310 0 44 143 0.1
    log file parallel write 1,048 1,048 2 2 0.4
    control file parallel write 75 0 1 8 0.0
    db file sequential read 38 0 0 2 0.0
    latch free 3 0 0 1 0.0
    control file sequential read 52 0 0 0 0.0
    rdbms ipc reply 3 0 0 0 0.0
    db file scattered read 1 0 0 0 0.0
    buffer busy waits 1 0 0 0 0.0
    rdbms ipc message 5,131 2,539 1,856 362 2.2
    smon timer 2 1 463 ###### 0.0
    pmon timer 86 86 226 2623 0.0
    Please help me on this.
    Thanks and Regards,
    Jatin

    Hi,
    Thanks for the response.
    Apologies for the late response.
    We made changes in parameter file,after which the db is not getting hang.
    but still its very slow.
    db_buffer_cache---3Gb changed to 6 Gb
    shared_pool_size---400MB changed to 600MB
    log_buffer--5MB changed to 218MB.
    Please find the statspack report below.
    STATSPACK report for
    DB Name DB Id Instance Inst Num Release Cluster Host
    FCRLIVE 822947670 fcrlive 1 9.2.0.4.0 NO zanacoret
    Snap Id Snap Time Sessions Curs/Sess Comment
    Begin Snap: 117 07-Jun-11 20:57:36 26 1.8
    End Snap: 118 08-Jun-11 03:14:10 33 29.6
    Elapsed: 376.57 (mins)
    Cache Sizes (end)
    ~~~~~~~~~~~~~~~~~
    Buffer Cache: 3,072M Std Block Size: 8K
    Shared Pool Size: 400M Log Buffer: 5,120K
    Load Profile
    ~~~~~~~~~~~~ Per Second Per Transaction
    Redo size: 560,384.15 157,618.29
    Logical reads: 26,085.91 7,337.14
    Block changes: 2,926.34 823.09
    Physical reads: 1,312.97 369.30
    Physical writes: 100.81 28.35
    User calls: 14.18 3.99
    Parses: 9.16 2.58
    Hard parses: 0.33 0.09
    Sorts: 53.39 15.02
    Logons: 0.06 0.02
    Executes: 801.72 225.50
    Transactions: 3.56
    % Blocks changed per Read: 11.22 Recursive Call %: 98.72
    Rollback per transaction %: 2.77 Rows per Sort: 18.85
    Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Buffer Nowait %: 99.95 Redo NoWait %: 100.00
    Buffer Hit %: 94.99 In-memory Sort %: 100.00
    Library Hit %: 99.89 Soft Parse %: 96.43
    Execute to Parse %: 98.86 Latch Hit %: 99.29
    Parse CPU to Parse Elapsd %: 5.68 % Non-Parse CPU: 99.80
    Shared Pool Statistics Begin End
    Memory Usage %: 20.38 74.21
    % SQL with executions>1: 52.84 35.47
    % Memory for SQL w/exec>1: 38.38 37.80
    Top 5 Timed Events
    ~~~~~~~~~~~~~~~~~~ % Total
    Event Waits Time (s) Ela Time
    db file sequential read 6,369,437 38,718 44.15
    db file scattered read 1,848,969 12,195 13.91
    CPU time 9,859 11.24
    db file parallel write 27,841 6,544 7.46
    log file sync 17,603 6,286 7.17
    Wait Events for DB: FCRLIVE Instance: fcrlive Snaps: 117 -118
    -> s - second
    -> cs - centisecond - 100th of a second
    -> ms - millisecond - 1000th of a second
    -> us - microsecond - 1000000th of a second
    -> ordered by wait time desc, waits desc (idle events last)
    Avg
    Total Wait wait Waits
    Event Waits Timeouts Time (s) (ms) /txn
    db file sequential read 6,369,437 0 38,718 6 79.3
    db file scattered read 1,848,969 0 12,195 7 23.0
    db file parallel write 27,841 0 6,544 235 0.3
    log file sync 17,603 4,321 6,286 357 0.2
    log buffer space 18,192 689 6,040 332 0.2
    buffer busy waits 319,377 13 1,992 6 4.0
    enqueue 1,094 422 1,339 1224 0.0
    SQL*Net break/reset to clien 412 0 1,144 2776 0.0
    db file parallel read 143,728 0 1,123 8 1.8
    SQL*Net message from dblink 1,698,780 0 1,043 1 21.1
    log file parallel write 81,639 81,332 364 4 1.0
    direct path write 7,869 0 339 43 0.1
    library cache pin 215 103 309 1438 0.0
    latch free 74,864 73,409 117 2 0.9
    log file switch completion 289 33 66 227 0.0
    library cache load lock 132 14 49 374 0.0
    control file parallel write 7,633 0 46 6 0.1
    local write wait 175 14 23 130 0.0
    SQL*Net more data to client 166,226 0 4 0 2.1
    direct path read 7,674 0 3 0 0.1
    sort segment request 1 1 1 1000 0.0
    log file single write 96 0 1 9 0.0
    SQL*Net message to dblink 1,698,780 0 0 0 21.1
    undo segment extension 1,172,153 1,172,094 0 0 14.6
    control file sequential read 3,474 0 0 0 0.0
    LGWR wait for redo copy 705 6 0 0 0.0
    L1 validation 2 2 0 10 0.0
    log file sequential read 96 0 0 0 0.0
    row cache lock 8 0 0 0 0.0
    SQL*Net more data to dblink 7 0 0 0 0.0
    SQL*Net more data from dblin 13 0 0 0 0.0
    buffer deadlock 281 275 0 0 0.0
    SQL*Net message from client 278,244 0 377,492 1357 3.5
    wakeup time manager 712 712 21,268 29870 0.0
    SQL*Net message to client 278,253 0 0 0 3.5
    SQL*Net more data from clien 10,186 0 0 0 0.1
    Background Wait Events for DB: FCRLIVE Instance: fcrlive Snaps: 117 -118
    -> ordered by wait time desc, waits desc (idle events last)
    Avg
    Total Wait wait Waits
    Event Waits Timeouts Time (s) (ms) /txn
    db file parallel write 27,841 0 6,544 235 0.3
    log buffer space 7,410 91 1,407 190 0.1
    log file parallel write 81,639 81,332 364 4 1.0
    control file parallel write 7,633 0 46 6 0.1
    rdbms ipc reply 535 0 36 66 0.0
    direct path write 936 0 9 10 0.0
    db file scattered read 593 0 6 10 0.0
    db file sequential read 573 0 2 3 0.0
    buffer busy waits 88 0 1 12 0.0
    log file single write 96 0 1 9 0.0
    direct path read 936 0 1 1 0.0
    control file sequential read 3,416 0 0 0 0.0
    latch free 34 18 0 3 0.0
    LGWR wait for redo copy 705 6 0 0 0.0
    log file sequential read 96 0 0 0 0.0
    rdbms ipc message 4,131,462 220,177 141,132 34 51.4
    pmon timer 7,573 7,573 22,050 2912 0.1
    smon timer 197 61 21,406 ###### 0.0
    SQL ordered by Gets for DB: FCRLIVE Instance: fcrlive Snaps: 117 -118
    -> End Buffer Gets Threshold: 10000
    -> Note that resources reported for PL/SQL includes the resources used by
    all SQL statements called within the PL/SQL code. As individual SQL
    statements are also reported, it is possible and valid for the summed
    total % to exceed 100
    CPU Elapsd
    Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
    136,430,565 7 19,490,080.7 23.1 496.31 1660.82 1267598321
    Module: EodControllerService.exe
    BEGIN :V1 :=ap_ffi_eod_gl_handoff (:V2 ,:V3 ,:V4 ,:V5 ,:V6 ,:V7
    ); END;
    129,875,732 60 2,164,595.5 22.0 421.03 584.27 1178926567
    Module: EodControllerService.exe
    INSERT INTO gl_tmp_consol_txns SELECT *
    FROM xf_stcap_gl_txns a WHERE cod_cc_brn
    = :b2 AND EXISTS ( S
    ELECT cod_gl_acct FROM gl_table
    WHERE cod_acct_no = a.cod_acct_no
    83,164,197 7 11,880,599.6 14.1 1437.82 19622.60 1310689453
    Module: EodControllerService.exe
    BEGIN :V1 :=ap_ch_txn_posting_1 (:V2 ,:V3 ); END;
    53,937,548 1 53,937,548.0 9.2 590.41 1662.42 1193408424
    Module: EodControllerService.exe
    BEGIN :V1 :=ap_eod_process_cotxn_logs (:V2 ,:V3 ,:V4 ,:V5 ,:V6
    ,:V7 ); END;
    48,257,221 1 48,257,221.0 8.2 478.16 466.95 518738743
    Module: EodControllerService.exe
    DELETE FROM xf_ol_st_cotxn_cutoff WHERE (cod_msg_typ
    , ref_sys_tr_aud_no, dat_t
    xn, acq_inst_id, fwd_inst_
    id ) IN ( SELECT resp.cod
    msgtyp, resp.ref_sys_tr_aud_no, re
    46,257,664 7 6,608,237.7 7.8 841.22 2214.64 879334765
    Module: EodControllerService.exe
    BEGIN :V1 :=ap_ln_action (:V2 ,:V3 ,:V4 ,:V5 ,:V6 ,:V7 ); END;
    44,754,751 3 14,918,250.3 7.6 622.38 2498.91 2167787315
    Module: EodControllerService.exe
    BEGIN :V1 :=ap_sc_housekeeping_2 (:V2 ,:V3 ,:V4 ,:V5 ,:V6 ,:V7
    ); END;
    35,500,506 616,696 57.6 6.0 728.72 780.55 1752188118
    Module: EodControllerService.exe
    SELECT NVL(SUM(bal_int_arrears), 0) + NVL(SUM(bal_int_arrears_su
    sp), 0) FROM ln_acct_int_balances A, ln_prod_int_attr B, ln_int_
    rules C WHERE C.cod_int_typ IN (0, 1, 4) AND B.cod_int_rule = C.
    cod_int_rule AND A.ctr_int_srl = B.ctr_srl_no AND A.cod_acct_no
    = :b2 AND B.cod_prod = :b1 AND B.flg_mnt_status = 'A' AND C.flg_
    32,697,572 105,726 309.3 5.5 581.16 596.32 3042519173
    Module: JDBC Thin Client
    SELECT rat_ccy_mid, rat_ccy_book, rat_ccy_
    SQL ordered by Gets for DB: FCRLIVE Instance: fcrlive Snaps: 117 -118
    -> End Buffer Gets Threshold: 10000
    -> Note that resources reported for PL/SQL includes the resources used by
    all SQL statements called within the PL/SQL code. As individual SQL
    statements are also reported, it is possible and valid for the summed
    total % to exceed 100
    CPU Elapsd
    Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
    cb, rat_ccy_special_1, rat_ccy_special_2,
    rat_note_buy_sprd, rat_note_sell_sprd,
    rat_chq_buy_sprd, rat_chq_sell_sprd,
    rat_xfer_buy_sprd, rat_xfer_sell_sprd FROM b
    30,808,307 110,576 278.6 5.2 294.44 15391.36 1194686144
    Module: EodControllerService.exe
    SELECT COUNT(*) FROM ch_arrears_table WHERE cod_acct_no = :b5 AN
    D cod_arrear_type = :b4 AND dat_arrears_due = :b3 AND cod_
    sc = :b2 AND cod_sc_ccy = :b1
    30,544,881 6,585 4,638.6 5.2 490.34 613.37 932403169
    Module: PosService.exe
    SELECT count(*) FROM xf_ol_st_postxn WHERE NV
    L(rtrim(acq_inst_id), ' ') = NVL(rtrim(:b7), ' ')
    AND NVL(rtrim(fwd_inst_id), ' ') = NV
    L(rtrim(:b6), ' ') AND NVL(rtrim(ca_id_code), ' ') =
    NVL(rtrim(:b5), ' ') AND NVL(rtrim(ca_
    26,690,998 155,669 171.5 4.5 662.17 675.63 3222131678
    Module: EodControllerService.exe
    UPDATE xf_st_cap_input_txn SET flg_process = 'Y'
    WHERE cod_acct_no = :b13 AND cod_cc_brn = :b12
    AND cod_prod = :b11 AND dat_post = :b10
    AND ctr_batch_no = :b9 AND NVL(cod_userno, 0)
    = NVL(:b8, 0) AND NVL(ref_sys_tr_aud_no, 0) =
    18,789,157 3,134 5,995.3 3.2 308.37 1094.89 1546108753
    Module: PosService.exe
    BEGIN :V1 :=ap_ol_pos_xfer_dr (:V2 ,:V3 ,:V4 ,:V5 ,:V6 ,:V7 ,:V
    8 ,:V9 ,:V10 ,:V11 ,:V12 ,:V13 ,:V14 ,:V15 ,:V16 ,:V17 ,:V18 ,:V
    19 ,:V20 ,:V21 ,:V22 ,:V23 ,:V24 ,:V25 ,:V26 ,:V27 ,:V28 ,:V29 ,
    :V30 ,:V31 ,:V32 ,:V33 ,:V34 ,:V35 ,:V36 ,:V37 ,:V38 ,:V39 ,:V40
    ,:V41 ,:V42 ,:V43 ,:V44 ,:V45 ,:V46 ,:V47 ,:V48 ,:V49 ,:V50 ,:V
    18,077,663 3,202 5,645.7 3.1 291.42 602.13 3022529234
    Module: PosService.exe
    BEGIN :V1 :=ap_ol_pos_xfer_mrch_cr (:V2 ,:V3 ,:V4 ,:V5 ,:V6 ,:V
    7 ,:V8 ,:V9 ,:V10 ,:V11 ,:V12 ,:V13 ,:V14 ,:V15 ,:V16 ,:V17 ,:V1
    8 ,:V19 ,:V20 ,:V21 ,:V22 ,:V23 ,:V24 ,:V25 ,:V26 ,:V27 ,:V28 ,:
    V29 ,:V30 ,:V31 ,:V32 ,:V33 ,:V34 ,:V35 ,:V36 ,:V37 ,:V38 ,:V39
    ,:V40 ,:V41 ,:V42 ,:V43 ,:V44 ,:V45 ,:V46 ,:V47 ,:V48 ,:V49 ,:V5
    15,191,513 2 7,595,756.5 2.6 392.91 418.92 718440598
    Module: SQLNav4.exe
    select cod_acct_no, nam_cust_shrt, round(bal_book,2) balance fro
    m flexlive.ln_acct_mast where bal_book >= 1.00 and flg_mnt_statu
    s = 'A' order by cod_acct_no
    14,314,012 1 14,314,012.0 2.4 283.17 323.20 2997552506
    SQL ordered by Gets for DB: FCRLIVE Instance: fcrlive Snaps: 117 -118
    -> End Buffer Gets Threshold: 10000
    -> Note that resources reported for PL/SQL includes the resources used by
    all SQL statements called within the PL/SQL code. As individual SQL
    statements are also reported, it is possible and valid for the summed
    total % to exceed 100
    CPU Elapsd
    Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
    Module: REPORT~1.EXE
    SELECT A.cod_cc_brn, A.nam_branch, A.cod_ccy, A.nam_ccy_short, A
    .cod_prod, A.nam_product, --A.cod_acct_no, A.cod_acct_no||'-'||c
    .TXT_CRR_DESC cod_acct_no, A.nam_cust_shrt, A.amt_face_value amt
    sanctioned, A.amtdisbursed amt_disbursed, A.amt_net_disbursed
    amt_net_disbursed, A.amt_princ_balance amt_princ_outst, A.amt_rp
    13,908,167 1,287,314 10.8 2.4 105.21 459.84 3522162665
    Module: EodControllerService.exe
    UPDATE sc_txns_summary SET ctr_txn_curr = 0, amt_txn_curr = 0,
    amt_sc_curr = 0, amt_sc_diffl_curr = 0, amt_sc_wvr_curr = 0,
    amt_sc_hold_curr = 0, dat_start = :b5, dat_end = :b4 WHERE
    cod_acct_no = :b3 AND cod_sc = :b2 AND cod_ccy = :b1
    13,402,123 1 13,402,123.0 2.3 444.18 457.86 875238559
    Module: REPORT~1.EXE
    BEGIN :RV1 := AP_CH_R103(:C1); END;
    SQL ordered by Reads for DB: FCRLIVE Instance: fcrlive Snaps: 117 -118
    -> End Disk Reads Threshold: 1000
    CPU Elapsd
    Physical Reads Executions Reads per Exec %Total Time (s) Time (s) Hash Value
    9,610,221 1 9,610,221.0 32.4 538.39 3259.15 3996534557
    Module: REPORT~1.EXE
    BEGIN :RV1 := AP_CH_R144(:C1); END;
    6,404,828 1 6,404,828.0 21.6 341.88 1774.46 4258600690
    Module: REPORT~1.EXE
    INSERT INTO rpt_ch_r144 ( cod_cc_brn , cod_prod
    , nam_product , cod_acct_no_swpin , cod_acct_no_be
    nef , txt_txn_desc , dat_txn , cod_userno
    , ref_sys_tr_aud_no , cod_txn_mnemonic , nam_branch
    , amt_txn_tcy , cod_txn_ccy , nam_ccy_short , SESSI
    3,507,577 1 3,507,577.0 11.8 243.07 1869.07 2966562005
    Module: EodControllerService.exe
    BEGIN :V1 :=ap_ln_btp (:V2 ,:V3 ,:V4 ,:V5 ,:V6 ,:V7 ); END;
    3,202,492 1 3,202,492.0 10.8 196.14 1478.50 1167537011
    Module: REPORT~1.EXE
    INSERT INTO TEMP_tmp_ch_r144 ( COD_ACCT_NO , COD_CC_B
    RN , COD_PROD , TXT_TXN_DESC
    , DAT_TXN , COD_USERNO , REF_SYS_TR_
    AUD_NO , COD_TXN_MNEMONIC , AMT_TXN_TCY ,
    COD_TXN_CCY , NAM_CCY_SHORT , SESSION_ID ) SELECT cod_acct_no
    3,017,581 3 1,005,860.3 10.2 398.28 6680.23 2812233565
    Module: python@svrstatement (TNS V1-V3)
    begin FLEXLIVE.ZN_DAILYSTMNT(:arg_1); end;
    3,004,269 3 1,001,423.0 10.1 394.83 6647.07 3411879556
    Module: python@svrstatement (TNS V1-V3)
    SELECT NVL(sum(amt_txn*instr('C',cod_drcr))-sum(amt_txn*instr('D
    ',cod_drcr)),0.00) from ch_nobook where cod_acct_no = :b2 and
    dat_post < :b1
    Latch Name Where Misses Sleeps Sleeps
    cache buffers chains kcbgtcr: kslbegin excl 0 44,053 43,307
    cache buffers chains kcbrls: kslbegin 0 26,416 28,168
    cache buffers chains kcbzsc 0 1,189 1
    cache buffers chains kcbzwb 0 942 704
    cache buffers chains kcbchg: kslbegin: bufs not 0 637 418
    cache buffers chains kcbgcur: kslbegin 0 527 876
    cache buffers chains kcbget: exchange rls 0 185 99
    cache buffers chains kcbget: exchange 0 123 133
    cache buffers chains kcbzib: multi-block read: 0 73 0
    cache buffers chains kcbget: pin buffer 0 45 136
    cache buffers chains kcbzgb: scan from tail. no 0 45 0
    cache buffers chains kcbnew 0 28 2
    cache buffers chains kcbbxsv 0 27 7
    cache buffers chains kcbgtcr: fast path 0 24 173
    cache buffers chains kcbgtcr 0 15 0
    cache buffers chains kcbzib: finish free bufs 0 12 63
    cache buffers chains kcbgtcr: kslbegin shared 0 9 5
    cache buffers chains kcbchg: kslbegin: call CR 0 9 274
    cache buffers chains kcbnlc 0 3 12
    cache buffers lru chain kcbbiop: lru scan 1,028 80 0
    cache buffers lru chain kcbzgb: multiple sets nowa 33,462 20 4
    cache buffers lru chain kcbzgb: posted for free bu 684 10 121
    cache buffers lru chain kcbbxsv: move to being wri 86 9 3
    cache buffers lru chain kcbgtcr:CR Scan:KCBRSKIP 191 7 0
    cache buffers lru chain kcbbwlru 59 2 0
    cache buffers lru chain kcbzar: KSLNBEGIN 11,844 2 0
    checkpoint queue latch kcbbxsv: move to being wri 0 9 0
    checkpoint queue latch kcbbwthc: thread checkpoin 0 7 0
    checkpoint queue latch kcbswcu: Switch buffers 0 2 17
    enqueue hash chains ksqcnl 0 6 5
    enqueue hash chains ksqrcl 0 2 1
    enqueues ksqdel 0 3 5
    enqueues ksqgel: create enqueue 0 2 0
    library cache kglpnc: child 0 13 18
    library cache kgllkdl: child: cleanup 0 8 0
    library cache kglupc: child 0 5 9
    library cache kglpndl: child: before pro 0 5 2
    library cache kglhdgn: child: 0 2 2
    library cache kglpnp: child 0 1 0
    library cache pin kglupc 0 3 5
    library cache pin kglpnc: child 0 3 1
    multiblock read objects kcbzib: normal mbr free 0 2 1
    redo allocation kcrfwr 0 73 73
    redo allocation kcrfwi: before write 0 1 1
    row cache enqueue latch kqreqd 0 1 0
    row cache objects kqrpfl: not dirty 0 15 3
    row cache objects kqrpre: find obj 0 6 18
    shared pool kghupr1 0 3 4
    shared pool kghalp 0 1 0
    simulator lru latch kcbs_simulate: simulate se 0 6 6
    simulator lru latch kcbs_lookup_setid 0 3 3
    undo global data ktudba: KSLBEGIN 0 3 3
    Latch Miss Sources for DB: FCRLIVE Instance: fcrlive Snaps: 117 -118
    -> only latches with sleeps are shown
    -> ordered by name, sleeps desc
    NoWait Waiter
    Latch Name Where Misses Sleeps Sleeps
    Parent Latch Statistics DB: FCRLIVE Instance: fcrlive Snaps: 117 -118
    -> only latches with sleeps are shown
    -> ordered by name
    Get Spin &
    Latch Name Requests Misses Sleeps Sleeps 1->4
    enqueues 1,911,942 22,454 5 22449/5/0/0/
    0
    multiblock read objects 4,388,310 1,031 2 1029/2/0/0/0
    row cache enqueue latch 13,604,407 5,954 1 5953/1/0/0/0
    Child Latch Statistics DB: FCRLIVE Instance: fcrlive Snaps: 117 -118
    -> only latches with sleeps/gets > 1/100000 are shown
    -> ordered by name, gets desc
    Child Get Spin &
    Latch Name Num Requests Misses Sleeps Sleeps 1->4
    cache buffers chains 3239 21,505,400 1,236,249 7,795 0/0/0/0/0
    cache buffers chains 3237 19,299,145 993,997 8,120 0/0/0/0/0
    cache buffers chains 3240 17,488,734 801,663 5,679 0/0/0/0/0
    cache buffers chains 3236 16,609,145 741,070 4,516 0/0/0/0/0
    cache buffers chains 3242 16,161,488 677,717 3,572 0/0/0/0/0
    cache buffers chains 3789 15,643,256 238,442 4,976 0/0/0/0/0
    cache buffers chains 3241 15,352,438 615,755 3,499 0/0/0/0/0
    cache buffers chains 2945 14,634,929 545,294 3,155 0/0/0/0/0
    cache buffers chains 510 13,117,914 455,313 1,994 0/0/0/0/0
    cache buffers chains 2947 12,685,566 419,997 1,589 0/0/0/0/0
    cache buffers chains 3238 12,591,861 408,182 1,501 0/0/0/0/0
    cache buffers chains 505 10,012,850 242,906 1,055 0/0/0/0/0
    cache buffers chains 511 9,979,520 244,777 1,078 0/0/0/0/0
    cache buffers chains 2948 9,094,481 199,262 822 0/0/0/0/0
    cache buffers chains 2185 9,045,926 209,522 924 0/0/0/0/0
    cache buffers chains 2944 8,677,071 191,854 832 0/0/0/0/0
    cache buffers chains 509 8,649,454 184,191 757 0/0/0/0/0
    cache buffers chains 508 6,868,267 112,615 414 0/0/0/0/0
    cache buffers chains 504 6,431,407 101,195 356 0/0/0/0/0
    cache buffers chains 2946 6,006,960 96,807 273 0/0/0/0/0
    cache buffers chains 2179 5,924,037 93,867 490 0/0/0/0/0
    cache buffers chains 2180 5,057,947 66,453 344 0/0/0/0/0
    cache buffers chains 507 4,638,543 57,389 172 0/0/0/0/0
    cache buffers chains 2181 3,465,838 16,960 100 0/0/0/0/0
    cache buffers chains 2186 3,255,441 29,094 142 0/0/0/0/0
    cache buffers chains 3398 3,124,434 33,454 213 0/0/0/0/0
    cache buffers chains 1593 2,908,993 558 117 0/0/0/0/0
    cache buffers chains 3504 2,673,360 25,420 215 0/0/0/0/0
    cache buffers chains 1177 2,424,271 298 56 0/0/0/0/0
    cache buffers chains 506 2,421,918 14,566 81 0/0/0/0/0
    cache buffers chains 1753 1,600,842 197 20 0/0/0/0/0
    cache buffers chains 2182 1,556,688 8,232 28 0/0/0/0/0
    cache buffers chains 1529 1,513,006 392 40 0/0/0/0/0
    cache buffers chains 2183 1,488,352 7,325 61 0/0/0/0/0
    cache buffers chains 2184 1,470,530 7,835 38 0/0/0/0/0
    cache buffers chains 3590 946,240 276 29 0/0/0/0/0
    cache buffers chains 3606 911,872 292 11 0/0/0/0/0
    Can we find the top 10 sql statement in AWR report.
    Please suggest.
    Thanks and Regards,
    Jatin

  • Running sql or perl script using DBMS_JOB

    Hi,
    Is there a way to run a sql or perl script using DBMS_JOB procedures? I have a perl script which checks out the table usage and emails the report to specific users. I want to run this script in a job scheduler, where I am using dbms_job to add the job. Please help. Any suggestions are greatly appreciated. Thanks.
    -Kristine

    You cannot run sql or perl scrips using DBMS_JOBS. You can run only Oracle procedures, functions, packages with DBMS_JOBS. They have to be stored in the database. You will have to create a Pro*C program that is listening on the pipe and push data to that pipe by using dbms_pipe. Then you can execute anything you want.

  • How to launching a perl script by the "begin" script of a jumpstart

    Hi all,
    i have an urgent pb with my solaris jumpstart, let me explain to you :
    i want that the begin script launch some perl script, but i have a problem
    here is my "begin" script:
    echo "Begining ISO FLAR based jumpstart."
    echo ""
    echo "Starting Ullink Configuration"
    env > /tmp/env
    /bin/sh << EOF
    /usr/bin/perl /cdrom/.archives/admin-scripts/sethostname.pl
    EOFmy perl script use a STDIN
    with this configuration, the perl script is launching but it runs in a loop indefinitely with an error "use of uninitialized value", because (i think) a value is return to the begin scritp and not to the perl script.
    well, on a pre-installed solaris, if a launch the begin script, it happens the same thing, it runs in a loop, BUT if i comment the line "/bin/sh <<EOF" and "EOF", it works.
    at this step, i say "ok it's cool my script is working", but when i use it during the jumpstart instalaltion, the perl script does not start, without any particular error.
    here is my perl script, if you want to test :
    #!/usr/bin/perl -w^M
    # Set Hostname for Ullink Jumpstart^M
    ^M
    use strict;^M
    ^M
    sub hit_enter {^M
        print "Hit enter to continue\n";^M
        <STDIN>;^M
        print "\033[2J";^M
    }^M
    ^M
    sub get_hostname {^M
        my %towns_list = (^M
            'Paris' => 'PA',^M
            'New-York' => 'NY',^M
        );^M
    ^M
        my %sites_list = (^M
            'Office' => 'OFC',^M
            'Redbus' => 'RED',^M
            'Telehouse' => 'TLH',^M
            'DTC' => 'DTC',^M
            'iAdvantage' => 'IAD',^M
            'Nutley' => 'NUT',^M
            'Level3' => 'LV3',^M
            'Equinix' => 'EQX',^M
            'Tata' => 'TAT',^M
            'Switch-data' => 'SWI',^M
            );^M
    ^M
        my %usage_list = (^M
            'Production' => 'PRD',^M
            'UAT' => 'UAT',^M
            'DMZ' => 'DMZ',^M
        );^M
    ^M
        sub select_list {^M
            my $counter=-1;^M
            my %hash_list = @_;^M
            my @keys = keys %hash_list;^M
    ^M
            # Clear screen^M
            print "\033[2J";^M
            print "In which country this machine is hosted or will be host and will be used ?\n\n";^M
    ^M
            # Get all keys from hash^M
            my $key;
            while ($key = each %hash_list ) {^M
                $counter++;^M
                print "$counter - $key\n";^M
            }^M
    ^M
            print "\nChoose the number corresponding to your choice :\n";^M
            my $choice_number;
            chomp ($choice_number = <STDIN>);^M
    ^M
            # Verify answer^M
            if (($choice_number =~ /\d+/) and ($choice_number <= $counter)) {^M
                # Add choice to chosen hostname^M
                my $chosen=$hash_list{$keys[$choice_number]};^M
                return $chosen;^M
            } else {^M
                print "\nYour answer is not correct, you need to enter a number between 0 and $counter\n";^M
                &hit_enter;^M
                &select_list;^M
            }^M
        }^M
    ^M
        sub srv_number {^M
            print "\033[2J";^M
            print "What is the server number ?\n";^M
            my $server_number;
            chomp ($server_number = <STDIN>);^M
            if ($server_number =~ /\d+/) {^M
                return $server_number;^M
            } else {^M
                print "\nYour answer is not correct, you need to enter a number\n";^M
                &hit_enter;^M
                &srv_number;^M
            }^M
        }^M
    ^M
        my $full_hostname = &select_list(%towns_list).'-';^M
        $full_hostname = $full_hostname.&select_list(%sites_list).'-';^M
        $full_hostname = $full_hostname.'SRV-';^M
        $full_hostname = $full_hostname.&select_list(%usage_list).'-';^M
        $full_hostname = $full_hostname.&srv_number;^M
    ^M
        sub write_hostname2tmp {^M
            open (HOSTNAME, ">/tmp/set_hostname") or warn "Couldn't write $_[0] to temp file : $!\n";^M
                print HOSTNAME "$_[0]\n";^M
            close (HOSTNAME);^M
        }^M
    ^M
        print "\033[2J";^M
        print "Is $full_hostname the correct name for this server ? (y/n)\n";^M
        if (<STDIN> =~ /y|yes/i) {^M
            &write_hostname2tmp($full_hostname);^M
        } else {^M
            print "Would you like to retry (r) or set manually the hostname (s) ? (r/s)\n";^M
            if (<STDIN> =~ /s/i) {^M
                print "Type the full required name and hit enter when finished :\n";^M
                chomp ($full_hostname = <STDIN>);^M
                &write_hostname2tmp;^M
            } else {^M
                &get_hostname;^M
            }^M
        }^M
    }^M
    ^M
    # Start configuration^M
    print "\033[2J";^M
    print "\n########################################################\n";^M
    print "#\t\t\t\t\t\t       #\n";^M
    print "#\t\t\tULLINK\t\t\t       #\n";^M
    print '#  Solaris Environnement Installation for Datacenters  #';^M
    print "\n#\t\t\t\t\t\t       #";^M
    print "\n########################################################\n\n";^M
    print "Before starting installation, you need to enter a set of informations.\n(answer to all questions, you can Ctrl+C to stop now)\n\n";^M
    &hit_enter;^M
    ^M
    &get_hostname;^Mthank for your help
    Edited by: ullink on Jun 25, 2009 6:05 AM

    Hi Manju,
    You can try the following command and check if any helps:
    Get-Exchangeserver |where-object{$_.AdminDisplayVersion -like "Version 15*"} |Get-MailboxStatistics | Ft -auto -wrap DisplayName,database,servername,*size*,*time*
    Best regards,
    Niko Cheng
    TechNet Community Support

  • 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

  • OCI NLS errors in Perl script

    I'm using Perl to access an Oracle DB, using Activestate Perl and pre-built DBI and DBD::Oracle modules.
    I'm running the scripts on a Windows XP laptop, connecting to an Oracle DB running on Solaris 10, Oracle versions are 10.2 in both cases.
    I can connect to the database successfully with sqlplus, run from the command line, using the 'easy connect' method.
    The script fails to connect, generating this error:
    DBI connect('host=host.domain.com;sid=mydb;port=1522','myusername',...)
    failed: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID)
    Check ORACLE_HOME and NLS settings etc. at C:\Perl\bin/esrch line 249
    My ORACLE_HOME points to the Oracle installation directory which was used to build the module, so I believe it's OK.
    Line 249 in the script is the dbi->connect(...) method.
    I have no idea which NLS variable would need to be set or changed, if that's what's needed.
    I also know that OCI_NLS_CHARSET_ID is a #define, found in oci.h. This file is included by the header file for my code.
    Any suggestions on how to get this working are much appreciated.
    Bob

    Hmm, there seems to be some confusion on my part regarding my login. I just used one which I swear I tried previously without success.
    In any case, I'm the original poster. Sorry for any confusion this causes.
    As for the questions asked.
    1. Oracle home access: yes, not only did the same user do the install of Oracle, I've verified that the user can access all files.
    2. I've run with NLS_LANG set and unset. The value used is the one stored in the registry:
    AMERICAN_AMERICA.WE8MSWIN1252
    3. I did a 'print "$ENV{NLS_LANG}\n"' from the perl script and got the expected output, as set above.
    4. As I understand it, the PerlSetVar function is a mod_perl feature, not part of the base language. I'm using batch files to run perl on my perl scripts, started from a command prompt.
    Thanks,
    Bob

  • Runtime.exec("Perl Script writing and reading on I/O"), handling Streams

    Hi all !!
    In a first place : sorry for my english if it's not really understandable but I try to do as good as possible !
    I'm writing a GUI with Swing that will allow (in one of my multiple tables) the user to run a Perl Script.
    This Perl Script ask the user to choose a Folder ... then read all the files in this folder and for each file (xml File), extract the datas and put them in a database. But when a file that has to be inserted in the database contains this line : <Template_Used name="ST1.mtt"> and if the Template table in my database doesn't have the "ST1.mtt" stored ... the Perl Script ask to the user to give him the path of the file "ST1.mtt" so that the script can put the "ST1.mtt template" datas in the database.
    This script runs well when it is from a windows console.
    But I need a graphic interface !!!
    So I created a JButton "Process a folder".
    When the button is pressed, a JFileChooser appears and ask the user which Folder has to be processed.
    Then a Process is created with the command : ("cmd.exe /C \"C:\\Program Files\\Fluke\\Ansur\\ProcessFolder.bat\").
    The BatFile :
    {code}cd C:\Documents and Settings\tsd\Desktop\Gael-Project\Project_Files
    perl Process.pl
    exit{code}
    At this moment everything is working well.
    But my Process.pl (which is 300 lines long ... and that you don't even want to hear about), ask in a first time the Path of the folder to process and sometimes ask the path to a file (a template file).
    So I need to read and wirte on the STDIN/STDOUT during the exec of the Process.
    In order to handle this I created two different threads : one reading the Process.getInputStream with a BufferedReader and one other writing on the Process.getOutputStream with a PrintWrinter.
    What I need to do is :
    When I read a line from the InputStream saying "I need the path of the ST1.mtt file", I should run a JFileChooser ... the user find the file in the computer ... and I write in the OutputStream the path of the file, so that my Perl Script doesn't have un Unitialised value on <STDIN> and can continue to process !!
    I'm pretty sure it's possible ... because at the moment I just used a trick :
    When the user push the "process a folder" button, I write the paths in the OutputStream before than the script needs it and it works !
    But I need to write in the OutputStream only when it is time !!!
    Any idea ??
    Here are some parts of my code :
    {code}
    String filename = File.separator+"tmp";
              JFileChooser fc = new JFileChooser(new File(filename));
              fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );
              // Show open dialog; this method does not return until the dialog is closed
         fc.showOpenDialog(null);
         Folder = fc.getSelectedFile();
              new GoodExec(cmd);
    {code}
    {code}
    public class GoodExec {
         public static Process proc;
         public static StreamGobbler errorGobbler;
         public static StreamGobbler inputGobbler;
         public static StreamGobbler outputGobbler;
         public GoodExec(String cmd)
         try
                   Runtime rt = Runtime.getRuntime();
              proc = rt.exec(cmd);
         // any error message?
         errorGobbler = new
         StreamGobbler(proc.getErrorStream(), "ERROR");
         // any input?
         inputGobbler = new
         StreamGobbler(proc.getInputStream(), "INPUT");
         // any output?
              outputGobbler = new
              StreamGobbler(proc.getOutputStream(), "OUTPUT");
         // kick them off
         errorGobbler.start();
         inputGobbler.start();
         outputGobbler.start();
         // any error???
         int exitVal = proc.waitFor();
         System.out.println("ExitValue: " + exitVal);
         } catch (Throwable t)
         t.printStackTrace();
    {code}
    {code}
    public class StreamGobbler implements Runnable
    InputStream is;
    OutputStream os;
    String type;
    Thread thread;
    public static String chaine;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.os=null;
    this.type = type;
    StreamGobbler(OutputStream os, String type)
    this.os = os;
    this.is=null;
    this.type = type;
    public void start () {
         thread = new Thread(this);
         thread.start ();
    public void run()
    try
    if (is == null){
         PrintWriter toProgram = new PrintWriter(os);
         File FolderToProcess = ProcessFolder.Folder;
    String Folder = FolderToProcess.getPath();
    toProgram.write(Folder);
    toProgram.close();
    else {
         if (os == null){
         InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    String comp = "Please enter the exact path of the directory that contains the files you want to process.";
    while ( (line = br.readLine()) != null){
         if (type.equals("INPUT")){
              chaine+=line+"\n";
         if (line.equals(comp)) {
              System.out.println("give directory");RUN A JFILECHOOSER AND GIVE THE DIRECTORY TO THE OUTPUTSTREAM
    System.out.println(type + ">" + line);
    is.close ();
    catch (IOException ioe){
         ioe.printStackTrace();
    {code}
    And here is an example of a simple perl script that could be used (it s a simple one !!) :
    {code}
    #!/usr/bin/perl -w
    use strict;
    print "Please enter the exact path of the directory that contains the files you want to process.\n";
    my $dir= <STDIN>;
    chomp ($dir);
    print "titallala $dir";
    if (the template of the file is not in the database){
    print "Please give me the template so that I can put it in the database";
    $dir= <STDIN>;
    chomp ($dir);
    {code}
    Thank you for your help ... if it's possible to help me !!
    Gael

    BalusC -- The line that gives me my NullPointerException is when I call the "DisplayProduct()" method. Its a dumb question, but with NetBeans how do I find out which reference could be null? I'm not very familiar with how NetBeans works with finding out how to debug. Any help you can give me would be greatly appreciated.The IDE is com-plete-ly irrelevant. It's all about the source code.
    Do you understand anyway when and why a NullPointerException is been thrown? It is a subclass of RuntimeException and those kind of exceptions are very trival and generally indicate an design/logic/thinking fault in your code.
    SomeObject someObject = null; // The someObject reference is null.
    someObject.doSomething(); // Invoking a reference which is null would throw NPE.

  • Perl Script in PLSQL

    When do we typically need to use external scripts like perl scripts while working in oracle?
    For file manipulation,perls split function would be better than pl/sql code ,however,performance wise which one is better?
    How many such scenarios are there where a perl is better to be used as opposed to pl/sql
    please advise

    That depends on where the data is. If it is outside Oracle then PL/SQL is not the best approach. The UTL_FILE I/O interface is primitive.
    If the data is inside Oracle, then PL/SQL is the best approach.
    One method to consider is loading the files to be processed by Perl, as CLOBs, into Oracle. And once in Oracle, use PL and SQL to process the contents.
    Performance wise, I expect pretty similar performance. It is unlikely that one would be significantly faster than the other in this case. Regular expressions are also supported in Oracle.
    There are however features and advantages on the Oracle side that you do not have on the o/s side with Perl. Concurrency controls. Transactions. How do you rollback changes made when in Perl? Code them - which can be complex. In PL/SQL, you simply use the rollback command. And save points are also supported.
    Other factors can include the availability of the file to other applications and web reporting systems, and security and backup.
    If the file resides outside Oracle and a web reporting system for example needs to show the file contents plus the structured data set parsed from the file... this gets hairy when Perl was used to load the structured into a database (easily accessible via web app layer) and the file still sits on the o/s (another method required by app layer to access file, another set of authentication and authorisation to deal with, etc).
    It is a lot easier if the file is a CLOB inside Oracle - as any application will use the database (single access method and point of access) to obtain both the structured data and the file's contents.
    Then there's also the issue of backups. If the file is a CLOB in the database, it is part of the backup and security mechanisms implemented on that database. No need to deal with it at o/s level and its complexities.
    Of course, I assume that these are requirements accompanying the need to process and parse the file. And that is the bottom line - the requirements should drive the decision of whether to use Perl or PL/SQL in such a case. It is not a mere matter of which one may perform better than the other (especially not when it cannot be shown that there will be a significant performance improvement).
    By the way - the above scenario is a real world one for us. And interestingly, we had more performance issues with the Perl code (huge knock on server resources) than doing the same inside Oracle using PL/SQL.

  • Facing Problem in Perl Script

    Hi ,
    I m facing one problem in perl script.
    Oracle Database 10g.
    DBD::Oracle::db selectall_arrayref failed: handle 2 is owned by thread 225ffc not c
    urrent thread 1c4f8ac (handles can't be shared between threads and your driver may
    need a CLONE method added) at c:\perl\update_card_numbers_oracle.pl line 258, <STDI
    N> line 1.
    Thx in advance....

    There are forums here at OTN for Perl related issues ... this isn't it.
    Return to the list of all forums and find the one where your inquiry belongs.

  • Execution of Perl Script from HTML DB page.

    Hi All,
    I have a Perl script which takes 5 parameters and fetches data from one database and insert that data into my database table which is a master table for my project.
    Is there any way to execute the perl script from a HTMLDB page by passing parameters.
    Pls. provide me inputs if any.
    Thanks & Regds.
    Kumaraswamy RJ.

    Check out MOS note 1515609.1.
    Regards,
    - Loc

Maybe you are looking for

  • Error message downloading from digital camera

    iPhoto cannot import your photos because there was a problem downloading an image. I need help getting past this error message. My camera and laptop have been compatable until now. I have recently removed all videos from the laptop and put them on an

  • RH7 Topics appearing in another language

    Another completley random, strange bug. I have a few topics in my web help project (same project having the TOC inssue; http://forums.adobe.com/message/3891122#3891122, as it happens) which are appearing either blank or in Chinese. ! I'm wondering...

  • HT204370 Movie Purchase

    I live in the United States.  I find that my friends can purchase several movies and download them to their iDevice; however, when I try to purchase or download the same movie to my iTunes account on my PC it will not let me?  Can someone explain thi

  • Crash and video garbage on K2M2

    I need help, I think that I have a bad k2m2 combo board. I have read through most of the forum and can't find any similar problem. I am not a newbie, I have seen this problem on an ASRock once before but RMA'd that board. But after getting an MSI, I

  • Adobe Indesign CC crash problem

    I am having trouble with my Indesign CC application. Everytime I try to launch the app (this was after trying to open a document previous worked on in Indesign CS5), just as it starts opening up, it brings up the message "restore windows" and "don't