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

Håndtering af CDB Fleet i Oracle Database 18c

Oracle Database 18c introducerer CDB-flådekonceptet, som er en samling af forskellige CDB'er, der kan administreres som én logisk CDB.

Denne funktion er i øjeblikket begrænset til Enterprise Edition på Engineered Systems, såsom Exadata, og Enterprise Edition på Oracle Database Cloud Services.

Der er to mulige roller i en flåde:LEAD_CDB og MEMBER_CDB . LEAD_CDB kan defineres ved at indstille egenskaben LEAD_CDB som "TRUE". Alle andre CDB'er i flåden ville fungere som MEMBER_CDB'er.

I eksemplet nedenfor har to CDB'er og PDB'er i sig.

cdbvert011 :Containerdatabase med pluggbare databaser PDBDP, PDBDW, PDBMV, PDBSWD og PDBADDADOS. Dette vil være flåden førende.
cdbhor011 :Containerdatabase med pluggbar database PDBWEBDW1.

Pluggbare databaser i containerdatabase 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 database i containerdatabase 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


Konfigurer 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

Tildel de relevante privilegier til den almindelige bruger i CDB-leddet:


sql> grant sysoper to system CONTAINER=ALL;

Grant succeeded.

Opret databaselinket og indstil som medlem af flåden:


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


Tilslut på CDBVERT011 og skriv alle PDB'er. STUB-værdien i STATUS-kolonnen definerer CDB'en og dens PDB'er som medlemmer af flåden. Når du har konfigureret CDB-flåden, synkroniseres PDB-oplysninger fra de forskellige CDB-medlemmer, inklusive CDB-medlemmet, med lead-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.

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

Deaktiver CDB-medlemmet:


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.

Referencer

Administration af en CDB-flåde. Tilgængelig på https://docs.oracle.com/en/database/oracle/oracle-database/18/multi/administering-cdb-fleet.html#GUID-0AA7FC65-F350-473B-96D2-976313514069


  1. Oracle:Dage mellem to dato og Ekskluder hverdage hvordan man håndterer negative tal

  2. Problemsæt 1 – Identifikation af enheder

  3. Returner primære nøgler fra en sammenkædet server i SQL Server (T-SQL-eksempler)

  4. Sådan rangeres rækker i en partition i SQL