Best Features of Oracle Mul0tenant -...

35
Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay, Argen<na, Perú, Guatemala, Colombia

Transcript of Best Features of Oracle Mul0tenant -...

Page 1: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

BestFeaturesofOracleMul0tenantByDeibyGómez

OTNTour2016Uruguay,Argen<na,Perú,Guatemala,Colombia

Page 2: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

DEIBYGOMEZ•  OracleACE-Youngestintheworld.•  OracleACEDirector-Youngestintheworld2015•  PresidentedelGrupodeUsuariosdeOracledeGuatemala•  Speaker

–  OTN’13,‘14,’15,’16–  OracleOpenWorldUSA,Brasil–  Collaborate,LasVegas,USA

•  DirectorofSupportQualityenLAOUC(La8nAmericanOracleUsersGroupCommunity)

•  Co-fundadordeOraWorldTeam(Suiza,India,Brasil,Francia,Guatemala)

•  OracleCer<fiedMaster11g(OCM11g)–YoungestinLa8nAmerica•  OracleCer<fiedMaster12c(OCM12c)–YoungestinLa8nAmerica

•  SELECTJournalEditor’sChoiceAward2016(LasVegas,IOUG)

Page 3: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

DEIBYGOMEZ

Autores•  AntonEls(NuevaZelanda)•  VitSpinka(RepublicaCheca)•  FranckPachot(Suiza)

RevisoresTécnicos:•  DeibyGómez(Guatemala)•  ArupNanda(India)

Pre-orderinAmazon!

Page 4: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

NUVOLA,S.A.•  Experienciadelequipo:

–  OracleLinuxCer<fiedImplementa<onSpecialist–  OracleDatabase11gAdministratorCer<fiedProfessional(OCP11g)–  OracleDatabase11gAdministratorCer<fiedMaster(OCM11g)–  OracleDatabase12cAdministratorCer<fiedProfessional(OCP12c)–  OracleServiceOrientedArchitectureInfrastructureImplementa<onCer<fied

Expert–  OracleCer<fiedExpert,OracleExadataX3andX4Administrator–  OracleRAC11gandGridInfraestructureAdministrator–  OracleRealApplica<onClusters12cCer<fiedImplementa<onSpecialist–  OracleDatabase12cAdministratorCer<fiedMaster(OCM12c)

•  SoporteyConsultoría:–  BasesdeDatosOracle.–  Exadata–  Middleware

•  CursosdeAdministracióndeOracle

www.nuvolacg.com

Page 5: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

FullDatabaseCaching

DBsize>BufferCacheLiUletables:

•  AllocatedinmemoryIfthetablesize<2%oftheBufferCachesize

Mediumtables:•  Allocatedinmemoryiftablesize[2%,10%]ofBufferCachesize(No

officialinforma<on)•  Oracleanalyzethedatewhenthetablewasusedlast<me•  FreespaceinBufferCache•  Etc

BigTables•  BigtablesarenotallocatedinBufferCache•  Use"KEEP”toadviceOracletoallocateabigtableinBufferCache

Page 6: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

FullDatabaseCaching

BufferCache>DBsizeLiUletables:

•  AllocatedinmemoryIfthetablesize<2%oftheBufferCachesize

Mediumtables:•  Allocatedinmemoryiftablesize[2%,10%]ofBufferCachesize(No

officialinforma<on)•  Oracleanalyzethedatewhenthetablewasusedlast<me•  FreespaceinBufferCache•  Etc

BigTables•  BigtablesarenotallocatedinBufferCache•  Use"KEEP”toadviceOracletoallocateabigtableinBufferCache

Page 7: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

FullDatabaseCaching

BufferCache>DBsize•  TablesarenotallocatedinBufferCacheimmediately•  BufferCachemustbebiggerthanDB(Oracledoesn’tverifythis)

IsFullDatabaseCachingenabled?SQL> SELECT FORCE_FULL_DB_CACHING FROM V$DATABASE; FORCE_FULL_DB_CACHING --------------------- YES

Page 8: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

FullDatabaseCaching

BufferCache !>DBsize

WhataboutifIenableitbutBufferCache!>DBSize?•  Algorithmstoallocatesmall,mediumandlargetablesarenotused.

•  MoreObjectsDealloca<on•  Newobjectscanned,blocksdeallocated.

Page 9: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

FullDatabaseCaching

How to enabled it?

SQL> shutdown immediate; SQL> startup mount; SQL> ALTER DATABASE FORCE FULL DATABASE CACHING; SQL> alter database open;

How to disable it?

SQL> shutdown immediate;. SQL> startup ; SQL> ALTER DATABASE NO FORCE FULL DATABASE CACHING; SQL> alter database open;

Page 10: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

Automa0cBigTableCaching

•  Bigtablecacheisusedforcachingdatafortablescans.•  Automa<cbigtablecachingusestemperatureandobjectbasedalgorithmstotrackmediumandbigtables.

Howtoenableit?•  DB_BIG_TABLE_CACHE_PERCENT_TARGET

o  percentage[0%,90%]o  10%ofcacheforNotablescans

•  SetPARALLEL_DEGREE_POLICYforRAC

Page 11: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

Instance2

Automa0cBigTableCachingIfalargetableisapproximatelythesizeofthecombinedsizeofthebigtablecacheofallinstances,thenthetableispar<<onedandcached,ormostlycached,onallinstances.Wheretocheckinforma0onaboutbigtablecaching?•  V$BT_SCAN_CACHE•  V$BT_SCAN_OBJ_TEMPS

Instance1

Page 12: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

ZoneMaps

SimilaraStorageIndexesEnOracleExadataperoenDisco

DisponiblesoloenExadata

Page 13: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBCONTAINERSClauseSELECT ename FROM CONTAINERS(scott.emp) WHERE CON_ID IN (11, 13);

Page 14: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBCONTAINERSClauseØ Thetablesandviews,orsynonymsofthem,specifiedintheCONTAINERSclausemustexistintherootandinallPDBs.

Ø EachtableandviewspecifiedintheCONTAINERSclausemustbeownedbythecommonuser.

§  WhenasynonymisspecifiedintheCONTAINERSclause,thesynonymmustresolvetoatableoraviewownedbythecommonuserissuingthestatement.

Page 15: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBFilePlacementinOMF

•  FILE_NAME_CONVERTclauseofCREATEPLUGGABLEDATABASE

•  CREATE_FILE_DESTclauseofCREATEPLUGGABLEDATABASE

•  DB_CREATE_FILE_DEST(rootlevel)

•  PDB_FILE_NAME_CONVERTini<aliza<onparameter

Page 16: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBLoggingClause

•  TableLevel–Logging

•  IndexLevel–Logging

•  TablespaceLevel–Logging

•  TablespaceLevel-ForceLogging

•  PDBLevel–Logging

•  PDBLevel-ForceNologging

•  CDB-ForceLogging

Page 17: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBLoggingClause

SQL> alter session set container=pdb1; SQL> startup restrict; SQL> alter pluggable database pdb1 nologging; SQL> alter pluggable database pdb1 logging; SQL> select pdb_name, logging, force_logging, force_nologging from cdb_pdbs; PDB_NAME LOGGING FORCE_LOGGING FORCE_NOLOGGING ---------- --------- --------------- --------------- PDB1 LOGGING NO NO

Page 18: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBMetadataClone

NODATAclauseoftheCREATEPLUGGABLEDATABASE

“Thisclauseisusefulforquicklycrea8ngclonesofaPDBwithonlytheobjectdefini8onsandnodata.”

Page 19: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBRemoteClone

INSOURCEDB: **alter pluggable database pdbsource open read only; create user C##dgomez identified by manager1; grant create session to C##dgomez;

Page 20: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBRemoteCloneINTARGETDB: create user C##dgomez identified by manager1; grant create session, create database link, create pluggable database to C##dgomez;

PDBSOURCE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = db12102.oraworld.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = pdbsource) ))

create database link dblinktosource connect to C##dgomez identified by manager1 using 'PDBSOURCE'; create pluggable database pdbtarget3 from pdbsource@dblinktosource;

Page 21: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBRemoteClone

Target:12.1.0.2Source:12.1.0.1

SQL> create pluggable database pdbtarget from pdbsource@dblinktosource; * ERROR at line 1: ORA-17627: ORA-00600: internal error code, arguments: [ksrpcsexec_1], [158], [20], [], [], [], [], [], [], [], [], [] ORA-17627: ORA-00600: internal error code, arguments: [ksrpcsexec_1], [158], [20], [], [], [], [], [], [], [], [], []

Page 22: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBRemoteClone

Target:12.1.0.1Source:12.1.0.1

SQL> create pluggable database pdbtarget from sourcepdb@dblinktosource * ERROR at line 1: ORA-17628: Oracle error 19505 returned by remote Oracle server ORA-19505: failed to identify file ""

Page 23: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBRemoteClone

Target:12.1.0.2Source:12.1.0.2

SQL> create pluggable database pdbtarget from pdbsource@dblinktosource; Pluggable database created.

Page 24: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBCloningflavors

Page 25: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

CreatePDBfromNon-CDB

@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

•  NOCOPY•  COPY•  MOVE

CREATEPLUGGABLEDATABASEsalespdbUSING'/disk1/usr/salespdb.xml'NOCOPY;

DBMS_PDB.DESCRIBE

noncdb_to_pdb.sqlnotre-runable!

Page 26: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBSTANDBYSClause

PDB1

PDB2

PDB3

PDB1

PDB2

PDB3

Primary Standby

•  DatafilesOffline•  Unnamed

Page 27: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBSTANDBYSClause

“TheSTANDBYSclauseoftheCREATEPLUGGABLEDATABASEstatementspecifieswhetherthenewPDBis

includedinstandbyCDBs”Ø  STANDBYS=ALLincludesthenewPDBinallofthestandbyCDBs.Ø  STANDBYS=NONEexcludesthenewPDBfromallofthestandbyCDBs.

Page 28: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBSTANDBYSClause

“ItispossibletoenableaPDBonastandbyCDBaXeritwasexcludedonthatstandbyCDB.”

Ø  PDBdatafilesneedtobecopiedtothestandbydatabasefromtheprimarydatabase

Ø  ThecontrolfileneedstobeupdatedtoreflecttheirpathsØ  ExecuteALTER PLUGGABLE DATABASE ENABLE RECOVERY

u  Itautoma<callyonlinesallofthedatafilesbelongingtothePDB.

Page 29: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBStateManagementAcrossCDBRestart

Source:"OracleDatabase12c:NewFeaturesforAdministrators”byOracleUniversity

12.1.0.1

Page 30: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBStateManagementAcrossCDBRestart

1.  SetthePDBattheStateyouwanttosave.2.  SQL> alter pluggable database pdb1 save state;

Pluggable database altered. or SQL> alter pluggable database pdb1 discard state; Pluggable database altered.

12.1.0.2

Page 31: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBStateManagementAcrossCDBRestart

SQL> ALTER PLUGGABLE DATABASE ALL EXCEPT PDB1 SAVE STATE; Pluggable database altered. SQL> ALTER PLUGGABLE DATABASE ALL SAVE STATE; Pluggable database altered.

12.1.0.2

Page 32: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBSubsetCloning

“TheUSER_TABLESPACESclauseoftheCREATEPLUGGABLEDATABASEstatementspecifieswhichtablespacesareavailable

inthenewPDB”o  Listoneormoretablespacestoinclude.

o  SpecifyALL,thedefault,toincludeallofthetablespaces.

o  SpecifyALLEXCEPTtoincludeallofthetablespaces,exceptforthetablespaceslisted.

o  SpecifyNONEtoexcludeallofthetablespaces.

Page 33: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

PDBSubsetCloning

DatabaseSourceTablespace1

Tablespace2

Tablespace3

PDB1Tablespace1

PDB2Tablespace2

PDB3Tablespace3

Page 34: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

DuplicatewithBackupsets

RMAN> DUPLICATE TARGET DATABASE TO 'DB2' FROM ACTIVE DATABASE USING BACKUPSET;

RMAN> DUPLICATE TARGET DATABASE TO 'DB2' FROM ACTIVE DATABASE USING COMPRESSED BACKUPSET;

Page 35: Best Features of Oracle Mul0tenant - PEOUGpeoug.org/icontact/presentations/otntour2016/DeibyGomez-Multiten… · Best Features of Oracle Mul0tenant By Deiby Gómez OTN Tour 2016 Uruguay,

DeibyGó[email protected]

Twi{er:@hdeibywww.nuvolacg.com