4 Replies Latest reply: Apr 3, 2014 12:52 AM by carajandb RSS

    customized seed database

    carajandb

      To my knowledge it isn't allowed yet to customize PDB$SEED. So I had the idea to create my own seed / template PDB which reflects my infrastructure (e.g. special schema, objects and tablespaces).

      The problem is that whenever I use ALTER PLUGGABLE DATABASE ALL CLOSE (or OPEN) that will impact my template as well.

      Is there a way to force the template to be opened always as read only?

        • 1. Re: customized seed database
          rp0428
          To my knowledge it isn't allowed yet to customize PDB$SEED. So I had the idea to create my own seed / template PDB which reflects my infrastructure (e.g. special schema, objects and tablespaces).

          The problem is that whenever I use ALTER PLUGGABLE DATABASE ALL CLOSE (or OPEN) that will impact my template as well.

          Is there a way to force the template to be opened always as read only?

          Sure - just write an after startup trigger that opens it READ ONLY when the CDB is opened. Then your ALTER command won't affect it since it will already be open.

          CREATE or REPLACE TRIGGER client_connection AFTER startup ON DATABASE

          A better question, though, is why would you manually use an ALL OPEN command to begin with? That might be ok for a demo installation you are using to just learn and work with 12c but for a real installation you would normally want to have fine-grained control over which PDBs are opened, closed, etc.

           

          For that you could use that AFTER STARTUP trigger to open the PDBs you want to open. That trigger could open the template in READ ONLY mode. Or you could use a script to execute that would affect only the PDBs (including your template) that are appropriate.

           

          Another related question is why you would want that template DB to be opened to begin with. Except when you plan to use it just keep it offline.

          • 2. Re: customized seed database
            Maki

            In my opinion, you shouldn't change PDB$SEED. However, if you want to experiment take a look at this http://www.challengezoran.com/apex/f?p=235:11:0::::P11_QUESTION_ID:652900346899504

             

            Kind regards,

            Maja

            • 3. Re: customized seed database
              rp0428

              Per the Database Concepts doc

              http://docs.oracle.com/cd/E16655_01/server.121/e17633/cdbovrvw.htm

              •   Exactly one seed PDB 

                The seed PDB is a system-supplied template that the CDB can use to create new PDBs. The seed PDB is named PDB$SEED. You cannot add or modify objects in PDB$SEED.

              • 4. Re: customized seed database
                carajandb

                I don't want to modify PDB$SEED (I know that it's possible but not supported). I want to create my own seed database and want to ensure that it is not opened read write accidentally. It seems that the only feasible way is to open it read only while starting the instance with an on startup trigger.