dbTalk Databases Forums  

Listing a DIRECTORY in Oracle?

comp.databases comp.databases


Discuss Listing a DIRECTORY in Oracle? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom Anderson
 
Posts: n/a

Default Listing a DIRECTORY in Oracle? - 06-24-2010 , 01:47 PM






Hello,

How do you list the files contained in a directory database object in
Oracle?

I'm working with some dumps made with expdp on Oracle 11.2.0.1.0. We say
something like this:

expdp scott/tiger@DEVDB DIRECTORY=build_dumps DUMPFILE=${timestamp}.dmp

Then later:

impdp scott/tiger@DEVDB DIRECTORY=build_dumps DUMPFILE=${timestamp}.dmp

With lots of extra parameters, of course.

'build-dumps' here is the name of a directory object which our DBA set up,
something like this:

CREATE DIRECTORY build_dumps AS '/var/whatever/data';

The trouble is, at the point at which we want to load a dump, we don't
actually know if the dump exists or not. If it doesn't, that's fine, we
can run a build process to set the database up, rather than using the
dump. But we do need to be able to tell if the dump exists, so we can
decide what to do. How can we do this?

At the moment, we just run impdp, and if it doesn't work, we assume it's
probably the file being missing, and run the build process. I'd like to be
a bit more elegant than this, though.

Thanks,
tom

--
The term Nihilartikel for a fictitious entry originated at the German
Wikipedia but was later identified as a hoax. -- Wikipedia

Reply With Quote
  #2  
Old   
John B. Matthews
 
Posts: n/a

Default Re: Listing a DIRECTORY in Oracle? - 06-24-2010 , 03:40 PM






In article <alpine.DEB.1.10.1006241820020.28635 (AT) urchin (DOT) earth.li>,
Tom Anderson <twic (AT) urchin (DOT) earth.li> wrote:

Quote:
How do you list the files contained in a directory database object in
Oracle?

I'm working with some dumps made with expdp on Oracle 11.2.0.1.0. We
say something like this:

expdp scott/tiger@DEVDB DIRECTORY=build_dumps
DUMPFILE=${timestamp}.dmp

Then later:

impdp scott/tiger@DEVDB DIRECTORY=build_dumps
DUMPFILE=${timestamp}.dmp

With lots of extra parameters, of course.

'build-dumps' here is the name of a directory object which our DBA
set up, something like this:

CREATE DIRECTORY build_dumps AS '/var/whatever/data';

The trouble is, at the point at which we want to load a dump, we
don't actually know if the dump exists or not. If it doesn't, that's
fine, we can run a build process to set the database up, rather than
using the dump. But we do need to be able to tell if the dump exists,
so we can decide what to do. How can we do this?

At the moment, we just run impdp, and if it doesn't work, we assume
it's probably the file being missing, and run the build process. I'd
like to be a bit more elegant than this, though.
If you know a location and filename, you can use UTL_FILE.FGETATTR:

<http://download.oracle.com/docs/cd/E...0577/u_file.ht
m#i1003488>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.