Can we alter the dbspace of a informix table?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















Suppose I have following schema.



create table tb1
(col1 Integer,
col2 varchar(50)
) in dbspace1 extent size 1000 next 500 lock mode row;


and I want to change the dbspace of above table to dbspace2 . After doing my alteration table schema should be look like as follows .



create table tb1
(col1 Integer,
col2 varchar(50)
) in dbspace2 extent size 1000 next 500 lock mode row;


Is it possible to do? If it is possible what is the command?










share|improve this question





























    1















    Suppose I have following schema.



    create table tb1
    (col1 Integer,
    col2 varchar(50)
    ) in dbspace1 extent size 1000 next 500 lock mode row;


    and I want to change the dbspace of above table to dbspace2 . After doing my alteration table schema should be look like as follows .



    create table tb1
    (col1 Integer,
    col2 varchar(50)
    ) in dbspace2 extent size 1000 next 500 lock mode row;


    Is it possible to do? If it is possible what is the command?










    share|improve this question

























      1












      1








      1








      Suppose I have following schema.



      create table tb1
      (col1 Integer,
      col2 varchar(50)
      ) in dbspace1 extent size 1000 next 500 lock mode row;


      and I want to change the dbspace of above table to dbspace2 . After doing my alteration table schema should be look like as follows .



      create table tb1
      (col1 Integer,
      col2 varchar(50)
      ) in dbspace2 extent size 1000 next 500 lock mode row;


      Is it possible to do? If it is possible what is the command?










      share|improve this question














      Suppose I have following schema.



      create table tb1
      (col1 Integer,
      col2 varchar(50)
      ) in dbspace1 extent size 1000 next 500 lock mode row;


      and I want to change the dbspace of above table to dbspace2 . After doing my alteration table schema should be look like as follows .



      create table tb1
      (col1 Integer,
      col2 varchar(50)
      ) in dbspace2 extent size 1000 next 500 lock mode row;


      Is it possible to do? If it is possible what is the command?







      informix






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 4:51









      NwnNwn

      14113




      14113
























          1 Answer
          1






          active

          oldest

          votes


















          1














          On the face of it, the ALTER FRAGMENT statement and the INIT clause allows you to write:



          ALTER FRAGMENT ON TABLE tb1 INIT IN dbspace2;


          The keyword TABLE is required; you could specify an index instead.



          I've not actually experimented to prove that it works, but the syntax diagram certainly allows it.






          share|improve this answer
























          • I tried with that and it seems works. I can see empty chunks are filling on dbspace2. Can I change the default dbspace of the database to this new dbspace2. Because I'm going to remove dbspace1

            – Nwn
            Jan 3 at 9:22








          • 2





            Nope. In Informix you cannot alter the base dbspace of a database. You will have to create a new database on the dbspace of your choice, if you want to change it. If the database was created in dbspace1, all the sys catalog tables were also created in that dbspace.

            – Luís Marques
            Jan 3 at 16:52






          • 1





            Probably, but I'd make sure I have a backup first.

            – Jonathan Leffler
            Jan 7 at 5:46






          • 1





            Yes; the message means that ONLINE cannot be used with that operation. It's likely because it is changing the dbspace; ONLINE operations tend not to involve cross-dbspace operations.

            – Jonathan Leffler
            Jan 8 at 5:12






          • 1





            Life is about to get interesting. I suspect that you may need to use something other than the INIT clause to ALTER FRAGMENT. For example, you may need to add another fragment in the other dbspace and ensure that all new rows are placed in the new fragment. Then you arrange to (slowly) update the old rows so that they migrate from the old fragment to the new; then you drop the now empty old fragment. I'd need to do some experimentation, though, to be sure it is doable.

            – Jonathan Leffler
            Jan 17 at 7:43












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016519%2fcan-we-alter-the-dbspace-of-a-informix-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          On the face of it, the ALTER FRAGMENT statement and the INIT clause allows you to write:



          ALTER FRAGMENT ON TABLE tb1 INIT IN dbspace2;


          The keyword TABLE is required; you could specify an index instead.



          I've not actually experimented to prove that it works, but the syntax diagram certainly allows it.






          share|improve this answer
























          • I tried with that and it seems works. I can see empty chunks are filling on dbspace2. Can I change the default dbspace of the database to this new dbspace2. Because I'm going to remove dbspace1

            – Nwn
            Jan 3 at 9:22








          • 2





            Nope. In Informix you cannot alter the base dbspace of a database. You will have to create a new database on the dbspace of your choice, if you want to change it. If the database was created in dbspace1, all the sys catalog tables were also created in that dbspace.

            – Luís Marques
            Jan 3 at 16:52






          • 1





            Probably, but I'd make sure I have a backup first.

            – Jonathan Leffler
            Jan 7 at 5:46






          • 1





            Yes; the message means that ONLINE cannot be used with that operation. It's likely because it is changing the dbspace; ONLINE operations tend not to involve cross-dbspace operations.

            – Jonathan Leffler
            Jan 8 at 5:12






          • 1





            Life is about to get interesting. I suspect that you may need to use something other than the INIT clause to ALTER FRAGMENT. For example, you may need to add another fragment in the other dbspace and ensure that all new rows are placed in the new fragment. Then you arrange to (slowly) update the old rows so that they migrate from the old fragment to the new; then you drop the now empty old fragment. I'd need to do some experimentation, though, to be sure it is doable.

            – Jonathan Leffler
            Jan 17 at 7:43
















          1














          On the face of it, the ALTER FRAGMENT statement and the INIT clause allows you to write:



          ALTER FRAGMENT ON TABLE tb1 INIT IN dbspace2;


          The keyword TABLE is required; you could specify an index instead.



          I've not actually experimented to prove that it works, but the syntax diagram certainly allows it.






          share|improve this answer
























          • I tried with that and it seems works. I can see empty chunks are filling on dbspace2. Can I change the default dbspace of the database to this new dbspace2. Because I'm going to remove dbspace1

            – Nwn
            Jan 3 at 9:22








          • 2





            Nope. In Informix you cannot alter the base dbspace of a database. You will have to create a new database on the dbspace of your choice, if you want to change it. If the database was created in dbspace1, all the sys catalog tables were also created in that dbspace.

            – Luís Marques
            Jan 3 at 16:52






          • 1





            Probably, but I'd make sure I have a backup first.

            – Jonathan Leffler
            Jan 7 at 5:46






          • 1





            Yes; the message means that ONLINE cannot be used with that operation. It's likely because it is changing the dbspace; ONLINE operations tend not to involve cross-dbspace operations.

            – Jonathan Leffler
            Jan 8 at 5:12






          • 1





            Life is about to get interesting. I suspect that you may need to use something other than the INIT clause to ALTER FRAGMENT. For example, you may need to add another fragment in the other dbspace and ensure that all new rows are placed in the new fragment. Then you arrange to (slowly) update the old rows so that they migrate from the old fragment to the new; then you drop the now empty old fragment. I'd need to do some experimentation, though, to be sure it is doable.

            – Jonathan Leffler
            Jan 17 at 7:43














          1












          1








          1







          On the face of it, the ALTER FRAGMENT statement and the INIT clause allows you to write:



          ALTER FRAGMENT ON TABLE tb1 INIT IN dbspace2;


          The keyword TABLE is required; you could specify an index instead.



          I've not actually experimented to prove that it works, but the syntax diagram certainly allows it.






          share|improve this answer













          On the face of it, the ALTER FRAGMENT statement and the INIT clause allows you to write:



          ALTER FRAGMENT ON TABLE tb1 INIT IN dbspace2;


          The keyword TABLE is required; you could specify an index instead.



          I've not actually experimented to prove that it works, but the syntax diagram certainly allows it.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 6:28









          Jonathan LefflerJonathan Leffler

          574k956881041




          574k956881041













          • I tried with that and it seems works. I can see empty chunks are filling on dbspace2. Can I change the default dbspace of the database to this new dbspace2. Because I'm going to remove dbspace1

            – Nwn
            Jan 3 at 9:22








          • 2





            Nope. In Informix you cannot alter the base dbspace of a database. You will have to create a new database on the dbspace of your choice, if you want to change it. If the database was created in dbspace1, all the sys catalog tables were also created in that dbspace.

            – Luís Marques
            Jan 3 at 16:52






          • 1





            Probably, but I'd make sure I have a backup first.

            – Jonathan Leffler
            Jan 7 at 5:46






          • 1





            Yes; the message means that ONLINE cannot be used with that operation. It's likely because it is changing the dbspace; ONLINE operations tend not to involve cross-dbspace operations.

            – Jonathan Leffler
            Jan 8 at 5:12






          • 1





            Life is about to get interesting. I suspect that you may need to use something other than the INIT clause to ALTER FRAGMENT. For example, you may need to add another fragment in the other dbspace and ensure that all new rows are placed in the new fragment. Then you arrange to (slowly) update the old rows so that they migrate from the old fragment to the new; then you drop the now empty old fragment. I'd need to do some experimentation, though, to be sure it is doable.

            – Jonathan Leffler
            Jan 17 at 7:43



















          • I tried with that and it seems works. I can see empty chunks are filling on dbspace2. Can I change the default dbspace of the database to this new dbspace2. Because I'm going to remove dbspace1

            – Nwn
            Jan 3 at 9:22








          • 2





            Nope. In Informix you cannot alter the base dbspace of a database. You will have to create a new database on the dbspace of your choice, if you want to change it. If the database was created in dbspace1, all the sys catalog tables were also created in that dbspace.

            – Luís Marques
            Jan 3 at 16:52






          • 1





            Probably, but I'd make sure I have a backup first.

            – Jonathan Leffler
            Jan 7 at 5:46






          • 1





            Yes; the message means that ONLINE cannot be used with that operation. It's likely because it is changing the dbspace; ONLINE operations tend not to involve cross-dbspace operations.

            – Jonathan Leffler
            Jan 8 at 5:12






          • 1





            Life is about to get interesting. I suspect that you may need to use something other than the INIT clause to ALTER FRAGMENT. For example, you may need to add another fragment in the other dbspace and ensure that all new rows are placed in the new fragment. Then you arrange to (slowly) update the old rows so that they migrate from the old fragment to the new; then you drop the now empty old fragment. I'd need to do some experimentation, though, to be sure it is doable.

            – Jonathan Leffler
            Jan 17 at 7:43

















          I tried with that and it seems works. I can see empty chunks are filling on dbspace2. Can I change the default dbspace of the database to this new dbspace2. Because I'm going to remove dbspace1

          – Nwn
          Jan 3 at 9:22







          I tried with that and it seems works. I can see empty chunks are filling on dbspace2. Can I change the default dbspace of the database to this new dbspace2. Because I'm going to remove dbspace1

          – Nwn
          Jan 3 at 9:22






          2




          2





          Nope. In Informix you cannot alter the base dbspace of a database. You will have to create a new database on the dbspace of your choice, if you want to change it. If the database was created in dbspace1, all the sys catalog tables were also created in that dbspace.

          – Luís Marques
          Jan 3 at 16:52





          Nope. In Informix you cannot alter the base dbspace of a database. You will have to create a new database on the dbspace of your choice, if you want to change it. If the database was created in dbspace1, all the sys catalog tables were also created in that dbspace.

          – Luís Marques
          Jan 3 at 16:52




          1




          1





          Probably, but I'd make sure I have a backup first.

          – Jonathan Leffler
          Jan 7 at 5:46





          Probably, but I'd make sure I have a backup first.

          – Jonathan Leffler
          Jan 7 at 5:46




          1




          1





          Yes; the message means that ONLINE cannot be used with that operation. It's likely because it is changing the dbspace; ONLINE operations tend not to involve cross-dbspace operations.

          – Jonathan Leffler
          Jan 8 at 5:12





          Yes; the message means that ONLINE cannot be used with that operation. It's likely because it is changing the dbspace; ONLINE operations tend not to involve cross-dbspace operations.

          – Jonathan Leffler
          Jan 8 at 5:12




          1




          1





          Life is about to get interesting. I suspect that you may need to use something other than the INIT clause to ALTER FRAGMENT. For example, you may need to add another fragment in the other dbspace and ensure that all new rows are placed in the new fragment. Then you arrange to (slowly) update the old rows so that they migrate from the old fragment to the new; then you drop the now empty old fragment. I'd need to do some experimentation, though, to be sure it is doable.

          – Jonathan Leffler
          Jan 17 at 7:43





          Life is about to get interesting. I suspect that you may need to use something other than the INIT clause to ALTER FRAGMENT. For example, you may need to add another fragment in the other dbspace and ensure that all new rows are placed in the new fragment. Then you arrange to (slowly) update the old rows so that they migrate from the old fragment to the new; then you drop the now empty old fragment. I'd need to do some experimentation, though, to be sure it is doable.

          – Jonathan Leffler
          Jan 17 at 7:43




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016519%2fcan-we-alter-the-dbspace-of-a-informix-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          Npm cannot find a required file even through it is in the searched directory