# Schema extraction, compare and search

This tool is used to either extract a script to recreate database objects, compare database objects or search database objects.

## Defining the operation

The first thing to select is if you want to extract script to recreate an object, compare or search. You choose this by selecting one of the radio buttons to the left of the screen.

Next you should indicate what kind of information you want included in the extract or compare. This is selected with the checkboxes just to the right of the mode selection. Depending on the mode some options may be disabled.

Include DDL | Include any database definition.
Include constraints | Extract constraint definitions from tables
Include indexes | Extract indexes for tables.
Include grants | Extract grants for database objects.
Include storage specification | Extract storage specifications for database objects.
Include parallel specification | Extract parallel specification for tables.
Include partition specification | Extract partition specification for tables.
Include code specification | Extract code for packages, procedures and functions.
Include comments | Extract comments for database objects.
Include content of tables | Extract the content of tables as well.
Generate prompts | Generate prompts in the extracted result indicating what the script is doing.
Generate header | Generate header of the script.
Generated schema | This specifies the schema to be used when extracting. If you select Same, the same schema as the source database is used. If you select None, no schema is generated. Specifying anything else will replace the source schema with the one entered here.

If you are searching you also need to indicate what you are searching for in the bottom left of the front page.

Containing any words | The object should contain at least one of the words in the line editor.
Containing all words | The object should contain all of the words in the line editor.
Exact match | The object should contain the exact string as in the line editor include whitespaces.
RegExp | The object should contain at least one of the words in the line editor. The dialect of RegExp:s is the ones in the version of Qt that TOra is compiled against. For more information on regular expressions check out http://doc.trolltech.com/qregexp.html, if you are using Qt 3.0 or later you have a more advanced form of regular expressions.

The next thing you need to do is to specify which objects you want to extract or compare. If you extract you only need to specify the source, if comparing destination objects are also needed.

Selecting or deselecting an item in this list will select all it's child items.

If you specify the extract mode you can also indicate a way to resize generated storage specifications. This could be useful to make a database have only a few standard storage specifications making the database less prone to fragmentation.

You have three modes to specify how resizing should work. First there is Don't resize which means leave the same as the original. Then there is Auto resize which should work for pretty much everyone. In this a resize specification for each order of magnitude of size is given a specific storage specification. And last is the Custom resize mode in which you specify how to transform the storage specifications to new values.

When you specify a custom resize you add items to the list with a limit size, initial size and next size. The sizes are used in the following way. When TOra is to determine the storage clause of an object it will take the initial and next sizes of the row in this list with the lowest limit size still higher than the current size of the object. If no row is found the one with the highest limit is used.

## Reading the result

If you extract the result is available under the Result tag of the dialog in the form of a worksheet tool where you can either start executing it or save it to a file. If you are comparing objects you will get the result under the Difference tab. The tab will look something like this.

On the left is a pane containing objects only available in the source database. On the right is a pane containing the objects only available in the destination database.

Only the items in the lists that have checks on them are actually dropped or created, the other items only need to be added to lead the list tree to the items that are actually dropped or created.