sql >> Databasteknik >  >> RDS >> Oracle

Hantera CDB Fleet i Oracle Database 18c

Oracle Database 18c introducerar CDB-flottans koncept som är en samling av olika CDB:er som kan hanteras som en logisk CDB.

Den här funktionen är för närvarande begränsad till Enterprise Edition på Engineered Systems, som Exadata, och Enterprise Edition på Oracle Database Cloud Services.

Det finns två möjliga roller i en flotta:LEAD_CDB och MEMBER_CDB . LEAD_CDB kan definieras genom att ställa in egenskapen LEAD_CDB som "TRUE". Alla andra CDBs i flottan skulle fungera som MEMBER_CDBs.

I exemplet nedan finns två CDB:er och PDB:er.

cdbvert011 :Containerdatabas med pluggbara databaser PDBDP, PDBDW, PDBMV, PDBSWD och PDBADDADOS. Detta kommer att vara ledningen för flottan.
cdbhor011 :Containerdatabas med pluggbar databas PDBWEBDW1.

Pluggbara databaser i Container Database cdbvert011 :


$ export ORACLE_SID=cdbvert011
$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Wed May 27 08:36:16 2020
Version 18.2.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.2.0.0.0

sql> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBDP READ WRITE NO
4 PDBDW READ WRITE NO
5 PDBMV READ WRITE NO
6 PDBSWD READ WRITE NO
7 PDBADDADOS READ WRITE NO

Pluggbar databas i containerdatabas cdbhor011:


$ export ORACLE_SID=cdbhor011
$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Wed May 27 08:36:16 2020
Version 18.2.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.2.0.0.0

sql> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBWEBDW1 READ WRITE NO


Konfigurera CDBVERT011 som LEAD CDB:


sql> select property_value from database_properties where property_name='LEAD_CDB';

no rows selected

sql> alter database set lead_cdb=TRUE;

Database altered.

sql> select property_value from database_properties where property_name='LEAD_CDB';

PROPERTY_VALUE
------------------------------
TRUE

Bevilja lämpliga privilegier till den vanliga användaren i CDB-ledningen:


sql> grant sysoper to system CONTAINER=ALL;

Grant succeeded.

Skapa databaslänken och ställ in som medlem av flottan:


Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.2.0.0.0

sql> select property_value from database_properties where property_name='LEAD_CDB_URI';

no rows selected

sql> create database link dblink_lead connect to system identified by password using 'CDBVERT011';

Database link created.

sql> alter database set LEAD_CDB_URI='dblink:dblink_lead';

Database altered.

sql> select property_value from database_properties where property_name='LEAD_CDB_URI';

PROPERTY_VALUE
--------------------------------------------------------------------------------
dblink:dblink_lead


Anslut på CDBVERT011 och lista alla PDB:er. STUB-värdet i STATUS-kolumnen definierar CDB och dess PDB som medlemmar i flottan. När du har konfigurerat CDB-flottan synkroniseras PDB-information från de olika CDB-medlemmarna inklusive CDB-medlemmen med huvud-CDB.


$ export ORACLE_SID=cdbvert011
$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Wed May 27 08:36:16 2020
Version 18.2.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.2.0.0.0

sql> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBDP READ WRITE NO
4 PDBDW READ WRITE NO
5 PDBMV READ WRITE NO
6 PDBSWD READ WRITE NO
7 PDBADDADOS READ WRITE NO
9 PDBWEBDW1 MOUNTED

sql> select pdb_id, pdb_name, status, is_proxy_pdb from dba_pdbs;

PDB_ID PDB_NAME STATUS IS_PROXY_
------- -------- ------ ----------
3 PDBDP NORMAL NO
2 PDB$SEED NORMAL NO
4 PDBDW NORMAL NO
5 PDBMV NORMAL NO
6 PDBSWD NORMAL NO
7 PDBADDADOS NORMAL NO
8 CDBHOR011 STUB YES
9 PDBWEBDW1 STUB YES

8 rows selected.

Inaktivera CDB-avledning:


sql> ALTER DATABASE SET LEAD_CDB = false;
Database altered. 

sql> select pdb_id, pdb_name, status, is_proxy_pdb from dba_pdbs;

PDB_ID PDB_NAME STATUS IS_PROXY_
------- -------- ------ ----------
3 PDBDP NORMAL NO
2 PDB$SEED NORMAL NO
4 PDBDW NORMAL NO
5 PDBMV NORMAL NO
6 PDBSWD NORMAL NO
7 PDBADDADOS NORMAL NO

6 rows selected.

Inaktivera CDB-medlemmen:


sql> alter database set lead_cdb_uri='';

Database altered.

sql> select pdb_id, pdb_name, status, is_proxy_pdb from dba_pdbs;

PDB_ID PDB_NAME STATUS IS_PROXY_
------- -------- ------ ----------
3 PDBWEBDW1 NORMAL NO
2 PDB$SEED NORMAL NO

sql> drop database link dblink_lead;

Database link dropped.

Referenser

Administrera en CDB-flotta. Tillgänglig på https://docs.oracle.com/en/database/oracle/oracle-database/18/multi/administering-cdb-fleet.html#GUID-0AA7FC65-F350-473B-96D2-976313514069


  1. GROUP BY + CASE uttalande

  2. Anropar en lagrad PROCEDUR i Toad

  3. mySQL DataSource på Visual Studio 2012

  4. Knee-Jerk Wait Statistik :CXPACKET