DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: running a script in unix

  1. #1
    Join Date
    Nov 2000
    Posts
    169
    Hello,
    Assuming I have a script saved in a file called my_scripts.sql under this directory: u03/oradata/AP01/scripts/my_script.sql ,

    Can I run it like this from

    SQL>@/my_scripts.sql

    OR I have to run it like this:


    SQL>@u03/oradata/AP01/scripts/my_script.sql

    Will both run? or I have to specify all the path name for the file to run the script?

    Please explain, I'm "kinda" new to the unix environment.

    thanks,
    learn

  2. #2
    Join Date
    Dec 2000
    Posts
    11
    Three ways:
    If you've started sql*plus from the same directory as your script the you don't need to use a path (i.e. @my_scripts.sql), otherwise you need to use a full path (i.e. @/u03/oradata/AP01/scripts/my_scripts.sql) or a path relative to your current directory (if your current working directory is /u03/oradata then @./AP01/scripts/my_script.sql). Also make sure that you start your full path with a '/', otherwise the path will be interpreted as starting in your current working directory.

  3. #3
    Join Date
    Nov 2000
    Posts
    71
    You can also set the env variable SQLPATH pointing to all the directories containing your scripts.
    In this way you can call your scripts everytime simply using an @ without specifing the script destination path.
    However if your script is in the current directory and it is not spiecified in the SQLPATH env variable you can call it using a double @ (example @@myscript)
    Bye.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width