Oracle 12c creates pluggable databases (PDB) and user

Source: Internet
Author: User

Because Oracle 12c uses the CDB-PDB architecture, similar to Docker, multiple pluggable-db can be loaded within the CONTAINER-DB, so additional configuration is required after installation to be used.

First, modify the Listener.ora, Tnsnames.ora
# # #listener. ora###
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521))
(Connect_data = (service_name = ORCL))
)

#sid list enumerates the database names for CDB and all PDB, and all SIDs are consistent with the Oracle environment variable #
Sid_list_listener =
(Sid_list =
(Sid_desc =
(Global_dbname = ORCL) #cdb db_name
(Sid_name = ORCL)
)
(Sid_desc =
(Global_dbname = PDBORCL) #pdb db_name
(Sid_name = ORCL)
)
)
# # #listener. ora###

# #tnsnames. ora###

#cdb

ORCL =
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521))
(Connect_data =
(service_name = ORCL) #cdb的db_name
)
)
#pdb
PDBORCL =
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521))

)
(Connect_data =
(service_name = PDBORCL) #pdb的db_name
)
)
# #tnsnames. ora###

Use the "Service_name+domain_name" connection when the client connects. If there's a ora-01017, it's probably

Second, create the PDB

CDB is equivalent to the operating system, invoking and managing each PDB. The PDB is equivalent to a database instance that truly provides business requirements. After the Oracle 12c installation, only the CDB is created and the corresponding PDB needs to be generated itself.

1. Create PDB

Under the Sqlplus:

Create pluggable Database Pdborcl
Admin user pdbadmin identified by pdbadmin
Role= (Resource)
file_name_convert= (' pdb$seed ' s directory ', ' Pdborcl's directory ');

2. Synchronizing files

Select Pdb_name,status from Cdb_pdbs

If the PDB status is need sync, you need:

Alter Sesseion set CONTAINER=PDBORCL
SHUTDOWN immediate or alter pluggable database PDBORCL close immediate;
Alter pluggable database PDBORCL open restricted;
exec dbms_pdb.sync_pdb; #调用dbms_pdb进行pdb


3. New users
Create user Scott account unlock identified by Tiger;
Grant resource to Scott;

Create the user as described above, if ora-01017 appears, it is likely that there is a 1, no connection specified service_name to the specific PDB, or Oracle is sensitive to password case. The former checks whether Sid_list is listed in Listener.ora, and checks whether the connection string is specified in Tnsnames.ora. If you cannot modify the front-end program, you can use

alter system set Sec_case_sensitive_logon = FALSE;

Forces the case check of the Oracle to be closed for confirmation.

Iii. Common Commands

Show PDBs: See how many pdb are contained in the current database container. If the session is in a PDB, you can view the current PDB.

Alter session Set Container=pdbname

Toggles the current session into a PDB. Switch to operate with private users of the current PDB

Startup/shutdown Immediate

Close the cdb/pdb of the current session

Alter pluggable database Pdbname open;

Open the specified PDB

Alter pluggable database Pdbname close immediate;

Close the specified PDB

Oracle 12c creates pluggable databases (PDB) and user

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.