2 Replies Latest reply on Nov 4, 2015 4:49 PM by thatJeffSmith-Oracle

    SQLCL.bat and SQLCL.exe :Good usage ?




      I have installed SQLCL 4.2, but I have some problems to use it...

      My goal is to execute a sql file by a powershell script and generate a csv file.


      I do not manage to use sqlcl.exe. It tells me to download a jre, while a jre 1.7 is already installed.


      However, by using the file sql.bat and pass it user/login and the script it seems to works, but I have other issues difficult to explains (sometimes the csv file generated is empty, sometime the result is googd, soemtimes the csv file is not generated!).


      So first step: What is the good way to use sqlcl ? Do I need to use sqlcl.exe, or the sql.bat is the good way ?


      Thank you

        • 1. Re: SQLCL.bat and SQLCL.exe :Good usage ?
          Dear DBA Frank


          you can launch the command line version of SQLDeveloper on a command line (which can be included in a .bat file) such as this:

          D:\tools\sqldeveloper\bin\sql yourusername/yourpassword@//host:1555/sid @d:\tools\countobjects.sql

          The contents of the countobjects.sql file would be something such as this:

          spool d:\tools\countobject.csv

          select /*csv*/ object_type, status, count(1) from user_objects group by object_type,status order by object_type,status ;

          spool off


          So the result of running countobjects.sql with the above command line would look something like this;



          "INDEX PARTITION","VALID",2065


          "TABLE PARTITION","VALID",1435


          Also note that SQLDeveloper 4 requires version 8 of the Java JDK.  If you run into further issues, consider creating a new post.

          All the best.

          • 2. Re: SQLCL.bat and SQLCL.exe :Good usage ?

            empty csv not related to exe or bat file


            if you add JRE to your OS path, the EXE should work just fine


            give us a test case where the CSV file is reliably empty