Solved

Open large sql file in SQL Server

Posted on 2012-04-10
8
1,004 Views
Last Modified: 2012-04-17
I have a rather large .sql file (over 7GB) and SQL Server 2012 Express Management Studio installed on my pc. How to open this file in it? when I opened it in Management Studio, it says "operation can't be completed". Do I need to install Developer version?
Thanks
0
Comment
Question by:rdgfilings
8 Comments
 
LVL 6

Expert Comment

by:RaithZ
ID: 37829150
.sql files are about the same as text files, and you need a really beefy machine to open a file that large, since it loads the file into RAM.  Also depending on the program it may not be able to handle that much text.  

I would recommend seeing if you can open it with notepad.  If not then you may need to use a different computer, or split the file into smaller files if possible.
0
 

Author Comment

by:rdgfilings
ID: 37829204
notepad couldn't open it either. the machine I'm having now is the best I can get (i7-2600 CPU @ 3.4 GHz, 8GB RAM and Win7 64). I just need to export any data tables within that sql file. Can Oracle Database do it?
0
 
LVL 6

Assisted Solution

by:RaithZ
RaithZ earned 334 total points
ID: 37829268
Its not so much about the database, its just the fact that the file is so large.  It sounds like your machine should be fine opening it but again I don't think I've ever had any luck opening a file that large.  I believe your other other option would be to find a program that will split large text files up.

Here is a free one:

http://www.gdgsoft.com/gsplit/

You would have to piece together the SQL statements but that shouldn't be too hard.  It would allow you to examine the file or work with the contents one file at a time.
0
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 37829986
I think you need to get extra RAM.  Setting up a 7GB is simply madness.  I probably includes INSERT statement for all rows in which case it would suggest you should split it as mentioned above and run it in pieces.
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

Author Comment

by:rdgfilings
ID: 37830418
I used GSplit, but it seems it splitted the file into several .gsd files. Do I open them in text editor or something? If not, then it is no use, coz I need to unite them again to use the file. What's the point?
So, there's no way I can view or extract the data without modifying hardware?
0
 
LVL 6

Assisted Solution

by:RaithZ
RaithZ earned 334 total points
ID: 37830598
What is it you need to do with the 7gb file?

you won't be able to put them all together at any point since its so much data, you can try opening the files in notepad.. but if that doesn't work, you can use another utility like the one discussed in this article:

http://www.ghacks.net/2010/10/16/split-large-text-files/

If you use the above program, I would split the file into at least 10 chunks.  

You will need to open them check them out.  If its SQL statements you may need move some of the lines of text to another file to make it work when you execute it.

If this doesn't work for you I did find a free text editor that is said to be able to open large files such as yours.  You can download it here:

http://www.vim.org/download.php#pc
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 37830691
Have you considered not opening it?  I mean let's for a minute assume you find a text editor to open this file (I have a couple that could do it).  How is that going to help you?  Are you honestly planning to edit the file?

The alternative is that all you want to do is execute it.  And for that SSMS in any Edition incarnation is not the right tool.  Instead consider using SQLCmd to run it.
0
 
LVL 10

Accepted Solution

by:
sqlservr earned 166 total points
ID: 37831318
to open a text file which is larger than 7 GB ,use this software
http://www.hhdsoftware.com/free-hex-editor
to execute the script directyl with out opening
use
this command
sqlcmd -E -S .\SQLEXPRESS -i Restore_And_Create_User_Script.sql -o RestoreDB.log
.\SQLEXPRESS :--- use instance name
-U  userName]
-P Password
-d databse name to use
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now