Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2002
    Location
    Vienna, VA
    Posts
    53

    Question Unanswered: Trying to duplicate database via scripts

    Okay. I have a production server at a client site. I have created scripts, and am trying to duplicate the database on a server at my work site. I don't want to have to import each table manually from a text file, but I will if I can't get this to work.

    How do I go about running a script to create a table on a particular database? Dummy instructions needed. Or a pointer to a dummy book or website that would describe how to do this would suffice.

    Thanks in advance,

    Leah

  2. #2
    Join Date
    Oct 2002
    Posts
    369

    Re: Trying to duplicate database via scripts

    Most versions of Sql Server feature Enterprise Manager support for creating such scripts e.g.(that may subsequently be run in Query Analyzer).

    In Sql Server 2k EM, for example, one would right click the desired DB (select All Tasks --> Generate Sql Script). In the ensuing dialog box click the Show All button and check the script all objects check box. Click OK and save the script to a file. Open the file on an appropriately "permissioned" account connection to the target server and run the script against the target server.

  3. #3
    Join Date
    Jan 2003
    Location
    Paris, France
    Posts
    320

    Re: Trying to duplicate database via scripts

    Originally posted by justmeleah
    Okay. I have a production server at a client site. I have created scripts, and am trying to duplicate the database on a server at my work site. I don't want to have to import each table manually from a text file, but I will if I can't get this to work.

    How do I go about running a script to create a table on a particular database? Dummy instructions needed. Or a pointer to a dummy book or website that would describe how to do this would suffice.

    Thanks in advance,

    Leah
    Why not to detach your db on your production server
    and reatach the db on your server
    look at sp_attachdb, sp_dettachdb.
    Olivier Miossec
    --
    http://www.lasso-developpeur.net/
    --

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    You can also use dts and the "copy database wizard".

  5. #5
    Join Date
    Jan 2003
    Location
    México City
    Posts
    31

    Backup/Restore?

    I think the easiest way is a simple backup/restore (maybe with path changing) via Enterprise Manager.
    Very intuitive, and you can also find instructions in documentation.

  6. #6
    Join Date
    Nov 2003
    Posts
    1

    Can the Generate SQL Scripts dialog be accessed through TSQL?

    Hiya

    I have a similar problem where the database structure must be duplicated (at least some of it). Currently we have scripts that are generated through the All Tasks - Generate SQL Script window. It would, however, be significantly better for us if we were able to create this script automatically. Is this functionality accessible in any way?
    Alternatively is there any way to use DMO to duplicate part of a database structure?

    cheers,
    Mike

  7. #7
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Check this link and goto DMO box for details.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •