O
Orr, Steve
Oracle provides an export utility (exp) and I have a shell script which
compresses its output (not stdout) thru a pipe but l need a platform
portable Python script for this.
Here's the shell script:
------------------------------------------------------------------
#!/bin/bsh
LOG_NAME='/tmp/expzip.log'
FILENAME='/tmp/expzip.dmp'
/bin/mknod $FILENAME p
/usr/bin/gzip <$FILENAME>$FILENAME.Z &
$ORACLE_HOME/bin/exp system/manager@local FULL=Y file=$FILENAME
log=$LOG_NAME
/bin/rm $FILENAME
------------------------------------------------------------------
Here's a Python script which runs the exp utility without on the fly
compression:
------------------------------------------------------------------
import os
expcmd = '/u01/app/oracle/product/9.2/bin/exp'
def expDB(theUser,thePW,theSrvr,dmpFile,logFile):
cmd='%s userid=%s/%s@%s full=y file=%s
log=%s'%(expcmd,theUser,thePW,
theSrvr,dmpFile,logFile)
cmdout = os.popen(cmd)
cmdout.close()
def main():
expDB('system','manager','local','/tmp/exptest.dmp','/tmp/exptest.log')
if __name__=='__main__':main()
------------------------------------------------------------------
I want to compress the *.dmp dump file on the fly without having to
compress an intervening file. I know I need to do something with pipes
and/or os.dup2() but I'm struggling. Has anyone done something like
this?
TIA,
D. B. Dweeb
compresses its output (not stdout) thru a pipe but l need a platform
portable Python script for this.
Here's the shell script:
------------------------------------------------------------------
#!/bin/bsh
LOG_NAME='/tmp/expzip.log'
FILENAME='/tmp/expzip.dmp'
/bin/mknod $FILENAME p
/usr/bin/gzip <$FILENAME>$FILENAME.Z &
$ORACLE_HOME/bin/exp system/manager@local FULL=Y file=$FILENAME
log=$LOG_NAME
/bin/rm $FILENAME
------------------------------------------------------------------
Here's a Python script which runs the exp utility without on the fly
compression:
------------------------------------------------------------------
import os
expcmd = '/u01/app/oracle/product/9.2/bin/exp'
def expDB(theUser,thePW,theSrvr,dmpFile,logFile):
cmd='%s userid=%s/%s@%s full=y file=%s
log=%s'%(expcmd,theUser,thePW,
theSrvr,dmpFile,logFile)
cmdout = os.popen(cmd)
cmdout.close()
def main():
expDB('system','manager','local','/tmp/exptest.dmp','/tmp/exptest.log')
if __name__=='__main__':main()
------------------------------------------------------------------
I want to compress the *.dmp dump file on the fly without having to
compress an intervening file. I know I need to do something with pipes
and/or os.dup2() but I'm struggling. Has anyone done something like
this?
TIA,
D. B. Dweeb