Re: About Oracle database 12c CDB and PDB

From: Kamus <kamusis_at_gmail.com>
Date: Tue, 16 Jul 2013 07:02:40 +0800
Message-ID: <ADF87710F62D4A978C258CFE1F1B189B_at_gmail.com>



Hi
Thanks for all your reply.
1. Trigger is OK, I used to think that should be a property for the PDB, something like OPEN_AUTOMATICALLY=TRUE :-D 2. Unfortunately CDB_ views cannot afford the information which I want, but thanks Sayan, V$PDBS is good, now I make it clear V$DATABASE is for CDB and V$PDBS is for all the PDBs.

3. I found the cause, if I use 10.2.0.4 instant client (I'm on a Mac) to connect to PDB, "startup" and "shutdown" will get ORA-24543, but by SQL*Plus 12.1.0.1.0, everything is OK. $ sqlplus sys/oracle_at_127.0.0.1:15210/pdbtest as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Jul 6 21:44:42 2013

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> SELECT SYS_CONTEXT ('USERENV', 'CON_NAME') FROM DUAL; SYS_CONTEXT('USERENV','CON_NAME')



PDBTEST Elapsed: 00:00:00.01

SQL> select NAME,PDB from dba_services;  select NAME,PDB from dba_services

                      *

ERROR at line 1:
ORA-01219: database or pluggable database not open: queries allowed on fixed tables or views only

SQL> startup
ORA-24543: instance startup or shutdown not allowed in pluggable database SQL> SQL> ALTER PLUGGABLE DATABASE OPEN; Operation 227 succeeded.

-- 
Kamus <kamusis_at_gmail.com>

Visit my blog for more : http://www.dbform.com
Join ACOUG: http://www.acoug.org



On Tuesday, July 16, 2013 at 12:49 AM, Jason Ma wrote:


> Hi Kamus,
> 1. As mentioned by many gurus, you can create trigger for it.
> 2. Martin give you a good point, you can check something like cdb_data_files for that info, depending on different context, you will get the "whole" info or just in the pdb.
> 3. What command you use, actually you need to login the PDB and run the startup/shutdown to manage the pdbs, if you are in the CDB, try alter database open/shutdown immediate clause for it.
>
> Actually I write one long weibo, and you can see the test result there. http://weibo.com/rosegun38
>
> Regards,
> Jason
>
>
>
> 2013/7/15 Martin Klier <usn_at_usn-it.de (mailto:usn_at_usn-it.de)>
> > Hi Kamus,
> >
> > you may want to have a general look at the CDB_ views, for example
> > CDB_PDBS and others. They are usually same as DBA_ views, but extended
> > with a CON_ID identifying the pluggable DB.
> >
> > Regards
> > Martin
> >
> > Kamus schrieb:
> >
> > > 2. Is there a view that showed all the databases (including CDB and all the PDBs) information? like V$DATABASES for all the databases.
> > >
> > > 3. When will the ORA-24543 should occurred? Yesterday I tried to using "startup" to open the PDB, I got ORA-24543 error.
> > >
> > > SQL> startup ORA-24543: instance startup OR shutdown NOT allowed IN pluggable DATABASE
> > >
> > > Today I tried again, it worked. What I modified is enable the multi-threaded database mode by setting threaded_execution=TRUE. Does it related?
> > >
> > > SQL> SHOW USER USER IS "SYS" SQL> startup Pluggable DATABASE opened. SQL> SQL> SHOW con_name CON_NAME ------------------------------ PDBTEST
> >
> > --
> > Usn's IT Blog for Oracle and Linux
> > http://www.usn-it.de
> >
> > --
> > http://www.freelists.org/webpage/oracle-l
> >
> >
>
>
>
> --
> Best wishes,
>
> Jason Ma
-- http://www.freelists.org/webpage/oracle-l
Received on Tue Jul 16 2013 - 01:02:40 CEST

Original text of this message