Solved

Open large sql file in SQL Server

Posted on 2012-04-10
8
1,083 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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
 

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

856 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