Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9316975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:45:43+00:00 2026-06-19T02:45:43+00:00

So we had an encrypted database that puked and killed our whole SQL Server

  • 0

So we had an encrypted database that puked and killed our whole SQL Server setup. Sucks about our data, but we were smart enough to have our Data structure/Stored Procs/Functions in Git

The problem is they’re saved as .sql files.

Is there any way we can batch restore our schema from directories full of these files?

I’ve looked around and I can only find tutorials for restoring from .bak files or .mdf‘s. This isn’t the lazy man’s way out- I just need to find a solution ASAP. Any advice or resources/ anything at all would be greatly appreciated.

Thanks Interwebs,

Dylan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T02:45:44+00:00Added an answer on June 19, 2026 at 2:45 am

    Considering the large size of the data structure I was trying restore, running each files individually was not a practical solution. I’m sure I could have written a bat fie, but I got it done pretty quickly in python:

    import os, subprocess
    processDir = 'C:\\Database-master\\'
    files = os.listdir(processDir)
    for f in files:
        db = processDir + f
        #potentially drop corrupt db and create new ones with f
        scripts = os.listdir(db)
        for script in scripts:
            path = db + '\\' + script
            proc = subprocess.Popen('sqlcmd -S 127.0.0.1 -i "' + path +'"', shell=True)
            proc.wait()     
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Server that holds a lot of data. An application, running
Had a good search here but can't see anything that gets my mind in
I had a debate about macros and their readability. I think that in some
I had a datetime column in a SQL Server table. We needed to encrypt
I had a question about encryption and core data. Is there any way to
I had a quick question about cookie security that I wanted to run by
I've had a need to create an encrypted volume on my mac for the
Had to download Command Line Tools from Apple to get make to work, but
Had a good read through similar topics but I can't quite a) find one
Had a page that was working fine. Only change I made was to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.