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)06/01 Report--
Recently, I have seen a lot of people trying the new 12C feature in oracle-Container Database. Orcle released the Release2 version in March this year, which can be regarded as a stable version. I tried it in the afternoon, but it was pretty good.
1. Preface
CDB and PDB are new features introduced by Oracle 12C. In the multi-rent user environment (Multitenant Environment) introduced by ORACLE 12C databases, one database container (CDB) is allowed to host multiple pluggable databases (PDB). The full name of CDB is ContainerDatabase, the Chinese translation is database container, and the full name of PDB is Pluggable Database. You can plug and unplug the database. Before ORACLE 12C, the instance and database had an one-to-one or many-to-one relationship (RAC): that is, an instance could only be associated with one database, and the database could be loaded by multiple instances. It is impossible for an instance to have an one-to-many relationship with a database. When entering ORACLE 12C, the instance can have an one-to-many relationship with the database.
On the relationship between CDB and PDB
In fact, if you are familiar with SQL SERVER, does this kind of CDB and PDB feel the same thing as SQL SERVER's single-instance multi-database architecture? Like PDB$SEED can be seen as master, msdb and other system databases, PDBS can be seen as user-created databases. The concept of pluggable and the separation and attachment of the user database in SQL SERVER is actually the same thing.
2. CDB component (Components of a CDB)
An CDB database container contains the following components:
-ROOT component
ROOT, also known as CDB$ROOT, stores the metadata and Common User provided by ORACLE. An example of metadata is the source code of the PL/SQL package provided by ORACLE, and Common User is the user that exists in each container.
-SEED component
Seed, also known as PDB$SEED, is the template you use to create a PDBS database. You cannot add or modify an object in Seed. There can be and only one Seed in a CDB. This feeling is very similar to the model database in SQL SERVER.
-PDBS
There can be one or more PDBS,PDBS backward compatible in CDB, and PDBS can be manipulated as before in the database, in this case, most general operations.
Each of these components can be called a container. Therefore, ROOT (root) is a container, Seed (seed) is a container, and each PDB is a container. Each container has a unique ID and name in CDB.
III. Specific operation
1. Check whether the database is CDB
Sqlplus log in to the database
[oracle@oracle12C-R2] $sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Wednesday June 14 15:37:13 2017 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connect to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit Production select name,cdb,open_mode,con_id from vault database share system ORCL > select name,cdb,open_mode,con_id from vault database; NAME CDB OPEN_MODE CON_ID- ORCL YES READ WRITE 0
two。 View the current container
Show con_name
SYS@orcl > show con_name; CON_NAME--CDB$ROOT
3. Create a new PDB
Create pluggable database pdb1 admin user pdb1 identified by pdb1 file_name_convert= ('/ u01Accord oradata plaza'/ u01Accord oradata / oradata')
4. View the PDB created
Show pdbs
SYS@orcl > show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 ORCLPDB MOUNTED 4 PDB1 MOUNTED 5 PDB2 MOUNTED
5. Start a created PDB
Alter pluggable database pdb1 open
Check again
SYS@orcl > show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 ORCLPDB MOUNTED 4 PDB1 READ WRITE NO 5 PDB2 READ WRITE NO
6. Close PDB
SYS@orcl > alter pluggable database pdb2 close; plug-in database has changed. SYS@orcl > show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 ORCLPDB MOUNTED 4 PDB1 READ WRITE NO 5 PDB2 MOUNTED
7. You can also use traditional startup and shutdown commands to start and shut down PDB through sqlplus
The SYS@orcl > alter session set container=pdb2; session has changed. SYS@orcl > show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED- 5 PDB2 MOUNTEDSYS@orcl > startup; plug-in database is open. SYS@orcl > show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED- 5 PDB2 READ WRITE NOSYS@orcl > shutdown immediate; plug-in database is closed. SYS@orcl > show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED- 5 PDB2 MOUNTEDSYS@orcl > alter session set container=CDB$ROOT
The session has changed.
8. Configure the listening file
The listening file directory is in $ORACLE_HOME/network/admin
[oracle@oracle12C-R2 admin] $cat listener.ora# listener.ora Network Configuration File: / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora# Generated by Oracle configuration tools.SID_LIST_LISTENER = (SID_LIST = (SID_DESC= (GLOBAL_DBNAME = ORCL) (SID_NAME = ORCL)) (SID_DESC= (GLOBAL_DBNAME = PDB1) (SID_NAME = PDB1) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.221.165) (PORT = 1521)) (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521) [oracle@oracle12C-R2 admin] $cat tnsnames.ora# tnsnames.ora Network Configuration File: / u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora# Generated by Oracle configuration tools. LISTENER_ORCL = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.221.165) (PORT = 1521)) ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.221.165) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)) PDB1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.221.165) ) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PDB1)
Test login
[oracle@oracle12C-R2 admin] $tnsping pdb1 TNS Ping Utility for Linux: Version 12.2.0.1.0-Production on 14-June-2017 16:02:05 Copyright (c) 1997, 2016, Oracle. All rights reserved. Parameter file used: / u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora has used the TNSNAMES adapter to resolve the alias attempt connection (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.221.165) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PDB1)) OK (10 Ms) [oracle@oracle12C-R2 admin] $sqlplus pdb1/ Pdb1@pdb1 SQL*Plus: Release 12.2.0.1.0 Production on Wednesday 14 June 16:02:28 2017 Copyright (c) 1982 2016, Oracle. All rights reserved. Last successful login time: Wednesday June 14 2017 15:51:38 + 08:00 connect to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit Production PDB1@pdb1 > select name from v$datafile where con_id=4 NAME----/u01/app/oracle/oradata/orcl/pdb1/system01.dbf/u01/app/oracle/oradata/orcl/pdb1/sysaux01.dbf/u01/app/oracle/oradata/orcl/pdb1/undotbs01.dbf PDB1@pdb1 >
When the database is started in 9.oracle12C, PDB does not start with CDB. However, we can start PDB with CDB by creating a trigger. As follows:
SQL > SHOW CON_NAME CON_NAME-- CDB$ROOT SQL > CREATE OR REPLACE TRIGGER open_pdbs AFTER STARTUP ON DATABASE BEGIN EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN'; END open_pdbs; trigger created SQL > SHUTDOWN IMMEDIATE database closed. The database has been uninstalled. The ORACLE routine has been closed. The SQL > STARTUP ORACLE routine has been started. The Total System Global Area 754974720 bytes Fixed Size 2928968 bytes Variable Size 524291768 bytes Database Buffers 222298112 bytes Redo Buffers 5455872 bytes database is loaded. The database is already open. SYS@orcl > show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED- 2 PDB$SEED READ ONLY NO 3 ORCLPDB READ WRITE NO 4 PDB1 READ WRITE NO 5 PDB2 READ WRITE NO
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.