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

Oracle12C multi-tenant management

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

-- enter cdb

Sqlplus / nolog

Conn sys/sys as dba

-- View basic database information

Select name,cdb from v$database

-- View information about the container

Select con_id,name from v$containers

-- View the path of the data file

Select con_id,file_name from cdb_data_files order by 1

-- displays the current connection container information

Show con_id con_name user

-- displays all pdb

Show pdbs

-- start and stop root containers

-- Startup data

-- CDB

Sqlplus / as sysdba

Startup

-- PDB (all PDB)

Alter pluggable database all open

-- start the pdb1 library

Alter pluggable database pdb1 open

-- close the database

-- CDB

Shutdown immediate

-- pdb1

Alter pluggable database pdb1 close

Alter pluggable database pdb1 close immediate

-- close all pdb

Alter pluggable database all close immediate

-- create public users (sys and system are automatically created public users in pluggable)

Sqlplus / as sysdba

Create user c#dba identified by alex

-- create a public role

Sqlplus / as sysdba

Create role c##dbaprivs container=all

Grant dba to c##dbaprivs container=all

-- Public roles for public users

Grant c##dbaprivs to c#dba container=all

-- switch containers

Alter session set container=ehrpdb

-- switch back to the root container

Alter session set container=cdb$root

-- 2 create a pluggable database

2.1 Clone seed container

Create pluggable database cpcdb

Admin user cpcadm identified by cpcadm

File_name_convert= ('/ oracle/app/oracle/oradata/edw/pdbseed','/oradata/edw/cpcdb/datafile/')

-- 2.2 create a database directly

CREATE PLUGGABLE DATABASE hrdb

ADMIN USER hrdba IDENTIFIED BY hrdba

STORAGE (MAXSIZE 100G MAX_SHARED_TEMP_SIZE 2G)

DEFAULT TABLESPACE hrdb DATAFILE'/ oradata/EDW/hrdb/datafile/hrdb001.dbf' SIZE 512m AUTOEXTEND on next 8M maxsize 10G

CREATE PLUGGABLE DATABASE cpcdb

ADMIN USER cpcdba IDENTIFIED BY cpcdba

STORAGE (MAXSIZE 100G MAX_SHARED_TEMP_SIZE 2G)

DEFAULT TABLESPACE tbscpc DATAFILE'/ oradata/EDW/cpcdb/datafile/tbscpc001.dbf' SIZE 512m AUTOEXTEND on next 8M maxsize 10G

-2.3 create a data case

Create pluggable database cpcdb

Admin user cpcadm identified by cpcadm

File_name_convert= ('/ oracle/app/oracle/oradata/edw/pdbseed','/oradata/edw/cpcdb/datafile/')

Create pluggable database ncdb

Admin user ncadm identified by ncadm

File_name_convert= ('/ oradata/edw/pdbseed','/oradata/edw/ncdb/datafile/')

CREATE PLUGGABLE DATABASE ncdb

ADMIN USER ncdba IDENTIFIED BY ncdba

STORAGE (MAXSIZE 100G MAX_SHARED_TEMP_SIZE 2G)

-- access the ncdb plug-in database

Sqlplus sys/ncdba@oraerp:1521/ncdb as sysdba

-- shut down the PDB database

Alter pluggable database ncdb close immediate

Alter pluggable database hrdb close immediate

Alter pluggable database cpcdb close immediate

Alter pluggable database edwpdb close immediate

-- Delete PDB database

DROP PLUGGABLE DATABASE ncdb INCLUDING DATAFILES

DROP PLUGGABLE DATABASE hrdb INCLUDING DATAFILES

DROP PLUGGABLE DATABASE cpcdb INCLUDING DATAFILES

DROP PLUGGABLE DATABASE edwpdb INCLUDING DATAFILES

-- create a pdb case

-1. Cpcdb

Create pluggable database cpcdb

Admin user cpcadm identified by cpcadm

File_name_convert= ('/ oradata/edw/pdbseed/','/oradata/edw/cpcdb/')

-2. Ncdb

Create pluggable database ncdb

Admin user ncadm identified by ncadm

File_name_convert= ('/ oradata/edw/pdbseed/','/oradata/edw/ncdb/')

-3. Hrdb

Create pluggable database hrdb

Admin user hradm identified by hradm

File_name_convert= ('/ oradata/edw/pdbseed/','/oradata/edw/hrdb/')

Alter pluggable database all open

-- Log into cpcdb

$sqlplus sys/Oracleedw13@192.168.1.2:1531/cpcdb as sysdba

$sqlplus sysplash OraEdwband 23rd 192.168.1.5 purl 1533cdb as sysdba-contains! You need to enter a password separately

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