ORACLE 12c新特性 可插拔
- 格式:doc
- 大小:557.58 KB
- 文档页数:16
Oracle 12C引入了CDB与PDB的新特性,在ORACLE 12C数据库引入的多租用户环境(Multitenant Environment)中,允许一个数据库容器(CDB)承载多个可插拔数据库(PDB)。
CDB全称为Container Database,中文翻译为数据库容器,PDB全称为Pluggable Database,即可插拔数据库。
在ORACLE 12C之前,实例与数据库是一对一或多对一关系(RAC):即一个实例只能与一个数据库相关联,数据库可以被多个实例所加载。
而实例与数据库不可能是一对多的关系。
当进入ORACLE 12C后,实例与数据库可以是一对多的关系。
下面是官方文档关于CDB与PDB的关系图。
其实大家如果对SQL SERVER比较熟悉的话,这种CDB与PDB是不是感觉和SQL SERVER的单实例多数据库架构是一回事呢。
像PDB$SEED可以看成是master、msdb等系统数据库,PDBS可以看成用户创建的数据库。
而可插拔的概念与SQL SERVER中的用户数据库的分离、附加其实就是那么一回事。
看来ORACLE也“抄袭”了一把SQL SERVER 的概念,只是改头换面的包装了一番。
CDB组件(Components of a CDB)一个CDB数据库容器包含了下面一些组件:ROOT组件ROOT又叫CDB$ROOT, 存储着ORACLE提供的元数据和Common User,元数据的一个例子是ORACLE提供的PL/SQL包的源代码,Common User 是指在每个容器中都存在的用户。
SEED组件Seed又叫PDB$SEED,这个是你创建PDBS数据库的模板,你不能在Seed中添加或修改一个对象。
一个CDB中有且只能有一个Seed. 这个感念,个人感觉非常类似SQL SERVER中的model数据库。
PDBSCDB中可以有一个或多个PDBS,PDBS向后兼容,可以像以前在数据库中那样操作PDBS,这里指大多数常规操作。
oracle12c的CDB与PDBoracle12c的CDB与PDBoracle12c的新特性Oracle 12C引⼊了CDB与PDB的新特性,在ORACLE 12C数据库引⼊的多租⽤户环境(Multitenant Environment)中,允许⼀个数据库容器(CDB)承载多个可插拔数据库(PDB)。
CDB全称为Container Database,中⽂翻译为数据库容器,PDB全称为Pluggable Database,即可插拔数据库。
在ORACLE 12C之前,实例与数据库是⼀对⼀或多对⼀关系(RAC):即⼀个实例只能与⼀个数据库相关联,数据库可以被多个实例所加载。
⽽实例与数据库不可能是⼀对多的关系。
当进⼊ORACLE 12C后,实例与数据库可以是⼀对多的关系。
下⾯是官⽅⽂档关于CDB与PDB的关系图。
cdb相当于操作系统,调⽤并管理各个pdb。
pdb相当于真正提供业务需求的数据库实例。
oracle 12c安装后只创建了cdb,需要⾃⼰⽣成相应的pdb。
oracle 12c使⽤了CDB-PDB架构,类似于docker,在container-db内可以加载多个pluggable-db.安装成功后修改tnsnames.ora我的在D:\app\oracle\product\12.1.0\dbhome_1\NETWORK\ADMIN⽂件夹下############################tnsnames.ora#######################cdborcl =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) )(CONNECT_DATA =(SERVICE_NAME = orcl) #cdb的db_name))#pdbpdborcl =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = pdborcl) #pdb的db_name))##########################tnsnames.ora######################数据库下拉框会出现pdborcl选项遇到的坑使⽤system登录,PLSQL Developer选择ORCL,执⾏select name,open_mode from v$pdbs; ⽤来查看当前CDB容器中包含的PDB容器pdborcl的open_mide的状态是READ WRITE,使⽤pdborcl也能登录,但是你重启服务器这个状态会变为这时候PLSQL Developer选择pdborcl就不能登录了,出现错误因为服务器重启时,pdb默认不启动PLSQL Developer选择ORCL. system登录(或使⽤sqlplus)执⾏alter pluggable database PDBORCL open; 启动pdb创建⽤户创建新⽤户,注意CDB容器中创建⼀个通⽤⽤户,⽤户名必须以C##或者c##开头,因为CDB中默认创建的是common user如果想要创建本地⽤户,则要在PDB容器中创建,下⾯会说如何切换到PDB容器create user C##test identified by 123456; //其中C##test为⽤户名,123456为密码给新⽤户授权grant create session to C##test;grant create table to C##test;grant create tablespace to C##test;grant create view to C##test;切换⾄查到的某个PDB容器(上⾯查到的是PDBORCL)注意使⽤这个命令需要的sysdba级别的权限,否则⽆法执⾏,切换后才可使⽤当前pdb的私有⽤户进⾏操作,12c数据库创建完成后,默认情况下使⽤sqlplus / as sysdba 登录连接的是CDB。
Top Oracle Database 12cHigh Availability Innovations A Technical DrilldownWei Hu, Vice President of Development, High Availability Technologies, OracleBest Innovations Make Things Easy▪Any sufficiently advanced technology is indistinguishable from magic - Arthur C. Clarke▪Any technology that is distinguishable from magic is not sufficiently advanced - Gregory Benford▪This talk will give an overview of the new high availability features introduced in Oracle Database 12c▪Then describes some of the internal innovations that make these features powerful and easy to useOracle Database 12c▪Oracle Database 12c introduces significant new HA capabilities that–Drastically cut down planned and unplanned downtime –Eliminate compromises between HA and Performance –Tremendously boost operational productivity▪These take Availability to unprecedented new levels–Next-generation Maximum Availability Architecture (MAA) –Optimized for OracleExtreme AvailabilityOracle Maximum Availability ArchitectureActive Data Guard–Data Protection, DR–Query OffloadGoldenGate–Active-active –HeterogeneousRMAN, Oracle Secure Backup–Backup to tape / cloudActive ReplicaEdition-based Redefinition,Online Redefinition, Data Guard, GoldenGate– Minimal downtime maintenance, upgrades, migrationsRAC–Scalability –Server HAFlashback–Human error correctionProduction SiteApplication Continuity–Application HAGlobal Data Services–Service Failover / Load BalancingOracle Database 12cHigh Availability Key* New Features ▪Application Continuity▪Global Data Services▪Data Guard Enhancements▪RMAN Enhancements▪Flex ASM▪Other HA Enhancements▪GoldenGate Update▪MAA at PayPal▪ *Nearly a hundred new HA features in 12cDatabase outages can cause in-flightwork to be lost, leaving users and applications in-doubt -–User frustration –Cancelled work –Duplicate submissions –Rebooting mid-tiers –Developer painsPre-12c SituationIn-Flight Work: Dealing with OutagesApplication ServersDatabase ServersEnd User▪Replays in-flight work on recoverable errors▪Masks many hardware, software, network, storage errors and outages ▪Supports JDBC-Thin, Universal Connection Pool (UCP), WebLogic Server, 3rd Party Java apps/mid-tiers ▪RAC, RAC One, & Active Data Guard ▪Better end user experienceApplication ContinuityMasks unplanned/planned outages when successfulApplication ServersDatabase ServersEnd UserDatabase RequestReplayedApplication Continuity SubtletiesThe hardest part of replay is deciding when NOT to replay▪Application Continuity minimizes divergence by re-executing SQL at original SCN (when possible) and rebuilding original environment–Stops replay (and returns error) if replayed request returns different result than original (e.g., two users concurrently updating same row)▪Application Continuity does not attempt replay (and returns error) if –Error is not recoverable – e.g., constraint violation–DDLs such as SHUTDOWN ABORT, DROP TABLESPACE are executed–Request has been explicitly disabled for replay – e.g., disbursing money–Failure occurred too long ago – don’t automatically replay a request from yesterday ▪Application Continuity is safe; only replays incomplete requests – Will not pay for the same item twiceafter outagesTransaction GuardPreserve & Retrieve COMMIT Outcome▪Tracks outcome of the last transaction ▪Without Transaction Guard, retry can cause logical corruption▪Transaction Guard allows applications to deal correctly with failures▪Application Continuity uses Transaction Guard▪Transaction Guard also available for applications that do not use Application ContinuityApplication Continuity I nternalsOracle Database 12cHigh Availability Key New Features▪Application Continuity▪Global Data Services▪Data Guard Enhancements▪RMAN Enhancements▪Flex ASM▪Other HA Enhancements▪GoldenGate UpdateDatabases in Replicated EnvironmentsChallenges▪Maximum Availability ArchitectureActive Data Guard and GoldenGate with RAC▪Want to optimize utilization ofActive Data Guard and GoldenGate databases–Efficiently use all availabledatabases–Automated load balancing and faulttolerancePrimary Active Standby Active StandbyGlobal Data Services•Extends RAC-style service failover, loadbalancing (within and across datacenters), and management capabilities to a set of replicated databases•Takes into account network latency,replication lag, and service placement policies•Achieve higher availability, improvedmanageability and maximize performanceLoad Balancing and Service Failover for Replicated Databases▪Reporting client routed to ‘best’ database–Based on location, response time, data, acceptabledata lag–Reports will automatically run on least loaded server▪Reporting client failover–If preferred database not available, will route toanother database in same region or a remote database▪Global service migration–Automatically migrates services based onfailover/switchover - if primary database is down, start Call Center service on the new primaryActive Data Guard ExampleActive Data GuardReporting ServiceCall Center Service▪Call Center Client connections andrequests transparently routed to the closest / best database–Runtime load balancing metrics give client real-timeinformation on which database to issue next request▪If a database fails, its global services arerestarted on another replicaGoldenGate ExampleGoldenGateCall Center ServiceLoad Balancing is Very ComplicatedGlobal Data Service (GDS) Load Balancing▪Supports connect-time and run-time (per-request) load balancing▪Load balancing is easy if all your machines and workload are uniform–GDS supports heterogeneous environment – RAC + non-RAC, powerful and less powerful machines (important since some customers have less powerful machines for DR)▪Load balancing is NOT equal load on all machines–Instead, GDS minimizes average response time across all requests–If database 1 much faster than database 2, then 100% of requests might go to machine database 1–Sometimes, request to lightly-loaded database in remote region might complete faster than request to heavily loaded database in local region–Equalization of average response time done for all clients in each region (remote requests expected to be longer) ▪Load balancing must balance responding rapidly to changing workloads and avoiding oscillations▪Uses internal database metrics, does not blindly rely on external metrics–More accurate (factors out network variability), handles workload generated external to global services, & handles planned shutdown caseGlobal Data Services: SummaryGlobally Replicated, High Availability Architecture••• GSM - Global Service ManagerLocal StandbyLocal StandbyData Center #2 EMEAAPACGuardData GuardPrimaryLocal StandbyActiveData GuardGDSCTLGDS Catalog PrimaryGDS Catalog StandbyMasterOracleGoldenGate Active GuardSALES POOL (sales_reporting_srvc, sales_entry_srvc)HR POOL(hr_apac_srvc, hr_emea_srvc)All GDS client databases connected to all GSMsMasterRemote StandbyReader FarmActive Data GuardGlobal Service ManagersGlobal Service ManagersOracle Database 12cHigh Availability Key New Features▪Application Continuity▪Global Data Services▪Data Guard Enhancements▪RMAN Enhancements▪Flex ASM▪Other HA Enhancements▪GoldenGate UpdateZero Data Loss ChallengeThe longer the distance, the larger the performance impactSynchronous Communication Leads To Performance Trade-OffsPrimaryStandbyCommitCommit AckNetwork SendNetwork AckStandbyData Guard Async – TodaySome Data Loss Exposure Upon DisasterZero Data Loss For Async Deployments▪Far Sync: light-weight Oracle instance: standby control file, standby redo logs, archived redo logs, no data files▪Receives redo synchronously from primary, forwards redo asynchronously in real-time to standby▪Upon Failover: Async standby transparently obtains last committed redo from Far Sync and applies: zero data loss failover▪Second Far Sync Instance can be pre-configured to transmit in reverse direction after failover/switchover▪Terminal standbys required to be Active Data Guard StandbysPrimaryStandbyFar SyncInstanceStandbyFar SyncInstanceActive Data Guard Far SyncMuch work done to make things work ‘like magic’▪Looks just like SYNC. So Fast Start Failover (FSFO) works – automatic, zero data loss failover to far destination▪If Far Sync instance fails, can failover to another Far Sync (recommended), or go into async mode directly to standby (using remote alternate log_archive_dest_x)▪Sophisticated logic to make failovers seamless–When primary dies, Far Sync keeps track of state of async connections to terminal standby to ship the exact redo needed for zero data loss–Works with RAC (multiple threads of redo)▪Smart gap resolution – if the primary is missing redo, it can fetch from Far Sync instance. Far Sync instance will transparently fetch from primary & forward to standbyActive Data Guard Far SyncSummary of Benefits▪Best data protection, least performance impact▪Low cost and complexity▪Best way to implement a near DR + Far DR model▪Relevant to existing Data Guard ASYNC configurations▪Data Guard Failover? No Problem! Just do it – No Data Loss!Active Data Guard Real-Time CascadingEliminates Propagation DelayPrimary▪In 12.1, Standby 1 forwards redo to Standby 2 in real-time, as it isreceived: no propagation delay for a log switch▪Standby 2 (Active Data Guard Standby) is up-to-date for offloadingread-only queries and reports▪In 11.2, Standby 1 waits till log switch before forwarding redo fromarchived logs to Standby 2Data Guard Fast SyncReduced Primary Database Impact for Maximum AvailabilityLogsStandbyRedoLogsCommitCommitAcknowledge▪For SYNC transport: remote siteacknowledges received redo beforewriting it to standby redo logs▪Reduces latency of commit on primary▪Better DR – increased SYNC distance▪If network round-trip latency less thantime for local online redo log write,synchronous transport will not impactprimary database performance▪Can use Fast Sync from Primary to FarSync , and Fast Sync works with FSFO CommitCommitAcknowledgeAcknowledgereturned on receiptLogsStandbyRedoLogsData GuardOther New Features in Oracle Database 12cOracle Database 12cHigh Availability Key New Features▪Application Continuity▪Global Data Services▪Data Guard Enhancements▪RMAN Enhancements▪Flex ASM▪Other HA Enhancements▪GoldenGate UpdateFine-grained Table Recovery From Backup▪Simple RECOVER TABLE command torecover one or more tables (mostrecent or older version) from an RMANbackup▪Eliminates time and complexityassociated with manual restore, recover& export–Enables fine-grained point-in-timerecovery of individual tables instead ofthe contents of the entire tablespaceRMANBackupsCross-Platform Backup & Restore▪Simplifies procedure for platform migration▪Minimize read-only impact with multiple incremental backupsSimplified Platform MigrationSource Database (AIX)Backup to Disk/Tape (data files, optional endian conversion,metadata export)Restore Backup (optional endian conversion, metadata import)Destination Database (Solaris)▪Backup and recover specific pluggable databases with new PLUGGABLE DATABASE keywords:RMAN> BACKUP PLUGGABLE DATABASE <PDB1>, <PDB2>;▪Familiar BACKUP DATABASE command backs up CDB, including all PDBs ▪PDB Complete Recovery–RESTORE PLUGGABLE DATABASE <PDB>; –RECOVER PLUGGABLE DATABASE <PDB>;▪PDB Point-in-Time Recovery–RMAN> RUN {–SET UNTIL TIME 'SYSDATE-3'; –RESTORE PLUGGABLE DATABASE <PDB>; –RECOVER PLUGGABLE DATABASE <PDB>;–ALTER PLUGGABLE DATABASE <PDB> OPEN RESETLOGS; }▪Familiar RECOVER DATABASE command recovers CDB, including all PDBsPluggable Database Backup & RestoreFine-Grained Backup & Recovery to Support ConsolidationOracle Database 12cHigh Availability Key New Features▪Application Continuity▪Global Data Services▪Data Guard Enhancements▪RMAN Enhancements▪Flex ASM▪Other HA Enhancements▪GoldenGate UpdateAutomatic Storage Management (ASM) OverviewASM Cluster Pool of StorageDisk Group BDisk Group A Shared Disk GroupsWide File StripingOne to OneMapping of ASM Instances to ServersASM InstanceASM DiskRAC ClusterNode4Node3Node2Node1Node5ASMASM ASM ASMASMASM InstanceDatabase InstanceDB ADB A DB BDB BDB CDB BCurrent StateFlex ASM: Eliminate 1:1 Server MappingNew: ASM Storage Consolidation in Oracle Database 12cASM Cluster Pool of StorageDisk Group BDisk Group A Shared Disk GroupsWide File StripingDatabases share ASM instancesASM InstanceDatabase InstanceASM DiskRAC ClusterNode5Node4Node3Node2Node1Node5 runs as ASM Client to Node4Node1Node2 Node4Node2 runs as ASM Client to Node3 ASM ASM ASMASM InstanceDB ADB A DB BDB BDB CDB BFlex ASM: Supporting Oracle Database 11gPrevious Database Versions Will Host Local ASM InstanceASM Cluster Pool of StorageDisk Group BDisk Group A Shared Disk GroupsWide File StripingDatabases share ASM instancesASM InstanceDatabase InstanceASM DiskRAC ClusterNode5Node4Node3Node2Node1ASM ASM ASMDB ADB A DB BDB BDB C DB BASMASM11.2DB11.2DBOracle Database 12cHigh Availability Key New Features▪Application Continuity▪Global Data Services▪Data Guard Enhancements▪RMAN Enhancements▪Flex ASM▪Other HA Enhancements▪GoldenGate UpdateOther HA EnhancementsOracle Database 12cHigh Availability Key New Features▪Application Continuity▪Global Data Services▪Data Guard Enhancements▪RMAN Enhancements▪Flex ASM▪Other HA Enhancements▪GoldenGate UpdateNote: A single DR copy may be multi-purposed for any combination of the use cases describedData Guard Redo TransportSYNC or ASYNCOracle DatabaseOracle Active Data GuardReal-Time Data Protection and AvailabilityStandby First Patching, Exact copy of primary Query & Report OffloadOpen Read-Only Snapshot StandbyConvert to Test Database(open read-write)Single Command Refresh of primary Offload RMAN Backups of primary Far Sync, Database Backup Appliance, GoldenGateExact copy of primarySource for thin snaps/clones Exact copy of primary Extract offload, source for GoldenGate ALO modeOracle & Non-OracleMessage BusOracle Database12c *Oracle GoldenGate 12c*Low-Impact, Real-Time Data Integration & Transactional ReplicationData IntegratorNew DB/ HW/OS/APP Fully Active Distributed DBReporting Database DataWarehouse ODSZero Downtime Upgrade& Migration Query & Report Offloading Data Synchronization within theEnterprise Real-time BI, OperationalReporting, MDMEvent Driven Architecture, SOAActive-Active High AvailabilityMessage BusGlobal Data Centers Logical Copy of Primary Disaster Recovery for Non-Oracle Databases *: GoldenGate 12c for Oracle Database 12c will be available in CY2013GoldenGate Zero Downtime Migration/Upgrade Seamless Migration and Upgrades to Oracle Database 12c* •Consolidate/migrate/maintain systems withoutdowntime•Minimize risk withfailback option•Validate data beforeswitchover•Use Active-Active replication for phased user migrationERP Oracle ERP*: GoldenGate 12c for Oracle Database 12c will be available in CY2013 Oracle10.2CRM11.2DWOracle GoldenGate for Active-Active DatabasesIncrease ROI on Existing Servers & Synchronize Data•Utilize secondarysystems for transactions •Enable continuousavailability during unplanned & planned outages•Synchronize data acrossglobal data centers •Use intelligent conflictdetection & resolution*: GoldenGate 12c for Oracle Database 12c will be available in CY2013Oracle 10.2 App2Oracle 11.2 App3Non-Oracle AppHeterogeneous Bi-DirectionalOracle Database 12c▪Oracle Database 12c offers a tremendously sophisticatedset of high availability (HA) capabilities▪These capabilities–Further reduce downtime–Significantly improve productivity–Eliminate traditional compromisesExtreme Availability: SummaryResources▪OTN HA Portal:/goto/availability▪Maximum Availability Architecture (MAA):/goto/maa▪MAA Blogs:/maa▪Exadata on OTN:/technetwork/database/exadata/index.html▪Oracle HA Customer Success Stories on OTN:/technetwork/database/features/ha-casestudies-098033.htmlKey HA Sessions and Demos by Oracle DevelopmentMonday, 23 September Moscone South10:45a Oracle DB 12c—Eng’d for Clouds and Big Data, North D1:45p Oracle Exadata—What’s New and What’s Coming, 1033:15p Top Oracle DB 12c HA Innovations - A Technical Drill-down, 103 4:45p RMAN in Oracle DB 12c: New Features and Best Practices, 102 4:45p Compression and Performance in Oracle Database 12c, 104Tuesday, 24 September Moscone South10:30a Always Available: Oracle Exadata and Oracle MAA, 10210:30a Oracle RAC 12c Best Practices, 10412:00p A Revolutionary New Way to Do DB Backup and Recovery, 102 12:00p Oracle Flex Cluster: Optimized Resource Mgmt. for Cloud, 104 12:00p Storage Optimization with Oracle Database 12c, 3013:45p Oracle DB 12c Best Practices for Data Availability andDisaster Protection, 1025:15p Optimize Oracle Active Data Guard and Oracle GoldenGate:Wednesday, 25 September Moscone South10:15a Best Practices for Integrating GoldenGate w/ Act. Data Guard, 104 11:45a The Next Big Thing!, 10311:45a Best Practices for Oracle Exadata Backup and Recovery, 20011:45a Cloning and Snapshots with Oracle Database 12c, 1021:15p Redefining Backup and Recovery with Oracle Eng’d Systems, 200 3:30p Oracle Active Data Guard: Next-Generation Data Protection, 103 5:00p Oracle Exadata Storage Availability Best Practices, 2005:00p Integrated Apply: Scalable Replication with GoldenGate, North 131 5:00p Exadata Planned Maintenance for Zero Downtime, Westin Metro. IThursday, 26 September Moscone South11:00a Oracle Database-Aware Flash: Maximizing Performance andAvailability for Your Database, 2362:00p Oracle MAA Best Practices for the Oracle Multitenant Option, 102 2:00p Maximize Availability by Using DB Services with Oracle RAC, 103。
Oracle 数据库12c新特性总结导读:本系列文章是Oracle ACE总监Syed Jaffer Hussain对Oracle数据库12c的一些新特性总结,包括数据库管理、RMAN、高可用性以及性能调优等内容。
关键词:Oracle数据库12c RMAN PGA限制不可见字段【TechTarget中国原创】编者按:甲骨文公司近日正式发布了新版旗舰级数据库Oracle Database 12c,在TechTarget数据库网站之前的一些报道中,我们曾对12c的一些新特性进行了介绍(参考:尝鲜Oracle Database 12c的十二大新特性)而随着产品正式GA,相关技术文档也披露了更多关于12c数据库的细节。
本系列文章是Oracle ACE总监Syed Jaffer Hussain对Oracle 数据库12c的一些新特性总结,包括数据库管理、RMAN、高可用性以及性能调优等内容。
Oracle 数据库12c新特性总结(一)在第一部分中,我们将介绍:1. 在线迁移活跃的数据文件2. 表分区或子分区的在线迁移3. 不可见字段4. 相同字段上的多重索引5. DDL日志6. 临时undo7. 新的备份用户特权8. 如何在RMAN中执行SQL语句9. RMAN中的表级别恢复10. PGA的大小限制问题1. 在线重命名和重新定位活跃数据文件不同于以往的版本,在Oracle数据库12c R1版本中对数据文件的迁移或重命名不再需要太多繁琐的步骤,即把表空间置为只读模式,接下来是对数据文件进行离线操作。
在12c R1中,可以使用ALTER DATABASE MOVE DATAFILE这样的SQL语句对数据文件进行在线重命名和移动。
而当此数据文件正在传输时,终端用户可以执行查询,DML以及DDL方面的任务。
另外,数据文件可以在存储设备间迁移,如从非ASM迁移至ASM,反之亦然。
重命名数据文件:SQL> ALTER DATABASE MOVE DATAFILE '/u00/data/users01.dbf' TO '/u00/data/u sers_01.dbf';从非ASM迁移数据文件至ASM:SQL> ALTER DATABASE MOVE DATAFILE '/u00/data/users_01.dbf' TO '+DG_DATA ';将数据文件从一个ASM磁盘群组迁移至另一个ASM磁盘群组:SQL> ALTER DATABASE MOVE DATAFILE '+DG_DATA/DBNAME/DATAFILE/users_0 1.dbf ' TO '+DG_DATA_02';在数据文件已存在于新路径的情况下,以相同的命名将其覆盖:SQL> ALTER DATABASE MOVE DATAFILE '/u00/data/users_01.dbf' TO '/u00/data_ new/users_01.dbf' REUSE;复制文件到一个新路径,同时在原路径下保留其拷贝:SQL> ALTER DATABASE MOVE DATAFILE '/u00/data/users_01.dbf' TO '/u00/data_ new/users_01.dbf' KEEP;当通过查询v$session_longops动态视图来移动文件时,你可以监控这一过程。
oracle database 12c 介绍和概要Oracle Database 12c 是一款由 Oracle 公司开发的数据库管理系统,它是目前最流行的关系型数据库之一。
在 Oracle Database 12c 中,引入了许多新特性和改进,使得数据库的可用性、可扩展性和性能得到了进一步提升。
Oracle Database 12c 引入了多租户架构,允许多个数据库实例共享同一套 Oracle 数据库软件,从而降低了成本和资源消耗。
同时,它还支持各种不同的计算环境,包括 x86、x64 和 zSeries 等。
Oracle Database 12c 提供了丰富的功能和工具来支持数据管理、事务处理和数据分析等任务。
其中,最受欢迎的功能之一是闪回(Flashback),它允许管理员在误操作或数据损坏后快速恢复到以前的数据库状态。
此外,Oracle Database 12c 还提供了许多其他的内置工具,例如自动存储管理(ASM)、自动数据优化(AOP)和数据安全等。
Oracle Database 12c 的主要组件包括数据库实例、数据文件、控制文件、日志文件和表空间等。
数据库实例是由多个进程和内存结构组成的,它负责访问和控制数据库。
数据文件用于存储数据库的数据,控制文件包含了数据库元数据和磁盘文件的信息,日志文件记录了对数据的所有更改信息。
表空间则是由一个或多个数据文件组成的逻辑容器,用于存储用户的数据。
总之,Oracle Database 12c 是一款功能强大、易于使用和管理的关系型数据库,适用于各种不同的应用场景。
它提供了许多先进的功能和工具,可以帮助企业降低成本、提高性能和可靠性,是数据库管理员的理想选择。
OracleDatabase12c版本介绍OracleDatabase12c?有三种版本,提供多种企业版选件来满足客户对各种领域(性能和可用性、安全性和合规性、数据仓储和分析、非结构化数据和可管理性)的特定需求。
OracleDatabase12c?标准版1企业级的性能和安全性OracleDatabase12c?标准版1经过了优化,适用于部署在小型企业、各类业务部门和分散的分支机构环境中。
该版本可在单个服务器上运行,最多支持两个插槽。
OracleDatabase12c?标准版1可以在包括Windows、Linux和Unix在内的所有Oracle支持的操作系统上使用。
概述●快速安装和配置,具有内置的自动化管理●适用于所有类型的数据和所有应用●公认的性能、可靠性、安全性和可扩展性●使用通用代码库,可无缝升级到OracleDatabase12c?标准版或OracleDatabase12c?企业版优势●以极低的每用户180美元起步(最少5个用户)●以企业级性能、安全性、可用性和可扩展性支持所有业务应用●可运行于Windows、Linux和Unix操作系统●通过自动化的自我管理功能轻松管理●借助OracleApplicationExpress、OracleSQLDeveloper和Oracle面向Windows的数据访问组件简化应用开发OracleDatabase12c?标准版经济实惠、功能全面的数据库OracleDatabase12c?标准版是面向中型企业的一个经济实惠、功能全面的数据管理解决方案。
该版本中包含一个可插拔数据库用于插入云端,还包含Oracle 真正应用集群用于实现企业级可用性,并且可随您的业务增长而轻松扩展。
●支持使用一个可插拔数据库实现入门级云计算和整合●跨平台恢复●内置的Oracle真正应用集群支持更高水平的系统正常运行时间●简化的安装和配置●适用于所有类型的数据和所有应用●向上兼容OracleDatabase12c?企业版,从而保护您的初期投资优势●每用户350美元(最少5个用户),您可以只购买目前需要的许可,然后使用Oracle真正应用集成随需扩展,从而节省成本●提高服务质量,实现企业级性能、安全性和可用性●可运行于Windows、Linux和Unix操作系统●通过自动化的自我管理功能轻松管理●借助OracleApplicationExpress、OracleSQLDeveloper和Oracle面向Windows的数据访问组件简化应用开发OracleDatabase12c?企业版插入云端全球首屈一指的数据库推出最新版本——OracleDatabase12c现已推出,可在各种平台上使用。
串串⾏行行到并⾏行行解读Oracle 12.2的核⼼心新特性孙雪云和恩墨墨•Agility – 敏捷–Rapid provisioning, cloning, movement•Elasticity – 弹性–Scale-out CPU cores, storage, memory•Cloud-scale Operations–Manage many databases as-one •Transforming Data Management–From Disk-based to In-Memory Databases –From Data Warehouse to Big Data–From On-Prem to Database Optimized CloudOracle 12c 的设计理理念转型深度转型速度适应性⾏行行业 重塑型⾏行行业迟钝型⾏行行业互补性⾏行行业Oracle 在12c中做了了什什么⾼高可⽤用⽤用于数据仓库的Data Guard;表的在线迁移和分区DBCA创建standbyIn-Memory IM expressions; Virtual Column;Fast Start;Join groupCore Improvement 实时索引配置情绪分析和搭配提取⽂文档单词的同义词创建只读分区Sharding分⽚片⾃自动部署;⽣生命周期管理理⾃自动管理理智能路路由RAC and GridActiveData GuardBig andData WarehouseMultitenantFlex ASM;Flex ClusterExtended RAC的配置⽀支持远程AWR;ADG⽀支持 SQL tuning advisor基于快照的standby只读实例例,local temp tablespace;并⾏行行递归with的增强SQL执⾏行行计划的增强管理理Application container;Domain based on PDBProxy PDB串串⾏行行的世界说多了了都是泪串串⾏行行到并⾏行行为什什么如此重要企业应⽤用的变化:业务系统增多业务数据量量变⼤大并发访问严重⽽而系统⾯面临的问题:通过CPU主频提升,软件能够⾃自动提升性能的时代已经⼀一去不不复返;⽽而⽤用户对于性能,响应速度要求更更⾼高在⾼高并发系统中,串串⾏行行就是等待⾼高配置⾼高并发⾼高等待阿姆达尔定律律串串⾏行行到并⾏行行,Slave 进程的引⼊入RAC 并⾏行行优化:LMs ! RMVn,CRn 单库并⾏行行优化:LGWR !LGnn 132Dg 并⾏行行优化:Multi MRP单实例例并⾏行行:LGWR! LGnn1、LGWR的作⽤用:2、LGWR相关的等待: Foreground:Log file Sync Background:Log file parallel write3、 Log file Sync产⽣生的原因:commit 过于频繁? Log buffer 过⼤大?CPU负载⾼高?4、什什么时候会产⽣生log file sync等待1)commit操作2)rollback操作3)DDL操作(DDL操作实施前都会⾸首先进⾏行行⼀一次commit)4)DDL操作导致的数据字典修改所产⽣生的commit5)某些能递归修改数据字典的操作:⽐比如查询SEQ的next值,可能会导致修改数据字典。
Oracle 12C引入了CDB与PDB的新特性,在ORACLE 12C数据库引入的多租用户环境(Multitenant Environment)中,允许一个数据库容器(CDB)承载多个可插拔数据库(PDB)。
CDB全称为Container Database,中文翻译为数据库容器,PDB全称为Pluggable Database,即可插拔数据库。
在ORACLE 12C之前,实例与数据库是一对一或多对一关系(RAC):即一个实例只能与一个数据库相关联,数据库可以被多个实例所加载。
而实例与数据库不可能是一对多的关系。
当进入ORACLE 12C后,实例与数据库可以是一对多的关系。
下面是官方文档关于CDB与PDB的关系图。
其实大家如果对SQL SERVER比较熟悉的话,这种CDB与PDB是不是感觉和SQL SERVER的单实例多数据库架构是一回事呢。
像PDB$SEED可以看成是master、msdb等系统数据库,PDBS可以看成用户创建的数据库。
而可插拔的概念与SQL SERVER中的用户数据库的分离、附加其实就是那么一回事。
看来ORACLE也“抄袭”了一把SQL SERVER 的概念,只是改头换面的包装了一番。
CDB组件(Components of a CDB)一个CDB数据库容器包含了下面一些组件:ROOT组件ROOT又叫CDB$ROOT, 存储着ORACLE提供的元数据和Common User,元数据的一个例子是ORACLE提供的PL/SQL包的源代码,Common User 是指在每个容器中都存在的用户。
SEED组件Seed又叫PDB$SEED,这个是你创建PDBS数据库的模板,你不能在Seed中添加或修改一个对象。
一个CDB中有且只能有一个Seed. 这个感念,个人感觉非常类似SQL SERVER中的model数据库。
PDBSCDB中可以有一个或多个PDBS,PDBS向后兼容,可以像以前在数据库中那样操作PDBS,这里指大多数常规操作。
这些组件中的每一个都可以被称为一个容器。
因此,ROOT(根)是一个容器,Seed(种子)是一个容器,每个PDB是一个容器。
每个容器在CDB中都有一个独一无二的的ID和名称。
1)连接到CDB数据库连接到CDB数据库容器非常简单,跟以前连接数据库是一样的[oracle@get-orasvr02 ~]$ sqlplus /as sysdbaSQL*Plus: Release 12.1.0.1.0 Production on Sun Oct 2023:41:362013Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to an idle instance.SQL>[oracle@get-orasvr02 ~]$ sqlplus sys/password as sysdbaSQL*Plus: Release 12.1.0.1.0 Production on Sun Oct 2023:43:172013Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to an idle instance.2)查看数据库是否为CDBSQL>select name, decode(cdb, 'YES', 'Multitenant Option enabled', 'Regular 12c Database: ') "Multitenant Option" , open_mode, con_id from v$database;NAME Multitenant Option OPEN_MODE CON_ID--------- ----------------------------- ------------------------------EPPS Multitenant Option enabled READ WRITE 0YES表示该数据库是CDB,如果是NO表示是NO-CDB(普通数据库)3)查看当前容器(Container)3.1SQL> show con_nameCON_NAME------------------------------CDB$ROOTSQL>3.2SQL>select sys_context('userenv', 'con_name') "Container DB" from dual;Container DB----------------------------------------------------CDB$ROOTSQL>4)查看CDB容器中的PDBS信息查看CDB中有多少个pluggable databaseSQL>select con_id, dbid, guid, name , open_mode from v$pdbs;CON_ID DBID GUID NAMEOPEN_MODE---------- ---------- -------------------------------------------------------------- ----------24071321146 E89E8DA2866E3157E043DE07A8C09238 PDB$SEED READ ONLY31930201447 E89E9418B882350CE043DE07A8C092B6 PDBEPPS MOUNTEDSQL>5)启动PDB数据库方式1:SQL>alter pluggable database PDBEPPS open;Pluggable database altered.SQL>select con_id, dbid, guid, name , open_mode from v$pdbs;CON_ID DBID GUID NAMEOPEN_MODE---------- ---------- -------------------------------------------------------------- ----------24071321146 E89E8DA2866E3157E043DE07A8C09238 PDB$SEED READ ONLY31930201447 E89E9418B882350CE043DE07A8C092B6 PDBEPPS READ WRITE方式2:SQL>alter session set container=PDBEPPS;Session altered.SQL> startupPluggable Database opened.SQL>6)关闭PDB数据库SQL> alter pluggable database PDBEPPS close;Pluggable database altered.SQL> select con_id, dbid, guid, name , open_mode from v$pdbs;CON_ID DBID GUID NAME OPEN_MODE ---------- ---------- -------------------------------- ------------------------------ ----------2 4071321146 E89E8DA2866E3157E043DE07A8C09238PDB$SEED READ ONLY3 1930201447 E89E9418B882350CE043DE07A8C092B6PDBEPPS MOUNTEDSQL>7)在容器间切换SQL> alter session set container=PDBEPPS;Session altered.SQL> show con_name;CON_NAME------------------------------PDBEPPSSQL>SQL> alter session set container=CDB$ROOT;Session altered.SQL> show con_name;CON_NAME------------------------------CDB$ROOTSQL>Oracle 12C加入了一个非常有新意的功能“可插拔数据库”特性,实现了数据库(PDB)在“容器”(CDB)上的拔功能,既能提高系统资源的利用率,也简化大面积数据库的管理和迁移工作。
下面我们体验一下可插拔数据库的CDB和PDB的操作:基本信息:根容器(CDB):CUP可插拔数据库(PDB):TEA启动根容器:[oracle@eric ~]$ export ORACLE_SID=cup[oracle@eric ~]$ sqlplus / as sysdbaSQL*Plus: Release 12.1.0.2.0 Production on Wed Jan 21 16:00:06 2015Copyright (c) 1982, 2014, Oracle. All rights reserved.Connected to an idle instance.SQL>startup-----不会直接启动所有可插拔数据库,如需启动所有可插拔数据库,执行命令:alter pluggable database all openORACLE instance started.Total System Global Area 767557632 bytesFixed Size 2929112 bytesVariable Size 574623272 bytesDatabase Buffers 184549376 bytesRedo Buffers 5455872 bytesDatabase mounted.Database opened.停止根容器:SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.查看是否创建了CDB,如果有显示名字:SQL> select name,cdb from v$database;NAME CDB--------- ---CUP YESSQL>show parameter service;NAME TYPE VALUE------------------------------------ ----------- ------------------------------ service_names string cup查看容器名字,其中有3个容器:根容器、种子容器和自己创建的容器:SQL> select con_id,name from v$containers;CON_ID NAME---------- ------------------------------1 CDB$ROOT ---根容器2 PDB$SEED ---种子容器,只可读3 TEA ---自己创建的可插拔数据库SQL>select file_name from dba_data_files;FILE_NAME--------------------------------------------------------------------------------/oracle/app/oradata/CUP/datafile/o1_mf_system_bch07kvz_.dbf/oracle/app/oradata/CUP/datafile/o1_mf_sysaux_bch020oo_.dbf/oracle/app/oradata/CUP/datafile/o1_mf_undotbs1_bch0d2on_.dbf/oracle/app/oradata/CUP/datafile/o1_mf_users_bch0d15n_.dbfSQL>select file_name from cdb_data_files;FILE_NAME--------------------------------------------------------------------------------/oracle/app/oradata/CUP/datafile/o1_mf_system_bch07kvz_.dbf/oracle/app/oradata/CUP/datafile/o1_mf_sysaux_bch020oo_.dbf/oracle/app/oradata/CUP/datafile/o1_mf_undotbs1_bch0d2on_.dbf/oracle/app/oradata/CUP/datafile/o1_mf_users_bch0d15n_.dbf创建公共用户:SQL>create user c##eric identified by gao;User created.SQL> conn c##eric/gaoERROR:ORA-01045: user C##ERIC lacks CREATE SESSION privilege; logon denied ----没有权限,我们可以单独给其赋予权限,也可以给其指定角色。