I am trying to log in to the the Oracle DB using PowerShell and run a script called "C:UsersAdministratorDesktoporacleOracleCleanTest.sql", When I execute the PS nothing happens.
Here is what I have.
$adminLogon = "sys as sysdba/manager@ORCL"
$logon = "sqlplussql/manager@ORCL"
$mydata = Invoke-SqlPlus -inputfile "@C:UsersAdministratorDesktoporacleOracleCleanTest.sql" $logon
I've also tried this.
$database = "ORCL";
$user = "sys as sysdba";
$pw = "manager";
sqlplus.exe -d $database -U $user -P $pw -I "@C:UsersAdministratorDesktoporacleOracleCleanTest.sql"
I tried this.
& 'C:appAdministratorproduct11.2.0client_1BINsqlplus.exe' 'QE-JDBC-1/manager@ORCL sys as sysdba' '@C:UsersAdministratorDesktoporacleOracleCleanTest.sql'
I get the error, "& : The module 'sqlplus' could not be loaded. For more information, run 'Import-Module sqlplus'. At line:5 char:3 + & $mydata Invoke-SqlPlus -inputfile "@C:UsersAdministratorDesktoporacleOrac ... + ~~~~~~~ + CategoryInfo : ObjectNotFound: (sqlplussql/manager@ORCL:String) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : CouldNotAutoLoadModule"
See Question&Answers more detail:os