Shell script for below pl/sql script dbms_file_transfer

Please let me know how tt write the shell script for below pl/sql script dbms_file_transfer it is
I have trasfer the files from asm into filesystem .
it is working . but i have to put in the loop
begin
dbms_file_transfer.copy_file(
source_directory_object => 'src',
source_file_name => 'ncsn',
destination_directory_object => 'dest',
destination_file_name => 'ncsn');
end;
Edited by: user8680248 on 27/10/2009 20:55

user8680248 wrote:
Please let me know how tt write the shell script for below pl/sql script dbms_file_transfer it is
I have trasfer the files from asm into filesystem .
it is working . but i have to put in the loop
begin
dbms_file_transfer.copy_file(
source_directory_object => 'src',
source_file_name => 'ncsn',
destination_directory_object => 'dest',
destination_file_name => 'ncsn');
end;What database version?
What are you trying to do exactly?
It's working but you have to put it in a loop. Fine, what's the problem you are having?
begin
  loop
    exit when ... whatever the exit condition is ...
    dbms_file_transfer.copy_file(
      source_directory_object => 'src',
      source_file_name => 'ncsn',
      destination_directory_object => 'dest',
      destination_file_name => 'ncsn');
  end loop;
end;

Similar Messages

  • Command for exceuting the sql script to a db from linux home

    Hi All,
    Can someone please tell me how to execute the /addev/ad/11.5/sql/adcdexcp.sql against case122 from my linux home for our product.
    Thanks in Advance

    Do not fully understand your question.. but some basics:
    You need an Oracle OCI client driver and Oracle client on the client side. E.g. Oracle Instant Client and Oracle's SQL*Plus.
    You need to connect to the database server (using SQL*Plus as the example):
    sqlplus scott/tiger@db-alias
    Where db-alias is a TNS alias for the database.
    Once connected, you can use SQL*Plus to load the contents of a SQL script, and send a single SQL command (or PL/SQL anonymous block) at a time to the Oracle server for execution. E.g.
    SQL> @/addev/ad/11.5/sql/adcdexcp.sql
    I suggest you point your browser to http://tahiti.oracle.com (Oracle Documentation Portal), and look for the SQ*Plus User Guide for the Oracle version you're running.
    If you can be more specific and provide proper details as to what you are attempting to achieve, forum members will be a better position to provide assistance and advice.

  • How can I convert a mysql sql script to a oracle sql script

    Hi,
    We have a bunch of tables with data running on a mysql server.
    This should now be moved to an oracle 9 db.
    are there any tools to convert the import script of a mysql db
    to a format of the sql script that work for oracle ?
    Thanks
    Michael

    Oracle has a tool called Migration Toolbench, which supports MySQL 3.22 and 3.23:
    http://otn.oracle.com/tech/migration/workbench/content.html
    On this same topic, I was wondering if anybody has tried migrating from PostgreSQL to Oracle 9i. The workbench doesn't seem to support it, and feeding a pg_dump file directly into SQL*Plus is not working.

  • How to Add an SQL script to another existing SQL script

    I have just created an SQL script and i need a way to join it with several other existing SQL scripts.
    I don't want to change any of the other scipts, i just need to add my new script on to the existing ones.
    I've looked at some of the functions and they don't seem to work for me.
    Let me use this as an example.
    Here is my new script:
    SELECT DISTINCT max(case when EC.EQUIPMENT_CLASS like '%_ERT' then 'Y' else 'N' end) over (partition by E.CURRENT_SERVICE_ID) as ERT
    FROM EQUIPMENT E,
    EQUIPMENT_TYPE ET,
    EQUIPMENT_CLASS EC
    WHERE E.EQUIPMENT_TYPE_ID = ET.EQUIPMENT_TYPE_ID
    and EC.EQUIPMENT_CLASS = ET.EQUIPMENT_CLASS
    and E.CURRENT_SERVICE_ID = 38514
    I need to add this to an existing script such as this:
    SELECT E.EQUIPMENT_NUMBER,
    E.EQUIPMENT_TYPE_ID,
    ET.EQUIPMENT_TYPE_DESC
    FROM EQUIPMENT E,
    EQUIPMENT_CATEGORY ECAT,
    EQUIPMENT_TYPE ET,
    EQUIPMENT_CLASS EC
    WHERE ET.EQUIPMENT_TYPE_ID = E.EQUIPMENT_TYPE_ID
    and EC.EQUIPMENT_CLASS = ET.EQUIPMENT_CLASS
    and EC.EQUIPMENT_CATEGORY = ECAT.EQUIPMENT_CATEGORY
    and E.EQUIPMENT_ID = 113950
    * The Reason why i can't just add the line i need together with the existing script, is because it's giving me invalid data from what i want to see. When i run them separately i get the desired results.
    Not sure if anything can be done like this or not, but if so, i'd appreciate a shove in the right direction.
    thanks

    I have just created an SQL script and i need a way to
    join it with several other existing SQL scripts.
    Do you simply want to append your newly created query to the file that contains an existing query ?
    >
    I've looked at some of the functions and they don't
    seem to work for me.
    Not sure how this is a SQL or PL/SQL related question, you'd probably want to just append the files using a text editor or maybe an OS command like cat or type.
    >
    * The Reason why i can't just add the line i need
    together with the existing script, is because it's
    giving me invalid data from what i want to see. When
    i run them separately i get the desired results.
    You may want to explain how the data is different from what you are expecting. In any case, your queries do not end with the sql terminator - the ";" character or a forward slash "/" at the first column of a line after the query; maybe that's the culprit.
    Consider this:
    SQL>
    SQL> host type c:\t1.sql
    select first_name from employees where rownum = 1
    SQL>
    SQL> @c:\t1.sql
      2  /
    FIRST_NAME
    Ellen
    SQL>
    SQL> host type c:\t2.sql
    select last_name from employees where rownum = 1
    SQL> @c:\t2.sql
      2  /
    LAST_NAME
    Abel
    SQL>
    SQL> host type t3.sql
    select first_name from employees where rownum = 1
    select last_name from employees where rownum = 1
    SQL> -- now, t3.sql contains both the queries of t1.sql and t2.sql
    SQL> -- however, they do not end with the sql terminators
    SQL>
    SQL> @c:\t3.sql
      2  /
    LAST_NAME
    Abel
    SQL> -- the first query was not executed...
    SQL>
    SQL> -- t3.sql has been fixed now
    SQL> host type t3.sql
    select first_name from employees where rownum = 1;
    select last_name from employees where rownum = 1;
    SQL> @c:\t3.sql
    FIRST_NAME
    Ellen
    LAST_NAME
    Abel
    SQL>pratz

  • A simple script for you, a giant script for me-

    I like scripts very much but scripting does not seems to like me! Can anyone help me and write a script for me? What I need is this:
    1. Ungroup everything in a spread
    2. A loop that goes through every text frame in the spread and, at the end of the text contained in each of those frames inserts a blank paragraph. (The frames contains text and inline graphics)
    This may seems strange but is what I need.
    Best regards and thank you in advance
    Maria

    I like scripts very much but scripting does not seems to like me! Can anyone help me and write a script for me? What I need is this:
    It's much easier for you to show us what you have and then we'll fix it for you or tell you what is wrong. Then you'll learn something to!
    1. Ungroup everything in a spread 
    This one's easy -- unless you're worried about groups inside groups?
    app.activeWindow.activeSpread.groups.everyItem().ungroup()
    If it's groups all-the-way-down, on the other hand, well, it might be more than one line...

  • Shell script for calling an sql file

    Hello, I would need your help in creating a ksh file. We have two ksh files. One for deletion the eim table and the other one is for running the eim job.
    Ksh file for running the eim job is okay. But the ksh file running the delete sql is not. We were thinking that we may have some sort of mistake in the syntax could have caused the problem we experiencing now. Need your expertise to check it. Please?
    Here’s the syntax we have.
    #!/bin/sh
    sqlplus -s <user>/<pwd>@dbname << EOF
    @<folder-path>/sqlrun.sql
    EXIT
    ENDSQL
    EXIT
    When we run it against putty, nothing seems to happen as in no error message appears at all. It prove that the sql file did not execute in TOAD.
    We tried the other way around, by putting the /dev/nu// as show below.
    sqlplus -s <user>/<password>@DBNAME > /dev/null <<ENDOFSQL
    still nothing happen.
    Regards

    user10070712 wrote:
    Hello, I would need your help in creating a ksh file. We have two ksh files. One for deletion the eim table and the other one is for running the eim job.
    Ksh file for running the eim job is okay. But the ksh file running the delete sql is not. We were thinking that we may have some sort of mistake in the syntax could have caused the problem we experiencing now. Need your expertise to check it. Please?What does this have to do with APEX, which is the topic of this forum?
    What is "eim"? Why have you chosen to post this here?

  • Generate E-R diagram for existing Oracle SQL Script

    Hi,
    We have some existed Packages,Procedures,Functions,Views and Materialized Views. We are planning to generate E-R diagrams for existed codes. Could you please suggest me how can we do the same.
    we are using Oracle SQL Developer and Oracle Version is : 11g.
    Thanks.
    Jai V

    Hi,
    I have already posted a thread regarding Data Flow diagram for existing source code. But I couldn't find find where exactly I have posted. So here I am posting my observations. I would like to prepare a Data Flow diagram for existing Source code. Using Visustin V7 I got the Data Flow Diagram. But am not able to export or Save or Print the diagram. As some one suggested it is possible to get the DFD using Visio. But am not able to get the DFD. Here am getting the problem like , Gave user name and Server name by connecting to ODBC. But still am not getting the required DFD.
    Can you please suggest me is there any way to get the DFD using Visio or any tool is there to get the DFD.
    Please advice.
    Thanks.

  • Shell script for DB

    Hi,
    I have written shell script for below scenarios, can you please guide me to write this as correct way, requirment is,
    1. i need to connect the database which is on unix server , but before connecting the DB some of the files needs to be removed from \tmp directory.
    2. once removed the script need to connect the database and call the sql file which is in \tmp directory.
    3. the output files will be stored in \tmp directory start with DB name.
    4. finally csv files needs to be transferred to local windows with help of FTP. please find below the script
    #!/bin/sh
    rm -f /tmp/dbmon/DB1*
    CONNSTRING=username/PASSWORD@service
    sqlplus -s $CONNSTRING @/tmp/STATS.sql << EOF
    EXIT;
    EOF
    HOST='xxxxx'
    USER='xxxxx'
    PASSWD='xxxxxx'
    FILE='E:\STATS\DB1.*'
    cd /tmp/dbmon
    ftp -n -v $HOST << EOT
    user $USER $PASSWD
    prompt
    mput $FILE
    bye
    EOT
    EXIT;
    EOF
    Thanks
    Edited by: ASP on Nov 18, 2011 4:45 PM

    Hi ASP
    It's always a good idea to write entries to timestamped log file without which you will never know where the script went wrong or failed.
    This is not tested but just a small example
    #!/bin/sh
    export LOG_DIR=/tmp/log
    export LOGFILE=$LOG_DIR/`basename $0`_${TIMESTAMP}.log
    if [ ! -d $LOG_DIR ]
    then
         mkdir $LOG_DIR
    fi
    echo "Removing the temporary files from /tmp/dbmon at `date +%Y%m%d_%H:%M:%S`" | tee -a $LOG_FILE
    rm -f /tmp/dbmon/DB1*
    CONNSTRING=username/PASSWORD@service
    echo "Run SQLPlus file" | tee -a $LOG_FILE
    sqlplus -s $CONNSTRING @/tmp/STATS.sql << EOF
    EXIT;
    EOF
    echo "Now FTP the files to windows box " | tee -a $LOG_FILE
    HOST='xxxxx'
    USER='xxxxx'
    PASSWD='xxxxxx'
    cd /tmp/dbmon
    ftp -vn $HOST <<EOF
    quote USER $USER
    quote PASS $PASSWD
    ascii
    cd E:\STATS
    mput DB1.*
    bye
    EOF

  • How to get SQL script for generating table, constraint, indexes?

    I'd like to get from somewhere Oracle tool for generating simple SQL script for generating table, indexes, constraint (like Toad) and it has to be Oracle tool but not Designer.
    Can someone give me some edvice?
    Thanks!
    m.

    I'd like to get from somewhere Oracle tool for
    generating simple SQL script for generating table,
    indexes, constraint (like Toad) and it has to be
    Oracle tool but not Designer.
    SQL Developer is similar to Toad and is an Oracle tool.
    http://www.oracle.com/technology/products/database/sql_developer/index.html

  • SQL script into a CASE statement ?

    Hy,
    can someone tell me, please, if is it possible insert into a case statement (shell unix script) one or more SQL script ?
    For example :
    case aaa in
    1 )
    sqlplus blabla <<!
    update ...
    insert ...
    2 )
    esac
    Thank you very much !
    Andys

    /unix/sqlplus -s username/pwd @file_name.sql
    This will work on unix prompt. use this in shell script and implement. file_name.sql containts update logic.
    I hope it will solve ur problem.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Andys:
    Hy,
    can someone tell me, please, if is it possible insert into a case statement (shell unix script) one or more SQL script ?
    For example :
    case aaa in
    1 )
    sqlplus blabla <<!
    update ...
    insert ...
    2 )
    esac
    Thank you very much !
    Andys<HR></BLOCKQUOTE>
    null

  • Running  sql scripts from different directory

    Hi
    I have sql scripts in different directories as follows:
    D:\myapp\sql
    - load.sql
    - init.sql
    D:\myapp\sql\schema
    -users.sql
    -structure.sql
    D:\myapp\sql\populate\
    - data1.sql
    - data2/sql
    load.sql call all the other scripts as below:
    @init.sql
    @schema\users.sql
    @schema\structure.sql
    @populate\data1.sql
    @populate\data2.sql
    All my scripts run correctly when I run load.sql from D:\myapp\sql on comand prompt.
    I need a way to run this script from a different directory say D:\ or C:\
    I am writing a installer which will execute from a different directory.
    Right now I get a file not found error for scripts within schema an populate folder.
    Please let me know how can I make this work from a different directory.
    Thanks
    kelvin

    Hi peter. i think you cannot run files spread across different locations.
    --the method which u specified always looks to the defined path                                                                                                                                                                                                                                                                                       

  • Generate sql scripts

    can we create sql scripts in ssis ; just like we create new excel files on package execution .

    well I simplified  requirement:
    I  want to run  an SP  and run this query  and return the below update statement as output.
    :select BusinessEntityID, into #temp from [HumanResources].[Employee]
    where jobtitle ='Engineering Manager'
    update ph
    set ph.payfrequency=10*2
    from [HumanResources].[EmployeePayHistory] ph  where BusinessEntityID in (select * from #temp)
    Hi Chelseasadhu,
    Do you want to generate such an T-SQL script as you posted above or you want to execute the above script in a SSIS package? If the former, there is not a stock task/component in SSIS can generate T-SQL script; if the later, you can execute
    the script via Execute SQL Task. One option is to use Script Task or Script Component to generate SQL script via SQL Server Management Objects (SMO):
    http://www.mssqltips.com/sqlservertip/1833/generate-scripts-for-database-objects-with-smo-for-sql-server/
    http://msdn.microsoft.com/en-IN/library/ms162153.aspx
    Regards,
    Mike Yin
    TechNet Community Support

  • Calling sql script in a folder

    Hi All,
    I'm calling a SQL script from a root SQL script which is present in a sub folder.
    root.sql
    Prompt Loading FULL_RECOMPILE.SQL
    SET DEFINE OFF
    @@Utils\FULL_RECOMPILE.SQL
    SET DEFINE ON
    Show errors
    commit;When I run the script I'm getting the following error.
    SP2-0310: unable to open file "UtilsFULL_RECOMPILE.SQL".
    I tried using forward / (@@Utils/FULL_RECOMPILE.SQL) and the script executed succesfully.
    Is there anyway I can execute the above script by using a backward slash?
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    Thanks,
    guru
    Edited by: guru on 30-Jun-2010 05:54

    Your requirement seems to be executing the script present in the path:
    *./Utils/FULL_RECOMPILE.SQL*
    Is there anyway I can execute the above script by using a backward slash?Whats the need for using a backslash? Unix paths are separated by forward slash in contrast to windows.

  • Problem while executing script in Toad - How to use '&' in the sql script ?

    I have to execute sql script in toad. Sql script has one insert query in which one insert-value is 'USA & CAN'. When I executed the script in toad by pressing F5, I got a prompt window asking for the value if 'CAN' as it is after the &.
    I tried using[b] {escape '\' } .... but could not resolve the problem.
    Is there any solution or workaround to overcome this problem. I have thousands of records with such values and I have to use sql script only.

    There is an option in TOAD to change this behaviour.
    Look in VIEW/OPTIONS/SQL Editor/
    Uncheck the box for "Scan statements for bound variables before execution".
    In SQL*PLUS it would be SET SCAN OFF
    (desupported version is SET DEFINE OFF)
    Message was edited by:
    Sven Weller

  • PL/SQL scripts to capture real time performance usage

    Looking for a PL/SQL script to gather real time accurate information on memory, CPU, I/O stats for users accessing tables in Oracle 10g database on Red Hat Linux.

    Google Search - DBA Scripts
    1) http://www.oracle-base.com/dba/DBACategories.php
    2) http://www.dbazine.com/oracle/or-articles/liu2
    3) http://www.pro-dba.com/oracle_scripts.html

Maybe you are looking for