Oracle
 sql >> Database >  >> RDS >> Oracle

Gestione della flotta CDB in Oracle Database 18c

Oracle Database 18c introduce il concetto di flotta CDB che è una raccolta di diversi CDB che possono essere gestiti come un unico CDB logico.

Questa funzionalità è attualmente limitata a Enterprise Edition su Engineered Systems, come Exadata, ed Enterprise Edition su Oracle Database Cloud Services.

Esistono due ruoli possibili in una flotta:LEAD_CDB e MEMBER_CDB . Il LEAD_CDB può essere definito impostando la proprietà LEAD_CDB come "TRUE". Tutti gli altri CDB della flotta agiranno come MEMBER_CDB.

Nell'esempio seguente sono presenti due CDB e PDB.

cdbvert011 :Database container con database pluggable PDBDP, PDBDW, PDBMV, PDBSWD e PDBADDADOS. Questo sarà il leader della flotta.
cdbhor011 :Database container con database collegabile PDBWEBDW1.

Database Pluggables nel database contenitore 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

Database collegabile nel database contenitore 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


Configura CDBVERT011 come 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

Concedi i privilegi appropriati all'utente comune nel lead CDB:


sql> grant sysoper to system CONTAINER=ALL;

Grant succeeded.

Crea il collegamento al database e impostalo come membro della flotta:


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


Collegati su CDBVERT011 ed elenca tutti i PDB. Il valore STUB nella colonna STATUS definisce il CDB ei relativi PDB come membri del parco istanze. Dopo aver configurato la flotta CDB, le informazioni PDB dai vari membri CDB, incluso il membro CDB, vengono sincronizzate con il CDB principale.


$ 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.

Disabilita il CDB Lead:


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.

Disabilita il membro CDB:


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.

Riferimenti

Amministrazione di una flotta CDB. Disponibile su https://docs.oracle.com/en/database/oracle/oracle-database/18/multi/administering-cdb-fleet.html#GUID-0AA7FC65-F350-473B-96D2-976313514069