DBA Hub

📋Steps in this guide1/2

How to unplug and plug in pluggable database in oracle 12c DBACLASS

We can unplug the pluggable database from existing CDB and Plug it in a different CDB or in the same CDB, depending upon the required. While plugging you can keep the pdb name same as before or can give a different name. DEMO: Here i will unplug ORCL pdb and then plug it into the […]

oracle clusteringintermediate
by OracleDba
13 views
1

DEMO:

Here i will unplug ORCL pdb and then plug it into the same CDP with different name ORCL_PLUG Connect to the pluggable database ORCL and close it. Connect to container and unplug pdb to a xml file. Now drop the pluggable database :

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCL 			  READ WRITE NO
	 5 PROD_MN			  READ WRITE NO
SQL> alter session set container=ORCL;

Session altered.

SQL> select file_name from dba_data_files;
 
FILE_NAME
--------------------------------------------------------------------------------
/home/oracle/app/oracle/oradata/cdb1/orcl/system01.dbf
/home/oracle/app/oracle/oradata/cdb1/orcl/sysaux01.dbf

SQL> shutdown immediate;
Pluggable Database closed.

[oracle@localhost orcl_plug]$ sqlplus sys/oracle@cdb1 as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sat Aug 29 03:37:50 2015

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options




SQL> alter pluggable database ORCL unplug into '/home/oracle/orcl_plug.xml';


Pluggable database altered.



  1* select pdb_name, status from dba_pdbs
SQL> /

PDB_NAME    STATUS
----------- ---------
ORCL	    UNPLUGGED
PDB$SEED    NORMAL
PROD_MN     NORMAL

SQL> drop pluggable database orcl;

Pluggable database dropped.
2

PLUGGING:

Here i want to plug the pdb orcl to the Same CDP Connect to root container in target database and create pluggable: Open the PDB:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[oracle@localhost orcl_plug]$ sqlplus sys/oracle@cdb1 as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sat Aug 29 03:37:50 2015

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>  create pluggable database orcl_plug  using '/home/oracle/orcl_plug.xml' FILE_NAME_CONVERT=('/home/oracle/app/oracle/oradata/cdb1/orcl','/home/oracle/app/oracle/oradata/cdb1/orcl_plug');

Pluggable database created.

SQL> alter pluggable database orcl_plug open;
  PDB altered.

SQL> select name, open_mode, total_size from v$pdbs;

NAME			       OPEN_MODE  TOTAL_SIZE
------------------------------ ---------- ----------
PDB$SEED		       READ ONLY   870318080
ORCL_PLUG		       READ WRITE 4396023808
PROD_MN 		       READ WRITE  891289600

Comments (0)

Please to add comments

No comments yet. Be the first to comment!