5 Replies Latest reply: Aug 8, 2012 9:14 PM by 926197 RSS

    Changing Default Directory in SQL*Plus

    208546
      How does one change the default directory in SQL*Plus? It's defaulting in the bin directory in <ORACLE_HOME> and I want to changed it to my own personal directory on my C:\ drive.
        • 1. re:Changing Default Directory in SQL*Plus
          3004
          SQL*Plus looks for scripts in the current directory, and then in the directories specified by the SQLPATH registry entry. Set the SQLPATH registry entry to change the script search path.

          The HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0 registry subkey contains the SQLPATH registry entry. You can concatenate directories with a semicolon. For example:

          C:\ORACLE\ORA90\DATABASE;C:\ORACLE\ORA90\DBS;C:\

          Alison
          • 2. re:Changing Default Directory in SQL*Plus
            210288
            First make sure that <ORACLE_HOME>\bin is in your PATH,
            and then just run SQL*Plus from your personal directory on C:\.

            Because it is in the PATH, SQL*Plus will be found even though it is not in the current directory; and when it starts, the default directory will be the directory that you were in when you executed the program.


            Or create a shortcut on the Desktop.
            For "Target", you can enter the complete path to SQL*Plus.
            For "Starts in", enter your personal directory on C:\.


            I do not know of any way to change the default directory once SQL*Plus is running.
            • 3. Re: Changing Default Directory in SQL*Plus
              user346369
              > I do not know of any way to change the default directory once SQL*Plus is running.

              One very late response, but... I have been using the Windows GUI version of SQl Plus (SqlplusW.exe) for years and I change the default directory all the time. Here is how:

              Use the File, Open pull-down menu dialog, and navigate to the folder you want. Then, select one of the files in that directory. I keep a file named 0~A.sql in each folder where I use SQL Plus for that purpose. It contains only comments, something like:
              --SET ECHO ON
              Once I open such a file, all the START commands run scripts in that folder.

              Now... since the Windows version of SQL Plus has been deprecated, how in the world can I do the same thing in the DOS command window version of SQL Plus?

              Why in the world doesn't Oracle provide such an obviously useful feature???
              • 4. Re: Changing Default Directory in SQL*Plus
                peter dequidt
                Dear Steve,

                I also used the trick you described here to change the working directory of SQL*Plus, and I was also surprised that the command-line version of Window is not capable of doing so... Have you got any answer to this? Did you post a SR on this to Oracle? If so, what was their answer?

                Peter
                • 5. Re: re:Changing Default Directory in SQL*Plus
                  926197
                  I tried running sqlplus from the directory i wished to use ..

                  The command prompt window comes up, but then i need to connect to oracle

                  and I get a ORA-TNS 12560: TNS Protocol Adaptor Error

                  How do I cure this error?

                  Thanks

                  Jefe

                  NB I am running Oracle 11 Express on Windows Vista; 3GB RAM