环境描述: 12.1.0.1 单机 DB_NAME=MAC有2个Pluggable Database MACP1和 MACP2
oracle@localhost:~$ ps -ef|grep MAC
oracle 4491 1 0 10:21 ? 00:00:00 ora_pmon_MAC
oracle 4495 1 0 10:21 ? 00:00:00 ora_psp0_MAC
oracle 4499 1 8 10:21 ? 00:00:07 ora_vktm_MAC
oracle 4505 1 0 10:21 ? 00:00:00 ora_gen0_MAC
oracle 4509 1 0 10:21 ? 00:00:00 ora_mman_MAC
oracle 4517 1 0 10:21 ? 00:00:00 ora_diag_MAC
oracle 4521 1 0 10:21 ? 00:00:00 ora_dbrm_MAC
oracle 4525 1 0 10:21 ? 00:00:00 ora_dia0_MAC
oracle 4529 1 0 10:21 ? 00:00:00 ora_dbw0_MAC
oracle 4533 1 0 10:21 ? 00:00:00 ora_lgwr_MAC
oracle 4537 1 0 10:21 ? 00:00:00 ora_ckpt_MAC
oracle 4541 1 0 10:21 ? 00:00:00 ora_smon_MAC
oracle 4545 1 0 10:21 ? 00:00:00 ora_reco_MAC
oracle 4549 1 0 10:21 ? 00:00:00 ora_lreg_MAC
oracle 4553 1 1 10:21 ? 00:00:01 ora_mmon_MAC
oracle 4557 1 0 10:21 ? 00:00:00 ora_mmnl_MAC
oracle 4561 1 0 10:21 ? 00:00:00 ora_d000_MAC
oracle 4565 1 0 10:21 ? 00:00:00 ora_s000_MAC
oracle 4591 1 0 10:21 ? 00:00:00 ora_tmon_MAC
oracle 4595 1 0 10:21 ? 00:00:00 ora_tt00_MAC
oracle 4599 1 0 10:21 ? 00:00:00 ora_smco_MAC
oracle 4603 1 0 10:21 ? 00:00:00 ora_w000_MAC
oracle 4607 1 0 10:21 ? 00:00:00 ora_aqpc_MAC
oracle 4616 1 3 10:21 ? 00:00:03 ora_p000_MAC
oracle 4620 1 5 10:21 ? 00:00:03 ora_p001_MAC
oracle 4624 1 1 10:21 ? 00:00:01 ora_p002_MAC
oracle 4628 1 0 10:21 ? 00:00:00 ora_p003_MAC
oracle 4684 1 0 10:21 ? 00:00:00 ora_qm02_MAC
oracle 4692 1 0 10:21 ? 00:00:00 ora_q002_MAC
oracle 4696 1 0 10:21 ? 00:00:00 ora_q003_MAC
oracle 4704 1 2 10:21 ? 00:00:01 ora_cjq0_MAC
oracle 4713 1 0 10:21 ? 00:00:00 ora_vkrm_MAC
oracle 4721 1 0 10:21 ? 00:00:00 ora_p004_MAC
oracle 4725 1 0 10:21 ? 00:00:00 ora_p005_MAC
oracle 4760 1 0 10:22 ? 00:00:00 ora_p006_MAC
oracle 4764 1 0 10:22 ? 00:00:00 ora_p007_MAC
oracle 4768 1 0 10:22 ? 00:00:00 ora_p008_MAC
oracle 4772 1 2 10:22 ? 00:00:00 ora_j000_MAC
oracle 4780 1 1 10:22 ? 00:00:00 ora_j002_MAC
oracle 4784 1 0 10:22 ? 00:00:00 ora_j003_MAC
oracle 4788 1 2 10:22 ? 00:00:00 ora_j001_MAC
oracle 4792 1 0 10:22 ? 00:00:00 ora_j004_MAC
oracle 4796 1 0 10:22 ? 00:00:00 ora_j005_MAC
oracle 4800 1 2 10:22 ? 00:00:00 ora_j006_MAC
oracle 4805 1 1 10:22 ? 00:00:00 ora_j007_MAC
oracle 4809 1 8 10:22 ? 00:00:01 ora_j008_MAC
oracle 4813 1 0 10:22 ? 00:00:00 ora_j009_MAC
oracle 4817 1 0 10:22 ? 00:00:00 ora_j010_MAC
oracle 4821 1 1 10:22 ? 00:00:00 ora_j011_MAC
oracle 4825 1 1 10:22 ? 00:00:00 ora_j012_MAC
oracle 4829 1 0 10:22 ? 00:00:00 ora_j013_MAC
oracle@localhost:~$ export ORACLE_SID=MAC
oracle@localhost:~$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 13 10:24:04 2013
Copyright (c) 1982, 2013, 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
// 首先检查该DB是否为CDB è Container Database
SQL> select name, cdb, con_id from v$database;
NAME CDB CON_ID
——— — ———-
MAC YES 0
并检查实例名:
SQL> select INSTANCE_NAME, STATUS, CON_ID from v$instance;
INSTANCE_NAME STATUS CON_ID
—————- ———— ———-
MAC OPEN 0
使用V$PDBS检查实例相关的Pluggable Databases
select con_id,dbid,name,open_mode,total_size from v$PDBS;
CON_ID DBID NAME OPEN_MODE TOTAL_SIZE
———- ———- —————————— ———- ———-
2 4062078151 PDB$SEED READ ONLY 283115520
3 1965483069 MACP1 READ WRITE 288358400
4 1550789943 MACP2 MOUNTED 0
V$PDBS的数据来源于X$CON内部视图
SELECT inst_id,
con_id,
dbid,
con_uid,
guid,
name,
DECODE (state,
0, ‘MOUNTED’,
1, ‘READ WRITE’,
2, ‘READ ONLY’,
3, ‘MIGRATE’),
DECODE (restricted, 0, ‘NO’, 1, ‘YES’),
stime,
create_scn,
total_size
FROM x$con
WHERE con_id > 1
而X$CON的数据应当主要来源是控制文件CONTROLFILE中的PLUGGABLE DATABASE RECORDS部分:
SQL> oradebug setmypid
Statement processed.
SQL> oradebug dump controlf 3;
Statement processed.
SQL> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/mac/MAC/trace/MAC_ora_4900.trc
***************************************************************************
PLUGGABLE DATABASE RECORDS
***************************************************************************
(size = 684, compat size = 684, section max = 10, section in-use = 4,
last-recid= 13, old-recno = 0, last-recno = 0)
(extent = 1, blkno = 540, numrecs = 10)
Pluggable DataBase record=1
id=1
dbid=797473714
name=CDB$ROOT
first datafile link=1
pdbinc=0, pdbrdi=0, status=0×00000000, flags=0×00000000
incrcv scn scn: 0×0000.00000000, clnscn scn: 0×0000.00000000, crescn scn: 0×0000.00000000
dbrls scn: 0×0000.00000000, dbrlc=0
iscn scn: 0×0000.00000000, itime=0
bscn scn: 0×0000.00000000, btime=0
escn scn: 0×0000.00000000, etime=0
Pluggable DataBase record=2
id=2
dbid=4062078151
name=PDB$SEED
first datafile link=7
pdbinc=0, pdbrdi=0, status=0×00000001, flags=0×00000000
incrcv scn scn: 0×0000.00000000, clnscn scn: 0×0000.001a80a5, crescn scn: 0×0000.001a41be
dbrls scn: 0×0000.00000000, dbrlc=0
iscn scn: 0×0000.00000000, itime=0
bscn scn: 0×0000.00000000, btime=0
escn scn: 0×0000.00000000, etime=0
Pluggable DataBase record=3
id=3
dbid=1965483069
name=MACP1
first datafile link=10
pdbinc=0, pdbrdi=0, status=0×00000000, flags=0×00000000
incrcv scn scn: 0×0000.00000000, clnscn scn: 0×0000.00000000, crescn scn: 0×0000.001a849c
dbrls scn: 0×0000.00000000, dbrlc=0
iscn scn: 0×0000.00000000, itime=0
bscn scn: 0×0000.00000000, btime=0
escn scn: 0×0000.00000000, etime=0
Pluggable DataBase record=4
id=4
dbid=1550789943
name=MACP2
first datafile link=13
pdbinc=0, pdbrdi=0, status=0×00000001, flags=0×00000000
incrcv scn scn: 0×0000.00000000, clnscn scn: 0×0000.001b04f4, crescn scn: 0×0000.001a897c
dbrls scn: 0×0000.00000000, dbrlc=0
iscn scn: 0×0000.00000000, itime=0
bscn scn: 0×0000.00000000, btime=0
escn scn: 0×0000.00000000, etime=0
DATA FILE #5:
name #9: /u01/app/oracle/oradata/MAC/pdbseed/system01.dbf
creation size=32000 block size=8192 status=0×80 flg=0×5 head=9 tail=9 dup=1
pdb_id 2, tablespace 0, index=6 krfil=1 prev_file_in_ts=0 prev_file_in_pdb=0
unrecoverable scn: 0×0000.00000000 01/01/1988 00:00:00
Checkpoint cnt:9 scn: 0×0000.001a80a5 06/30/2013 14:27:50
Stop scn: 0×0000.001a80a5 06/30/2013 14:27:50
Creation Checkpointed at scn: 0×0000.001a41be 06/30/2013 14:23:04
thread:1 rba:(0×1.1eb.10)
Hot Backup end marker scn: 0×0000.00000000
aux_file is NOT DEFINED
Plugged readony: NO
Plugin scnscn: 0×0000.00000000
Plugin resetlogs scn/timescn: 0×0000.00000000 01/01/1988 00:00:00
Foreign creation scn/timescn: 0×0000.00000000 01/01/1988 00:00:00
Foreign checkpoint scn/timescn: 0×0000.00000000 01/01/1988 00:00:00
Online move state: 0
DATA FILE #8:
name #12: /u01/app/oracle/oradata/MAC/MACP1/system01.dbf
creation size=32000 block size=8192 status=0xe flg=0×1 head=12 tail=12 dup=1
pdb_id 3, tablespace 0, index=9 krfil=1 prev_file_in_ts=0 prev_file_in_pdb=0
unrecoverable scn: 0×0000.00000000 01/01/1988 00:00:00
Checkpoint cnt:9 scn: 0×0000.001ed479 07/13/2013 10:22:14
Stop scn: 0xffff.ffffffff 07/01/2013 03:41:49
Creation Checkpointed at scn: 0×0000.001a849c 06/30/2013 14:28:40
thread:1 rba:(0×6.2.10)
Hot Backup end marker scn: 0×0000.00000000
aux_file is NOT DEFINED
Plugged readony: NO
Plugin scnscn: 0×0000.00000000
Plugin resetlogs scn/timescn: 0×0000.00000000 01/01/1988 00:00:00
Foreign creation scn/timescn: 0×0000.00000000 01/01/1988 00:00:00
Foreign checkpoint scn/timescn: 0×0000.00000000 01/01/1988 00:00:00
Online move state: 0
透过对控制文件信息的探索可以发现 多出了以下几个属性:
- Plugged readony
- Plugin scnscn
- Plugin resetlogs scn/timescn
- Foreign creation scn/timescn
- Foreign checkpoint scn/timescn
- Online move state
SQL> select TYPE FROM V$CONTROLFILE_RECORD_SECTION where type like ‘%PDB%’;
TYPE
—————————-
PDB RECORD
PDBINC RECORD
下面的测试可以证明V$PDBS的数据来源于控制文件,但是 TOTAL_SIZE需要OPEN PLUGGABLE DB后才能获得
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2293880 bytes
Variable Size 562040712 bytes
Database Buffers 268435456 bytes
Redo Buffers 2334720 bytes
Database mounted.
SQL> select con_id,dbid,name,open_mode,total_size from v$PDBS;
CON_ID DBID NAME OPEN_MODE TOTAL_SIZE
———- ———- —————————— ———- ———-
2 4062078151 PDB$SEED MOUNTED 0
3 1965483069 MACP1 MOUNTED 0
4 1550789943 MACP2 MOUNTED
SQL> alter pluggable database MACP1 open;
alter pluggable database MACP1 open
*
ERROR at line 1:
ORA-01109: database not open
SQL> alter database open;
Database altered.
SQL> select con_id,dbid,name,open_mode,total_size from v$PDBS;
CON_ID DBID NAME OPEN_MODE TOTAL_SIZE
———- ———- —————————— ———- ———-
2 4062078151 PDB$SEED READ ONLY 283115520
3 1965483069 MACP1 MOUNTED 0
4 1550789943 MACP2 MOUNTED 0
SQL> alter pluggable database MACP1 open;
Pluggable database altered.
SQL> select con_id,dbid,name,open_mode,total_size from v$PDBS;
CON_ID DBID NAME OPEN_MODE TOTAL_SIZE
———- ———- —————————— ———- ———-
2 4062078151 PDB$SEED READ ONLY 283115520
3 1965483069 MACP1 READ WRITE 288358400
4 1550789943 MACP2 MOUNTED 0
在一个PDB MACP1打开的情况下我们去了解LISTENER 服务注册的情况:
oracle@localhost:~$ lsnrctl service
LSNRCTL for Linux: Version 12.1.0.1.0 – Production on 13-JUL-2013 10:40:20
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary…
Service “MAC” has 1 instance(s).
Instance “MAC”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:ready
LOCAL SERVER
Service “MACXDB” has 1 instance(s).
Instance “MAC”, status READY, has 1 handler(s) for this service…
Handler(s):
“D000″ established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: localhost.localdomain, pid: 5139>
(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=43229))
Service “macp1″ has 1 instance(s).
Instance “MAC”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:ready
LOCAL SERVER
Service “macp2″ has 1 instance(s).
Instance “MAC”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully
可以看到MACP1这个PLUGGABLE DATABASE OPEN的情况下是有INSTANCE READY可用的,尝试连接,首先连接CDB$ROOT
可以通过SQLPLUS的SHOW CON_ID或者CON_NAME来获得当前的CONTAINER信息
也可以通过sys_context(‘userenv’,'CON_NAME’) 、sys_context(‘userenv’,'CON_ID’)来获得
SQL> SELECT sys_context(‘userenv’,'CON_NAME’) from dual;
SYS_CONTEXT(‘USERENV’,'CON_NAME’)
——————————————————————————–
CDB$ROOT
SQL> SELECT sys_context(‘userenv’,'CON_ID’) from dual;
SYS_CONTEXT(‘USERENV’,'CON_ID’)
——————————————————————————–
1
SQL> show CON_ID
CON_ID
——————————
1
SQL> show CON_NAME
CON_NAME
——————————
CDB$ROOT
oracle@localhost:~$ sqlplus sys/oracle@localhost:1521/MAC as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 13 10:42:34 2013
Copyright (c) 1982, 2013, 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> SHOW CON_id
CON_ID
——————————
1
SQL> show con_name
CON_NAME
——————————
CDB$ROOT
SQL> select name from v$pdbs;
NAME
——————————
PDB$SEED
MACP1
MACP2
SQL> SELECT PROGRAM,CON_ID FROM V$SESSION
PROGRAM CON_ID
———————————————— ———-
oracle@localhost.localdomain (PMON) 0
oracle@localhost.localdomain (PSP0) 0
oracle@localhost.localdomain (VKTM) 0
oracle@localhost.localdomain (GEN0) 0
oracle@localhost.localdomain (MMAN) 0
oracle@localhost.localdomain (RECO) 0
oracle@localhost.localdomain (DIAG) 0
oracle@localhost.localdomain (DBRM) 0
oracle@localhost.localdomain (DIA0) 0
oracle@localhost.localdomain (DBW0) 0
oracle@localhost.localdomain (LGWR) 0
oracle@localhost.localdomain (CKPT) 0
oracle@localhost.localdomain (SMON) 0
oracle@localhost.localdomain (LREG) 0
oracle@localhost.localdomain (MMON) 0
oracle@localhost.localdomain (MMNL) 0
oracle@localhost.localdomain (CJQ0) 0
oracle@localhost.localdomain (TMON) 0
oracle@localhost.localdomain (TT00) 0
oracle@localhost.localdomain (SMCO) 0
oracle@localhost.localdomain (AQPC) 0
oracle@localhost.localdomain (W000) 0
sqlplus@localhost.localdomain (TNS V1-V3) 1
oracle@localhost.localdomain (QM02) 0
oracle@localhost.localdomain (Q002) 0
oracle@localhost.localdomain (Q003) 0
oracle@localhost.localdomain (VKRM) 0
27 rows selected.
SQL> select count(*) from tab$;
COUNT(*)
———-
2372
SQL> select count(*) from dba_tables;
COUNT(*)
———-
2325
SQL>select count(*) from cdb_tables;
COUNT(*)
———-
6957
ALTER SESSION 将当前容器设置为MACP1
SQL> alter session set container=MACP1;
Session altered.
SQL> show con_id
CON_ID
——————————
3
SQL> show con_name
CON_NAME
——————————
MACP1
SQL> select name from v$pdbs;
NAME
——————————
MACP1
SQL> select name from v$database;
NAME
———
MAC
SQL> SELECT PROGRAM,CON_ID FROM V$SESSION where CON_ID!=0;
PROGRAM CON_ID
———————————————— ———-
sqlplus@localhost.localdomain (TNS V1-V3) 3
而此时若实际使用CDB$ROOT去查 V$SESSION则可以发现:
SQL> SELECT PROGRAM,CON_ID FROM V$SESSION where CON_ID!=0;
PROGRAM CON_ID
———————————————— ———-
sqlplus@localhost.localdomain (TNS V1-V3) 3
sqlplus@localhost.localdomain (TNS V1-V3) 1
可以看出CDB/Pluggable Database对于V$视图的设计是可以让用户察觉到这是一个Pluggable Database,但不能让用户了解到非本地的其他Pluggable Database的运行情况。
通过X$CON内部视图可以看到 ,PDB的这种V$视图的只能观察本Container信息的实现是通过X$视图底层实现的。
SQL> show con_name
CON_NAME
——————————
MACP1
SQL> select name from x$CON;
NAME
——————————
MACP1
SQL> show con_name
CON_NAME
——————————
CDB$ROOT
SQL> select name from x$CON;
NAME
——————————
CDB$ROOT
PDB$SEED
MACP1
MACP2
SQL> select count(*) from tab$;
COUNT(*)
———-
2363
SQL> select count(*) from dba_tables;
COUNT(*)
———-
2316
SQL> select count(*) from cdb_tables;
COUNT(*)
———-
2316
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
oracle@localhost:~$ sqlplus sys/oracle@localhost:1521/MACP1 as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 13 10:44:41 2013
Copyright (c) 1982, 2013, 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> show con_name
CON_NAME
——————————
MACP1
SQL> show con_id
CON_ID
——————————
3
oracle@localhost:~$ sqlplus sys/oracle@localhost:1521/MACP2 as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 13 11:01:32 2013
Copyright (c) 1982, 2013, 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> show con_id
CON_ID
——————————
4
SQL> show con_name
CON_NAME
——————————
MACP2
SQL> select count(*) from tab;
select count(*) from tab
*
ERROR at line 1:
ORA-01219: database or pluggable database not open: queries allowed on fixed
tables or views only
oracle@localhost:~$ oerr ora 1219
01219, 00000, “database or pluggable database not open: queries allowed on fixed tables or views only”
// *Cause: A query was issued against an object not recognized as a fixed
// table or fixed view before the database or pluggable database has
// been opened.
// *Action: Re-phrase the query to include only fixed objects, or open the
// database or pluggable database.
由于MACP2 这个Container由于尚未OPEN所以无法查表,遇到了ORA-1219错误
oracle@localhost:~$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 13 11:03:02 2013
Copyright (c) 1982, 2013, 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 name, con_id from v$services;
NAME CON_ID
—————————————————————- ———-
macp2 4
macp1 3
MACXDB 1
MAC 1
SYS$BACKGROUND 1
SYS$USERS 1
6 rows selected.
视图cdb_pdbs也记录了PDB的信息
SQL> desc cdb_pdbs
Name Null? Type
—————————————– ——– —————————-
PDB_ID NOT NULL NUMBER
PDB_NAME NOT NULL VARCHAR2(128)
DBID NOT NULL NUMBER
CON_UID NOT NULL NUMBER
GUID RAW(16)
STATUS VARCHAR2(13)
CREATION_SCN NUMBER
CON_ID NUMBER
SQL> col PDB_NAME format a8
SQL> col CON_ID format 999999
SQL> select PDB_ID, PDB_NAME, DBID, GUID, CON_ID from cdb_pdbs;
PDB_ID PDB_NAME DBID GUID CON_ID
———- ——– ———- ——————————– ——-
3 MACP1 1965483069 E060EC0DEFDA2A4CE0430100007FADFA 1
2 PDB$SEED 4062078151 E060D99341542648E0430100007F6B20 1
4 MACP2 1550789943 E060EF86B0C22ABFE0430100007F6F3C 1
SQL> select text from dba_VIEWS where view_name=’CDB_PDBS’;
TEXT
——————————————————————————–
SELECT “PDB_ID”,”PDB_NAME”,”DBID”,”CON_UID”,”GUID”,”STATUS”,”CREATION_SCN”,”CON_
ID” FROM CDB$VIEW(“SYS”.”DBA_PDBS”)
SQL> select text from dba_VIEWS where view_name=’DBA_PDBS’;
TEXT
——————————————————————————–
select c.con_id#, o.name, c.dbid, c.con_uid, o.oid$,
decode(c.status, 0, ‘UNUSABLE’, 1, ‘NEW’, 2, ‘NORMAL’, 3, ‘UNPLUGGED’, 4, ‘NEED
S SYNC’,
5, ‘NEEDS UPGRADE’, 6, ‘CONVERTING’, ‘UNDEFINED’),
c.create_scnwrp*power(2,32)+c.create_scnbas
from sys.container$ c, sys.obj$ o
where o.obj# = c.obj# and c.con_id# > 1
CDB_PDBS的数据来源于CDB$VIEW(“SYS”.”DBA_PDBS”),而DBA_PDBS的数据来源于字典对象container$, CONTAINER$的基表存放在 $ORACLE_HOME/rdbms/admin/dcore.bsq中
create table container$
(
obj# number not null, /* Object number for the container */
con_id# number not null, /* container ID */
dbid number not null, /* database ID */
con_uid number not null, /* unique ID */
status number not null, /* active, plugged…*/
create_scnwrp number not null, /* creation scn wrap */
create_scnbas number not null, /* creation scn base */
clnscnwrp number, /* clean offline scn – zero if not offline clean */
clnscnbas number, /* clnscnbas – scn base, clnscnwrp – scn wrap */
rdba number not null, /* r-dba of the container */
flags number, /* flags */
spare1 number, /* spare */
spare2 number, /* spare */
spare3 varchar2(“M_IDEN”), /* spare */
spare4 varchar2(“M_IDEN”) /* spare */
)
/
CREATE UNIQUE INDEX i_container1 ON container$(obj#)
/
CREATE UNIQUE INDEX i_container2 ON container$(con_id#)
/
CREATE UNIQUE INDEX i_container3 ON container$(con_uid)
/
CREATE UNIQUE INDEX i_container3 ON container$(con_uid)
/
create table cdb_file$ /* file table in a consolidated db */
(
file# number not null, /* file identifier number */
con_id# number not null, /* container ID */
mtime date, /* time it was created, modified */
spare1 number, /* spare */
spare2 number, /* spare */
spare3 number, /* spare */
spare4 number, /* spare */
f_afn number not null, /* foreign absolute file number */
f_dbid number not null, /* foreign database id */
f_cpswrp number not null, /* foreign checkpoint scn */
f_cpsbas number not null,
f_prlswrp number not null, /* foreign plugin resetlogs scn */
f_prlsbas number not null,
f_prlstim number not null /* foreign plugin resetlogs time */
)
/
CREATE UNIQUE INDEX i_cdbfile1 ON cdb_file$(file#, con_id#)
REM to provide PDB lineage information.
create table pdb_history$
(
name varchar2(“M_IDEN”) not null, /* Name of the PDB */
con_id# number not null, /* Container ID */
dbid number not null, /* DBID of PDB */
guid raw(16) not null, /* GUID of PDB */
scnbas number not null, /* SCN base when operation occured */
scnwrp number not null, /* SCN wrap when operation occured */
time date not null, /* time when operation occured */
operation varchar2(16) not null, /* CREATE, CLONE, UNPLUG, PLUG, RENAME */
db_version number not null, /* Database version */
c_pdb_name varchar2(“M_IDEN”), /* Created, Cloned from PDB name */
c_pdb_dbid number, /* Created, Cloned from PDB DBID */
c_pdb_guid raw(16), /* Created, Cloned from PDB GUID */
c_db_name varchar2(“M_IDEN_128″), /* Created, Cloned in DB name */
c_db_uname varchar2(“M_IDEN”), /* Created, Cloned in DB unique name */
c_db_dbid number, /* Created, Cloned in DBID */
clonetag varchar2(128), /* Clone tag name */
spare1 number, /* spare */
spare2 number, /* spare */
spare3 varchar2(“M_IDEN”), /* spare */
spare4 varchar2(“M_IDEN”) /* spare */
)
/
SQL> create table container_backup as select * from sys.container$;
Table created.
SQL> truncate table sys.container$;
Table truncated.
SQL> select PDB_ID, PDB_NAME, DBID, GUID, CON_ID from cdb_pdbs;
no rows selected
虽然目前container$字典基表仍不算BOOTSTRAP对象,但是该基表的数据讹误仍导致无法OPEN CDB$ROOT
SQL> create table container_backup as select * from sys.container$;
Table created.
Insert into sys.container$ select * from container_backup;
SQL> truncate table sys.container$;
Table truncated.
SQL> select PDB_ID, PDB_NAME, DBID, GUID, CON_ID from cdb_pdbs;
no rows selected
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2293880 bytes
Variable Size 562040712 bytes
Database Buffers 268435456 bytes
Redo Buffers 2334720 bytes
Database mounted.
SQL> show con_name
CON_NAME
——————————
CDB$ROOT
SQL> alter database open ;
alter database open
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [kpdbLoadCbk-bad-obj#], [185], [],
[], [], [], [], [], [], [], [], []
Process ID: 6250
Session ID: 1 Serial number: 5
Recovery sets nab of thread 1 seq 33 to 88 with 8 zeroblks
Count of ofsmtab$: 0 entries
07/13/2013 11:16:12 07/13/2013 11:16:122013-07-13 11:16:12.705: [ OCRMSG]prom_waitconnect: CONN NOT ESTABLISHED (0,29,1,2)
2013-07-13 11:16:12.705: [ OCRMSG]GIPC error [29] msg [gipcretConnectionRefused]
2013-07-13 11:16:12.705: [ OCRMSG]prom_connect: error while waiting for connection complete [24]
2013-07-13 11:16:12.706: [ OCRMSG]prom_waitconnect: CONN NOT ESTABLISHED (0,29,1,2)
2013-07-13 11:16:12.706: [ OCRMSG]GIPC error [29] msg [gipcretConnectionRefused]
2013-07-13 11:16:12.706: [ OCRMSG]prom_connect: error while waiting for connection complete [24]
2013-07-13 11:16:12.708: [ OCRMSG]prom_waitconnect: CONN NOT ESTABLISHED (0,29,1,2)
2013-07-13 11:16:12.708: [ OCRMSG]GIPC error [29] msg [gipcretConnectionRefused]
2013-07-13 11:16:12.708: [ OCRMSG]prom_connect: error while waiting for connection complete [24]
2013-07-13 11:16:12.709: [ OCRMSG]prom_waitconnect: CONN NOT ESTABLISHED (0,29,1,2)
2013-07-13 11:16:12.709: [ OCRMSG]GIPC error [29] msg [gipcretConnectionRefused]
2013-07-13 11:16:12.709: [ OCRMSG]prom_connect: error while waiting for connection complete [24]
*** 2013-07-13 11:16:12.969
Incident 31361 created, dump file: /u01/app/oracle/diag/rdbms/mac/MAC/incident/incdir_31361/MAC_ora_6250_i31361.trc
ORA-00600: internal error code, arguments: [kpdbLoadCbk-bad-obj#], [185], [], [], [], [], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [kpdbLoadCbk-bad-obj#], [185], [], [], [], [], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [kpdbLoadCbk-bad-obj#], [185], [], [], [], [], [], [], [], [], [], []
Stack call:
kpdbLockPdbSwitch=> kglget=> kglLock=> kgllkal=> kglLoadOnLock=> kpdbLoadCbk=>报错
可以看到内核新增了一个MODULE名字叫 KPDB
|