« Systematic Oracle Performance Tuning | Main | Using _spin_count to reduce latch contention in 11g »

January 28, 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d834c21a6453ef00e551d8812e8833

Listed below are links to weblogs that reference Accessing Oracle from Powershell:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Diego Ucedo

Very useful piece of code.
I am wonder if it is possible to call a stored procedure from powershell scripting. This is a requirement for performance reason. Thanks.

Guy Harrison

Two methods for calling stored procedures. Firstly, if you just surround the stored procedure call with BEGIN .. END, then you can issue it as a NonQuery command. Eg:

$sql="begin mystoredproc; end;"
$command = New-Object Oracle.DataAccess.Client.OracleCommand( $sql,$conn)
$command.ExecuteNonQuery();

A slightly more correct way to do this would be to set the CommandType to "StoredProcedure". Then you don't need the BEGIN END:

$sql="mystoredproc"
$spCommand=New-Object Oracle.DataAccess.Client.OracleCommand( $sql,$conn)
$spCommand.CommandType="StoredProcedure"
$spCommand.ExecuteNonQuery();

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment