Posts Tagged ‘Oracle with Windows 7’

Connect Oracle SQL by Dos And Run Query

June 27th, 2015, posted in Oracle Queries, Windows
Share

 

1 – Make a bat file and connect it with Oracle Sql, let be file name connect.bat :

 

@echo off
sqlplus username/password@connect_identifier @C:UsersrizDesktopmYmy.sql

 

2 – Now make a sql file and write query in it !!

 

spool C:UsersmeDesktopmYmy_log.txt
set linesize 50
set pagesize 50
prompt Purpose:
prompt To run Daily
SELECT TO_CHAR (SYSDATE, 'MM-DD-YYYY HH24:MI:SS') "NOW" FROM DUAL;
select * from v$instance;
SELECT TO_CHAR (SYSDATE, 'MM-DD-YYYY HH24:MI:SS') "NOW" FROM DUAL;
exit
spool off;

 

And you are all done.
The first select will give you time so that you may know when it started, the second seelct will give you the instance details and the third select will give you time again so that you can check when it ended.

Share