SQL Server Performance

Backup db vs Generate SQL Script?

Discussion in 'General Developer Questions' started by isa, Apr 17, 2007.

  1. isa New Member

    Hello everyone, In SQL Server 2000, i want to know the difference between backup database and Generate SQL script? As we generate the SQL script
    for backup the database as run the script file it again makes Tables, SP and so on.. kindly tell me the clear difference between these.

    I want to generate the scripts of my database on regular basis start of the each day, is that possible to make any thing that do this
    without manually do that on each day if yes then how to make a plan for this as i have a little bit knowledge about Maintenance plan
    how to make a plzn for taking backups, plz help me

    Thanx in Advance as i also trying to learn and study BOL but still need ur suggestions and ideas also.


    isa
  2. thomas New Member

    Generating scripts for everything means that you can run the script to recreate all the object in your database. But all the tables will be empty - no data in them.

    Backup will copy everything in the database to a file. Tables, SPs, all objects, all data, all users etc etc. You must ALWAYS back up your database regularly with full back up. Generating scripts for your objects can be useful, but is not a disaster recovery option, as you'll have no way to get your data back.

    For details on how to make maintenance plans, have a look in Books Online.
  3. dineshasanka Moderator

    it seems that you don't need data. do you?

    if you need only db obejcts then yes go with scripting. but if you need data, you better go with backups

    ----------------------------------------
    Contributing Editor, Writer & Forums Moderator
    http://www.SQL-Server-Performance.Com

    Visit my Blog at
    http://dineshasanka.spaces.live.com/
  4. jezemine New Member

    if you really want to generate scripts in an automated way each day, this app I wrote might be useful to you. it will generate scripts for any 2000 or 2005 db. It's a console app so it's easily automated from .bat files or some other method.

    it's open source so you can tweak it if it's not exactly to your liking. implemented in C#, uses SMO to generate scripts.

    http://www.elsasoft.org/tools.htm

    www.elsasoft.org
  5. MohammedU New Member

  6. Aniket Patil New Member

    You can take the data along with database objects by clicking Advanced -> & selecting 'Schema & data' in Types of data to script. it will include data as well
  7. Luis Martin Moderator

    Aniket, welcome to the forums!
    This thread is 7 years old.;)

Share This Page