Home » Infrastructure » Windows » Creating windows script to be run by dbms_scheduler (merged)
Creating windows script to be run by dbms_scheduler (merged) [message #345225] Tue, 02 September 2008 11:59 Go to next message
rolex.mp
Messages: 161
Registered: February 2007
Senior Member
I am using Oracle 10.2.0.2 version on Windows Server 2003 .

I have wrote a unix shell script which I was using in Linux platforms to identify the idle users and now I need to deploy it in the Windows server.

I have'nt written any DOS code so can you give some pointers about how to proceed ?
I was not able to get much information from the net Sad

#!/usr/bin/ksh
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=/usr/bin:/usr/sbin:$ORACLE_HOME/bin:$ORACLE_HOME/lib:$PATH:.
export ORACLE_SID=DBTCB1

sqlplus / as sysdba << EOF
SET FEEDBACK OFF
COLUMN username FORMAT a30
COLUMN accnt_status FORMAT a30
COLUMN lock_date FORMAT a30
SPOOL /export/home/oracle/scripts/mp_idle_schemas.sql
SELECT c.username username, u.account_status accnt_status, u.lock_date lock_date FROM (SELECT username FROM dba_users WHERE username LIKE 'FC%'  MINUS SELECT schema_name username FROM test_users@dbadb WHERE database_name LIKE 'DBTCB1%') c, dba_users u WHERE c.username = u.username;
SPOOL OFF;
EXIT;
EOF

grep -v '^$' /export/home/oracle/scripts/mp_idle_schemas.sql > /export/home/oracle/scripts/mp_idle_schemas1.sql
sed '1d' /export/home/oracle/scripts/mp_idle_schemas1.sql > /export/home/oracle/scripts/mp_idle_schemas.sql
rm /export/home/oracle/scripts/mp_idle_schemas1.sql

sqlplus / as sysdba << EOF
SET HEAD OFF
SET FEEDBACK OFF
EXEC mp_idle_schemas;
EXIT;
EOF
Re: Creating windows script to be run by dbms_scheduler [message #345228 is a reply to message #345225] Tue, 02 September 2008 12:00 Go to previous messageGo to next message
Michel Cadot
Messages: 58606
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
How is this a SQL question?
Still choosing your forum randomly?

Regards
Michel
Re: Creating windows script to be run by dbms_scheduler [message #345233 is a reply to message #345228] Tue, 02 September 2008 12:23 Go to previous messageGo to next message
rolex.mp
Messages: 161
Registered: February 2007
Senior Member
Sorry about that

I have reposted in the correct forum.

Re: Creating windows script to be run by dbms_scheduler [message #345239 is a reply to message #345233] Tue, 02 September 2008 13:01 Go to previous message
Michel Cadot
Messages: 58606
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If you just read the title of the 3 first topics in Windows forum before posting you'd see your answer.

Regards
Michel
Previous Topic: Problem during installation of 10g
Next Topic: Cant Connect to oracle on windows from linux
Goto Forum:
  


Current Time: Tue Jul 29 00:46:05 CDT 2014

Total time taken to generate the page: 0.05283 seconds