Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert Oracle 12c nocdb to cdb

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to convert Oracle 12c nocdb into cdb". In daily operation, I believe many people have doubts about how to convert Oracle 12c nocdb into cdb. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to convert Oracle 12c nocdb into cdb". Next, please follow the editor to study!

Oracle 12c nocdb converted to cdb

Environment description:

OS:Oracle Linux Server release 6.3

DB:Oracle 12.2.0.1.0

DBName:dapuchai

Scene:

Oracle 11.2.0.4.0 is upgraded to Oracle 12.2.0.1.0. The default is no-cdb mode. After the upgrade, convert no-cdb to cdb as needed, that is, the previous 11.2.0.4.0 data is completely migrated to PDB (Creating a PDB Using a Non-CDB).

Implementation plan:

One: connect non-CDB (dapuchai) to generate a database description file in XML format

2: DBCA New cdb Database (cjcdb)

Three: Plug in the non-CDB (cjcpdb)

Four: execute noncdb_to_pdb.sql

Five: verify the data

Reference: https://docs.oracle.com/database/121/ADMIN/cdb_plug.htm#ADMIN13598

One: connect non-CDB (dapuchai) to generate a database description file in XML format

Connect to the non-CDB, and run the DBMS_PDB.DESCRIBE procedure to construct an XML file that describes the non-CDB.

[root@cjc ~] # ps-ef | grep pmon

Oracle 2677 1 0 22:35? 00:00:00 ora_pmon_dapuchai

Root 3057 2634 0 22:37 pts/1 00:00:00 grep pmon

SQL > select name,cdb from v$database

NAME CDB

DAPUCHAI NO

SQL > show pdbs

SQL > show con_id

CON_ID

-

0

SQL > shutdown immediate

-Open dapuchai database in read-only mode

SQL > startup open read only

SQL > select name,open_mode,cdb from v$database

NAME OPEN_MODE CDB

-

DAPUCHAI READ ONLY NO

-generate a database description file in xml format

SQL > BEGIN

DBMS_PDB.DESCRIBE (pdb_descr_file = >'/ home/oracle/20200113.xml')

END; 2 3

4 /

PL/SQL procedure successfully completed.

2: DBCA New cdb Database (cjcdb)

[oracle@cjc ~] $dbca

Three: Plug in the non-CDB (cjcpdb)

[oracle@cjc oracle12] $ps-ef | grep pmon

Oracle 3106 10 22:38? 00:00:00 ora_pmon_dapuchai

Oracle 4326 1 0 23:05? 00:00:00 ora_pmon_cjcdb

Oracle 5651 3249 0 23:16 pts/1 00:00:00 grep pmon

[oracle@cjc ~] $export ORACLE_SID=cjcdb

[oracle@cjc ~] $sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Mon Jan 13 23:18:52 2020

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit Production

SQL > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

SQL > select name,open_mode,cdb from v$database

NAME OPEN_MODE CDB

-

CJCDB READ WRITE YES

[oracle@cjc oradata] $mkdir cjcpdb

[oracle@cjc oradata] $cd cjcpdb/

[oracle@cjc cjcpdb] $pwd

/ u01/app/oracle12/oradata/cjcpdb

SQL > select name from v$dbfile

NAME

/ u01/app/oracle12/oradata/cjcdb/users01.dbf

/ u01/app/oracle12/oradata/cjcdb/undotbs01.dbf

/ u01/app/oracle12/oradata/cjcdb/system01.dbf

/ u01/app/oracle12/oradata/cjcdb/sysaux01.dbf

/ u01/app/oracle12/oradata/cjcdb/pdbseed/system01.dbf

/ u01/app/oracle12/oradata/cjcdb/pdbseed/sysaux01.dbf

/ u01/app/oracle12/oradata/cjcdb/pdbseed/undotbs01.dbf

7 rows selected.

SQL > create pluggable database cjcpdb using'/ home/oracle/20200113.xml' copy FILE_NAME_CONVERT = ('/ u01apuchaiapuchai,'/ u01apuchaiapuchaiapuchai,'/ u01qapuchai,'/ u01lemapapuchai, oracle12, oracle12, oradata, or orjcpdb)

Pluggable database created.

-data file migration completed

[oracle@cjc cjcpdb] $pwd

/ u01/app/oracle12/oradata/cjcpdb

[oracle@cjc cjcpdb] $ll-rth

Total 2.5G

-rw-r- 1 oracle oinstall 58m Jan 13 23:26 temp01.dbf

-rw-r- 1 oracle oinstall 11m Jan 13 23:26 ogg_temtbs01.dbf

-rw-r- 1 oracle oinstall 11m Jan 13 23:26 ogg_tbs01.dbf

-rw-r- 1 oracle oinstall 11m Jan 13 23:26 cjc_tbs01a.dbf

-rw-r- 1 oracle oinstall 16M Jan 13 23:26 users01.dbf

-rw-r- 1 oracle oinstall 446M Jan 13 23:26 undotbs01.dbf

-rw-r- 1 oracle oinstall 1.2G Jan 13 23:26 system01.dbf

-rw-r- 1 oracle oinstall 881M Jan 13 23:26 sysaux01.dbf

SQL > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

3 CJCPDB MOUNTED

Four: execute noncdb_to_pdb.sql

The virtual machine memory was allocated only 4 gigabytes, and it was a mechanical hard disk. The script was executed for 1 hour.

Switch to PDB and execute the script

SQL > alter session set container=cjcpdb

SQL > @? / rdbms/admin/noncdb_to_pdb.sql

.

.

.

-start pdb

SQL > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

3 CJCPDB MOUNTED

SQL > alter pluggable database cjcpdb open

Pluggable database altered.

Alarm log view pdb startup process

Five: verify the data

[oracle@cjc ~] $cd / u01/app/oracle12/product/12.2.0.1/db_1/network/admin/

[oracle@cjc admin] $vi tnsnames.ora

.

CJCPDB =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = cjc) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = CJCPDB)

)

)

-modify the environment variable to specify the cdb instance

[oracle@cjc ~] $vi .bash _ profile

.

# export ORACLE_SID=dapuchai

Export ORACLE_SID=cjcdb

.

[oracle@cjc ~] $source .bash _ profile

-turn off no-cdb

At this point, the study on "how to convert Oracle 12c nocdb into cdb" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report