设为首页收藏本站

Botang唐波's Oracle Station

查看: 133|回复: 0

活动第34/35次(2018-07-01星期日上下午)

[复制链接]

719

主题

1081

帖子

7844

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
7844
发表于 2018-7-1 09:23:00 | 显示全部楼层 |阅读模式
准备插入none-CDB(orcl2)到cdb2:

  1. [oracle@station90 ~]$ . oraenv
  2. ORACLE_SID = [cdb2] ? orcl2
  3. The Oracle base remains unchanged with value /u01/app/oracle
  4. [oracle@station90 ~]$ sqlplus /nolog

  5. SQL*Plus: Release 12.1.0.2.0 Production on Sun Jul 1 09:15:08 2018

  6. Copyright (c) 1982, 2014, Oracle.  All rights reserved.

  7. SQL> conn / as sysdba
  8. Connected.
  9. SQL> shutdown immediate
  10. Database closed.
  11. Database dismounted.
  12. ORACLE instance shut down.
  13. SQL> startup mount
  14. ORACLE instance started.

  15. Total System Global Area 2147483648 bytes
  16. Fixed Size                    2926472 bytes
  17. Variable Size                 1325402232 bytes
  18. Database Buffers          805306368 bytes
  19. Redo Buffers                   13848576 bytes
  20. Database mounted.
  21. SQL> alter database open read only;

  22. Database altered.

  23. SQL> desc dbms_pdb
  24. FUNCTION CHECK_PLUG_COMPATIBILITY RETURNS BOOLEAN
  25. Argument Name                        Type                        In/Out Default?
  26. ------------------------------ ----------------------- ------ --------
  27. PDB_DESCR_FILE                 VARCHAR2                IN
  28. PDB_NAME                        VARCHAR2                IN     DEFAULT
  29. FUNCTION CLEANUP_TASK RETURNS NUMBER
  30. Argument Name                        Type                        In/Out Default?
  31. ------------------------------ ----------------------- ------ --------
  32. TASK_ID                        NUMBER                        IN
  33. PROCEDURE CREATEX$PERMANENTTABLES
  34. PROCEDURE DESCRIBE
  35. Argument Name                        Type                        In/Out Default?
  36. ------------------------------ ----------------------- ------ --------
  37. PDB_DESCR_FILE                 VARCHAR2                IN
  38. PDB_NAME                        VARCHAR2                IN     DEFAULT
  39. PROCEDURE DROPX$PERMANENTTABLES
  40. PROCEDURE EXEC_AS_ORACLE_SCRIPT
  41. Argument Name                        Type                        In/Out Default?
  42. ------------------------------ ----------------------- ------ --------
  43. SQL_STMT                        VARCHAR2                IN
  44. PROCEDURE NONCDB_TO_PDB
  45. Argument Name                        Type                        In/Out Default?
  46. ------------------------------ ----------------------- ------ --------
  47. PHASE                                NUMBER                        IN
  48. PROCEDURE POPULATESYNCTABLE
  49. PROCEDURE RECOVER
  50. Argument Name                        Type                        In/Out Default?
  51. ------------------------------ ----------------------- ------ --------
  52. PDB_DESCR_FILE                 VARCHAR2                IN
  53. PDB_NAME                        VARCHAR2                IN
  54. FILENAMES                        VARCHAR2                IN
  55. PROCEDURE SYNC_PDB
  56. FUNCTION UPDATE_CDBVW_STATS RETURNS NUMBER
  57. FUNCTION UPDATE_COMDATA_STATS RETURNS NUMBER
  58. FUNCTION UPDATE_OBJLINK_STATS RETURNS NUMBER
  59. PROCEDURE UPDATE_VERSION

  60. SQL> show parameter db_name

  61. NAME                                     TYPE         VALUE
  62. ------------------------------------ ----------- ------------------------------
  63. db_name                              string         ORCL2
  64. SQL> exec dbms_pdb.describe('/home/oracle/orcl2.xml') ;

  65. PL/SQL procedure successfully completed.

  66. SQL>
复制代码

多租户书的这一页中的2.是完全没有必要的(原因是orcl2是OMF的数据库)
a.png

书上这么写是因为它的orcl2是普通的文件系统库,并且不是OMF的。前面讲过的,做插件数据库时,必须有自己的临时文件,所以文件名冲突就会报错。

在原处“收编”non-CDB就用nocopy,如果要拷贝方式创建就用file_name_covert:

  1. select  con_id, name , open_mode from v$pdbs;

  2. alter pluggable database all open;

  3. create pluggable database pdb_orcl2 using
  4. '/home/oracle/orcl2.xml' nocopy;

  5. select  con_id, name , open_mode from v$pdbs;
复制代码

b.png

第一件事情就是去清理, non-CDB中原来的undo表空间和临时文件:
  1. [oracle@station90 cdb2]$ . oraenv
  2. ORACLE_SID = [orcl2] ? +ASM
  3. The Oracle base remains unchanged with value /u01/app/oracle
  4. [oracle@station90 cdb2]$ asmcmd
  5. ASMCMD> ls
  6. DATA/
  7. FRA/
  8. ASMCMD> cd data
  9. ASMCMD> ls
  10. CDB1/
  11. CDB2/
  12. ORCL2/
  13. ASMCMD> cd orcl2
  14. ASMCMD> ls
  15. AUTOBACKUP/
  16. CONTROLFILE/
  17. DATAFILE/
  18. ONLINELOG/
  19. PARAMETERFILE/
  20. TEMPFILE/
  21. spfileorcl2.ora
  22. ASMCMD> d datafile
  23. ASMCMD-9487: 'd' cannot be run with 'sysasm' privilege
  24. ASMCMD> cd datafile
  25. ASMCMD> ls
  26. EXAMPLE.270.980156363
  27. SYSAUX.269.980156355
  28. SYSTEM.267.980156347
  29. UNDOTBS1.268.980156349
  30. USERS.271.980156367
  31. ASMCMD> rm UNDOTBS1.268.980156349
  32. ASMCMD>
复制代码

  1. ASMCMD> cd ..
  2. ASMCMD> ls
  3. CDB1/
  4. CDB2/
  5. ORCL2/
  6. ASMCMD> cd ORCL2/
  7. ASMCMD> ls
  8. AUTOBACKUP/
  9. CONTROLFILE/
  10. DATAFILE/
  11. ONLINELOG/
  12. PARAMETERFILE/
  13. TEMPFILE/

  14. spfileorcl2.ora
  15. ASMCMD> cd TEMPFILE/
  16. ASMCMD> ls
  17. TEMP.260.980157325
  18. ASMCMD> rm TEMP.260.980157325
  19. ASMCMD>
复制代码
第二步:为了完成整个操作,不得不通过从PDB SYSTEM表空间中删除不必要的元数据(数据字典)来转换刚刚插入的 non-CDB到正确的PDB状态。
  1. cdexttab.sql                   exfcpu.sql                           prvtbrse.plb          prvtsnps.plb        xsutil.sql
  2. [oracle@station90 admin]$ ls -l non*
  3. -rw-r--r-- 1 oracle oinstall 33608  6月 14 2014 noncdb_to_pdb.sql
  4. [oracle@station90 admin]$ sqlplus /nolog

  5. SQL*Plus: Release 12.1.0.2.0 Production on Sun Jul 1 09:42:48 2018

  6. Copyright (c) 1982, 2014, Oracle.  All rights reserved.

  7. SQL> conn sys/oracle_4U@pdb_orcl2 as sysdba
  8. Connected.
  9. SQL> @noncdb_to_pdb.sql
  10. SQL> SET SERVEROUTPUT ON
  11. SQL> SET FEEDBACK 1
  12. SQL> SET NUMWIDTH 10
  13. SQL> SET LINESIZE 80
  14. SQL> SET TRIMSPOOL ON
  15. SQL> SET TAB OFF
  16. SQL> SET PAGESIZE 100
  17. SQL>
  18. SQL> WHENEVER SQLERROR EXIT;
  19. SQL>
  20. SQL> DOC
  21. DOC>#######################################################################
  22. DOC>#######################################################################
  23. DOC>   The following statement will cause an "ORA-01403: no data found"
  24. DOC>   error if we're not in a PDB.
  25. DOC>   This script is intended to be run right after plugin of a PDB,
  26. DOC>   while inside the PDB.
  27. DOC>#######################################################################
  28. DOC>#######################################################################
  29. DOC>#
  30. SQL>
  31. SQL> VARIABLE cdbname VARCHAR2(128)
  32. SQL> VARIABLE pdbname VARCHAR2(128)
  33. SQL> BEGIN
  34.   2    SELECT sys_context('USERENV', 'CDB_NAME')
  35.   3      INTO :cdbname
  36.   4      FROM dual
  37.   5      WHERE sys_context('USERENV', 'CDB_NAME') is not null;
  38.   6    SELECT sys_context('USERENV', 'CON_NAME')
  39.   7      INTO :pdbname
  40.   8      FROM dual
  41.   9      WHERE sys_context('USERENV', 'CON_NAME') <> 'CDB$ROOT';
复制代码
附:如果要拷贝方式创建就用file_name_covert:
  1. create pluggable database pdb_orcl2 using
  2. '/home/oracle/orcl2.xml'
  3. file_name_convert=('+data/orcl2/datafile/SYSTEM.267.980156347', '/u01/app/oracle/oradata/cdb2/pdb_orcl2/system01.dbf',
  4.                               '+data/orcl2/datafile/SYSAUX.269.980156355','/u01/app/oracle/oradata/cdb2/pdb_orcl2/sysaux01.dbf',
  5.                               '+data/orcl2/datafile/USERS.271.980156367','/u01/app/oracle/oradata/cdb2/pdb_orcl2/users01.dbf',
  6.                               '+data/orcl2/datafile/EXAMPLE.270.980156363','/u01/app/oracle/oradata/cdb2/pdb_orcl2/example01.dbf'
  7. );
复制代码
----------------------------------------------------------------------------------------------------------------------------------------
拔出一个插件数据库:
  1. [root@station90 ~]# su - oracle
  2. [oracle@station90 ~]$ . oraenv
  3. ORACLE_SID = [cdb2] ? cdb1
  4. The Oracle base remains unchanged with value /u01/app/oracle
  5. [oracle@station90 ~]$ sqlplus /nolog

  6. SQL*Plus: Release 12.1.0.2.0 Production on Sun Jul 1 09:55:47 2018

  7. Copyright (c) 1982, 2014, Oracle.  All rights reserved.

  8. SQL> conn / as sysdba
  9. Connected.
  10. SQL> select  con_id, name , open_mode from v$pdbs;

  11.     CON_ID NAME                           OPEN_MODE
  12. ---------- ------------------------------ ----------
  13.          2 PDB$SEED                          READ ONLY
  14.          3 PDB1_1                          MOUNTED

  15. SQL> alter pluggable database pdb1_1 open ;

  16. Pluggable database altered.

  17. SQL> alter pluggable database pdb1_1 unplug into '/home/oracle/pdb1_1.xml';
  18. alter pluggable database pdb1_1 unplug into '/home/oracle/pdb1_1.xml'
  19. *
  20. ERROR at line 1:
  21. ORA-65025: Pluggable database PDB1_1 is not closed on all instances.


  22. SQL> alter pluggable database pdb1_1 close;

  23. Pluggable database altered.

  24. SQL> select  con_id, name , open_mode from v$pdbs;

  25.     CON_ID NAME                           OPEN_MODE
  26. ---------- ------------------------------ ----------
  27.          2 PDB$SEED                          READ ONLY
  28.          3 PDB1_1                          MOUNTED

  29. SQL> alter pluggable database pdb1_1 unplug into '/home/oracle/pdb1_1.xml';

  30. Pluggable database altered.

  31. SQL> select  con_id, name , open_mode from v$pdbs;

  32.     CON_ID NAME                           OPEN_MODE
  33. ---------- ------------------------------ ----------
  34.          2 PDB$SEED                          READ ONLY
  35.          3 PDB1_1                          MOUNTED

  36. SQL> desc cdb_pdbs
  37. Name                                           Null?    Type
  38. ----------------------------------------- -------- ----------------------------
  39. PDB_ID                                    NOT NULL NUMBER
  40. PDB_NAME                                   NOT NULL VARCHAR2(128)
  41. DBID                                           NOT NULL NUMBER
  42. CON_UID                                   NOT NULL NUMBER
  43. GUID                                                    RAW(16)
  44. STATUS                                             VARCHAR2(9)
  45. CREATION_SCN                                            NUMBER
  46. VSN                                                    NUMBER
  47. LOGGING                                            VARCHAR2(9)
  48. FORCE_LOGGING                                            VARCHAR2(3)
  49. FORCE_NOLOGGING                                    VARCHAR2(3)
  50. CON_ID                                    NOT NULL NUMBER

  51. SQL> select  PDB_NAME, CON_ID, STATUS from cdb_pdbs;

  52. PDB_NAME
  53. --------------------------------------------------------------------------------
  54.     CON_ID STATUS
  55. ---------- ---------
  56. PDB1_1
  57.          3 UNPLUGGED

  58. PDB$SEED
  59.          2 NORMAL


  60. SQL>
复制代码

keep datafiles的反义词是including datafiles(drop pluggable database pdb1_1 including datafiles):
  1. SQL> drop pluggable database pdb1_1 keep datafiles;

  2. Pluggable database dropped.

  3. SQL> select  PDB_NAME, CON_ID, STATUS from cdb_pdbs;

  4. PDB_NAME
  5. --------------------------------------------------------------------------------
  6.     CON_ID STATUS
  7. ---------- ---------
  8. PDB$SEED
  9.          2 NORMAL


  10. SQL> select  con_id, name , open_mode from v$pdbs;

  11.     CON_ID NAME                           OPEN_MODE
  12. ---------- ------------------------------ ----------
  13.          2 PDB$SEED                          READ ONLY

  14. SQL>
复制代码
对拔出来的插件数据库检查兼容性:
  1. select  * from cdb_pdbs;

  2. declare
  3.   v1  boolean;
  4. begin
  5.    v1 := dbms_pdb.check_plug_compatibility(
  6.    pdb_descr_file => '/home/oracle/pdb1_1.xml',
  7.    pdb_name => 'PDB1_1');
  8.    if v1=true then
  9.       dbms_output.put_line('OK');
  10.    end if;
  11. end;
  12.    
  13.   select  * from pdb_plug_in_violations;
复制代码
插入插件数据库时,与之前的non-CDB语法是一样的:
在原处“收编”non-CDB就用nocopy,如果要拷贝方式创建就用file_name_covert。
  1. create pluggable database pdb1_1 using '/home/oracle/pdb1_1.xml' nocopy;

  2. select  con_id,name,open_mode from v$pdbs;

  3. select  * from cdb_pdbs;

  4. alter pluggable database pdb1_1 open;
复制代码
清理一下CRS并且注册一下Cloud Control:
  1. [oracle@station90 ~]$ srvctl remove database  -db orcl2
  2. 是否删除数据库 orcl2? (y/[n]) y
  3. [oracle@station90 ~]$ crs_stat -t
  4. Name           Type           Target    State     Host        
  5. ------------------------------------------------------------
  6. ora.DATA.dg    ora....up.type ONLINE    ONLINE    station90   
  7. ora.FRA.dg     ora....up.type ONLINE    ONLINE    station90   
  8. ora....ER.lsnr ora....er.type ONLINE    ONLINE    station90   
  9. ora.asm        ora.asm.type   ONLINE    ONLINE    station90   
  10. ora.cdb1.db    ora....se.type OFFLINE   OFFLINE               
  11. ora.cdb2.db    ora....se.type ONLINE    ONLINE    station90   
  12. ora.cssd       ora.cssd.type  ONLINE    ONLINE    station90   
  13. ora.diskmon    ora....on.type OFFLINE   OFFLINE               
  14. ora.emrep.db   ora....se.type ONLINE    ONLINE    station90   
  15. ora.evmd       ora.evm.type   ONLINE    ONLINE    station90   
  16. ora.ons        ora.ons.type   OFFLINE   OFFLINE               
  17. ora.orcl.db    ora....se.type ONLINE    ONLINE    station90   
  18. [oracle@station90 ~]$ srvctl remove database  -db cdb1  
  19. 是否删除数据库 cdb1? (y/[n]) y
  20. [oracle@station90 ~]$ crs_stat -t
  21. Name           Type           Target    State     Host        
  22. ------------------------------------------------------------
  23. ora.DATA.dg    ora....up.type ONLINE    ONLINE    station90   
  24. ora.FRA.dg     ora....up.type ONLINE    ONLINE    station90   
  25. ora....ER.lsnr ora....er.type ONLINE    ONLINE    station90   
  26. ora.asm        ora.asm.type   ONLINE    ONLINE    station90   
  27. ora.cdb2.db    ora....se.type ONLINE    ONLINE    station90   
  28. ora.cssd       ora.cssd.type  ONLINE    ONLINE    station90   
  29. ora.diskmon    ora....on.type OFFLINE   OFFLINE               
  30. ora.emrep.db   ora....se.type ONLINE    ONLINE    station90   
  31. ora.evmd       ora.evm.type   ONLINE    ONLINE    station90   
  32. ora.ons        ora.ons.type   OFFLINE   OFFLINE               
  33. ora.orcl.db    ora....se.type ONLINE    ONLINE    station90   
  34. [oracle@station90 ~]$
复制代码

c.png

---------------------------------------------------------------

d.png

-------------------------------------------------------------
e.png


----------------------------------------------------------

alter pluggable database all close如果关不掉,杀进程:

1.png

after startup触发器:
  1. create or replace trigger trigger1
  2. after startup on database
  3. begin
  4.   execute immediate 'alter pluggable database all open';
  5. end;

  6. select  * from cdb_triggers t where t.TRIGGER_NAME='TRIGGER1';
复制代码
要打开restricted模式,可以不用关闭数据库(包括插件数据库):
  1. SQL> alter system enable restricted session;

  2. System altered.

  3. SQL> select  con_id, name , open_mode , RESTRICTED from v$pdbs
  4.   2  ;

  5.     CON_ID NAME                           OPEN_MODE  RES
  6. ---------- ------------------------------ ---------- ---
  7.          3 PDB2_1                          READ WRITE YES

复制代码
代替书上:
2.png

  1. SQL> alter pluggable database rename global_name to pdb2;
  2. alter pluggable database rename global_name to pdb2
  3.                                                *
  4. ERROR at line 1:
  5. ORA-65045: pluggable database not in a restricted mode


  6. SQL> alter system enable restricted session;

  7. System altered.

  8. SQL> select  con_id, name , open_mode , RESTRICTED from v$pdbs
  9.   2  ;

  10.     CON_ID NAME                           OPEN_MODE  RES
  11. ---------- ------------------------------ ---------- ---
  12.          3 PDB2_1                          READ WRITE YES

  13. SQL> alter pluggable database rename global_name to pdb2;

  14. Pluggable database altered.

  15. SQL> select  con_id, name , open_mode , RESTRICTED from v$pdbs
  16.   2  ;

  17.     CON_ID NAME                           OPEN_MODE  RES
  18. ---------- ------------------------------ ---------- ---
  19.          3 PDB2                           READ WRITE YES

  20. SQL> conn / as sysdba
  21. Connected.
  22. SQL> select  con_id, name , open_mode , RESTRICTED from v$pdbs;

  23.     CON_ID NAME                           OPEN_MODE  RES
  24. ---------- ------------------------------ ---------- ---
  25.          2 PDB$SEED                          READ ONLY  NO
  26.          3 PDB2                           READ WRITE YES
  27.          4 PDB2_2                          READ WRITE NO
  28.          5 PDB_ORCL2                          READ WRITE NO
  29.          6 PDB1_1                          READ WRITE NO

  30. SQL> conn sys/oracle_4U@pdb2_1 as sysdba
  31. ERROR:
  32. ORA-12514: TNS:listener does not currently know of service requested in connect
  33. descriptor


  34. Warning: You are no longer connected to ORACLE.
  35. SQL> conn sys/oracle_4U@pdb2 as sysdba
  36. Connected.
  37. SQL> alter system disable restricted session;

  38. System altered.

  39. SQL> select  con_id, name , open_mode , RESTRICTED from v$pdbs;

  40.     CON_ID NAME                           OPEN_MODE  RES
  41. ---------- ------------------------------ ---------- ---
  42.          3 PDB2                           READ WRITE NO

  43. SQL> conn / as sysdba
  44. Connected.
  45. SQL> select  con_id, name , open_mode , RESTRICTED from v$pdbs;

  46.     CON_ID NAME                           OPEN_MODE  RES
  47. ---------- ------------------------------ ---------- ---
  48.          2 PDB$SEED                          READ ONLY  NO
  49.          3 PDB2                           READ WRITE NO
  50.          4 PDB2_2                          READ WRITE NO
  51.          5 PDB_ORCL2                          READ WRITE NO
  52.          6 PDB1_1                          READ WRITE NO

  53. SQL>
复制代码
在多租户环境中少有的对V$视图的改变:
V$PARAMETER看自己的,而V$SYSTEM_PARAMETER看所有插件库的。
  1. SQL> show con_name

  2. CON_NAME
  3. ------------------------------
  4. PDB2
  5. SQL> select  name , value from v$system_parameter  where name like 'optimizer_use_sql%';

  6. NAME
  7. --------------------------------------------------------------------------------
  8. VALUE
  9. --------------------------------------------------------------------------------
  10. optimizer_use_sql_plan_baselines
  11. FALSE


  12. SQL> conn / as sysdba
  13. Connected.
  14. SQL> select  name , value from v$system_parameter  where name like 'optimizer_use_sql%';

  15. NAME
  16. --------------------------------------------------------------------------------
  17. VALUE
  18. --------------------------------------------------------------------------------
  19. optimizer_use_sql_plan_baselines
  20. TRUE

  21. optimizer_use_sql_plan_baselines
  22. FALSE


  23. SQL> select con_id, name , value from v$system_parameter  where name like 'optimizer_use_sql%';

  24.     CON_ID
  25. ----------
  26. NAME
  27. --------------------------------------------------------------------------------
  28. VALUE
  29. --------------------------------------------------------------------------------
  30.          0
  31. optimizer_use_sql_plan_baselines
  32. TRUE

  33.          3
  34. optimizer_use_sql_plan_baselines
  35. FALSE

  36.     CON_ID
  37. ----------
  38. NAME
  39. --------------------------------------------------------------------------------
  40. VALUE
  41. --------------------------------------------------------------------------------

复制代码
就像参数一样,表空间在插件数据库之间,也是有个性设置的:
3.png

看表空间和数据文件的关系,尽量查v$视图(关联):
4.png


-------------------------------------------------------------------

书上的多租户实验环境中的公共用户一共有多少个:
CDB$ROOT有36个:
  1. select  u.USERNAME
  2. from  cdb_users u where u.COMMON='YES'  and con_id=1;
复制代码
因此由于传递性,所以PDB2、PDB2_2和PDB1_1这3个插件数据库共有36*3=108个公共用户。

独立数据库(pdb_orcl2)插入后变成插件数据库的只有33个公共用户(少3个):
  1. select  u.USERNAME
  2. from  cdb_users u where u.COMMON='YES'  and con_id=1
  3.   minus
  4.   select   u.USERNAME
  5. from  cdb_users u where u.COMMON='YES'  and con_id=5;
复制代码

   USERNAME
1DVF
2DVSYS
3LBACSYS

所以整个CDB2中有:36(根容器)+108+33=177个公共用户。
  1.   select  u.USERNAME
  2. from  cdb_users u where u.COMMON='YES' ;
复制代码

------------------------------------------------------------------------------------------
多租户ag书的P128页,是第一次做授权。与建用户不同的是,授权时,要明确说明container=all,才会进行公共授权(而建用户时,不写container=ALL实际上默认就是container=all):
5.png


-----------------------------------------------------------------------------------

书上的多租户实验环境中的公共角色一共有多少个:
CDB$ROOT有84个:
  1. select * from  cdb_roles u where u.COMMON='YES'  and con_id=1;
复制代码
因此由于传递性,所以PDB2、PDB2_2和PDB1_1这3个插件数据库共有84*3=252个公共角色。

独立数据库(pdb_orcl2)插入后变成插件数据库的只有68个公共角色(少16个):
  1.   select  role  from  cdb_roles u where u.COMMON='YES'  and con_id=1
  2. minus
  3.   select  role from  cdb_roles u where u.COMMON='YES'  and con_id=5;
复制代码
   ROLE
1DV_ADMIN
2DV_GOLDENGATE_ADMIN
3DV_GOLDENGATE_REDO_ACCESS
4DV_OWNER
5DV_AUDIT_CLEANUP
6DV_DATAPUMP_NETWORK_LINK
7DV_REALM_RESOURCE
8DV_XSTREAM_ADMIN
9LBAC_DBA
10DV_PATCH_ADMIN
11DV_STREAMS_ADMIN
12DV_MONITOR
13DV_PUBLIC
14DV_REALM_OWNER
15DV_ACCTMGR
16DV_SECANALYST

独立数据库(pdb_orcl2)插入后变成插件数据库还有5个本地role:
   CON_IDCOMMONROLE
15NOCWM_USER
25NOOLAPI_TRACE_USER
35NOOWB$CLIENT
45NOOWB_DESIGNCENTER_VIEW
55NOOWB_USER


所以整个CDB2中有:84(根容器)+252+68+5=409个角色(其中公共角色404个,本地角色5个)。
  1. select  r.CON_ID, r.COMMON, r.ROLE
  2. from cdb_roles r;
复制代码

-----------------------------------------------------------------------------------------

新特性container_data:

6.png

----------------------------------------
  1. select  * from cdb_container_data d
  2. where d.USERNAME  not like '%INTERNAL'
  3.   and d.USERNAME not like 'APP%'  and d.USERNAME<>'DBSNMP';
  4.   
  5.   alter user c##jfv
  6.   set container_data=(cdb$root)
  7.   for v_$session
  8.   container=current;
复制代码

-----------------------------------------------
  1. [oracle@station90 ~]$ rman target /

  2. Recovery Manager: Release 12.1.0.2.0 - Production on Sun Jul 1 17:52:12 2018

  3. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: CDB2 (DBID=727229478)

  5. RMAN> ALTER SYSTEM SET db_recovery_file_dest_size=
  6. 2> 24G;

  7. using target database control file instead of recovery catalog
  8. Statement processed

  9. RMAN> list backup;

  10. specification does not match any backup in the repository

  11. RMAN> list copy;

  12. specification does not match any datafile copy in the repository
  13. specification does not match any control file copy in the repository
  14. specification does not match any archived log in the repository

  15. RMAN> backup tag '1T_WHOLE_INCR0' incremental level 0 database plus archivelog delete all input;  


  16. Starting backup at 2018-07-01:17:54:12
  17. current log archived
  18. allocated channel: ORA_SBT_TAPE_1
  19. channel ORA_SBT_TAPE_1: SID=320 device type=SBT_TAPE
  20. channel ORA_SBT_TAPE_1: Oracle Secure Backup
  21. allocated channel: ORA_SBT_TAPE_2
  22. channel ORA_SBT_TAPE_2: SID=326 device type=SBT_TAPE
  23. channel ORA_SBT_TAPE_2: Oracle Secure Backup
  24. channel ORA_SBT_TAPE_1: starting archived log backup set
  25. channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
  26. input archived log thread=1 sequence=62 RECID=1 STAMP=980358852
  27. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-01:17:54:26
  28. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-01:17:54:51
  29. piece handle=01t6u5mi_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  30. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:25
  31. channel ORA_SBT_TAPE_1: deleting archived log(s)
  32. archived log file name=/u01/app/oracle/fast_recovery_area/CDB2/archivelog/2018_07_01/o1_mf_1_62_fmk964v6_.arc RECID=1 STAMP=980358852
  33. Finished backup at 2018-07-01:17:54:51

  34. Starting backup at 2018-07-01:17:54:52
  35. using channel ORA_SBT_TAPE_1
  36. using channel ORA_SBT_TAPE_2
  37. channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
  38. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  39. input datafile file number=00001 name=/u01/app/oracle/oradata/cdb2/system01.dbf
  40. input datafile file number=00004 name=/u01/app/oracle/oradata/cdb2/undotbs01.dbf
  41. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-01:17:54:52
  42. channel ORA_SBT_TAPE_2: starting incremental level 0 datafile backup set
  43. channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
  44. input datafile file number=00003 name=/u01/app/oracle/oradata/cdb2/sysaux01.dbf
  45. input datafile file number=00024 name=/u01/app/oracle/oradata/cdb2/cdata_01.dbf
  46. input datafile file number=00006 name=/u01/app/oracle/oradata/cdb2/users01.dbf
  47. channel ORA_SBT_TAPE_2: starting piece 1 at 2018-07-01:17:54:52
  48. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-01:17:55:17
  49. piece handle=02t6u5nc_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  50. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:25
  51. channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
  52. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  53. input datafile file number=00011 name=/u01/app/oracle/oradata/cdb2/pdb2_1/sysaux01.dbf
  54. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-01:17:55:17
  55. channel ORA_SBT_TAPE_2: finished piece 1 at 2018-07-01:17:55:17
  56. piece handle=03t6u5nc_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  57. channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:25
  58. channel ORA_SBT_TAPE_2: starting incremental level 0 datafile backup set
  59. channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
  60. input datafile file number=00013 name=/u01/app/oracle/oradata/cdb2/pdb2_2/CDB2/6FDA0B7BDBCD67DAE0535A00A8C0D512/datafile/o1_mf_sysaux_fmgo7cnk_.dbf
  61. channel ORA_SBT_TAPE_2: starting piece 1 at 2018-07-01:17:55:17
  62. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-01:17:55:42
  63. piece handle=04t6u5o5_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  64. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:25
  65. channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
  66. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  67. input datafile file number=00007 name=/u01/app/oracle/oradata/cdb2/pdbseed/sysaux01.dbf
  68. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-01:17:55:43
  69. channel ORA_SBT_TAPE_2: finished piece 1 at 2018-07-01:17:55:43
  70. piece handle=05t6u5o5_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  71. channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:26
  72. channel ORA_SBT_TAPE_2: starting incremental level 0 datafile backup set
  73. channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
  74. input datafile file number=00010 name=/u01/app/oracle/oradata/cdb2/pdb2_1/system01.dbf
  75. input datafile file number=00025 name=/u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf
  76. channel ORA_SBT_TAPE_2: starting piece 1 at 2018-07-01:17:55:43
  77. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-01:17:56:08
  78. piece handle=06t6u5ov_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  79. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:25
  80. channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
  81. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  82. input datafile file number=00012 name=/u01/app/oracle/oradata/cdb2/pdb2_2/CDB2/6FDA0B7BDBCD67DAE0535A00A8C0D512/datafile/o1_mf_system_fmgo7cnj_.dbf
  83. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-01:17:56:08
  84. channel ORA_SBT_TAPE_2: finished piece 1 at 2018-07-01:17:56:08
  85. piece handle=07t6u5ov_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  86. channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:25
  87. channel ORA_SBT_TAPE_2: starting incremental level 0 datafile backup set
  88. channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
  89. input datafile file number=00005 name=/u01/app/oracle/oradata/cdb2/pdbseed/system01.dbf
  90. channel ORA_SBT_TAPE_2: starting piece 1 at 2018-07-01:17:56:08
  91. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-01:17:56:33
  92. piece handle=08t6u5po_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  93. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:25
  94. channel ORA_SBT_TAPE_2: finished piece 1 at 2018-07-01:17:56:33
  95. piece handle=09t6u5po_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  96. channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:25
  97. Finished backup at 2018-07-01:17:56:33

  98. Starting backup at 2018-07-01:17:56:33
  99. current log archived
  100. using channel ORA_SBT_TAPE_1
  101. using channel ORA_SBT_TAPE_2
  102. channel ORA_SBT_TAPE_1: starting archived log backup set
  103. channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
  104. input archived log thread=1 sequence=63 RECID=2 STAMP=980358994
  105. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-01:17:56:34
  106. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-01:17:56:59
  107. piece handle=0at6u5qi_1_1 tag=1T_WHOLE_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  108. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:25
  109. channel ORA_SBT_TAPE_1: deleting archived log(s)
  110. archived log file name=/u01/app/oracle/fast_recovery_area/CDB2/archivelog/2018_07_01/o1_mf_1_63_fmk9bl78_.arc RECID=2 STAMP=980358994
  111. Finished backup at 2018-07-01:17:56:59

  112. Starting Control File and SPFILE Autobackup at 2018-07-01:17:56:59
  113. piece handle=c-727229478-20180701-00 comment=API Version 2.0,MMS Version 10.4.0.4
  114. Finished Control File and SPFILE Autobackup at 2018-07-01:17:57:24

  115. RMAN> report schema;

  116. Report of database schema for database with db_unique_name CDB2

  117. List of Permanent Datafiles
  118. ===========================
  119. File Size(MB) Tablespace           RB segs Datafile Name
  120. ---- -------- -------------------- ------- ------------------------
  121. 1    790      SYSTEM               YES     /u01/app/oracle/oradata/cdb2/system01.dbf
  122. 3    700      SYSAUX               NO      /u01/app/oracle/oradata/cdb2/sysaux01.dbf
  123. 4    645      UNDOTBS1             YES     /u01/app/oracle/oradata/cdb2/undotbs01.dbf
  124. 5    250      PDB$SEED:SYSTEM      NO      /u01/app/oracle/oradata/cdb2/pdbseed/system01.dbf
  125. 6    5        USERS                NO      /u01/app/oracle/oradata/cdb2/users01.dbf
  126. 7    550      PDB$SEED:SYSAUX      NO      /u01/app/oracle/oradata/cdb2/pdbseed/sysaux01.dbf
  127. 10   260      PDB2:SYSTEM          NO      /u01/app/oracle/oradata/cdb2/pdb2_1/system01.dbf
  128. 11   580      PDB2:SYSAUX          NO      /u01/app/oracle/oradata/cdb2/pdb2_1/sysaux01.dbf
  129. 12   260      PDB2_2:SYSTEM        NO      /u01/app/oracle/oradata/cdb2/pdb2_2/CDB2/6FDA0B7BDBCD67DAE0535A00A8C0D512/datafile/o1_mf_system_fmgo7cnj_.dbf
  130. 13   580      PDB2_2:SYSAUX        NO      /u01/app/oracle/oradata/cdb2/pdb2_2/CDB2/6FDA0B7BDBCD67DAE0535A00A8C0D512/datafile/o1_mf_sysaux_fmgo7cnk_.dbf
  131. 24   10       CDATA                NO      /u01/app/oracle/oradata/cdb2/cdata_01.dbf
  132. 25   10       PDB2:LDATA           NO      /u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf

  133. List of Temporary Files
  134. =======================
  135. File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
  136. ---- -------- -------------------- ----------- --------------------
  137. 1    197      TEMP                 32767       /u01/app/oracle/oradata/cdb2/temp01.dbf
  138. 2    100      PDB$SEED:TEMP        32767       /u01/app/oracle/oradata/cdb2/pdbseed/pdbseed_temp012018-06-30_04-54-31-PM.dbf
  139. 3    20       PDB2:TEMP            32767       /u01/app/oracle/oradata/cdb2/pdb2_1/pdbseed_temp012018-06-30_04-54-31-PM.dbf
  140. 4    20       PDB2_2:TEMP          32767       /u01/app/oracle/oradata/cdb2/pdb2_2/CDB2/6FDA0B7BDBCD67DAE0535A00A8C0D512/datafile/o1_mf_temp_fmgo7cnk_.dbf
  141. 7    500      TEMP_ROOT            500         /u01/app/oracle/oradata/cdb2/temproot_01.dbf
  142. 8    100      PDB2:TEMP_PDB2       100         /u01/app/oracle/oradata/cdb2/pdb2_1/temppdb2_01.dbf
  143. 9    10       PDB2:MY_TEMP         10          /u01/app/oracle/oradata/cdb2/pdb2_1/my_temp_pdb2_01.dbf

  144. RMAN> list backup of datafile 25;


  145. List of Backup Sets
  146. ===================


  147. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  148. ------- ---- -- ---------- ----------- ------------ -------------------
  149. 7       Incr 0  209.00M    SBT_TAPE    00:00:10     2018-07-01:17:55:53
  150.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  151.         Handle: 07t6u5ov_1_1   Media: station90-000004
  152.   List of Datafiles in backup set 7
  153.   File LV Type Ckp SCN    Ckp Time            Name
  154.   ---- -- ---- ---------- ------------------- ----
  155.   25   0  Incr 3792981    2018-07-01:17:55:43 /u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf

  156. RMAN> list backup of datafile 24;


  157. List of Backup Sets
  158. ===================


  159. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  160. ------- ---- -- ---------- ----------- ------------ -------------------
  161. 3       Incr 0  534.50M    SBT_TAPE    00:00:14     2018-07-01:17:55:06
  162.         BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  163.         Handle: 03t6u5nc_1_1   Media: station90-000004
  164.   List of Datafiles in backup set 3
  165.   File LV Type Ckp SCN    Ckp Time            Name
  166.   ---- -- ---- ---------- ------------------- ----
  167.   24   0  Incr 3792946    2018-07-01:17:54:52 /u01/app/oracle/oradata/cdb2/cdata_01.dbf

  168. RMAN> list backup of datafile 10;


  169. List of Backup Sets
  170. ===================


  171. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  172. ------- ---- -- ---------- ----------- ------------ -------------------
  173. 7       Incr 0  209.00M    SBT_TAPE    00:00:10     2018-07-01:17:55:53
  174.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  175.         Handle: 07t6u5ov_1_1   Media: station90-000004
  176.   List of Datafiles in backup set 7
  177.   File LV Type Ckp SCN    Ckp Time            Name
  178.   ---- -- ---- ---------- ------------------- ----
  179.   10   0  Incr 3792981    2018-07-01:17:55:43 /u01/app/oracle/oradata/cdb2/pdb2_1/system01.dbf

  180. RMAN>
复制代码

其中pdb2的备份:
  1. RMAN> list backup of  datafile 10;


  2. List of Backup Sets
  3. ===================


  4. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  5. ------- ---- -- ---------- ----------- ------------ -------------------
  6. 7       Incr 0  209.00M    SBT_TAPE    00:00:10     2018-07-01:17:55:53
  7.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  8.         Handle: 07t6u5ov_1_1   Media: station90-000004
  9.   List of Datafiles in backup set 7
  10.   File LV Type Ckp SCN    Ckp Time            Name
  11.   ---- -- ---- ---------- ------------------- ----
  12.   10   0  Incr 3792981    2018-07-01:17:55:43 /u01/app/oracle/oradata/cdb2/pdb2_1/system01.dbf

  13. RMAN> list backup of  datafile 11;


  14. List of Backup Sets
  15. ===================


  16. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  17. ------- ---- -- ---------- ----------- ------------ -------------------
  18. 4       Incr 0  462.50M    SBT_TAPE    00:00:12     2018-07-01:17:55:29
  19.         BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  20.         Handle: 04t6u5o5_1_1   Media: station90-000003
  21.   List of Datafiles in backup set 4
  22.   File LV Type Ckp SCN    Ckp Time            Name
  23.   ---- -- ---- ---------- ------------------- ----
  24.   11   0  Incr 3792968    2018-07-01:17:55:17 /u01/app/oracle/oradata/cdb2/pdb2_1/sysaux01.dbf

  25. RMAN> list backup of  datafile 25;


  26. List of Backup Sets
  27. ===================


  28. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  29. ------- ---- -- ---------- ----------- ------------ -------------------
  30. 7       Incr 0  209.00M    SBT_TAPE    00:00:10     2018-07-01:17:55:53
  31.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  32.         Handle: 07t6u5ov_1_1   Media: station90-000004
  33.   List of Datafiles in backup set 7
  34.   File LV Type Ckp SCN    Ckp Time            Name
  35.   ---- -- ---- ---------- ------------------- ----
  36.   25   0  Incr 3792981    2018-07-01:17:55:43 /u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf

复制代码
新语法:插件数据库单独备份:
  1. RMAN> backup tag '2T_PDB2_INCR0' incremental level 0 pluggable database pdb2;

  2. Starting backup at 2018-07-01:18:03:03
  3. using channel ORA_SBT_TAPE_1
  4. using channel ORA_SBT_TAPE_2
  5. channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
  6. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  7. input datafile file number=00011 name=/u01/app/oracle/oradata/cdb2/pdb2_1/sysaux01.dbf
  8. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-01:18:03:03
  9. channel ORA_SBT_TAPE_2: starting incremental level 0 datafile backup set
  10. channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
  11. input datafile file number=00010 name=/u01/app/oracle/oradata/cdb2/pdb2_1/system01.dbf
  12. input datafile file number=00025 name=/u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf
  13. channel ORA_SBT_TAPE_2: starting piece 1 at 2018-07-01:18:03:03
  14. channel ORA_SBT_TAPE_2: finished piece 1 at 2018-07-01:18:03:28
  15. piece handle=0dt6u66n_1_1 tag=2T_PDB2_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  16. channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:25
  17. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-01:18:03:38
  18. piece handle=0ct6u66n_1_1 tag=2T_PDB2_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  19. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:35
  20. Finished backup at 2018-07-01:18:03:38

  21. Starting Control File and SPFILE Autobackup at 2018-07-01:18:03:38
  22. piece handle=c-727229478-20180701-01 comment=API Version 2.0,MMS Version 10.4.0.4
  23. Finished Control File and SPFILE Autobackup at 2018-07-01:18:04:03

  24. RMAN>
复制代码

效果:
  1. RMAN> list backup of datafile 10;


  2. List of Backup Sets
  3. ===================


  4. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  5. ------- ---- -- ---------- ----------- ------------ -------------------
  6. 7       Incr 0  209.00M    SBT_TAPE    00:00:10     2018-07-01:17:55:53
  7.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  8.         Handle: 07t6u5ov_1_1   Media: station90-000004
  9.   List of Datafiles in backup set 7
  10.   File LV Type Ckp SCN    Ckp Time            Name
  11.   ---- -- ---- ---------- ------------------- ----
  12.   10   0  Incr 3792981    2018-07-01:17:55:43 /u01/app/oracle/oradata/cdb2/pdb2_1/system01.dbf

  13. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  14. ------- ---- -- ---------- ----------- ------------ -------------------
  15. 12      Incr 0  209.00M    SBT_TAPE    00:00:09     2018-07-01:18:03:12
  16.         BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: 2T_PDB2_INCR0
  17.         Handle: 0dt6u66n_1_1   Media: station90-000003
  18.   List of Datafiles in backup set 12
  19.   File LV Type Ckp SCN    Ckp Time            Name
  20.   ---- -- ---- ---------- ------------------- ----
  21.   10   0  Incr 3794250    2018-07-01:18:03:03 /u01/app/oracle/oradata/cdb2/pdb2_1/system01.dbf

  22. RMAN> list backup of datafile 11;


  23. List of Backup Sets
  24. ===================


  25. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  26. ------- ---- -- ---------- ----------- ------------ -------------------
  27. 4       Incr 0  462.50M    SBT_TAPE    00:00:12     2018-07-01:17:55:29
  28.         BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  29.         Handle: 04t6u5o5_1_1   Media: station90-000003
  30.   List of Datafiles in backup set 4
  31.   File LV Type Ckp SCN    Ckp Time            Name
  32.   ---- -- ---- ---------- ------------------- ----
  33.   11   0  Incr 3792968    2018-07-01:17:55:17 /u01/app/oracle/oradata/cdb2/pdb2_1/sysaux01.dbf

  34. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  35. ------- ---- -- ---------- ----------- ------------ -------------------
  36. 13      Incr 0  462.50M    SBT_TAPE    00:00:19     2018-07-01:18:03:22
  37.         BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: 2T_PDB2_INCR0
  38.         Handle: 0ct6u66n_1_1   Media: station90-000004
  39.   List of Datafiles in backup set 13
  40.   File LV Type Ckp SCN    Ckp Time            Name
  41.   ---- -- ---- ---------- ------------------- ----
  42.   11   0  Incr 3794249    2018-07-01:18:03:03 /u01/app/oracle/oradata/cdb2/pdb2_1/sysaux01.dbf

  43. RMAN> list backup of datafile 25;


  44. List of Backup Sets
  45. ===================


  46. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  47. ------- ---- -- ---------- ----------- ------------ -------------------
  48. 7       Incr 0  209.00M    SBT_TAPE    00:00:10     2018-07-01:17:55:53
  49.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  50.         Handle: 07t6u5ov_1_1   Media: station90-000004
  51.   List of Datafiles in backup set 7
  52.   File LV Type Ckp SCN    Ckp Time            Name
  53.   ---- -- ---- ---------- ------------------- ----
  54.   25   0  Incr 3792981    2018-07-01:17:55:43 /u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf

  55. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  56. ------- ---- -- ---------- ----------- ------------ -------------------
  57. 12      Incr 0  209.00M    SBT_TAPE    00:00:09     2018-07-01:18:03:12
  58.         BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: 2T_PDB2_INCR0
  59.         Handle: 0dt6u66n_1_1   Media: station90-000003
  60.   List of Datafiles in backup set 12
  61.   File LV Type Ckp SCN    Ckp Time            Name
  62.   ---- -- ---- ---------- ------------------- ----
  63.   25   0  Incr 3794250    2018-07-01:18:03:03 /u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf

  64. RMAN>
复制代码
新语法:
  1. RMAN> backup tag '3T_PDB2:LDATA_INCR0' incremental level 0 tablespace pdb2:ldata;

  2. Starting backup at 2018-07-01:18:07:27
  3. using channel ORA_SBT_TAPE_1
  4. using channel ORA_SBT_TAPE_2
  5. channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
  6. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  7. input datafile file number=00025 name=/u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf
  8. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-01:18:07:27
  9. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-01:18:07:52
  10. piece handle=0ft6u6ev_1_1 tag=3T_PDB2:LDATA_INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  11. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:25
  12. Finished backup at 2018-07-01:18:07:52

  13. Starting Control File and SPFILE Autobackup at 2018-07-01:18:07:52
  14. piece handle=c-727229478-20180701-02 comment=API Version 2.0,MMS Version 10.4.0.4
  15. Finished Control File and SPFILE Autobackup at 2018-07-01:18:08:17
复制代码
效果:
  1. RMAN> list backup of datafile 25;  


  2. List of Backup Sets
  3. ===================


  4. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  5. ------- ---- -- ---------- ----------- ------------ -------------------
  6. 7       Incr 0  209.00M    SBT_TAPE    00:00:10     2018-07-01:17:55:53
  7.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: 1T_WHOLE_INCR0
  8.         Handle: 07t6u5ov_1_1   Media: station90-000004
  9.   List of Datafiles in backup set 7
  10.   File LV Type Ckp SCN    Ckp Time            Name
  11.   ---- -- ---- ---------- ------------------- ----
  12.   25   0  Incr 3792981    2018-07-01:17:55:43 /u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf

  13. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  14. ------- ---- -- ---------- ----------- ------------ -------------------
  15. 12      Incr 0  209.00M    SBT_TAPE    00:00:09     2018-07-01:18:03:12
  16.         BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: 2T_PDB2_INCR0
  17.         Handle: 0dt6u66n_1_1   Media: station90-000003
  18.   List of Datafiles in backup set 12
  19.   File LV Type Ckp SCN    Ckp Time            Name
  20.   ---- -- ---- ---------- ------------------- ----
  21.   25   0  Incr 3794250    2018-07-01:18:03:03 /u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf

  22. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  23. ------- ---- -- ---------- ----------- ------------ -------------------
  24. 15      Incr 0  1.25M      SBT_TAPE    00:00:09     2018-07-01:18:07:36
  25.         BP Key: 15   Status: AVAILABLE  Compressed: NO  Tag: 3T_PDB2:LDATA_INCR0
  26.         Handle: 0ft6u6ev_1_1   Media: station90-000003
  27.   List of Datafiles in backup set 15
  28.   File LV Type Ckp SCN    Ckp Time            Name
  29.   ---- -- ---- ---------- ------------------- ----
  30.   25   0  Incr 3794482    2018-07-01:18:07:27 /u01/app/oracle/oradata/cdb2/pdb2_1/ldata_01.dbf

  31. RMAN>
复制代码








回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Botang唐波's Oracle Station   

GMT+8, 2018-9-18 22:06 , Processed in 0.117076 second(s), 27 queries .

快速回复 返回顶部 返回列表