Home » RDBMS Server » Server Utilities » exp on WIndows thru sqlplus
exp on WIndows thru sqlplus [message #194862] Mon, 25 September 2006 15:05 Go to next message
Messages: 3
Registered: June 2005
Location: Garland, TX
Junior Member
exp user/pwd tables=owner.table_name_TAB consistent=y file=%ARCH_DEST%/table_name_TAB.%TODAY% query="""where CATALOG_DELETE_FLAG='Y'"""
This line is spooling out from my sqlplus script. It is called from a batch file on WIndows. I set the variables ARCH_DEST and TODAY in the batch file that calls the sql script.

How can I force the sql script to replace the environment variables with the correct values.

And does anybody know a good way to use DATE and TIME to make a variable to append to a file name?

Re: exp on WIndows thru sqlplus [message #194874 is a reply to message #194862] Mon, 25 September 2006 18:15 Go to previous message
Messages: 2794
Registered: April 2006
Senior Member
From your description, I'm not exactly sure what problem you are having with passing the environment variables. However, here is a method to append the date/time (dd_mm_yyyy_hhmi -> 09_25_2006_1911) to the filename and set the ARCH_DEST as a variable:

@echo off
set oracle_sid=orcl
set oracle_home=c:\oracle\product\10.2.0\db_1
set path=%oracle_home%\bin
set arch_dest=c:\exports\%oracle_sid%
for /f "tokens=2" %%i in ("%date:/=_%") do set vdate=%%i
for /f "tokens=1,2 delims=:" %%i in ("%time: =%") do set vdate=%vdate%_%%i%%j
exp.exe user/pwd tables=owner.table_name_TAB file=%arch_dest%\table_name_TAB_%vdate%.dmp query="""where CATALOG_DELETE_FLAG='Y'""" 
echo on

Previous Topic: import - how to make it faster
Next Topic: SQLLDR
Goto Forum:

Current Time: Thu Feb 23 12:36:24 CST 2017

Total time taken to generate the page: 0.12708 seconds