Delete user of  oracle 12c through powershell scripting

member 01
member 01 used Ask the Experts™
Hi Experts,

I am using oracle database 12C. I have to delete users of this database And kindly let me know how PowerShell will make connection with oracle database? Integration part ?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Geert GOracle dba
Top Expert 2009
powershell ???
can you fix a car with a pen  ?
use the right tool for the right job

install an oracle client
then you will have sqlplus
use sqlplus to
login with a dba user, which requires you to know the password
or login with sys ...

then execute "drop user user_name"
Senior Oracle DBA
While I believe that the SQL*Plus route is probably the easiest way to go, you can actually do this in PowerShell.  Installing a full client is not required (although the ODAC install does include instant client).

I saw something about this recently and decided to do some research.  Turns out PowerShell has some sort of .Net framework built into it.    There is a pretty good article about that here.  It includes an example, but that really relates to SQL Server which has some built in access with PowerShell.

To connect to Oracle, you need to install ODP.NET, you can get that here.

Then this is a pretty good example of how to connect to Oracle through PowerShell.
Most Valuable Expert 2012
Distinguished Expert 2018
>>To connect to Oracle, you need to install ODP.NET, you can get that here.

Go with the Managed Client.  There is no "install".  Single DLL and proper references and you are good to go.

Disclaimer:  Yes, I've seen quick .Net code run in Powershell.  I've never done it personally.
PberSolutions Architect

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

-- johnsone (https:#a42060329)
-- Geert Gruwez (https:#a42059196)
-- slightwv (䄆 Netminder) (https:#a42064110)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial