This year I plan to implement database build automation. There are lot of manual tasks for a developer DBA to create and deploy a release package.I decided to use the Windows Powershell as build tool. it integrates best in the Windows environment to access ...

File System - read/write parse and concatenate files

Registry/Environment - access them like a fiele system

Database - Add ODP.NET Assembly to access the database

Source control like Team Foundation Server

In my first example i want to show how easy database access is achieved very well controlled due to exception handling via try {} catch {} and finally {} blocks.

This is not a Windows Powershell introduction but an example how you could use it for your own tasks;

The following example connects to the database to extract the tables DDL File.Use the Powershell console (powershell.exe) to execute the commands

retrieved data could be processed with all capabilities of the Powershell

clean output of data without header, prompt, ...

This is just an easy demonstration how to connect to the Oracle database via Powershell;One of the next blogs will be the use of the Powershell as a preprocessor;for example using an include directive in SQL scripts similar that way the the preprocessor of C is doing it;

Checking connection state : If the opening of a connection fails an error-message with error-stack is written on the screen, but no exception is thrown. You have to check the connection.status object to check if your attempt to connect to the database was successfully.