In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "Oracle 12c how to create and delete PDB", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn how to create and delete PDB "this article.
1. Create PDB by hand
When you create a PDB from SEED database, you can specify the location where the files are stored. There are two ways to specify the location of the file.
The first is to add the FILE_NAME_CONVERT option to the CREATE PLUGGABLE DATABASE syntax.
Http://www.cndba.cn/dave/article/221
Http://www.cndba.cn/dave/article/221
SQL > set lin 120SQL > col name for a60SQL > select * from v$dbfile 13 / u01/app/oracle/oradata/dave/pdb1/ado2.dbf 3 14 / u01/app/oracle/oradata/dave/pdb1/cndba01.dbf 3 22 / u01/app/oracle/oradata/dave/cndba/system.dbf 4 23 / u01/app/oracle/oradata/dave/cndba/sysaux.dbf 4 24 / u01/app/oracle/oradata/dave/cndba/users. Dbf 4 25 / u01/app/oracle/oradata/dave/cndba/ado1.dbf 4 26 / u01/app/oracle/oradata/dave/cndba/ado2.dbf 418 rows selected.
View the location of PDB and create a new directory:
[oracle@Ora12c ~] $mkdir / u01/app/oracle/oradata/dave/huainingSQL > create pluggable database huaining admin user cndba identified by cndbafile_name_convert= ('/ u01 Pluggable database created) Pluggable database created.
It can also be abbreviated: http://www.cndba.cn/dave/article/221
Create pluggable database huaining admin user cndba identified by cndbafile_name_convert= ('pdbseed','huaining') SQL > show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 CNDBA READ WRITE NO 5 HUAINING MOUNTED
-- check the status of PDB: it is NEW, and the test is not available.
Http://www.cndba.cn/dave/article/221
SQL > set lin 120SQL > col pdb_name for a15SQL > select pdb_name,status from dba_pdbs;PDB_NAME STATUS--PDB1 NORMALPDB$SEED NORMALCNDBA NORMALHUAINING NEW
Open database that must be displayed: http://www.cndba.cn/dave/article/221
SQL > alter pluggable database huaining open Pluggable database altered.SQL > show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 CNDBA READ WRITE NO 5 HUAINING READ WRITE NOSQL > select pdb_name Status from dba_pdbs PDB_NAME STATUS--PDB1 NORMALPDB$SEED NORMALCNDBA NORMALHUAINING NORMAL
The second way is to specify the value of the PDB_FILE_NAME_CONVERT parameter and then execute the create command without specifying the FILE_NAME_CONVERT option.
Http://www.cndba.cn/dave/article/221
[oracle@Ora12c pdbseed] $mkdir / u01/app/oracle/oradata/dave/ahdbaSQL > show parameter pdb_NAME TYPE VALUE-- pdb_ File_name_convert stringpdb_lockdown stringpdb_os_credential stringSQL > alter session set pdb_file_name_convert='/u01/app/oracle/oradata/dave/pdbseed/' '/ u01 apprenticeship oradatascarpUS01ActionoradataUniple daveUniverse Session altered.SQL > show parameter pdb_NAME TYPE VALUE-- pdb_file_name_convert string / u01/app/oracle/oradata/dave/p dbseed/ / u01/app/oracle/orada ta/dave/ahdba/pdb_lockdown stringpdb_os_credential stringSQL > SQL > create pluggable database ahdba admin user cndba identified by cndba Pluggable database created.SQL > show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 CNDBA READ WRITE NO 5 HUAINING READ WRITE NO 6 AHDBA MOUNTEDSQL > alter pluggable database ahdba open Pluggable database altered.SQL > show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 CNDBA READ WRITE NO 5 HUAINING READ WRITE NO 6 AHDBA READ WRITE NOSQL >
two。 Delete PDB manually
When you delete a PDB, you have two options, KEEP DATAFILES and including DATAFILES, and the default is KEEP.
SQL > show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 CNDBA READ WRITE NO 5 HUAINING READ WRITE NO 6 AHDBA READ WRITE NOSQL > drop pluggable database huaining Drop pluggable database huaining*ERROR at line 1:ORA-65179: cannot keep datafiles for a pluggable database that is not unpluggedSQL >! oerr ora 6517965179, 00000, "cannot keep datafiles for a pluggable database that is not unplugged" / / * Cause: An attempt was made to drop a pluggable database without// specifying the INCLUDING DATAFILES clause And the pluggable// database has not been unplugged.// * Action: Unplug the pluggable database before dropping the pluggable// database or use the INCLUDING DATAFILES clause in the// DROP PLUGGABLE DATABASE statement.//SQL > drop pluggable database huaining including datafiles Pluggable database dropped.SQL > show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 CNDBA READ WRITE NO 6 AHDBA READ WRITE NOSQL > operating system level The corresponding file is also deleted: [oracle@Ora12c huaining] $pwd/u01/app/oracle/oradata/dave/huaining [oracle@Ora12c huaining] $ls [oracle@Ora12c huaining] $
If you are using KEEP datafiles, you must perform the operation of unplug before you can execute drop.
SQL > drop pluggable database ahdba keep datafiles;drop pluggable database ahdba keep datafiles*ERROR at line 1:ORA-65179: cannot keep datafiles for a pluggable database that is not unpluggedSQL > alter pluggable database ahdba unplug into'/ tmp/ahdba.xml';Pluggable database altered.SQL > drop pluggable database ahdba keep datafiles;Pluggable database dropped.
Deleted successfully.
The above is all the content of the article "how Oracle 12c creates and deletes PDB". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.