Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Copying 683 Tables Is Harder Than It Looks

Copying 683 Tables Is Harder Than It Looks

Scheduled Pinned Locked Moved The Lounge
databasesql-servercomsysadminhelp
21 Posts 7 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Brisingr Aerowing

    And?

    Gryphons Are Awesome! ‮Gryphons Are Awesome!‬

    A Offline
    A Offline
    AspDotNetDev
    wrote on last edited by
    #7

    34 million rows copied so far, and about 50 million rows to go. Might actually work this time (probably going to take another half hour to finish). :)

    Thou mewling ill-breeding pignut!

    1 Reply Last reply
    0
    • B Brisingr Aerowing

      And?

      Gryphons Are Awesome! ‮Gryphons Are Awesome!‬

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #8

      Not sure why the network graph is so varied. I was hoping it would just saturate the connection until it finished, but there are a bunch of lulls.

      Thou mewling ill-breeding pignut!

      1 Reply Last reply
      0
      • B Brisingr Aerowing

        And?

        Gryphons Are Awesome! ‮Gryphons Are Awesome!‬

        A Offline
        A Offline
        AspDotNetDev
        wrote on last edited by
        #9

        It worked! I now have a dev database with real data to play with. :-D

        Thou mewling ill-breeding pignut!

        _ B 2 Replies Last reply
        0
        • A AspDotNetDev

          I'm using the SQL Server Import and Export tool to refresh a dev database with production data (over 20GB worth). I've failed at least 10 times now. Each time, I hit a new issue. The last big one was that it doesn't like to force inserts into fields of type timestamp. Found all those and ignored those fields. Now I keep hitting errors when it tries to truncate tables with foreign keys. You would think an import tool could account for this. I expect another 600 or so failures before I get this working. :sigh:

          Thou mewling ill-breeding pignut!

          Z Offline
          Z Offline
          ZurdoDev
          wrote on last edited by
          #10

          The way we do it is to keep a script file. Any database changes get added to a script file so if we need to bring down a db from production we do that and then run the script to update the db to development code. Of course that doesn't help you now. :)

          There are only 10 types of people in the world, those who understand binary and those who don't.

          A 1 Reply Last reply
          0
          • A AspDotNetDev

            It worked! I now have a dev database with real data to play with. :-D

            Thou mewling ill-breeding pignut!

            _ Offline
            _ Offline
            _Damian S_
            wrote on last edited by
            #11

            Woot!! Now recreate all your indices and keys before you get too excited...

            Quad skating his way through the world since the early 80's... Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

            A 1 Reply Last reply
            0
            • _ _Damian S_

              Woot!! Now recreate all your indices and keys before you get too excited...

              Quad skating his way through the world since the early 80's... Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

              A Offline
              A Offline
              AspDotNetDev
              wrote on last edited by
              #12

              Pretty sure all the indexes are still intact. It's just the constraints that are buggered. I kept the output of all the deleted FK constraints, so I should be able to create a script against the old database to snag them and then recreate them on the new database (I copied the dev database before making changes).

              Thou mewling ill-breeding pignut!

              _ 1 Reply Last reply
              0
              • Z ZurdoDev

                The way we do it is to keep a script file. Any database changes get added to a script file so if we need to bring down a db from production we do that and then run the script to update the db to development code. Of course that doesn't help you now. :)

                There are only 10 types of people in the world, those who understand binary and those who don't.

                A Offline
                A Offline
                AspDotNetDev
                wrote on last edited by
                #13

                We have lots of teams and ex-coworkers who touch/have touched the DB. Trying to enforce any sort of policy would not be feasible for us.

                Thou mewling ill-breeding pignut!

                Z 1 Reply Last reply
                0
                • A AspDotNetDev

                  Pretty sure all the indexes are still intact. It's just the constraints that are buggered. I kept the output of all the deleted FK constraints, so I should be able to create a script against the old database to snag them and then recreate them on the new database (I copied the dev database before making changes).

                  Thou mewling ill-breeding pignut!

                  _ Offline
                  _ Offline
                  _Damian S_
                  wrote on last edited by
                  #14

                  One thing I didn't ask earlier... why didn't you simply detach the other database, make a copy of the mdf and ldf files, and reattach it in your dev environment?

                  Quad skating his way through the world since the early 80's... Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

                  A N 2 Replies Last reply
                  0
                  • _ _Damian S_

                    One thing I didn't ask earlier... why didn't you simply detach the other database, make a copy of the mdf and ldf files, and reattach it in your dev environment?

                    Quad skating his way through the world since the early 80's... Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

                    A Offline
                    A Offline
                    AspDotNetDev
                    wrote on last edited by
                    #15

                    Some of the dev tables need to remain unchanged. For example, we have different integration with AD between our dev and our production environments. If we overwrote those tables on dev, we would no longer be able to login to our web environments. Also, we are always making changes to dev... don't want to screw up the work of other developers. The big one, though, are the permissions. I don't even want to try dealing with permission issues between environments.

                    Thou mewling ill-breeding pignut!

                    1 Reply Last reply
                    0
                    • A AspDotNetDev

                      I'm using the SQL Server Import and Export tool to refresh a dev database with production data (over 20GB worth). I've failed at least 10 times now. Each time, I hit a new issue. The last big one was that it doesn't like to force inserts into fields of type timestamp. Found all those and ignored those fields. Now I keep hitting errors when it tries to truncate tables with foreign keys. You would think an import tool could account for this. I expect another 600 or so failures before I get this working. :sigh:

                      Thou mewling ill-breeding pignut!

                      B Offline
                      B Offline
                      Brady Kelly
                      wrote on last edited by
                      #16

                      The SSMS Export & Import tool is a POS. I use Access to import/export tables. Way better. That is the only reason I use Access.

                      A 1 Reply Last reply
                      0
                      • _ _Damian S_

                        One thing I didn't ask earlier... why didn't you simply detach the other database, make a copy of the mdf and ldf files, and reattach it in your dev environment?

                        Quad skating his way through the world since the early 80's... Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

                        N Offline
                        N Offline
                        Nicholas Marty
                        wrote on last edited by
                        #17

                        yeah. or just restoring a backup? ;P

                        1 Reply Last reply
                        0
                        • A AspDotNetDev

                          We have lots of teams and ex-coworkers who touch/have touched the DB. Trying to enforce any sort of policy would not be feasible for us.

                          Thou mewling ill-breeding pignut!

                          Z Offline
                          Z Offline
                          ZurdoDev
                          wrote on last edited by
                          #18

                          Quote:

                          We have lots of teams and ex-coworkers who touch/have touched the DB. Trying to enforce any sort of policy would not be feasible for us.

                          Sounds like a mess. I feel sorry for you. :)

                          There are only 10 types of people in the world, those who understand binary and those who don't.

                          1 Reply Last reply
                          0
                          • B Brady Kelly

                            The SSMS Export & Import tool is a POS. I use Access to import/export tables. Way better. That is the only reason I use Access.

                            A Offline
                            A Offline
                            AspDotNetDev
                            wrote on last edited by
                            #19

                            Please don't tell me you also use an Access database. :((

                            Thou mewling ill-breeding pignut!

                            1 Reply Last reply
                            0
                            • A AspDotNetDev

                              It worked! I now have a dev database with real data to play with. :-D

                              Thou mewling ill-breeding pignut!

                              B Offline
                              B Offline
                              Brisingr Aerowing
                              wrote on last edited by
                              #20

                              Party, lets have a party!

                              Gryphons Are Awesome! ‮Gryphons Are Awesome!‬

                              1 Reply Last reply
                              0
                              • A AspDotNetDev

                                I'm using the SQL Server Import and Export tool to refresh a dev database with production data (over 20GB worth). I've failed at least 10 times now. Each time, I hit a new issue. The last big one was that it doesn't like to force inserts into fields of type timestamp. Found all those and ignored those fields. Now I keep hitting errors when it tries to truncate tables with foreign keys. You would think an import tool could account for this. I expect another 600 or so failures before I get this working. :sigh:

                                Thou mewling ill-breeding pignut!

                                T Offline
                                T Offline
                                thecodeproject treacy co uk
                                wrote on last edited by
                                #21

                                I see your problem and feel your pain... Solution: Stop using SQL!

                                Sorry I couldn't resit that!

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups