Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need to execute SQL PLUS commands from C# code

956081Aug 16 2012 — edited Aug 16 2012
Hello all,
This is my first question here and hopefully I will get my solution :)

Right now we are doing 3 tasks manually

1) Clearing everything from a DB.
We use sql plus and execute this :

RAMNIVAS_CI/RAMNIVAS_CI@orclwex3
set pages 0
set lines 80
spool c:\delete_objects_CI
select 'drop '||object_type||' '||object_name||';'
from user_objects;
spool off
start c:\delete_objects_CI.lst
purge recyclebin;
set pages 100
select count(*) from user_objects;

RAMNIVAS_CI/RAMNIVAS_CI@orclwex3 are the username and pwd which gets input when we paste entire thing in sql plus


2) Then we restore that DB again using sql plus to do it using the command:
imp file=CL.DMP log=CL.log buffer=1000000 fromuser=RAMNIVAS_CL touser=RAMNIVAS_CL statistics=none grants=n commit=y


3)Execute sql scripts on it using sql developer. (This is not hard I guess coz I know we can use oracle client)

4) Take backup using this command:

exp RAMNIVAS_CI/RAMNIVAS_CI@ORCLWEX3 file=CI.dmp log=CI.log direct=y compress=y buffer=1000000 grants=n statistics=none


Is there anything I cna do to execute SQL PLUS commands using c#?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2012
Added on Aug 16 2012
1 comment
3,109 views