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

Oracle 12C CDB, PDB common management commands

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

-- View PDB information (in CDB mode)

Show pdbs-- View all pdbselect name,open_mode from vdatabases;-- v$pdbs is PDB Information View select con_id, dbid, guid, name,open_mode from v$pdbs

-- switch containers

Alter session set container=orcl1-- switch to PDBorcl1 container alter session set container=CDB$ROOT-- switch to CDB container

-- check which container currently belongs to

Select sys_context ('USERENV','CON_NAME') from dual;-- use sys_context to see which container show con_name belongs to-- use show to see which container currently belongs

-- start PDB

Alter pluggable database orcl1 open;-- enable specified PDBalter pluggable database all open;-- enable all PDBalter session set container=orcl1;-- switch to PDB to open database startup

-- close PDB

Alter pluggable database orcl1 close;-- close the specified PDBalter pluggable database all close;-- close all PDBalter session set container=orcl1;-- switch to PDB to go in and close the database shutdown immediate

-- specify the location of the file map before creating or cloning (sysdba permission under CBD is required)

Alter system set db_create_file_dest='/u01/app/oracle/oradata/orcl/orcl2'

-- create a new PDB: (sysdba permission under CBD is required)

Create pluggable database test admin user admin identified by admin; alter pluggable database test_pdb open;-Open test_pdb

-- Clone PDB (sysdba permission under CBD is required)

Create pluggable database orcl2 from orcl1;-- test_pdb must be open before alter pluggable database orcl2 open; can be opened-- and then open the pdb

-- Delete PDB (sysdba permission under CBD is required)

Alter pluggable database orcl2 close;-- drop pluggable database orcl2 including datafiles; cannot be deleted until closed-- delete PDB orcl2

-- set CDB to start PDB auto-start (trigger is used in this case)

CREATE OR REPLACE TRIGGER open_pdbsAFTER STARTUP ON DATABASEBEGINEXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';END open_pdbs;/

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