Hello. The idea is to provide Toad with list of DB object names (owner and object name), and I want Toad to save all of them to file locally (file name as object_name + object extension). I haven't managed to do it via automation. Any solutions for that? Thanks!
what do you mean "save them"? Do you want scripts to create the objects? Insert statements for tables? Something else?
By "save" I mean to create local file with filename as provided object_name.
Example: My input is simple text list with say, 4 rows:
PROCEDURE1
PROCDURE2
FUNCTION1
FUNCTION2
And Toad should read those 4 objects from database (like you do when press on F4), and save each of them as a file on my local filesystem, so the final result would be:
PROCEDURE1.prc
PROCEDURE2.prc
FUNCTION1.fnc
FUNCTION2.fnc
etc.
I tried this but it doesn't work as I would understand how automation works
You'd have to make one file with functions, another with procedures, another with packages, etc.
But here is how you can do it:
- Make a file like this (note those are commas not dots between owner and object name)
-
In Automation Designer, create a file iterator like this:
-
drop an Export DDL action on it, like this (Note it is nested below the File Iterator as a subnode, not after it, like a sibling node)
-
double-click the Export DDL Action, then Add->Variables.
-
Set Variables like this:
(Edit: You can actually type a variable into the "Type" dropdown, if you want to add that object type into your file)
- Run it like this:
Something that may be easier - if you just want to export all objects (or just some types of objects) in a schema, use "Generate Schema Script" and choose this option. You can't specify the list of objects with this method. It just exports all of them. But it's a lot faster.
Well, actually - you could use the Object Set filter to specify the list of objects. But the file would look different than your example. You could click the + button, add a few objects, then Save the file to see the format.