3 Replies Latest reply on Feb 7, 2018 12:00 AM by EdStevens

    Copy specific records to remote database.

    Steve42

      In SQLDeveloper, I can use the DataBase Copy. I can limit the records , example Select * from table where FYear=2018

       

      In the remote table, I need to do Delete from Remote.table where FYear=2018       BEFORE  

      I do the copy.

      I have MANY tables that I would have to Delete on Remote database.

      I may end up doing this  every 3 months.

      I do not want to copy ALL the records because there are a lot of records in 2017, 2016, etc.

       

      What is the best way to do this?

       

      oracle 12c

      PL/SQL 12.1

       

       

      TIA

      Steve42

        • 1. Re: Copy specific records to remote database.
          EdStevens

          Steve42 wrote:

           

          In SQLDeveloper, I can use the DataBase Copy. I can limit the records , example Select * from table where FYear=2018

           

          In the remote table, I need to do Delete from Remote.table where FYear=2018 BEFORE

          I do the copy.

          I have MANY tables that I would have to Delete on Remote database.

          I may end up doing this every 3 months.

          I do not want to copy ALL the records because there are a lot of records in 2017, 2016, etc.

           

          What is the best way to do this?

           

          oracle 12c

          PL/SQL 12.1

           

           

          TIA

          Steve42

          then you need to write a sql script.

           

          -- myscript.sql

          delete from my_table_1 where fyear=2018;

          delete from my_table_2 where fyear=2018;

          delete from my_table_3 where fyear=2018;

          delete from my_table_4 where fyear=2018;

           

          Connect to your database and execute the script.  You can do that with SQL Dev or sqlplus or Toad or . . . .

           

          "But I have many tables!"

          So? With a good text editor, or even with notepad, you should be able to knock that out in just a few minutes, using copy/paste and find/replace.

          • 2. Re: Copy specific records to remote database.
            Steve42

            I will try it!!!

            • 3. Re: Copy specific records to remote database.
              EdStevens

              Steve42 wrote:

               

              I will try it!!!

              "Scripting.  It's what DBA's do."