Is there any functionality within Oracle to generate deployment scripts given a defined set of database objects. I'm thinking of functionality similar to the SQL Server Database Publishing Wizard, which when provided with the desired objects, it will go away and generate a script (accommodating dependencies). I know SQL Developer along with most of the other (pay-for) tools are able to do this but I wondered if there was anything out of the box (that comes with Oracle) that provides this facility.
It would actually be a combination of a script to capture all of your objects using the technique described in this previous question: How to programmatically generate DDL from Oracle database?
Basically, you use dbms_metadata.get_ddl to generate the object ddl.
You can make an export of the database schema (with or without any table data) using Data Pump Export.
Disadvantage is, the export file is not a human readable script, but in general it works.
we can use oracle export utility to generate ddl scripts without data option, which is available as a backward compatibility in latest oracle versions.
Related
I just lost some stored procedures in a test database. So I don't have to go through this again is there a way I can generate a script that I could use to recreate ALL my database objects. I am using the SSMS so I am hoping there's some option with that which will allow me to get a script for recreation of everything.
Right Click (the database in object explorer)
Tasks
Generate Scripts
or use a version control tool or documentation tool from some one like redgate
finally you could simply take regular backups
As suggested, you can generate scripts using management studio for any views or functions but
The ideal way is to keep a repository of every object in SVN , TFS or something similar.
We do it for our dev, test (and off course for prod). We do not treat non-prod environments as non-important.
I have a master database where we define all information of our software.
It contains
tables
queries
trigger
stored procedures
stored functions
meta data
in the table (content)
At the moment, with every change I manually (with some support from SQL Management Studio) edit files where I have all the CREATE, UPDATE, INSERT statements for the stuff mentioned above. When I have to create a new database I fire-up all the xyz.sql files, which contains my SQL statements.
I know there is a database creation script wizard in management studio, but this for example doesn't include the content data. I also need to make sure the stuff is executed for creation in the right order (e.g. queries , function, etc. last then structure tables are available).
At the moment I was thinking about a .NET project where I start read all the shema tables and then create the files automatically. In Ruby on rails the system creates a shema.rb and for the data yaml files. I tried work with this, but as many tables not created by active record (old c++ stuff also running), this won't work for me.
So does anyone have any hint for me how to do this best or any tool that fits perfect to my demand?
You can do this very easily in .NET using the SMO frameworks.
There are integrated tools for scripting out in dependency order, and you can script out data as well if you desire.
See my answer here for some info and links.
SQL Compare Pro should be able to load up your DDL creation scripts and deploy them to a target in the correct order. In the Edit Project dialog make sure you load your scripts as a Scripts Folder. For the data you'll need to use SQL Data Compare Pro. If you have any trouble or have questions, let me know as I work for Red Gate so will be able to help you with these tools.
I'm a little confused about why you've got UPDATEs given that these scripts create a database from scratch. Shouldn't they all be INSERTs?
SSMS does have the ability to create data scripts as well. You need SSMS 2008 and you need to go to Tasks/Generate Scripts and in the Choose Script Options pane you have to make sure Script Data is set to True.
If you're looking to maintain these scripts as a sensible way to source control your SQL Server objects, you might want to consider SQL Source Control. This will maintain your schema objects AND static data tables as individual .sql files.
"I know there is a database creation script wizard in management studio, but this for example doesn't include the content data."
You have to look carefully! Of course this build-in script engine can include the content data. You just have to click the button labeled "properties" (or something like that) and there you can change all the SMO script options including a full data dump.
This ends up in the script with many INSERT INTO... statements.
In-depth description
Try DbSourceTools.
It is a SQL Management tool designed specifically to script SQL databases to disk ( including data ), and then re-create them using "Deployment Targets".
We are using it for database source control in an agile project.
RedGate makes a tool for Microsoft SQL Server that allows you to snapshot the difference between two databases. It generates the scripts needed to update the database schema while preserving the data.
I need to find a tool like this for the Firebird database. We use Firebird in an embedded fashion, and would like to push out schema updates to remote machines with as little hassle as possible.
I don't know of a tool for Firebird that does exactly the same.
However, FlameRobin allows you to extract the metadata for single database objects or the complete database. It can also create scripts to recreate a certain database object including its dependencies. So you could either diff two database creation scripts and save the differences as the starting point (which may still need some changes), or you could use the recreation scripts for a single object and its dependencies.
This list contains a couple of comparison tools
As #devio suggsted, I took a look at the large list of administration tools listed on the IBPhoenix site. Of the tools on the list, the only two that generate scripts to migrate schema and data changes are XCase and Database Workbench.
Does anyone have experience with these tools? Are there others that I may have missed?
Embarcadero Change Manager will add support for InterBase and Firebird in the fall. Read all about it here. Change Manager includes schema archive compare and synchronizations, data compare, sync, and masking, and configuration management.
see IBExpert, it have a command line tool too where you can run scripts in a propietary language. You can compare two db and get the script to update the target db, it does a great job with dependecies, like views, it drops every dependency where the view is used, alter the view and then recreate the dropped objects. This can be done in GUI too, and a lot of other nice things
Migration tools for Firebird on IBPhoenix site are on a separate link Contributed Downloads - Migration Tools
Try SchemaCrawler link
SchemaCrawler is an open-source Java
API that makes working with database
metadata as easy as working with plain
old Java objects.
SchemaCrawler is also a command-line
tool to output your database schema
and data in a readable form. The
output is designed to be diff-ed with
previous versions of your database
schema.
As it requires a JDBC driver, you would also need the following: Firebird JDBC Driver
In MS SQL Server 2005, how can I create a script consisting off all the objects in the database (tables, stored procedures, views)? I want to use the script to create the database using SMO or to update its objects (alter, drop) if they already exist. I know about the scripting feature in SQL Server Management Studio, I am however not familiar with the configuration options.
If versioning your database schema is what you're getting to, try Wizardby. Although it does not directly support neither views nor sprocs, it supports running native SQL scripts as part of an upgrade/downgrade process.
I use Easy Sql Tools. The deploy version is free. You can generate scripts from schemas, data, indexes, almost everything.
http://www.easysqltools.com
There's a great tool SQL Compare that will actually compare two databases and create a change script for you. It's a great tool for staging purposes. There's also SQL Data Compare tool that will also compare lookup tables and act accordingly.
The downside is, they're not free. :(
Trying to search for a more elegant/overall solution to our common/basic data export tasks
I am convinced that there must be software out there that allows me to:
Define and persist a "setup" (definition of file format, delimiters, encoding, column names etc) from a GUI
Run on a schedule/from command line
Work on both Oracle and MSSql
However, I haven't found it yet... any tips?
what about using groovy to export the data to xml files.
see http://groovy.codehaus.org/Convert+SQL+Result+To+XML
for the gui thing, Oracle's SQL Developer can connect to Oracle, MySQL, SQL Server, MS Access and Sybase
The search ended in using products from http://sqlmanager.net.
They have products that covers the described needs, except that there are separate products for i.e. MSSQL and Oracle