Home » Developer & Programmer » Precompilers, OCI & OCCI » SQLPLUS commands (Shutdown an instance) using C#
SQLPLUS commands (Shutdown an instance) using C# [message #125206] Thu, 23 June 2005 15:47 Go to next message
charlie.becker@hp.com
Messages: 2
Registered: June 2005
Junior Member
Hello,

I'm new to Oracle development, but I'm looking for a way to programatically shutdown an Oracle instance so I can then migrate some datafiles.

I've had no problem using SQLPLUS to run "shutdown" and then to run some of the "alter database" commands I need for migration, however I need a way to programatically run these commands from within C#.

With C# I have been successful using OracleConnection and OracleCommand to run certain "select" statements, but it gives the "ORA-00900: invalid SQL statement" if I try to run "shutdown".

I have been searching for many many hours but have not found any good solution. If this can't be done using C# commands, then I'd like to find a way to run the script and pull the results into my C# program to get the results of whether or not the "shutdown" or the "alter database" commands were successful.

Anyone have any suggestions?

Charlie Becker
Re: SQLPLUS commands (Shutdown an instance) using C# [message #130133 is a reply to message #125206] Thu, 28 July 2005 06:12 Go to previous messageGo to next message
Michael Hartley
Messages: 110
Registered: December 2004
Location: West Yorkshire, United Ki...
Senior Member


What error messages did you get?

Did you connect to the database as sysdba?

Kind regards
Michael Hartley
http://www.openfieldsolutions.co.uk
Re: SQLPLUS commands (Shutdown an instance) using C# [message #130182 is a reply to message #130133] Thu, 28 July 2005 10:59 Go to previous messageGo to next message
charlie.becker@hp.com
Messages: 2
Registered: June 2005
Junior Member
Michael,

When I run "shutdown" commands using OracleConnection/OracleCommand I get the error:

ORA-00900: invalid SQL statement

Yes, I am logging in as sysdba.

Hope you can help, this is definitely stumping me!

Thanks,

Charlie
Re: SQLPLUS commands (Shutdown an instance) using C# [message #130337 is a reply to message #130182] Fri, 29 July 2005 07:50 Go to previous message
Michael Hartley
Messages: 110
Registered: December 2004
Location: West Yorkshire, United Ki...
Senior Member

Hi

Have you tried using different execute statements?

like
stmt->executeUpdate("shutdown immedate");

instead of
stmt->execute("shutdown immedate");


I dug into the documentation a little further and am reasonably certain you can't shut a database down using OCI or OCCI. These interfaces provide programmatic interfaces to the database to execute data management, data definition, data transaction control and data transformation.

So I'm reasonably certain what you are attempting to perform is not possible without access to unpublished functional contained in other (non oci/occi) libraries.

Kind regards
Michael Hartley
http://www.openfieldsolutions.co.uk
Previous Topic: Problems using OCCI ,get Date
Next Topic: Pro*C
Goto Forum:
  


Current Time: Tue Mar 19 05:10:01 CDT 2024