Database Structure Dump into SQL file
I would like to dump the entire structure of my database into an file that will be used later to recreate the same structure. I would like oracle to create almost like a sql file the can be run in another tablespace. I would like to create all the sql commands that would be used to create the tables and sequence generators. Is there a command in oracle that dumps the information?
Thanks,
eric
No there isn't such a command
But You can use export to export only table structure without data and You can see all CREATE statements there
Or you can use Oracle Designer, Visio or maybe another free tool to reverse engineer tables and then generate CREATE scripts
Or You can make Your own script or maybe search for one in internet that creates these DDL statements from data dictionary
Similar Messages
-
Skip bad row during importing large dump into sql server
Hello,
I have an issue during importing very large (more than 3 GB) dump file into sql server express. I have used command line for this purpose. Unfortunately this file was exported in UTF-8 so I had to convert it unicode. The unicode columns contain N' prefix.
Unfortunately the file contains apostrophes in other fields as well.
My question is: Is there an opportunity to skip bad rows during importing? (Force import e.g.)
Sincerely, Laszlo Toth>>>Unfortunately the file contains apostrophes in other fields as well.
You can concatenate the single quote using the CHAR function to build the string:
SELECT N'Brian O'+CHAR(39)+'Brien'
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Export Oracle Databaes Objects into sql file
Hi Experts,
I searched and could not find anything whether is that possible to dump oracle database into a sql file.
Can some one clarify this?
Thanks,
Dharan VHi,
Still struggling here,
CREATE OR REPLACE DIRECTORY DUMP_DIR AS 'c:\';
GRANT DATAPUMP_EXP_FULL_DATABASE TO SCOTT;
GRANT DATAPUMP_IMP_FULL_DATABASE TO SCOTT;
EXPDP SCOTT@LOCAL-DB directory=DUMP_DIR dumpfile=scott.dmp content=metadata_only Full=Y
password: tiger
C:\Documents and Settings\Dharan>expdp SCOTT@LOCAL-DB directory=DUMP_DI
R dumpfile=scott.dmp content=metadata_only Full=Y
Export: Release 11.1.0.6.0 - Production on Sunday, 31 January, 2010 16:48:42
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Password:
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Produc
tion
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SCOTT"."SYS_EXPORT_FULL_01": SCOTT/********@LOCAL-DB directo
ry=DUMP_DIR dumpfile=scott.dmp content=metadata_only Full=Y
Processing object type DATABASE_EXPORT/TABLESPACE
Processing object type DATABASE_EXPORT/PROFILE
Processing object type DATABASE_EXPORT/SYS_USER/USER
Processing object type DATABASE_EXPORT/SCHEMA/USER
Processing object type DATABASE_EXPORT/ROLE
Processing object type DATABASE_EXPORT/GRANT/SYSTEM_GRANT/PROC_SYSTEM_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/GRANT/SYSTEM_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/POST_SCHEMA/PROCACT_SCHEMA
Processing object type DATABASE_EXPORT/AUDIT
Master table "SCOTT"."SYS_EXPORT_FULL_01" successfully loaded/unloaded
Dump file set for SCOTT.SYS_EXPORT_FULL_01 is:
C:\SCOTT.DMP
Job "SCOTT"."SYS_EXPORT_FULL_01" successfully completed at 16:51:20But i don't see any scott.dmp in either c:\ [on newly created directory]
OR C:\Documents and Settings\Dharan.
Ok...i Tried similarly the second one now
C:\Documents and Settings\Dharan>impdp SCOTT@LOCAL-DB directory=DUMP_DI
R dumpfile=scott.dmp content=metadata_only Full=Y
Export: Release 11.1.0.6.0 - Production on Sunday, 31 January, 2010 16:48:42
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Password:
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Produc
tion
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SCOTT"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "SCOTT"."SYS_SQL_FILE_FULL_01": SCOTT/********@LOCAL-DB dire
tory=DUMP_DIR dumpfile=scott.dmp SQLFILE=SCOTT.sql
Processing object type DATABASE_EXPORT/TABLESPACE
Processing object type DATABASE_EXPORT/PROFILE
Processing object type DATABASE_EXPORT/SYS_USER/USER
Processing object type DATABASE_EXPORT/SCHEMA/USER
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/POST_INSTANCE/PROCDEPOBJ
Processing object type DATABASE_EXPORT/SCHEMA/POST_SCHEMA/PROCOBJ
Processing object type DATABASE_EXPORT/SCHEMA/POST_SCHEMA/PROCACT_SCHEMA
Processing object type DATABASE_EXPORT/AUDIT
Job "SCOTT"."SYS_SQL_FILE_FULL_01" successfully completed at 17:13:35Even now i can't see any .sql file either c:\ [on newly created directory]
OR C:\Documents and Settings\Dharan.
Suggest what am doing wrong here.
Thanks,
Dharan V -
How to Select from Oracle 8i database and insert into Sql Server 2005 datab
Hi how to Select from Oracle 8i and insert into Sql Server 2005.
Source db as Oracle 8i
Target db as Sql Server 2005.
I need to select one table data from Oracle 8i & insert into Sql Server 2005
ThanksThanks Khan..
Is there is any query (OPENQUERY) available for that?
Regards.. -
Hi All,
I would like to ask how can imports my dump oracle database file data and struct into sql server 2005
with out make connection oracle.
best regards.
Hakim.Hi Hakim.
Based on your title, what I understood there is a issue regarding transfer oracle db dump to sql database using C# code. Am I right? If so, I am afraid there is no build-in method which meet your requrements in .NET framework. You must provides
OraDump Export API to allow developers integrate corresponding capabilities into their applications. These capabilities are about export data from Oracle dump files into popular databases like Microsoft SQL server. Every developer
having OraDump Export API can write just few lines of code on C# or Visual Basic to implement the appropriate export process.
I am search a third-party link, but it's a paid service.
http://www.convert-in.com/data-migration-service.htm
If you don't have to with code, Please refer to: Migrating Oracle Databases to SQL Server 2000
http://technet.microsoft.com/en-us/library/cc966513.aspx
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Restore MySQL database file into SQL server
Hi experts,
I have a MySQL Server backup file. How can I restore it to SQL Server?
Or what is the way around getting the database into SQL Server?
ebroHi experts,
I have a MySQL Server backup file. How can I restore it to SQL Server?
Or what is the way around getting the database into SQL Server?
ebro
You cannot restore MySQL backup file on SQL Server.
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
My TechNet Wiki Articles -
Insert Fixed Width data into SQL database.
I have a file sent from a client that I need to get into a SQL database.
The file name is ELIG and it is in a flat file, fixed width format.
I am just going round and round how to get the data into a database using SSMS.
Because another user is going to be doing this in the future it needs to be easy.
I tried tasks, import data, flat file, file path and then "Fixed Width", but it puts all of it in one field.
the data does NOT have headers either.
I'm not good at this kind of thing so would appreciate any help I can get.
GeeYes I saw Uri's request and I'd love to comply, since this is giving me such a hard time, but the data is too sensitive and I would be shunned by my employer and thrown out into the street.
I've been all over google trying to find a solution. I'm still a bit of a novice, but even so, I have never found data that is so hard to normalize. Just error after error.
Gee
Hi Gee,
I can understand your issue :-)
it is a common issue that people think that we can read minds, troubleshoot issues without having the option to test it and without any information regarding the issues. It is like going to the children doctor and ask him to treat your children without taking
the your children to the doctor. If you can not take the children to the doctor, then you might need to take a doctor to the your children!
Troubleshooting can be tedious, because there may be quite some information you will need to supply. If you can not post the information in public, then maybe you need to get a private supporting, but this will cost you (your boss/company).
Option 1: Create a case study which is based on your real issue. Use different DDL and DML (database structure and data) than the real database, and reproduce the issue in a way that you can post us the information that we need. We have
to get the ability to reproduce the issue in our server as well, if you need our support.
Option 2: Use the real database information with private support,
after the supporter sign a Confidentiality agreement. If you check people profiles in the forum, then you will find that most of the supporters here are actually work as consultants and they give support on a daily
bases. This is our job. In the forum we come to help volunteer, but
there is a reason why people continue to pay for support. free public support do not fit all :-)
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
Importing MYSQL dump into Oracle database
Hi,
I want to import MYSQL database dump into Oracle 9i database.
Can any body suggest as how to proceed for this.
thanks in advanceif you're referring to dump generated by mysqldump then you have a lot of work to do since Oracle does not support sql syntax in the dump file.
alternatively, you can export each table into .csv file using phpMyAdmin and then load that .csv using SQL Loader or external table. -
Importing and executing a .sql file into Oracle 10g
Hi
I am looking to import and execute a .sql file(create scripts created of a databse designed in MS SQL Server 2005). The file was imported into Oracle APEX 3.10 but we are unable to execute the script. Please suggest alternatives as to how we can import these files.
Thanks in advance.You likely need to migrate the database (objects and data). This is not so easy and you should have a look to migration tools: http://www.oracle.com/technology/oramag/oracle/07-sep/o57sql.html.
-
How to load decimal values into a file using bcp in SQL Server 2000?
Hi everyone,
I'm trying to load data from a database table to a text file using bcp on SQL Server 2000. When I'm loading the decimal values, the values before the decimal are not being loaded into the file. How could I load the values before decimals?
Here are the DDLs and DMLs of what I'm trying to run:
CREATE TABLE [dbo].[Product_Sales](
[Year_of_Sale] [smallint] NOT NULL,
[Product_Type] [varchar](25) NOT NULL,
[Product_Group] [varchar](25) NOT NULL,
[Category_Type] [varchar](25) NOT NULL,
[Category_Group] [varchar](10) NOT NULL,
[Product_Count] [bigint] NOT NULL,
[Product_Amount] [decimal](19, 2) NOT NULL,
[Category_Count] [bigint] NOT NULL,
[Category_Amount] [decimal](19, 2) NOT NULL,
CONSTRAINT [PK_Product_Sales] PRIMARY KEY CLUSTERED
[Year_of_Sale] ASC,
[Product_Type] ASC,
[Product_Group] ASC,
[Category_Type] ASC,
[Category_Group] ASC
) ON [PRIMARY]
) ON [PRIMARY]
INSERT INTO [Yearly_Sales].[dbo].[Product_Sales]
VALUES(2010, 'Online', 'Web', 'Cameras', 'Electronics', 547, 0.00, 0, 0.00)
EXEC [master].[dbo].[xp_cmdshell] 'bcp "SELECT * FROM [Yearly_Sales].[dbo].[Product_Sales]" queryout D:\Yearly_Sales\Product_Sales.dat -c -T -S'
And the output I see in the file is:
2010 Online Web Cameras Electronics 547 .00 0 .00
The values before decimals are being truncated.
Thanks,
Bangaaram
Known is a DROP, Unknown is an OCEAN.You can modify the decimal column(s) in the table to varchar type before export. But it does not look good.
alter table [dbo].[Product_Sales]
Alter column [Product_Amount] varchar(20)
alter table [dbo].[Product_Sales]
Alter column [Category_Amount] varchar(20)
Does that make any sense?
Known is a DROP, Unknown is an OCEAN.
Basically you modify the decimal column to a varchar type before you run the bcp command for export. You can modify your source table or you can modify them on the fly. It is just a workaround.
Modifying the source wouldn't be a good idea. Never do that if you can't get your desired output.
Known is a DROP, Unknown is an OCEAN. -
I want to use the SQL Toolkit of NI and SQL Server as my databasis on a server. Do I need to install a client in each computer I want to handle the data into SQL tables or I need only a ODBC driver?
You only need the ODBC driver on each computer. If you are distributing the SQL Toolkit app as an executable and do not install the whole toolkit on each computer, you'll need the SQL Toolkit support files. This is about a dozen files. You can get the list at http://digital.ni.com/public.nsf/websearch/b814be005f9da9258625658700550c75?OpenDocument.
-
Help with creating a sql file that will capture any database table changes.
We are in the process of creating DROP/Create tables, and using exp/imp data into the tables (the data is in flat files).
Our client is bit curious to work with. They do the alterations to their database (change the layout, change the datatype, drops tables) without our knowing. This has created a hell lot of issues with us.
Is there a way that we can create a sql script which can capture any table changes on the database, so that when the client trys to execute imp batch file, the sql file should first check to see if any changes are made. If made, then it should stop execution and give an error message.
Any help/suggestions would be highly appreciable.
Thanks,Just to clarify...
1. DDL commands are like CREATE, DROP, ALTER. (These are different than DML commands - INSERT, UPDATE, DELETE).
2. The DDL trigger is created at the database level, not on each table. You only need one DDL trigger.
3. You can choose the DDL commands for which you want the trigger to fire (probably, you'll want CREATE, DROP, ALTER, at a minimum).
4. The DDL trigger only fires when one of these DDL commands is run.
Whether you have 50 tables or 50,000 tables is not significant to performance in this context.
What's signficant is how often you'll be executing the DDL commands on which the trigger is set to fire and whether the DDL commands execute in acceptable time with the trigger in place. -
Adding a link to an external file into SQL table
I would like to add a link to an external file (picture stored on my local hard drive) into SQL table. Then use C# to query data from SQL table and export to Excel. I got everything working ok except the link to external file. I would like to export
this link to Excel and user can click on the link to open the file. How can I accomplish this? Thank you very much in advance for your help!In that case the Filetable feature could be of interest to you. With this feature the file can be part of the database, and still be accessible from tools outside SQL Server.
I don't really have any good examples handy, but if anyone knows of a good blog post that could help Nhan, please feel free to add.
Here is a link to the description in Books Online:
http://msdn.microsoft.com/en-us/library/ff929144.aspx
Erland Sommarskog, SQL Server MVP, [email protected] -
CLR to get the SQL Server Data into .CSV File
Hi,
I transformed 10 columns 1000 rows from the source table to 1 column 1000 rows in the destination table by making the comma separated columns ( Just like ..
Insert into DestinationTable
SELECT col1+','+col2 ....
FROM SourceTable
Then I want to take this column into CSV file.
I dont have the rights to command shell.
I heard that we may use CLR procedure for this. Can someone throw light?using System;
using System.IOM
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public class ExportFileClass {
[Microsoft.SqlServer.Server.SqlProcedure]
public static void export_file()
using (SqlConnection connection = new SqlConnection(
"context connection=true"))
connection.Open();
// Operation to open file goes here.
SqlCommand command = new SqlCommand("SELECT col FROM YourTable");
// Consume result set and write rows.
Build this from the command line:
sn -k keypair.snk
csc /target:library /keyfile:keypair.snk exportfile.cs
Then run in SQL Server (assuming that the files are in C:\temp on the SQL
Server machine:
[sql]
USE master
go
-- To be able to create an external-access assembly, we need to load
-- the key, the assembly is signed with. The key needs a password, but we
-- don't need to know the password.
DECLARE @sql nvarchar(MAX),
@password char(40)
SELECT @password = convert(char(36), newid()) + 'Ab4?'
SELECT @sql = 'CREATE ASYMMETRIC KEY slog_loopback FROM FILE = ' +
'''C:\temp\keypair.snk'' ' +
'ENCRYPTION BY PASSWORD = ''' + @password + ''''
PRINT @sql
EXEC(@sql)
-- And then a login to carry the permission.
CREATE LOGIN exportfile$asymkey FROM ASYMMETRIC KEY ExportFile
GRANT EXTERNAL ACCESS ASSEMBLY TO exportfile$asymkey
go
-- Now we can go back to our regular database and create the assembly.
USE youddatabase
go
CREATE ASSEMBLY ExportFile FROM 'C:\temp\exportfile.dll'
WITH PERMISSION_SET = EXTERNAL_ACCESS
go
CREATE PROCEDURE ExportFile AS
EXTERNAL NAME ExportFile.ExportFileClass.export_file
[sql]
It is likely that you will have to do ask your DBA to do things in the
master database.
Erland Sommarskog, SQL Server MVP, [email protected] -
To get the table data into a file in pl/sql developer
Hi
i have table with 90k rows, i want to get the table data into a file like excel....
i executed the select statement it shows only 5k rows because of buffer problem.
can u please help me any alternative way to get the table data into a file.
using cursors like thatReally? excel for 90K rows :)
face/desk/floor/"Hi and sorry neighbours below, it's me again"
Err, I see you point, thanks Dang, I completely missed the 90k recs part, I must be getting old or modern ;)
@Ramanjaneyulu,
can u please help me any alternative way to get the table data into a file.You can always dump a query to a file, check these:
http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteflat.html
How to create Excel file (scroll down when necessary)
http://forums.oracle.com/forums/search.jspa?threadID=&q=export+to+excel&objID=f137&dateRange=all&userID=&numResults=15&rankBy=10001
Depending on your database version ( the result of: select * from v$version; ) you might have some other options.
Maybe you are looking for
-
Retrieving process id from a batch file
Hi friends, I am having a problem to retrieve the process id from a batch file. I will give the code which I have written and if anyone can help me it will be grateful. I am having time pressure. Here when I call Process p = rt.exec("checkExec.bat");
-
Copy and Paste from TextEdit to Word
I have been told that I can simplify images in Word easily by copying into TextEdit, and then back into Word. I can copy and paste into TextEdit easily, but am unable to select, copy, and paste a graphic from TextEdit into Word. Is there some key I"m
-
Album order (after "sort photos manually") not staying
I have an album of about 500 pictures (from my 10,000 library). I sorted the pictures in it manually, but every time I close iPhoto and then reopen it, the order is messed up a bit with random pictures are out of order. any ideas? roger
-
Which media server protocols enable frame accurate seeking and frame stepping in players?
Hi, ... and thank you in advance for taking the time to respond. I am evaluating different protocls for different client platforms, and I'd like to know the following... Which media server protocols enable frame accurate seeking and frame stepping in
-
Problem in Services PO: Urgent
Hi Experts, I have a big problem with the services PO. Issue is described as under. 1. One PO was created with Quantity of Services 28. (Price: 1000 INR) 2. The first SES was created for quantity of 4. 3. 2nd SES was created for the quantity 11. 4. I