• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Oracle question

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Oracle question

    Before I run a process to delete a lot (thousands) of records from an Oracle table, is there an easy way of backing those records up first in case it all goes wrong, so they can be restored if necessary? Like copying the records to a text file or something like that?

    I'm relatively new to Oracle, so be gentle with me.

    #2
    CREATE TABLE blah AS ( SELECT * FROM original );

    Creates a new backup table with them all in.
    Best Forum Advisor 2014
    Work in the public sector? You can read my FAQ here
    Click here to get 15% off your first year's IPSE membership

    Comment


      #3
      Use Oracle export, why clog-up the DB with table copies? You'll forget about them - I do!

      Oracle Export:
      exp userid=<schema-owner> file=MyFile log=MyLog compress=n consistent=y recordlength=65000 buffer=512000 direct=y tables=table1,table2, etc.

      You'll be prompted for the schema-owner's database password.

      Comment


        #4
        Originally posted by DBA_bloke View Post
        Use Oracle export, why clog-up the DB with table copies? You'll forget about them - I do!

        Oracle Export:
        exp userid=<schema-owner> file=MyFile log=MyLog compress=n consistent=y recordlength=65000 buffer=512000 direct=y tables=table1,table2, etc.

        You'll be prompted for the schema-owner's database password.
        I was thinking along the lines of quickly being able to recover from an error without anyone noticing! Exp/Imp might be too visible!!
        Best Forum Advisor 2014
        Work in the public sector? You can read my FAQ here
        Click here to get 15% off your first year's IPSE membership

        Comment


          #5
          Originally posted by TheFaQQer View Post
          I was thinking along the lines of quickly being able to recover from an error without anyone noticing! Exp/Imp might be too visible!!
          I like your sneaky style! 10 points.

          Comment


            #6
            well, if you don't commit then no one (but you) can see your changes.

            So do your work. Then test everything. checksum. if all okay, commit. otherwise rollback and start all over.

            If you are thinking Oracle works like Access or SQL Server - it don't - it works much better.
            McCoy: "Medical men are trained in logic."
            Spock: "Trained? Judging from you, I would have guessed it was trial and error."

            Comment


              #7
              Originally posted by lilelvis2000 View Post
              well, if you don't commit then no one (but you) can see your changes.

              So do your work. Then test everything. checksum. if all okay, commit. otherwise rollback and start all over.

              If you are thinking Oracle works like Access or SQL Server - it don't - it works much better.
              But if there are "lots" of records, then there is a chance that you might blow the rollback segment.

              And, you may need to commit before seeing the impact (e.g. deleting data and then check that your workflow / form / report / etc works.)
              Best Forum Advisor 2014
              Work in the public sector? You can read my FAQ here
              Click here to get 15% off your first year's IPSE membership

              Comment


                #8
                Originally posted by TheFaQQer View Post
                But if there are "lots" of records, then there is a chance that you might blow the rollback segment.

                And, you may need to commit before seeing the impact (e.g. deleting data and then check that your workflow / form / report / etc works.)
                Agreed.

                Comment


                  #9
                  Originally posted by DBA_bloke View Post
                  Agreed.
                  Cor, that OCP is really paying off now!
                  Best Forum Advisor 2014
                  Work in the public sector? You can read my FAQ here
                  Click here to get 15% off your first year's IPSE membership

                  Comment


                    #10
                    Gosh! You gurus.
                    McCoy: "Medical men are trained in logic."
                    Spock: "Trained? Judging from you, I would have guessed it was trial and error."

                    Comment

                    Working...
                    X