Hi, this is Jeff Podlasek with Toad DB2 Development. I'm going to cover some of the key DBA features that are available in Toad for DB2-- for DB2 on z/OS or DB2 on the mainframe. I've got Toad up and running. And I've got a Database Explorer open. And the first thing I want to talk about is the ability to easily generate DDL for any type of object.
Every time you select an object on the left-hand side of the database explorer, you will see a script tab on the right-hand side of the Explorer. You can very quickly and easily go there. And it will generate the DDL for that object. You can then right-click if you wanted to and then open up that DDL in an Editor.
That's one way of getting the DDL for a given object. Toad has many variations of and ways of getting DDL. That's one.
Another would be just to right-click and generate-- select Generate SQL, and then select Creation Script. And this will actually open up a creation script inside a SQL Editor. So that's another way of getting the DDL for a given object.
Another way is to use the Extract DDL Wizard. To invoke that, you would right-click and you would select Extract DDL. And up comes the Extract DDL Wizard.
This gives you the option. It's a little more powerful than the script tab or just sending the DDL to an Editor because it gives the option of selecting referenced objects and dependent objects. And you could get very granular as to which objects you want to generate with the selected object.
But once you hit Build Script, a background task is going to start. And it's going to generate the DDL and then open up a SQL Editor. And you can see now that a SQL Editor has been opened with all the DDL for that object and all its referenced independent objects. I'm Can shut this down.
And I'm just going to bring up the Script Map. So rather quickly we can see what type of objects have been generated. So this table has some views, has some indexes, et cetera. So that's the generated script from the Extract DDL Wizard. I'm going to shut this down now.
And I'm just going to show you another example. If I jumped over to Databases, one thing that's known is that you could invoke Extract DDL with any type of object. So I picked, let's say, Extract DDL with a database. And from the Wizard, I say, Include Dependents. That's going to bring in and create the DDL for not only the database, but all the tablespaces in that database and then the tables within those tablespaces.
So I'm going to click Build Script again and drive it. And I got a background task is executed. You can see that the task is executing in the task bar. And then a script tab will open when that is complete. You can see that a SQL editor session was opened with the script that was generated.
Again, I'm going to bring up Script Map and refresh. Now you can see all the statements that were generated. You want to jump to a statement, you just double-click on it in the Script Map. You can see that there's plenty of create table, create tablespace statements that were created because I wanted all the referenced, or the dependent objects, for that database, as I selected in the Extract DDL Wizard. So those are some of the quick and easy ways to generate DDL using Toad for DB2 on z/OS.