SET LINESIZE 1500
COL CON_ID FORMAT 99999
COL PROPERTY_NAME FORMAT a17
COL PDB_NAME FORMAT a9
COL VALUE FORMAT a12
COL DESCRIPTION FORMAT a90
SELECT r.CON_ID, p.PDB_NAME, PROPERTY_NAME,PROPERTY_VALUE AS value, DESCRIPTION
FROM CDB_PROPERTIES r,CDB_PDBS p
WHERE r.CON_ID = p.CON_ID AND PROPERTY_NAME LIKE 'MAX_PDB%'
ORDER BY PROPERTY_NAME;
CON_ID PDB_NAME PROPERTY_NAME VALUE DESCRIPTION
----- --------- ----------------- --------- ---------------------------------------------------------------
3 ORCLPDB MAX_PDB_SNAPSHOTS 7 maximum number of snapshots for a given PDB
3 ORCLPDB MAX_PDB_STORAGE UNLIMITED Maximum Space Usage of Datafiles and Local Tempfiles in Container
下面语句将当前pdb的快照数设置为7
1
2
3
4
5
6
进入PDB
YAO.CHONG> alter session set container = ORCLPDB;
Session altered.
Elapsed: 00:00:00.01
YAO.CHONG> ALTER PLUGGABLE DATABASE SET MAX_PDB_SNAPSHOTS=7;
Pluggable database altered.
想要删除所有的快照,我们只需要执行下面一条命令即可。
1
2
3
4
5
6
7
8
9
10
ALTER PLUGGABLE DATABASE SET MAX_PDB_SNAPSHOTS=0;
SET LINESIZE 150
COL CON_NAME FORMAT a10
COL SNAPSHOT_NAME FORMAT a25
COL SNAP_SCN FORMAT 9999999
COL FULL_SNAPSHOT_PATH FORMAT a45
SELECT CON_ID,CON_NAME,SNAPSHOT_NAME,SNAPSHOT_SCN AS snap_scn, FULL_SNAPSHOT_PATH
FROM DBA_PDB_SNAPSHOTS
ORDER BY SNAP_SCN;
##都没了
SET LINESIZE 150
COL CON_NAME FORMAT a10
COL SNAPSHOT_NAME FORMAT a30
COL SNAP_SCN FORMAT 9999999
COL FULL_SNAPSHOT_PATH FORMAT a70
SELECT CON_ID, CON_NAME, SNAPSHOT_NAME,SNAPSHOT_SCN AS snap_scn, FULL_SNAPSHOT_PATH
FROM DBA_PDB_SNAPSHOTS
ORDER BY SNAP_SCN;
CON_ID CON_NAME SNAPSHOT_NAME SNAP_SCN FULL_SNAPSHOT_PATH
------- ---------- -------------------- -------- ---------------------------------------------
3 CDB1_PDB1 CDB1_PDB1_B4WEDLOAD 2962078 /disk1/oracle/dbs/snap_3489077498_2962078.pdb
3 CDB1_PDB1 CDB1_PDB1_AFWEDLOAD 2962938 /disk1/oracle/dbs/snap_3489077498_2962938.pdb
如果你不指定快照名,系统自动生成唯一名称的快照,下面即为不指定名字创建快照
1
2
3
4
5
6
7
8
9
10
11
12
ALTER PLUGGABLE DATABASE SNAPSHOT;
SET LINESIZE 150
COL CON_NAME FORMAT a10
COL SNAPSHOT_NAME FORMAT a25
COL SNAP_SCN FORMAT 9999999
COL FULL_SNAPSHOT_PATH FORMAT a45
SELECT CON_ID, CON_NAME, SNAPSHOT_NAME,SNAPSHOT_SCN AS snap_scn, FULL_SNAPSHOT_PATH
FROM DBA_PDB_SNAPSHOTS
ORDER BY SNAP_SCN;
CON_ID CON_NAME SNAPSHOT_NAME SNAP_SCN FULL_SNAPSHOT_PATH
---------- ---------- ------------------------- -------- ----------------------------------------------------
3 ORCLPDB SNAP_3034367141_987737800 2995234 /home/oradata/ORCL/orclpdb/snap_3034367141_2995234.pdb
SET LINESIZE 150
COL CON_NAME FORMAT a10
COL SNAPSHOT_NAME FORMAT a25
COL SNAP_SCN FORMAT 9999999
COL FULL_SNAPSHOT_PATH FORMAT a45
SELECT CON_ID,CON_NAME,SNAPSHOT_NAME,SNAPSHOT_SCN AS snap_scn, FULL_SNAPSHOT_PATH
FROM DBA_PDB_SNAPSHOTS
ORDER BY SNAP_SCN;
CON_ID CON_NAME SNAPSHOT_NAME SNAP_SCN FULL_SNAPSHOT_PATH
---------- ---------- ------------------------- -------- -----------------------------------------------------
3 ORCLPDB CDB_CNDBA_20180813151200 2970060 /home/oradata/ORCL/orclpdb/snap_3034367141_2970060.pdb
3 ORCLPDB SNAP_3034367141_987737800 2995234 /home/oradata/ORCL/orclpdb/snap_3034367141_2995234.pdb
ALTER PLUGGABLE DATABASE DROP SNAPSHOT CDB_CNDBA_20180813151200;
再次查询PDB快照已经被删除
CON_ID CON_NAME SNAPSHOT_NAME SNAP_SCN FULL_SNAPSHOT_PATH
---------- ---------- ------------------------- -------- ---------------------------------------------------
3 ORCLPDB SNAP_3034367141_987737800 2995234 /home/oradata/ORCL/orclpdb/snap_3034367141_2995234.pdb
create pluggable database pdb_snap_test from orclpdb using snapshot at SCN 3620951;
与recover database until scn指定scn方式打开数据库不同,pdb snapshot Carousel指定scn生成的PDB只能是创建snapshot时的固定scn,并且生成快照与snapshot生成pdb的过程中占据了大量的物理空间与IO资源。
那么问题来了,说了这么多关于PDB snapshot Carousel的优势与好处,是否就说明已经找到了最佳的解决方案呢?
Hold on.
凡事有利也有弊,同样PDB snapshot Carousel也不能幸免。
快照数量受限
虽然能够做到Carousel轮转,但毕竟数量有限,较为死板。在用户的实际测试环境中条件复杂多变,会限制测试环境的搭建.
占据大量物理空间与IO资源
对于当前用户动辄几十T的数据量,在生成snapshot与snapshot创建pdb的过程中,消耗的时间和占据的物理资源是巨大的。
拘泥固定时间点
对于PDBsnapshot Carouse而言,只能基于固定时间,即快照点创建,无法根据测试需要灵活指定时间点。面对不断变化的测试需求,如此死板的模式明显是不可能满足要求的。
版本受限
最后是客观条件的限制,利用新特性需要满足是在18C的环境下且启用了PDB功能,但目前很多用户依然是10G\11G\12C的环境,因此也仅仅只能远观而无法上手,对于实际工作很难产生推动作用。
说到这,是否还有更好的解决办法呢?
答案是必须有!
16 Administering a PDB Snapshot Carousel
您可以为指定的PDB配置一个PDB快照库,手动或自动创建快照,并设置快照的最大数量。
This section contains the following topics:
About PDB Snapshot Carousel
A PDB snapshot is a point-in-time copy of a PDB. You can create snapshots manually using the SNAPSHOT clause of CREATE PLUGGABLE DATABASE (or ALTER PLUGGABLE DATABASE ), or automatically using the EVERY interval clause. A PDB snapshot carousel is a library of snapshots.
Setting the Maximum Number of Snapshots in a PDB Snapshot Carousel
You can set the maximum number of PDB snapshots for a PDB.
Configuring Automatic PDB Snapshots
Configure a PDB for automatic snapshots by using the SNAPSHOT MODE EVERY clause when creating or altering a PDB.
Creating PDB Snapshots Manually
To create a PDB snapshot manually, specify the SNAPSHOT snapshot_name clause in ALTER PLUGGABLE DATABASE or CREATE PLUGGABLE DATABASE .
Dropping a PDB Snapshot
You can drop a PDB snapshot by running an ALTER PLUGGABLE DATABASE statement with the DROP SNAPSHOT clause.
Parent topic: Administering a Multitenant Environment 16.1 About PDB Snapshot Carousel
PDB快照是PDB的时间点副本。您可以使用create PLUGGABLE DATABASE(或ALTER PLUGGABLE DATABASE)的SNAPSHOT子句手动创建快照,也可以使用each interval子句自动创建快照
. A PDB snapshot carousel 快照库.
This section contains the following topics:
Purpose of PDB Snapshot Carousel
A PDB snapshot carousel is a useful way of maintaining a library of recent PDB copies for point-in-time recovery and cloning.
How PDB Snapshot Carousel Works
The carousel for a specific PDB is a circular library of copies for this PDB.
User Interface for PDB Snapshot Carousel
The SNAPSHOT MODE clause controls creation of snapshots, and determines whether creation is manual, automatic, or disabled.
Parent topic: Administering a PDB Snapshot Carousel
16.1.1 Purpose of PDB Snapshot Carousel
PDB快照库是维护最近的PDB副本库以便进行时间点恢复和克隆的一种有用方法。
克隆用于开发和测试的PDBs
在一个典型的开发用例中,您克隆一个产品PDB来进行测试。当CDB处于ARCHIVELOG模式和本地撤销模式时,源生产PDB可以以读/写模式打开,并在操作过程中充分发挥功能。这种技术被称为热克隆。当SCN完成时,热克隆在事务上与源PDB一致of the ALTER PLUGGABLE DATABASE ... OPEN statement.
例如,当名为pdb1_prod的生产PDB处于打开状态并正在使用时,您将创建一个名为pdb1_test_master的可刷新克隆。然后配置pdb1_test_master来每天创建自动快照。当您需要新的PDBs进行测试时,请创建任何快照的完整克隆,然后使用 CREATE PLUGGABLE DATABASE ... SNAPSHOT COPY .
下图显示了从4月5日拍摄的PDB快照创建的克隆pdb1_test_full1。图中显示了从pdb1_test_full1创建的三个PDBs快照副本。
Figure 16-1 Automatic Snapshots of a Refreshable Clone PDB
Description of "Figure 16-1 Automatic Snapshots of a Refreshable Clone PDB"
使用PDB快照库进行时间点恢复
典型的策略是每天在同一时间对PDB进行快照。另一种策略是在数据加载之前手动进行快照。在这两种情况下,PDB快照库都允许您使用任何可用快照恢复PDB。
例如,名为pdb1_prod的销售历史记录PDB每天在12:01生成一个自动快照。在4/9周一下午的daily data load中,您意外加载了错误的数据,损坏了PDB。您可以基于Monday 4/9快照创建一个新的生产PDB,删除损坏的PDB,然后重试数据加载。
Figure 16-2 Restore a Production PDB Using a Snapshot
Description of "Figure 16-2 Restore a Production PDB Using a Snapshot"
See Also:
" About Cloning a PDB "
Oracle Database SQL Language Reference for CREATE PLUGGABLE DATABASE syntax and semantics
Parent topic: About PDB Snapshot Carousel
16.1.2 How PDB Snapshot Carousel Works
The carousel 对于特定的PDB,是该PDB的一个循环复制库。
数据库根据需要或自动地在库中创建连续的副本。当达到快照限制时,数据库将重写最旧的快照。
This section includes the following topics:
Contents of a PDB Snapshot
The data files of the PDB snapshot reside in an archive file on the file system.
Contents of a PDB Snapshot Carousel
The PDB snapshot carousel is the set of all existing snapshots for a PDB.
Parent topic: About PDB Snapshot Carousel
16.1.2.1 Contents of a PDB Snapshot
PDB快照的数据文件驻留在文件系统上的归档文件中。
不包括存档的重做日志文件。通常,归档文件存储在与PDB的数据文件相同的目录中。对于系统生成的快照名称,snap_以惟一标识符为前缀,该标识符包含快照SCN。该归档文件的扩展名是.pdb。
数据库使用隐式的using snapshot子句获取快照。在使用创建可插入数据库快照获取快照时,不能指定快照复制子句。
Note:
使用USING snapshot子句创建的PDB快照和使用snapshot copy子句创建的快照复制PDB是两种不同类型的快照,它们不应该混淆。USING SNAPSHOT子句创建一个不需要物化的完整PDB。快照复制子句创建了一个稀疏的PDB,如果您想删除它所基于的PDB快照,就必须将其物化。
虽然PDB快照carousel中的快照始终是完整的PDB,但是您可以在carousel中获取快照的快照副本。在这种情况下,快照副本是一个稀疏克隆。
See Also:
" How a Snapshot Copy PDB Differs from a Standard Clone "
Parent topic: How PDB Snapshot Carousel Works
16.1.2.2 Contents of a PDB Snapshot Carousel
PDB快照库是一个PDB的所有现有快照的集合。
max_pdb_snapshot属性指定库中允许的最大快照数量。当前设置在CDB_PROPERTIES视图中是可见的。
下图显示了cdb1_pdb1的库。在本例中,数据库每24小时自动获取一个快照,维护一组8个快照。创建了前8个快照之后,每个新快照都会替换旧快照。例如,星期二4/10快照替换星期一4/2快照;星期三4/11快照取代星期二4/3快照;等等。
Figure 16-3 PDB Snapshot Carousel
Description of "Figure 16-3 PDB Snapshot Carousel"
Parent topic: How PDB Snapshot Carousel Works
16.1.3 User Interface for PDB Snapshot Carousel
The SNAPSHOT MODE clause controls creation of snapshots, and determines whether creation is manual, automatic, or disabled.
CREATE PLUGGABLE DATABASE Statement
要为PDB设置快照模式,请在快照模式中使用以下值之一 clause of ALTER PLUGGABLE DATABASE or CREATE PLUGGABLE DATABASE :
MANUAL
This clause, which is the default, enables the creation of manual snapshots of the PDB. To create a snapshot on demand, specify the SNAPSHOT snapshot_name clause in an ALTER PLUGGABLE DATABASE or CREATE PLUGGABLE DATABASE statement.
EVERY snapshot_interval [MINUTES|HOURS]
This clause enables the automatic creation of snapshots after an interval of time. The following restrictions apply to the interval specified:
The database assigns each automatic snapshot a system-generated name. Note that manual snapshots are also supported for the PDB when EVERY is specified.
The minutes value must be less than 3000 .
The hours value must be less than 2000 .
NONE
This clause disables snapshot creation for the PDB.
See Also:
" About Point-in-Time Cloning of PDB Snapshots "
Oracle Database SQL Language Reference for the syntax and semantics of the SNAPSHOT clause
MAX_PDB_SNAPSHOTS Database Property
要设置PDB的最大快照数量,请在ALTER PLUGGABLE DATABASE或CREATE PLUGGABLE DATABASE中指定max_pdb_snapshot属性。属性的默认值是8,这也是最大值。当创建了允许的最大快照数量时,数据库将清除最旧的快照。CDB_PROPERTIES视图显示了max_pdb_snapshot的设置。
See Also:
Oracle Database SQL Language Reference for the syntax of the ALTER PLUGGABLE DATABASE statement
DBA_PDB_SNAPSHOTS and DBA_PDBS
The following data dictionary views provide snapshot information:
The DBA_PDB_SNAPSHOTS view metadata about the snapshots, including name, creation SCN, creation time, and file name.
The DBA_PDBS view has a SNAPSHOT_MODE and SNAPSHOT_INTERVAL column.
See Also:
Oracle Database Reference to learn about DBA_PDB_SNAPSHOTS and DBA_PDBS
Parent topic: About PDB Snapshot Carousel 16.2 Setting the Maximum Number of Snapshots in a PDB Snapshot Carousel
You can set the maximum number of PDB snapshots for a PDB.
max_pdb_snapshot数据库属性设置PDB快照旋转***中每个PDB的最大快照数量。默认最大值是8。不能将属性设置为大于8的数字。
Prerequisites
The PDB must be open in read/write mode.
To set the maximum number of PDB snapshots for a PDB:
In SQL*Plus, ensure that the current container is the PDB for which you want to set the limit.
Optionally, query CDB_PROPERTIES for the current setting of the SET MAX_PDB_SNAPSHOTS property.
Run an ALTER PLUGGABLE DATABASE or ALTER DATABASE statement with the SET MAX_PDB_SNAPSHOTS clause.
Example 16-1 Setting the Maximum Number of PDB Snapshots for a PDB
The following query shows the maximum in the carousel for cdb1_pdb1 (sample output included):
SET LINESIZE 150COL CON_ID FORMAT 99999COL PROPERTY_NAME FORMAT a17COL PDB_NAME FORMAT a9COL VALUE FORMAT a3COL DESCRIPTION FORMAT a43SELECT r.CON_ID, p.PDB_NAME, PROPERTY_NAME,PROPERTY_VALUE AS value, DESCRIPTIONFROM CDB_PROPERTIES r, CDB_PDBS pWHERE r.CON_ID = p.CON_IDAND PROPERTY_NAME LIKE 'MAX_PDB%' ORDER BY PROPERTY_NAME;CON_ID PDB_NAME PROPERTY_NAME VAL DESCRIPTION------ --------- ----------------- --- -------------------------------------------3 CDB1_PDB1 MAX_PDB_SNAPSHOTS 8 maximum number of snapshots for a given PDB
The following SQL statement sets the maximum number of PDB snapshots for the current PDB to 7:
ALTER PLUGGABLE DATABASE SET MAX_PDB_SNAPSHOTS=7;
Example 16-2 Dropping All Snapshots in a PDB Snapshot Carousel
To drop all snapshots in a PDB snapshot carousel, set the MAX_PDB_SNAPSHOTS database property to (zero), as shown in the following statement:
ALTER PLUGGABLE DATABASE SET MAX_PDB_SNAPSHOTS=0;
This technique is faster than executing ALTER PLUGGABLE DATABASE ... DROP SNAPSHOTsnapshot_name for every snapshot.
See Also:
" About Container Access in a CDB "
Parent topic: Administering a PDB Snapshot Carousel 16.3 Configuring Automatic PDB Snapshots
在创建或更改PDB时,通过使用快照模式EVERY子句为自动快照配置PDB。
默认情况下,PDB是为手动快照配置的。
Prerequisites
Note the following prerequisites for the ALTER PLUGGABLE DATABASE SNAPSHOT statement:
The CDB must be in local undo mode.
The administrator must have the privileges to create a PDB and drop a PDB.
To configure automatic snapshots when altering a PDB:
In SQL*Plus, log in as an administrator to the PDB whose snapshot mode you intend to configure.
Optionally, query DBA_PDBS to determine the current snapshot mode.
Run ALTER PLUGGABLE DATABASE with the SNAPSHOT MODE EVERY interval clause, specifying either MINUTES or HOURS .
To configure automatic snapshots when creating a PDB:
In SQL*Plus, log in as an administrator to the CDB root or application root.
Optionally, query DBA_PDBS to determine the current snapshot mode.
Run CREATE PLUGGABLE DATABASE with the SNAPSHOT MODE EVERY interval clause, specifying either MINUTES or HOURS .
Example 16-3 为现有PDB每天配置一个自动快照
本例假设您已登录到要更改其快照模式的PDB。查询数据字典,确认PDB目前处于手动模式(包括示例输出):
SELECT SNAPSHOT_MODE "S_MODE", SNAPSHOT_INTERVAL/60 "SNAP_INT_HRS" FROM DBA_PDBS;S_MODE SNAP_INT_HRS------ ------------MANUAL
Change the snapshot mode to every 24 hours:
ALTER PLUGGABLE DATABASE SNAPSHOT MODE EVERY 24 HOURS;
Confirm the change to automatic mode:
SELECT SNAPSHOT_MODE "S_MODE", SNAPSHOT_INTERVAL/60 "SNAP_INT_HRS" FROM DBA_PDBS;S_MODE SNAP_INT_HRS------ ------------AUTO 24
Example 16-4 Creating a PDB That Takes Snapshots Every Two Hours
This example assumes that you are logged in to the CDB root. The following statement creates cdb1_pdb3 from an existing PDB named cdb1_pdb1 , and configures it to take snapshots automatically every 2 hours:
CREATE PLUGGABLE DATABASE cdb1_pdb3 FROM cdb1_pdb1FILE_NAME_CONVERT=('cdb1_pdb1','cdb1_pdb3')SNAPSHOT MODE EVERY 120 MINUTES;
See Also:
" Creating a Point-in-Time Clone of a PDB Snapshot: Example "
" Configuring a CDB to Use Local Undo Mode "
Parent topic: Administering a PDB Snapshot Carousel 16.4 Creating PDB Snapshots Manually
To create a PDB snapshot manually, specify the SNAPSHOT snapshot_name clause in ALTER PLUGGABLE DATABASE or CREATE PLUGGABLE DATABASE .
Prerequisites
Note the following prerequisites for the ALTER PLUGGABLE DATABASE SNAPSHOT statement:
The CDB must be in local undo mode.
The administrator must have the privileges to create a PDB and drop a PDB.
To create a PDB snapshot:
In SQL*Plus, log in as an administrator to the PDB whose snapshot you intend to create.
Optionally, query DBA_PDBS to confirm that the snapshot mode is not set to NONE .
Run an ALTER PLUGGABLE DATABASE statement with the SNAPSHOT clause.
Example 16-5 Creating a Snapshot with a User-Specified Name
以下SQL语句创建两个cdb1_pdb1的PDB快照,一个在周三数据加载之前,一个在周三数据加载之后:
ALTER PLUGGABLE DATABASE SNAPSHOT cdb1_pdb1_b4wedload;-- data loadALTER PLUGGABLE DATABASE SNAPSHOT cdb1_pdb1_afwedload;
The following query of DBA_PDB_SNAPSHOTS shows the locations of two snapshots of the PDB named cdb1_pdb1 (sample output included):
SET LINESIZE 150COL CON_NAME FORMAT a10COL SNAPSHOT_NAME FORMAT a20COL SNAP_SCN FORMAT 9999999COL FULL_SNAPSHOT_PATH FORMAT a45SELECT CON_ID, CON_NAME, SNAPSHOT_NAME,SNAPSHOT_SCN AS snap_scn, FULL_SNAPSHOT_PATHFROM DBA_PDB_SNAPSHOTSORDER BY SNAP_SCN;CON_ID CON_NAME SNAPSHOT_NAME SNAP_SCN FULL_SNAPSHOT_PATH------- ---------- -------------------- -------- ---------------------------------------------3 CDB1_PDB1 CDB1_PDB1_B4WEDLOAD 2962078 /disk1/oracle/dbs/snap_3489077498_2962078.pdb3 CDB1_PDB1 CDB1_PDB1_AFWEDLOAD 2962938 /disk1/oracle/dbs/snap_3489077498_2962938.pdb
If you do not specify a PDB snapshot name, then the database generates a unique name.
Example 16-6 创建具有系统指定名称的快照
下面的SQL语句创建一个快照,但没有指定名称:
ALTER PLUGGABLE DATABASE SNAPSHOT;
The following sample query shows that the database assigned the snapshot a name prefixed with SNAP_ :
SET LINESIZE 150COL CON_NAME FORMAT a10COL SNAPSHOT_NAME FORMAT a25COL SNAP_SCN FORMAT 9999999COL FULL_SNAPSHOT_PATH FORMAT a45SELECT CON_ID, CON_NAME, SNAPSHOT_NAME,SNAPSHOT_SCN AS snap_scn, FULL_SNAPSHOT_PATHFROM DBA_PDB_SNAPSHOTSORDER BY SNAP_SCN;CON_ID CON_NAME SNAPSHOT_NAME SNAP_SCN FULL_SNAPSHOT_PATH------- ---------- ------------------------- -------- ---------------------------------------------3 CDB1_PDB1 CDB1_PDB1_B4WEDLOAD 2962078 /disk1/oracle/dbs/snap_3489077498_2962078.pdb3 CDB1_PDB1 CDB1_PDB1_AFWEDLOAD 2962938 /disk1/oracle/dbs/snap_3489077498_2962938.pdb3 CDB1_PDB1 SNAP_3489077498_960130367 2993525 /disk1/oracle/dbs/snap_3489077498_2993525.pdb
See Also:
" About Container Access in a CDB "
" Configuring a CDB to Use Local Undo Mode "
Parent topic: Administering a PDB Snapshot Carousel 16.5 Dropping a PDB Snapshot
You can drop a PDB snapshot by running an ALTER PLUGGABLE DATABASE statement with the DROP SNAPSHOT clause.
To drop all PDB snapshots based on a PDB, set the MAX_PDB_SNAPSHOTS property in the PDB to (zero).
To drop a PDB snapshot:
In SQL*Plus, ensure that the current container is the PDB from which you created the PDB snapshot.
Run an ALTER PLUGGABLE DATABASE statement with the DROP SNAPSHOT clause.
Example 16-7 Dropping a PDB Snapshot
The following SQL statement drops a PDB snapshot named sales_snap :
ALTER PLUGGABLE DATABASE DROP SNAPSHOT sales_snap;
See Also:
" About Container Access in a CDB "
Parent topic: Administering a PDB Snapshot Carousel
<span style="color:#444444"><span style="color:#222222">SQL> SELECT r.CON_ID, p.PDB_NAME, PROPERTY_NAME,
2 PROPERTY_VALUE AS value, DESCRIPTION
3 FROM CDB_PROPERTIES r, CDB_PDBS p
4 WHERE r.CON_ID = p.CON_ID
5 AND PROPERTY_NAME LIKE 'MAX_PDB%'
6 AND description like 'maximum%'
7 ORDER BY PROPERTY_NAME;
CON_ID PDB_NAME PROPERTY_NAME VALUE DESCRIPTION
---------- -------------------- -------------------- -------------------- ----------------------------------------------------------------------
3 ORCLPDB1 MAX_PDB_SNAPSHOTS 8 maximum number of snapshots for a given PDB
</span></span>
默认情况下是手动创建快照,我们可以把它改成自动创建。
<span style="color:#444444"><span style="color:#222222">SQL> select snapshot_mode,snapshot_interval/60 from dba_pdbs;
SNAPSH SNAPSHOT_INTERVAL/60
------ --------------------
MANUAL
SQL> alter pluggable database snapshot mode every 4 hours;
Pluggable database altered.
SQL> select snapshot_mode,snapshot_interval/60 from dba_pdbs;
SNAPSH SNAPSHOT_INTERVAL/60
------ --------------------
AUTO 4
</span></span>