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 create pdb for oracle 12 DBCA

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces oracle 12 DBCA how to create pdb, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

12c the new pdb is a new database management mode, which is different from the traditional database. Today's lab uses the dbca graphical interface to create a pdb, and then uses dbca's silent way to create a pdb.

Pdb is a pluggable database, of course, it can not be separated from cdb. C is container, the container.

The environment variables are as follows

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1

Export ORACLE_SID=CDB

Export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH

Export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

Export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

If there is a wrong report here, Error in Process:/u01/app/oracle/product/12.1.0/db_1/perl/bin/perl

See my other blog, http://blog.itpub.net/29047826/viewspace-1434056/.

Connect to the root library through SQL PLUS

[oracle@snow ~] $sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sun Feb 8 16:11:18 2015

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

Connected to:

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

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Check the pdb status, which is already open (read write)

SQL >

SQL > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

3 PDB1 READ WRITE NO

After installation, the graphics include root library CDB$ROOT,con_id 1, seed bank PDB$SEED,con_id 2, and the pluggable library pdb1,con_id 3.

SQL > select con_id,name from v$containers

CON_ID NAME

1 CDB$ROOT

2 PDB$SEED

3 PDB1

By viewing the cdb_data_files data dictionary, you can see the data files of cdb and pdb

SQL > col file_name for A60

SQL > set line 120

SQL > select con_id,file_name from cdb_data_files order by 1

CON_ID FILE_NAME

1/ u01/app/oracle/oradata/CDB/system01.dbf

1/ u01/app/oracle/oradata/CDB/users01.dbf

1/ u01/app/oracle/oradata/CDB/undotbs01.dbf

1/ u01/app/oracle/oradata/CDB/sysaux01.dbf

2 / u01/app/oracle/oradata/CDB/pdbseed/sysaux01.dbf

2 / u01/app/oracle/oradata/CDB/pdbseed/system01.dbf

3 / u01/app/oracle/oradata/CDB/pdb1/sysaux01.dbf

3 / u01/app/oracle/oradata/CDB/pdb1/pdb1_users01.dbf

3 / u01/app/oracle/oradata/CDB/pdb1/system01.dbf

If you switch to pdb, you can only see your own data file.

SQL > alter session set container=pdb1

SQL > col name for A60

SQL > select con_id,name from v$datafile

CON_ID NAME

0 / u01/app/oracle/oradata/CDB/undotbs01.dbf

3 / u01/app/oracle/oradata/CDB/pdb1/system01.dbf

3 / u01/app/oracle/oradata/CDB/pdb1/sysaux01.dbf

3 / u01/app/oracle/oradata/CDB/pdb1/pdb1_users01.dbf

Because my virtual machine space is small, delete the cdb and pdb I just created with dbca before executing the following script. Note that dbca does not clean up the physical files on disk after deleting the database. It needs to be deleted manually, such as rm-rf $ORACLE_BASE/oradata/CDB. This command is only an example. Do not imitate it.

The following dbca-silent... Statement is a complete statement that does not wrap. The keyword inside is createAsContainerDatabase true, if not this keyword creates a normal database, not the CDB we need this time.

After the command is executed, output Copying database files.. 1% complete

[oracle@snow] $dbca-silent-createDatabase-templateName General_Purpose.dbc-gdbname CDB-sid CDB-responseFile NO_VALUE-characterSet AL32UTF8-memoryPercentage 30-emConfiguration LOCAL-createAsContainerDatabase true-sysPassword oracle-systemPassword oracle

Copying database files

1% complete

3% complete

37% complete

Creating and starting Oracle instance

40% complete

45% complete

46% complete

47% complete

52% complete

57% complete

58% complete

59% complete

62% complete

Completing Database Creation

66% complete

70% complete

74% complete

85% complete

96% complete

100% complete

Look at the log file "/ u01/app/oracle/cfgtoollogs/dbca/CDB/CDB.log" for further details.

At this point, the CDB is created, and its contents are viewed through the following sql statement.

[oracle@snow ~] $sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sun Feb 8 16:51:36 2015

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

Connected to:

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

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

SQL >

SQL > select con_id,name from v$containers

CON_ID NAME

1 CDB$ROOT

2 PDB$SEED

SQL > col file_name for A60

SQL > select con_id,file_name from cdb_data_files order by 1

CON_ID FILE_NAME

1/ u01/app/oracle/oradata/CDB/system01.dbf

1/ u01/app/oracle/oradata/CDB/users01.dbf

1/ u01/app/oracle/oradata/CDB/undotbs01.dbf

1/ u01/app/oracle/oradata/CDB/sysaux01.dbf

2 / u01/app/oracle/oradata/CDB/pdbseed/sysaux01.dbf

2 / u01/app/oracle/oradata/CDB/pdbseed/system01.dbf

Let's create a pdb through the seed container

[oracle@snow ~] $sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sun Feb 8 16:59:03 2015

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

Connected to:

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

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL > create pluggable database pdb1 admin user pdb1adm identified by oracle file_name_convert= ('/ u01 *

Pluggable database created.

The status of pdb at this time is mounted

SQL > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

3 PDB1 MOUNTED

The following query statement only follows the information of the library and cannot display the information of pdb.

SQL > select con_id,file_name from cdb_data_files order by 1

CON_ID FILE_NAME

1/ u01/app/oracle/oradata/CDB/system01.dbf

1/ u01/app/oracle/oradata/CDB/sysaux01.dbf

1/ u01/app/oracle/oradata/CDB/undotbs01.dbf

1/ u01/app/oracle/oradata/CDB/users01.dbf

2 / u01/app/oracle/oradata/CDB/pdbseed/sysaux01.dbf

2 / u01/app/oracle/oradata/CDB/pdbseed/system01.dbf

Open all pdb libraries with the following command

SQL > alter pluggable database all open

Pluggable database altered.

At this point, the state of pdb has changed from mount to read write.

SQL > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

3 PDB1 READ WRITE NO

Execute the following query again to see the data file for pdb

SQL > select con_id,file_name from cdb_data_files order by 1

CON_ID FILE_NAME

1/ u01/app/oracle/oradata/CDB/system01.dbf

1/ u01/app/oracle/oradata/CDB/users01.dbf

1/ u01/app/oracle/oradata/CDB/undotbs01.dbf

1/ u01/app/oracle/oradata/CDB/sysaux01.dbf

2 / u01/app/oracle/oradata/CDB/pdbseed/system01.dbf

2 / u01/app/oracle/oradata/CDB/pdbseed/sysaux01.dbf

3 / u01/app/oracle/oradata/CDB/pdb1/system01.dbf

3 / u01/app/oracle/oradata/CDB/pdb1/sysaux01.dbf

Thank you for reading this article carefully. I hope the article "how to create pdb with oracle 12 DBCA" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!

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

Database

Wechat

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

12
Report