0

I am trying to run a .sql file form powershell as :-

sqlplus username/password@TnsAlias 'c:\path\to\DBscript.sql'

Here TnsAlias refers to my ORACLE_SID

Whenever i run this command, i get the standard usage instructions of sqlplus.

Could someone help me out on this.

I am running this on Windows Server 2012 and Powershell version 4.0,if it helps.

1
  • try test connection without sqlfile sqlplus username/password@TnsAlias Commented Aug 16, 2018 at 6:34

1 Answer 1

1

This works for me:

PS M:\> sqlplus scott/tiger@kc11g "@m:\dbscript.sql"

SQL*Plus: Release 11.2.0.1.0 Production on ╚et Kol 16 07:59:25 2018

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

SQL>
Sign up to request clarification or add additional context in comments.

2 Comments

I am using Oracle 12.1.0.2.0 Do you think that might be a reason for it not running
I'm not sure whether you noticed the difference in the way you called the SQL script and the way I did it. Should be "@m:\dbscript.sql". I don't think that difference in database version has anything to do with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.