SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


how to restore a stored procedure from a backup


how to restore a stored procedure from a backup

Author
Message
SQLHeap
SQLHeap
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2009 Visits: 765
The db is too big to restore fully, can't even just restore the primary filegroup anywhere. How can I get a single stored procedure back?

There is an exception to every rule, except this one...
Alan Burstein
Alan Burstein
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32169 Visits: 8571
If you have db backed up as a single .BAK file then restoring the database is the only way I can think of; there is no way to dig around that file.

Note that you can restore it to another computer and grab the DDL for the stored proc from there.

It's worth noting that Redgate has a product (I believe it is SQL Backup Pro) that allows for object-level recovery. I have used it in the past for this kind of situation.

-- Alan Burstein


Helpful links:

Best practices for getting help on SQLServerCentral -- Jeff Moden
How to Post Performance Problems -- Gail Shaw

Nasty fast set-based string manipulation functions:
For splitting strings try DelimitedSplit8K or DelimitedSplit8K_LEAD (SQL Server 2012+)
To split strings based on patterns try PatternSplitCM
Need to clean or transform a string? try NGrams, PatExclude8K, PatReplace8K, DigitsOnlyEE, or Translate8K

I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code. -- Itzik Ben-Gan 2001

John Mitchell-245523
John Mitchell-245523
SSC Guru
SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)

Group: General Forum Members
Points: 79608 Visits: 17889
Yes, I think LiteSpeed from Quest has object level restore as well.

Another alternative is to purchase some software that allows you to mount a database backup as a database without actually restoring it. I can't remember who makes such utilities.

If neither of the above is possible, you'll need to restore the whole database.

John
s_osborne2
s_osborne2
Hall of Fame
Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)

Group: General Forum Members
Points: 3981 Visits: 2292
Hi,

You might be able to make use of the trial version of this:

http://www.apexsql.com/sql_tools_restore.aspx
http://www.apexsql.com/sql_tools_recover.aspx

Thanks,

Simon



MCSE: Data Platform
MCSE: Business Intelligence
Follow me on Twitter: @WazzTheBadger
LinkedIn Profile: Simon Osborne
SQLHeap
SQLHeap
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2009 Visits: 765
Thanks for the ideas, will try them. There are 5 files in 3 different filegroups, is there a way to just restore 1 filegroup at a time to a blank db somewhere?

There is an exception to every rule, except this one...
Lowell
Lowell
SSC Guru
SSC Guru (181K reputation)SSC Guru (181K reputation)SSC Guru (181K reputation)SSC Guru (181K reputation)SSC Guru (181K reputation)SSC Guru (181K reputation)SSC Guru (181K reputation)SSC Guru (181K reputation)

Group: General Forum Members
Points: 181641 Visits: 41569
SQLHeap (6/25/2013)
The db is too big to restore fully, can't even just restore the primary filegroup anywhere. How can I get a single stored procedure back?


grab the trial version of Idera's SQL Virtual Database, which is one of the products that John Mitchell mentioned: it opens a backup as if it were a real database, but without the disk space requirements.

then you can grab and DDL definitions or data you need.

Lowell
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
GilaMonster
GilaMonster
SSC Guru
SSC Guru (545K reputation)SSC Guru (545K reputation)SSC Guru (545K reputation)SSC Guru (545K reputation)SSC Guru (545K reputation)SSC Guru (545K reputation)SSC Guru (545K reputation)SSC Guru (545K reputation)

Group: General Forum Members
Points: 545438 Visits: 47728
YEs, you can restore just the primary filegroup from the backup, even if it's the full database backup.

Look up the RESTORE DATABASE syntax, you're looking for the FILEGROUP = option, and you'll want to specify PRIMARY as the filegroup to restore.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


SQLHeap
SQLHeap
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2009 Visits: 765
Thanks! I will give that a try.

There is an exception to every rule, except this one...
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search