Solved

Open large sql file in SQL Server

Posted on 2012-04-10
8
1,290 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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:
Ramesh Babu Vavilla 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.

707 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