DBA Hub

📋Steps in this guide1/6

Convert non CDB database to PDB database DBACLASS

Convert non CDB database to PDB database i.e Plugging a normal 12c non pdb database to a container database. create pluggable database NONCDB

oracle clusteringintermediate
by OracleDba
16 views
1

Overview

Below are steps for converting a non CDB/PDB database to PDB database in oracle. i.e Plugging a normal 12c non pdb database to a container database . > READ more about CDB and PDB: Oracle 12c Multitenent architecture READ more about CDB and PDB: Oracle 12c Multitenent architecture NON-CDB DB -NAME -> NONCDB CDB DB NAME -> DBATEST Prerequisites :
2

Section 2

Make sure One container database already exists. > Check out How to create container database Check out How to create container database STEPS :
3

Section 3

1. Open the non-cdb database in read only mode: 2. Check the compatibility of PDB on ( NONCDB)

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
SQL> select name from v$database;

NAME
---------
NONCDB

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup open read only
ORACLE instance started.

Total System Global Area 1.8119E+10 bytes
Fixed Size                  7641528 bytes
Variable Size            1.0133E+10 bytes
Database Buffers         7851737088 bytes
Redo Buffers              126574592 bytes
Database mounted.
Database opened.
SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
NONCDB    READ ONLY

BEGIN
DBMS_PDB.DESCRIBE(pdb_descr_file => '/export/home/oracle/NonCDB.xml');
END;
/

PL/SQL procedure successfully completed.
4

Section 4

3. shutdown the NON-CDB database ( NONCDB) Now connect to the container database, where it need to be plugged. 5. Check the violations:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

SET SERVEROUTPUT ON;
DECLARE
compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(pdb_descr_file => '/export/home/oracle/NonCDB.xml')
WHEN TRUE THEN 'YES'
ELSE 'NO'
END;
BEGIN
DBMS_OUTPUT.PUT_LINE(compatible);
END;
/
5

Section 5

6. Create pluggable database ( DBATEST) 7 . Run the noncdb_to_pdb.sql script

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
select name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONS where name='NONCDB';

NAME                 CAUSE                TYPE
-------------------- -------------------- ---------
MESSAGE                             STATUS
----------------------------------- ---------
NONCDB               Non-CDB to PDB       WARNING
PDB plugged in is a non-CDB,        PENDING
requires noncdb_to_pdb.sql be run.

NONCDB               Parameter            WARNING
CDB parameter memory_target         PENDING
mismatch: Previous 17280M Current
13856M

SQL>  create  pluggable database NONCDB using '/export/home/oracle/NonCDB.xml' NOCOPY;
 create  pluggable database NONCDB using '/export/home/oracle/NonCDB.xml' NOCOPY
*
ERROR at line 1:
ORA-27038: created file already exists
ORA-01119: error in creating database file '/archive/NONCDB/temp01.dbf'


--- As tempfile is already there, so mention tempfile reuse tag, to avoid this error.

SQL> create  pluggable database NONCDB using '/export/home/oracle/NonCDB.xml' NOCOPY tempfile reuse;

Pluggable database created.
6

Section 6

8. 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
26
ALTER SESSION SET CONTAINER=NONCDB;

@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

SQL> ALTER PLUGGABLE DATABASE OPEN;

Pluggable database altered.

SQL> SELECT name, open_mode FROM v$pdbs;


NAME                 OPEN_MODE
-------------------- ----------
NONCDB               READ WRITE

1 row selected.


SQL> select name,open_mode from v$pdbs;

NAME                 OPEN_MODE
-------------------- ----------
PDB$SEED             READ ONLY
PDB1                 READ WRITE
PDB2                 READ WRITE
NONCDB               READ WRITE

Comments (0)

Please to add comments

No comments yet. Be the first to comment!