ASM 创建pdb

简介: asm创建pdb,asm克隆pdb.

在相同磁盘磁盘组,使用SEED创建pdb.

1,数据库现有状态为,没有pdb.

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    890      SYSTEM               YES     +DATA/PCDB/DATAFILE/system.266.1036560211
3    570      SYSAUX               NO      +DATA/PCDB/DATAFILE/sysaux.261.1036560245
4    335      UNDOTBS1             YES     +DATA/PCDB/DATAFILE/undotbs1.265.1036560271
5    270      PDB$SEED:SYSTEM      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/system.257.1036560595
6    330      PDB$SEED:SYSAUX      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/sysaux.267.1036560595
7    5        USERS                NO      +DATA/PCDB/DATAFILE/users.264.1036560271
8    100      PDB$SEED:UNDOTBS1    NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/undotbs1.268.1036560595

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    128      TEMP                 32767       +DATA/PCDB/TEMPFILE/temp.258.1036560363
2    36       PDB$SEED:TEMP        32767       +DATA/PCDB/A2385627B2ED789AE053E600A8C098C9/TEMPFILE/temp.269.1036560637

RMAN> 

2,创建pdb01

SQL> show pdbs;

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
SQL>  CREATE PLUGGABLE DATABASE pdb01 ADMIN USER padmin IDENTIFIED BY oracle;

Pluggable database created.

SQL> SHOW PDBS;

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
     3 PDB01              MOUNTED

3,检查数据库文件情况

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    890      SYSTEM               YES     +DATA/PCDB/DATAFILE/system.266.1036560211
3    570      SYSAUX               NO      +DATA/PCDB/DATAFILE/sysaux.261.1036560245
4    335      UNDOTBS1             YES     +DATA/PCDB/DATAFILE/undotbs1.265.1036560271
5    270      PDB$SEED:SYSTEM      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/system.257.1036560595
6    330      PDB$SEED:SYSAUX      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/sysaux.267.1036560595
7    5        USERS                NO      +DATA/PCDB/DATAFILE/users.264.1036560271
8    100      PDB$SEED:UNDOTBS1    NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/undotbs1.268.1036560595
9    270      PDB01:SYSTEM         NO      +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/system.272.1036615745
10   330      PDB01:SYSAUX         NO      +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/sysaux.273.1036615745
11   100      PDB01:UNDOTBS1       NO      +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/undotbs1.271.1036615745

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    128      TEMP                 32767       +DATA/PCDB/TEMPFILE/temp.258.1036560363
2    36       PDB$SEED:TEMP        32767       +DATA/PCDB/A2385627B2ED789AE053E600A8C098C9/TEMPFILE/temp.269.1036560637
3    36       PDB01:TEMP           32767       +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/TEMPFILE/temp.274.1036615767

通过pdb01克隆生成新的pdb02(不需要制定FILE_NAME_CONVERT参数)

SQL> SHOW PDBS;

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
     3 PDB01              MOUNTED

SQL> alter pluggable database pdb01 open;

Pluggable database altered.

SQL> CREATE PLUGGABLE DATABASE pdb02 FROM pdb01;

Pluggable database created.

SQL> show pdbs;

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
     3 PDB01              READ WRITE NO
     5 PDB02              MOUNTED

检查数据库文件情况:

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    890      SYSTEM               YES     +DATA/PCDB/DATAFILE/system.266.1036560211
3    570      SYSAUX               NO      +DATA/PCDB/DATAFILE/sysaux.261.1036560245
4    335      UNDOTBS1             YES     +DATA/PCDB/DATAFILE/undotbs1.265.1036560271
5    270      PDB$SEED:SYSTEM      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/system.257.1036560595
6    330      PDB$SEED:SYSAUX      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/sysaux.267.1036560595
7    5        USERS                NO      +DATA/PCDB/DATAFILE/users.264.1036560271
8    100      PDB$SEED:UNDOTBS1    NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/undotbs1.268.1036560595
9    270      PDB01:SYSTEM         YES     +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/system.272.1036615745
10   330      PDB01:SYSAUX         NO      +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/sysaux.273.1036615745
11   100      PDB01:UNDOTBS1       YES     +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/undotbs1.271.1036615745
12   270      PDB02:SYSTEM         NO      +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/DATAFILE/system.276.1036616815
13   330      PDB02:SYSAUX         NO      +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/DATAFILE/sysaux.277.1036616815
14   100      PDB02:UNDOTBS1       NO      +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/DATAFILE/undotbs1.275.1036616815

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    128      TEMP                 32767       +DATA/PCDB/TEMPFILE/temp.258.1036560363
2    36       PDB$SEED:TEMP        32767       +DATA/PCDB/A2385627B2ED789AE053E600A8C098C9/TEMPFILE/temp.269.1036560637
3    36       PDB01:TEMP           32767       +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/TEMPFILE/temp.274.1036615767
4    36       PDB02:TEMP           32767       +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/TEMPFILE/temp.278.1036616839

pdb创建在另外一个磁盘组

1,新建pdb03需要制定为+DATA2

SQL> CREATE PLUGGABLE DATABASE pdb03 ADMIN USER padmin IDENTIFIED BY oracle FILE_NAME_CONVERT=('+DATA','+DATA02')
  2  ;

Pluggable database created.

SQL> SHOW PDBS;

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
     3 PDB01              READ WRITE NO
     4 PDB03              MOUNTED
     5 PDB02              MOUNTED
SQL>

数据文件使用情况:

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    890      SYSTEM               YES     +DATA/PCDB/DATAFILE/system.266.1036560211
3    570      SYSAUX               NO      +DATA/PCDB/DATAFILE/sysaux.261.1036560245
4    335      UNDOTBS1             YES     +DATA/PCDB/DATAFILE/undotbs1.265.1036560271
5    270      PDB$SEED:SYSTEM      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/system.257.1036560595
6    330      PDB$SEED:SYSAUX      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/sysaux.267.1036560595
7    5        USERS                NO      +DATA/PCDB/DATAFILE/users.264.1036560271
8    100      PDB$SEED:UNDOTBS1    NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/undotbs1.268.1036560595
9    270      PDB01:SYSTEM         YES     +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/system.272.1036615745
10   330      PDB01:SYSAUX         NO      +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/sysaux.273.1036615745
11   100      PDB01:UNDOTBS1       YES     +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/undotbs1.271.1036615745
12   270      PDB02:SYSTEM         NO      +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/DATAFILE/system.276.1036616815
13   330      PDB02:SYSAUX         NO      +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/DATAFILE/sysaux.277.1036616815
14   100      PDB02:UNDOTBS1       NO      +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/DATAFILE/undotbs1.275.1036616815
15   270      PDB03:SYSTEM         NO      +DATA02/PCDB/A2452ADC6EEB6F8DE053E600A8C09846/DATAFILE/system.257.1036617221
16   330      PDB03:SYSAUX         NO      +DATA02/PCDB/A2452ADC6EEB6F8DE053E600A8C09846/DATAFILE/sysaux.258.1036617221
17   100      PDB03:UNDOTBS1       NO      +DATA02/PCDB/A2452ADC6EEB6F8DE053E600A8C09846/DATAFILE/undotbs1.256.1036617221

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    128      TEMP                 32767       +DATA/PCDB/TEMPFILE/temp.258.1036560363
2    36       PDB$SEED:TEMP        32767       +DATA/PCDB/A2385627B2ED789AE053E600A8C098C9/TEMPFILE/temp.269.1036560637
3    36       PDB01:TEMP           32767       +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/TEMPFILE/temp.274.1036615767
4    36       PDB02:TEMP           32767       +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/TEMPFILE/temp.278.1036616839
5    36       PDB03:TEMP           32767       +DATA02/PCDB/A2452ADC6EEB6F8DE053E600A8C09846/TEMPFILE/temp.259.1036617245

pdb克隆在另外一个磁盘组

1,pdb04克隆pdb01(+DATA) ,pdb04位置+DATA02

SQL>  CREATE PLUGGABLE DATABASE pdb04  FROM pdb01 FILE_NAME_CONVERT=('+DATA','+DATA02');

Pluggable database created.

SQL> show pdbs;

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
     3 PDB01              READ WRITE NO
     4 PDB03              MOUNTED
     5 PDB02              MOUNTED
     6 PDB04              MOUNTED

数据文件情况:

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    890      SYSTEM               YES     +DATA/PCDB/DATAFILE/system.266.1036560211
3    570      SYSAUX               NO      +DATA/PCDB/DATAFILE/sysaux.261.1036560245
4    335      UNDOTBS1             YES     +DATA/PCDB/DATAFILE/undotbs1.265.1036560271
5    270      PDB$SEED:SYSTEM      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/system.257.1036560595
6    330      PDB$SEED:SYSAUX      NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/sysaux.267.1036560595
7    5        USERS                NO      +DATA/PCDB/DATAFILE/users.264.1036560271
8    100      PDB$SEED:UNDOTBS1    NO      +DATA/PCDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE/undotbs1.268.1036560595
9    270      PDB01:SYSTEM         YES     +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/system.272.1036615745
10   330      PDB01:SYSAUX         NO      +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/sysaux.273.1036615745
11   100      PDB01:UNDOTBS1       YES     +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/DATAFILE/undotbs1.271.1036615745
12   270      PDB02:SYSTEM         NO      +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/DATAFILE/system.276.1036616815
13   330      PDB02:SYSAUX         NO      +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/DATAFILE/sysaux.277.1036616815
14   100      PDB02:UNDOTBS1       NO      +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/DATAFILE/undotbs1.275.1036616815
15   270      PDB03:SYSTEM         NO      +DATA02/PCDB/A2452ADC6EEB6F8DE053E600A8C09846/DATAFILE/system.257.1036617221
16   330      PDB03:SYSAUX         NO      +DATA02/PCDB/A2452ADC6EEB6F8DE053E600A8C09846/DATAFILE/sysaux.258.1036617221
17   100      PDB03:UNDOTBS1       NO      +DATA02/PCDB/A2452ADC6EEB6F8DE053E600A8C09846/DATAFILE/undotbs1.256.1036617221
18   270      PDB04:SYSTEM         NO      +DATA02/PCDB/A2452ADC6EEE6F8DE053E600A8C09846/DATAFILE/system.261.1036617469
19   330      PDB04:SYSAUX         NO      +DATA02/PCDB/A2452ADC6EEE6F8DE053E600A8C09846/DATAFILE/sysaux.262.1036617469
20   100      PDB04:UNDOTBS1       NO      +DATA02/PCDB/A2452ADC6EEE6F8DE053E600A8C09846/DATAFILE/undotbs1.260.1036617469

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    128      TEMP                 32767       +DATA/PCDB/TEMPFILE/temp.258.1036560363
2    36       PDB$SEED:TEMP        32767       +DATA/PCDB/A2385627B2ED789AE053E600A8C098C9/TEMPFILE/temp.269.1036560637
3    36       PDB01:TEMP           32767       +DATA/PCDB/A2452ADC6EE36F8DE053E600A8C09846/TEMPFILE/temp.274.1036615767
4    36       PDB02:TEMP           32767       +DATA/PCDB/A2452ADC6EE96F8DE053E600A8C09846/TEMPFILE/temp.278.1036616839
5    36       PDB03:TEMP           32767       +DATA02/PCDB/A2452ADC6EEB6F8DE053E600A8C09846/TEMPFILE/temp.259.1036617245
6    36       PDB04:TEMP           32767       +DATA02/PCDB/A2452ADC6EEE6F8DE053E600A8C09846/TEMPFILE/temp.263.1036617495
相关文章
|
存储 Oracle 关系型数据库
|
Oracle 关系型数据库 数据库
|
SQL 测试技术 数据库
|
SQL Oracle 关系型数据库