Drop user package using Unix script

Hi,
When I run this script, I get an error :
#!/bin/ksh
echo
echo '==== DROP AND RE-CREATE ALL TEST PACKAGES ===='
echo '# After executing this script with 'y' option execute test.sql'
echo
echo 'Do you want to drop and re-create test packages ? (y/n)'
echo '# rtrvCondTest.pkb'
echo '# ex2_test3.pkb'
read ans
if [[ "$ans" = "y" ]]; then
  echo 'Rebuilding all.... '
  sqlplus -s / <<-eof
  set heading off
  set echo off
  set serveroutput on
  DROP PACKAGE rtrvCondTest
  DROP PACKAGE ex2_test3
  START rtrvCondTest.pkb
  START ex2_test3.pkb
  eof
fi
exit 0$ ./rebuildAll.ks
==== DROP AND RE-CREATE ALL TEST PACKAGES ====
# After executing this script with y option execute test.sql
Do you want to drop and re-create test packages ? (y/n)
# rtrvCondTest.pkb
# ex2_test3.pkb
n
./rebuildAll.ks[10]: syntax error at line 13 : `<<' unmatched
How do I get this script to work??
Any help is appreciated.
Thanks
Sharath

there should be no space left to eof
Regards
Laurent Schneider
OCM-DBA

Similar Messages

  • How to load abap ztable using unix script

    Hi Experts,
    I want to upload the data from excel sheet into abap ztable using unix script. If possible give me a sample coding for this..
    Regards,
    vijay

    hi vijay see the  code below
    REPORT YFTP1 .
    FTP by abap.
    This program passses host, user, source/target
    directory and file parameters to a UNIX script which
    in turn gets the required file from the host by ftp.
    The unix script should look like this:
    #! /bin/sh
    ftp -n $1 << !!
    user $2 $3
    cd ..                      <-- only for mainframe ftp
    get $4 $5
    quit
    placed in the adm path, preferably under
    /sapmnt//exe. In order to make this program
    work please create sapcpic/manager cpic user and
    apply note no. 41770.
    PARAMETERS: HOST(10) OBLIGATORY LOWER CASE,
    USER(8) OBLIGATORY LOWER CASE,
    PASSWORD(8) OBLIGATORY LOWER CASE,
    SRC_FILE(45) OBLIGATORY LOWER CASE,
    TRG_FILE(45) DEFAULT '/usr/sap/trans/data/??????' OBLIGATORY LOWER CASE,
    BIN AS CHECKBOX.
    DATA: JC(8), FLG(1), B(128), PRNAME(128), LOGFILE(30), AAA(40).
    DATA: BEGIN OF A,
    1(12), 2(10), 3(10), 4(47), 5(47),
    END OF A.
    IF HOST = 'zxaq'.
      IF BIN = 'X'.
        PRNAME = 'ftp_bin_vms'.
      ELSE.
        PRNAME = 'ftp_asc_vms'.
      ENDIF.
    ELSE.
      IF BIN = 'X'.
        PRNAME = '/usr/sap/trans/bin/ftp_bin_unix'.
      ELSE.
        PRNAME = '/usr/sap/trans/bin/ftp_asc_unix'.
      ENDIF.
    ENDIF.
    A-1 = HOST.
    A-2 = USER.
    A-3 = PASSWORD.
    A-4 = SRC_FILE.
    A-5 = TRG_FILE.
    CONDENSE A.
    B = A.
    CALL FUNCTION 'JOB_OPEN'
         EXPORTING
              JOBNAME  = 'FTP'
         IMPORTING
              JOBCOUNT = JC.
    CALL FUNCTION 'JOB_SUBMIT'
         EXPORTING
              AUTHCKNAM     = SY-UNAME
              EXTPGM_NAME   = PRNAME
              EXTPGM_PARAM  = B
              EXTPGM_SYSTEM = 'jupiter'
              JOBCOUNT      = JC
              JOBNAME       = 'FTP'.
    CALL FUNCTION 'JOB_CLOSE'
         EXPORTING
              JOBCOUNT         = JC
              JOBNAME          = 'FTP'
              STRTIMMED        = 'X'
              TARGETSYSTEM     = 'jupiter'
         IMPORTING
              JOB_WAS_RELEASED = FLG.
    LOGFILE = '/tmp/ftp.log'.
    DO.
      OPEN DATASET LOGFILE FOR INPUT IN TEXT MODE.
      IF SY-SUBRC = 0. EXIT. ENDIF.
    ENDDO.
    DO.
      READ DATASET LOGFILE INTO AAA.
      IF SY-SUBRC = 0. WRITE / AAA. ENDIF.
      IF AAA = 'FTP completed'. EXIT. ENDIF.
    ENDDO.
    CLOSE DATASET LOGFILE.
    delete dataset logfile.
    now the file is in the application server which you can upload in your internal table and update the database table....
    thnkx
    bhanu

  • Call a Java API using Unix Script

    Hi SDNers,
    I want to call a Java API using Unix Script. Please suggest what will be the commands in Unix.
    Please help!!
    Thanks,
    Priti
    Edited by: Priti Rani Patnaik on Jul 7, 2010 4:17 PM

    Hi
    Try this
    String[] cmd = {"/bin/sh", "-c", "ls > hello"};
      Runtime.getRuntime().exec(cmd);
    [Other Help|/thread/5425832 [original link is broken];
    BR
    Satish Kumar

  • How to find which users has used external scripting

    I want to find out the users who used the scripting for doing any mass changes activity.

    Hi Murphy;
    Please check which user has which forms open? and Re: how to determine which forms are currently open?
    Hope it helps you in your issue
    Regard
    Helios

  • File port query  File transfer from SAP R/3 to Webmethods using Unix Script

    SAP drops the files in the /sapio/ directory and triggers an unix script using File port partner destination.
    Unix script will perform a secure copy of files to Webmethods server.
    If in unix script, error occurs then an RFC function will be called to send an error notification to a person.
    Queries
    1) How is the unix script triggered using the File port partner destination ?
    2) What is the unix command to invoke a report which sends the error notification mail ?
    3) Does SCP command to copy files to webmethods work , if the unix script is placed in /sapio/ directory ? Or whether
    any connection need to be established between SAP and Webmethods server ?

    Hello,
    Since you want to transfer Article Master, it should be a Retail System. So you should use Message Type ARTMAS. For fullbuild, you can use transaction WDBM and for changes, you can use WDBU.  For changes, you can enable change pointers for required fields using BD64.
    Thanks,
    Venu

  • How to call pakage using Unix script

    Hi,
    I have created one package in Oracle(contains2 funcation and 4 procedure) which is in in xxx14database.
    Now i can execute the package and its working fine at database level.
    As per requirement ,i need to create on Unix script to trigger the package.
    I have no idea how to create the Unix script to execute the package.
    The Unix script need to created in xxxx001 Server.
    Can anyone please let me know the template or any link which I can refer to create the same.
    Or anyway i can create a script/batch on window and test first in my laptop and use the same script for my project work with required modification
    Secondly the application owner asked me to give them both database and Unix script to them so that their database team will test the Package which i developed.
    Database script meand the Package body and spec i should save as file.pkb format and send them or i can save them in .sql file and send them
    Thanking you all in advance please help its urgent.

    Now that you know how to do it ... reconsider whether doing so is a good idea.
    There is almost nothing you can do calling from a shell script that can't be done more easily from DBMS_SCHEDULER other than compromise security. Shell scripts connecting to the database are, as shown in the demo code, inherently insecure and, if you get enough of them, make it difficult to cycle passwords on a regular basis.

  • Set Default Printer based on user setting using Powershell script

    Hi 
    I would like to create a script that runs on user log off and captures the default printer (set manually by the user) and then another script to reapply the settings (saved upon log off) when the user logs back in.
    This is because local printers are set as default printer (PDF Creator Programs) when we all use Network Printers so this means a user has to set default printer to the network printer all the time.
    I have found this script to start with:
    $Printer = Get-WmiObject -namespace root\cimv2 -Query “select * from Win32_Printer Where Default = TRUE” -Impersonation 3 | select name | out-file C:\temp\Printer.txt
    But the out file looks like this:
    name
    \\PrinterserverName\Accounts01
    Which I dont see how it can be used on another script plus there are spaces after\Account01 
    Any Ideas please?
    M
    Maelito

    Hi Maelito,
    According to your description, you want to export the default printer name to text file, then read this printer name from text file and set the default printer via Powershell:
    #save printer name to text file
    Get-WmiObject -namespace root\cimv2 -Query “select * from Win32_Printer Where Default = TRUE” -Impersonation 3 | select -ExpandProperty name | out-file C:\temp\Printer.txt
    # read printer name from text file and set default printer
    $name=get-content C:\temp\Printer.txt
    (Get-WmiObject -Class Win32_Printer -Filter "Name='$name'").SetDefaultPrinter()
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Modify an user attribute using Powershell script

    In the current account creation script I am setting the following two attributes targetAddress and proxyAddressess:
    $UserAttributes[0].Add('targetAddress', $User.mail)
     $UserAttributes[0].Add('proxyAddresses', "SMTP:" + $User.mail)
    I need to be able to change these values sometimes.  I thought if I replaced add with replace that would work it did not.
    Ideas?
    Here is the whole function:
     $AttributeItems=$UserAttributes[0].GetEnumerator()
     ForEach ($AttributeItem in $AttributeItems) {
      $AIKey=$AttributeItem.Key
      $NewAttribute=$AttributeItem.Value
      $ADAttribute=$FullUser.$AIKey
      if ($ADAttribute -ne $NewAttribute) {
       Set-ADUser $User.sAMAccountName -Replace @{$AIKey=$NewAttribute}
     $UserAttributes[0].Add('targetAddress', $User.mail)
     $UserAttributes[0].Add('proxyAddresses', "SMTP:" + $User.mail)
     $ClearCount=$UserAttributes[1].Count
     If ($UserAttributes[1].Count -gt 0) {
      Set-ADUser $User.sAMAccountName -Clear $UserAttributes[1]
     $enattendantgodot='Hold on there pardner!'

    I'm using example 4.
    This is what I have: 
    $UpdateUserAttributesArray = 'sn','givenName','initials','displayName','info','mail','departmentNumber','department','telephoneNumber','ipPhone','title','physicalDeliveryOfficeName','employeeType'
    Function StudentNameChange {
        $Attributes=BuildUserTable $UpdateUserAttributesArray
        Set-ADuser $User.sAMAccountName -Replace @{mail="$User.mail";targetAddress="$User.mail";proxyAddressess="SMTP:$User.mail";sn="$User.sn";cn="$User.sn + $User.givename"}
    $UpdateUserAttributesArray sets the value for the import file.
    StudentNameChange should set the updated value has needed.
    The script runs but no settings are changed.
    Set-AdUser $User.sAMAccountName  -mail $User.mail -surname $User.sn
    Like that.,
    Replace is only for optional attribute.
    Function does not specifi $user so that may also be missing.
    I think you need to spend some time learning the basics of PowerShell. It looks like you are just gluing things together thazt you have found with no understranding of how any of the bits work.
    Try just setting one user at a command prompt until you see how the CmdLet and PowerShell work.  Post single simple questions as you try each parameter.
    # build a test user object
    $user New-Object PsObject@{
    SamAccoutnName='somename'
    Mail='[email protected]'
    SN='lastname'
    GivenName='John'
    proxyAddresses='...<list of addresses>'
    #start like this and add items until you understand what is working.
    Get-AdUser $user.SamAccountName |
    Set-AdUser -Surname $user.sn -GivenName $user .GivenName -Replace @{Mail='$($user.Mail'}
    #use Rename-Object to change CN.
    You need to learn the simple bits before you try to do grand things.
    ¯\_(ツ)_/¯

  • Changing the filenames using unix script

    Hi,
    I have a scenario where I have to change the file names on the Receiver CC using a unix script and add date and timestamp to the file name
    this is what I'll be writing to filename_01.xml I need to change that to newfilename_01_MMDDYYYY_HHMISS.xml
    the 01 in the file name is the counter, so I might having more than one file where 01,02, etc will represent the counter on the filename.
    Any help is really appreciated.
    Thanks,
    Joe.P

    you can try this
    create the field called filename in target
    use a costant and concat it with the out out of UDF( or some functon avaleiable counter) which will genereate numbers like 1,2,3,4,5,6 and send this filename_01 to the output field and use this in the variable substution to genreate the filename by the CC
    if you dnt want to send this fieldin output file then specify that fieldname in CC length as 0

  • Cannot drop user -must use DBMS_AQADM.DROP_QUEUE_TABLE to drop queue tables

    Hi,
    I had this issue before, but forgot the command that should be used to flush some kind of a trash bin.
    Can someone assist me?
    Thanks!

    Hi,
    Use this link :
    Re: Unable to drop USERS tablespace.

  • Advantage's using Unix Script

    I'm creating ACH file using program RFPNFC00 which goes and stores in the application server. I need to ping this file from application server to FTP for which i wanna know which one is the best way to do is that with FM  CALL FUNCTION 'FTP_CONNECT' or shall i ask the Unix guy to write a small script to ping the file from app server to FTP.
    Basically can anyone lemme know the advantages and disadvantages of Unix script and ABAP code to ping the file to FTP.
    Regards
    VENk@

    Venkat,
    it depends on the security-configuration in your company.
    If you're authorized use SAP-FTP -> look sample program RSFTP004
    hope that helps
    Andreas

  • Trigger ABAP program using UNIX script

    Hi All,
    I want to trigger an Abap program whenever a unix file comes to SAP.
    Can any1 please tellme how to write a unix script to trigger the ABAP program.
    Thanks in advance.

    you will need to create a batch job in SM37 for the ABAP program, and use an event for the start criteria.
    The event can be created in SM62
    Then in unix, you will need to call an executable SAPEVT.
    This will be in the directory /usr/sap/<SAPSID>/SYS/exe/run
    you will need to use the appropriate profile for the SAP system to run the sapevt utility.
    example :-
    sapevt abap_event -t pf=/usr/sap/<SID>/SYS/profile/<SID>_DVEBMGS00_<SYSNAME> nr=00

  • Using unix  script (perl)  copyoutboundfile

    Hi  guru,
    I  want  to  copy  a  file  from a directory  origin  to  directory destination.
    The script  copyoutboundfile use  parameter  $sourcesid  and $targetid.
    How i progmammed it in abap .
    I  defined a unix command name Z_TRANS_FILE  to execute the script in SM69 .
    How i pass  the parameters if i use this function  ?
    or do you have other solution ?
    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
          EXPORTING
            commandname                   = unix_command
            additional_parameters         = params
          IMPORTING
            status                        = return_code
          TABLES
            exec_protocol                 = tabl
          EXCEPTIONS
            no_permission                 = 1
            command_not_found             = 2
            parameters_too_long           = 3
            security_risk                 = 4
            wrong_check_call_interface    = 5
            program_start_error           = 6
            program_termination_error     = 7
            x_error                       = 8
            parameter_expected            = 9
            too_many_parameters           = 10
            illegal_command               = 11
            wrong_asynchronous_parameters = 12
            cant_enq_tbtco_entry          = 13
            jobcount_generation_error     = 14.
    Thanks in advance
    Soufiene

    Re: Running a batch file kept on the server
    FM ''SXPG_COMMAND_EXECUTE"
    Using of SXPG_COMMAND_EXECUTE Function Module.

  • Advice executing oracle package using shell script.

    Hi,
    I am writing one shell script that accepts several parameters as an input. These parameters are then passed while executing Oracle package procedure. However this procedure has an OUT parameter and I am not aware of how to receive that parameter in shell script.
    Any advice /suggestion is really appreciated.
    Below is the part of code I am using ... (P_OUT is suppose to be an out parameter for package)
    sqlplus -s apps/apps <<endsql
    whenever sqlerror exit failure
    set serveroutput on size 10000
    execute TEST_PKG.GET_COC_REQ ('$P_FROM_DATE','$P_TO_DATE','$P_MONTH_YY', '$P_OUT');
    endsql

    There is more than one way. Here an example :
    SQL> select ename,sal from emp where empno=7902;
    ENAME             SAL
    FORD             3000
    SQL> create or replace procedure extsal (
      2     empnum  in      number,
      3     salout  out     number)
      4  is
      5  begin
      6     select sal into salout
      7     from emp
      8     where empno = empnum;
      9* end;
    SQL> /
    Procedure created.
    SQL> exit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.4.0 - Production
    $ EMP=7902
    $ SAL=`sqlplus -s scott/tiger << EOF
    set head off
    var salout number;
    exec extsal ($EMP, :salout);
    print salout
    exit
    EOF
    `$ echo $SAL | awk -F. '{print $2}'
    3000
    $

  • Insert into a table using UNIX

    i have file Summary.txt
    contants looks like this
    ./log_CS-185.lst:Error detected, rollbacking
    ./log_CS-13603.lst:Error detected, rollbacking
    ./log_CS-1002.lst:Error detected, rollbacking
    now i have to parse this file to get (CS-185,CS-13603,CS-1002)
    and insert these vlaues into a table... how do i do this using unix script ?..

    i have to parse this file to get (CS-185,CS-13603,CS-1002)
    and insert these vlaues into a table... how do i do this using unix script ?..Example :$ cat read_Sum.sh
    cat Summary.txt | while read LINE
    do
            VAR=`echo $LINE | awk -F_ '{print $2}' | awk -F. '{print $1}'`
            echo $VAR
            sqlplus -s test/test << EOF
            insert into summary values('$VAR');
            exit
    EOF
    done
    $ ./read_Sum.sh
    CS-185
    1 row created.
    CS-13603
    1 row created.
    CS-1002
    1 row created.
    $ sqlplus test/test
    SQL*Plus: Release 10.2.0.3.0 - Production on Thu May 19 13:32:40 2011
    Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select * from summary;
    CODE
    CS-185
    CS-13603
    CS-1002
    SQL>

Maybe you are looking for