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

Oracle 12c Non CDB database switch to PDB

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

If the database is upgraded from 10.2 (11g) to 12c or created in 12c, the database is NON CDB, which is no different from the version before 12c, so it is common to convert 12cnoncdb to pdb for management.

The test steps are as follows:

One: source library

1.

Select name,CDB from v$database

NAME CDB

ERPDB NO

SQL >

SQL > set lines 150

SQL > select * from v$version

BANNER CON_ID

-

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0-64bit Production 0

PL/SQL Release 12.1.0.2.0-Production 0

CORE 12.1.0.2.0 Production 0

TNS for Linux: Version 12.1.0.2.0-Production 0

NLSRTL Version 12.1.0.2.0-Production 0

Note: run the following script before conversion

two。

@? / rdbms/admin/utluppkg.sql

SET SERVEROUTPUT ON

Exec dbms_preup.run_fixup_and_report ('INVALID_SYS_TABLEDATA')

Exec dbms_preup.run_fixup_and_report ('INVALID_USR_TABLEDATA')

If you do not run the noncdb_to_pdb.sql, the following error will be reported

SQL > SELECT rpad (u.nameme128) TABLENAME, rpad (o.nameme128) OWNER

2 rpad (c.namemar128) COLNAME FROM SYS.OBJ$ o, SYS.COL$ c, SYS.COLTYPE$ t

3 SYS.USER$ u

4 WHERE o.OBJ# = t.OBJ# AND c.OBJ# = t.OBJ# AND c.COL# = t.COL#

5 AND t.INTCOL# = c.INTCOL# AND BITAND (t.FLAGS, 256) = 256

6 AND o.OWNER# = u.USER# AND o.OWNER# NOT IN

7 (SELECT UNIQUE (d.USER_ID) FROM SYS.DBA_USERS d, SYS.REGISTRY$ r

8 WHERE d.USER_ID = r.SCHEMA# and r.NAMESPACEThe server

WHERE d.USER_ID = r.SCHEMA# and r.NAMESPACESERVER')

*

ERROR at line 8:

3. Boot the database to read-only mode

Startup open read only

4. Generate xml file

BEGIN

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

END

/

Shut immediate

Two: target library

1. Check compatibility

SET SERVEROUTPUT ON

DECLARE

Compatible CONSTANT VARCHAR2 (3): = CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY (pdb_descr_file = >'/ home/oracle/scripts/erpdbPDB.xml')

WHEN TRUE THEN 'YES'

ELSE 'NO'

END

BEGIN

DBMS_OUTPUT.PUT_LINE (compatible)

END

/

two。 Check for errors that can occur in Convert

Elect name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONS where name='ERPDB'

3. Create a pluggable database

CREATE PLUGGABLE DATABASE erpdb USING'/ home/oracle/scripts/erpdbPDB.xml'

Copy

FILE_NAME_CONVERT = ('/ u01qoraclemax oradataActionerpdbscarp sys01.bdftogether,'/ u01plicatableoradataUniplicatableoradataSys01.bdf'

'/ u01Universe oraclemax oradataUniverse,' / u01Grexample oradataplicationsys03.bdf` / u01Uniplicateoraclelemoradataandpdbprodlemoradata

'/ u01Universe oraclemax oradataUniverse,' / u01helplash oraclelemoradata Universe,'/ u01UniplicateoraclelemoradataandpdbprodlemoradataUniplicationsys04.bdf'

'/ u01qqoracleqoradataplicationerpdbpdbtemp01.dbfencoding magicalityu01andapplyoradataandpdbprodlemoradataplemp01.dbf')

Pluggable database created.

4. Run the script $ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

SQL > SQL > ALTER SESSION SET CONTAINER=erpdb

SQL > @ $ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql (about 40 minutes)

SQL >

SQL >-- leave the PDB in the same state it was when we started

SQL > BEGIN

2 execute immediate'& open_sql & restricted_state'

3 EXCEPTION

4 WHEN OTHERS THEN

5 BEGIN

6 IF (sqlcode-900) THEN

7 RAISE

8 END IF

9 END

10 END

11 /

PL/SQL procedure successfully completed.

SQL >

SQL >

SQL > WHENEVER SQLERROR CONTINUE

SQL >

Show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

3 ERPDB MOUNTED

5. Open the pdb database

Alter pluggable database erpdb open

Pluggable database altered.

SQL > SELECT name, open_mode FROM v$pdbs

NAME OPEN_MODE

ERPDB READ WRITE

SQL > col cause for A20

SQL > col name for A20

SQL > col message for A35 word_wrapped

SQL > select name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONS where name='ERPDB'

No rows selected

Reference documentation

How to Convert Non-CDB to PDB Database in 12c-Testcase (document ID 2012448.1)

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