Oracle 11g Script database with data - sql

Is there a way in Oracle 11g to dump database to sql script, that when run will perform database, users, tables and data creation?
In Microsoft SQL Server there's SSMS Toolpack that is capable of such thing. (Script all data from SQL Server database) I'm interested whether the same is possible in Oracle 11g.

To extract metadata and data you should look at data pump, specifically the export and import tools. This will be the simplest, fastest and most supported way to move everything.
You will need to already have created the database, but I'm not sure if you're confusing that with the Oracle schema. Which you will also have to create in advance by creating the user(s) that will own all the objects. You can extract a script to create the user/schema, e.g. from Toad or SQL Developer, or using the DBMS_METADATA package.
Most client applications also have options to export pretty much everything as scripts. In SQL Developer, for example, go to the Tools menu and there's an 'Export database' option where you can choose what you want to include, which will be pretty much everything in your case. You'll still need to pre-create the new database to run those scripts against.

Related

Create a copy of a DB that is blank then import data from another DB

I have 2 databases I need to work with.
Database A (DBA) = the clients database that is far too outdated to be used with my current data structure.
Database B (DBB) = my current development database
What I need, is to find a way to create a blank database that is structured as DBB, schemas, tables, triggers, everything, and then import data from DBA.
I have the Red Gate SQL Compare/Datacompare and SQL Management Tool available to me.
Is what I am trying to achieve possible with what I have or possible in general?
Normally I have scripts to update the DB going up a version at a time, but DBA is so far behind on the updates, I do not have access to those scripts anymore.
I am using SQL Server 2005.
I'm not familiar with RedGate stuff but you could do the Generate Scripts task (right click a database in SSMS) on both. Select Schema Only for DBA then Data Only for DBB in the Advanced Options.

importing data from one database to other when schemas are different

I have this SQL Server 2005 DB and we are upgrading to a new DB in SQL Server 2008. The schemas would be slightly different between the databases. What would be a best option to copy data from the old DB to the new DB.
Define "slightly different". Integration Service is probably the way to go.
Since the schemas are only slightly different, I would suggest making a full backup of the SQL2005 DB and restoring it on the SQL2008 server. Once you have the direct copy, use a script to migrate the data on the few tables where the schema is different.
It really depends on the definition of slightly.
Use Integration Service to design a whole package, or you can connect to the 2005 instance from within 2008 SSMS and right click on the tables and select "Import Data". This will bring up an Wizard that will do the work for you (through SSIS) and let you copy the data right over.
Another option is to use SQL Server Data Tools, which is a new tool from MS that has a schema compare tool where you can actually generate the scripts to create the tables and related objects.
http://msdn.microsoft.com/en-us/data/gg427686

How can I copy from Oracle to Sybase using SQL*Plus?

I have an application that stores data in an Oracle database. I want to copy selected rows from a table in this database to a table in a Sybase database (archiving records). Can I do this directly (i.e. without storing and loading results from a file)?
I've mostly looked into SQL*Plus
SQL*Plus COPY Command (http://docs.oracle.com/cd/B19306_01/server.102/b14357/apb.htm)
Copying Data from the Oracle Database Server to Sybase (http://docs.oracle.com/cd/A95432_01/a80982/ch5.htm#153526)
Copy Command (http://www.oracleutilities.com/SQLPLus/copy.html)
Oracle® Database Gateway for Sybase User's Guide (http://docs.oracle.com/cd/B28359_01/gateways.111/b31048/toc.htm)
I also understand the following: "However, INSERT is the only option supported when copying to Sybase. The SQL*Plus COPY command does not support copying to tables with lowercase table names." However, I haven't been able to do this in SQL*Plus. I'll keep trying, but if anyone has an example of how to do it here, I'd very much appreciate it.
If this is not possible, is Oracle Data Pump (http://www.oracle.com/technetwork/database/enterprise-edition/index-093639.html) my best alternative?
Thank you!
Sincerely,
Deepyaman
Your best bet may be to use some form of ETL tool to handle this if the size of your data is reasonable, rather than getting into the details of setting up the gateways, etc, between systems.
There are many options - Talend Open Studio (free), Informatica, or Microsoft SSIS all should be able to handle this.
The robust way to do this is create a flat file(txt,csv) or an INSERT sql from your "COPY_FROM_DATABASE". And then load it into corresponding table. You might have to do a bit of formatting in this sql in order to run it on a different server. I personally like INSERT sql better.

Migrate SQL Server to Oracle

I need to migrate data (including tables, procedures, schema) from Sql Server 2005 to Oracle 10g. Can anyone suggest me a way to do it? Thanks.
Take a look at the Oracle Migration Workbench
SwisSQL have a commercial tool that will do that. It can go from and to several different database vendors. I've used it before to go from SQL Server to Oracle and it works well.
The best way to work around is by using ORACLE GATEWAY First create tables, views, stored procedures and triggers in ORACLE and then using ORACLE GATEWAY you can directly insert the data from SQLSERVER to ORACLE.
But you need to be cautious about data types. For migrating data from Image, TEXT you need to use *DBMS_Sql*
One of the possible options is to use SQL Developer. It is an Oracle free tool, which migrates both database objects and data. However, you need to have high level of knowledge in database migration, in particular experience of working with Oracle and SQL Server. Sometimes the results of automatic migration with SQL Developer require significant manual adjustments.

How to Convert SQL server to Oracle?

I have a SQL server database (Tables, Views, SP...). I need to convert this database to Oracle 10g. How can I do it?
Transferring the data will be easy; SQL Server integration services can do that, or Oracle's SQL Developer.
However, views and stored procedures are different between Oracle and SQL Server. SQL Server uses T-SQL, Oracle uses PL/SQL. These are not very compatible and I don't know a tool can automatically convert between the two. If your database relies on specific T-SQL features, you will need a developer to do the conversion.
Get the jTDS jdbc driver from sourceforge.
Add it to Oracle SQL Developer.
Tools > Migration > Migrate
Create a migration repository in your new Oracle database.
Create a new migration project.
Point it to your SQL Server database.
Convert it - mind the data types.
Migrate the data:
online row-by-row inserts over JDBC. Fine for SMALL/test boxes.
offline - use micrsosoft's unload utility to pull the sql server down to flat files. SQL Developer will create SQL*Loader scripts to put them over into Oracle.
If you have GoldenGate licensed, use that to move the data over and to synch changes from one system to the other in case you need to keep both up and going.
Start looking at the migrated T-SQL procs and functions. SQL Developer will leave comments for code blocks it wasn't able to translate...but you will need to TEST and VERIFY every single translation. Customers can see upwards to 80-90% translation rates for their T-SQL, but it could be as low as 50%...it just depends on the nature of your code.
The entire process is described here.
I wrote a white paper, with Sybase ASE as the example source platform, here. The process is identical for SQL Server. It has step-by-step guidance with screenshots.
If you have an Oracle account manager, reach out for help. We have specialists that deal exclusively with migrations such as yours. They have lots of practical advice and can recommend 3rd party partners if you lack the expertise.
sql developer can help. You can download it here , it is free. http://www.oracle.com/technology/software/products/sql/index.html
There is step by step documentation including videos on how to migrate SQL Server to Oracle DB. You find it here:
Migrating from Microsoft SQL Server to Oracle
Or you can use a tool to do the job for you like Ispirer - Migrate Microsoft SQL Server to Oracle
You basicaly setup an Oracle Server, once its ready you migrate your tables using a software made for that. I guess this script can do the job:
m2o