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

The connection between CDB and PDB

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

Share

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

1. Connect

Sqlplus system/xxxxx@10.8.5.206:1521/pdbtest

ALTER SESSION SET CONTAINER = PDB$SEED

two。 Switch connections in CDB

C:\ Users\ Administrator > sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Friday December 15 09:33:39 2017

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connect to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit Production

SQL > show con_name

CON_NAMECDB$ROOT

SQL > select name from v$pdbs

NAME

PDB$SEED

PDBTEST

CLONEPDB_PLUG

SQL > alter session set container=PDBTEST

The session has changed.

SQL > select name from v$pdbs

NAME

-PDBTEST

SQL > show con_name

CON_NAME

PDBTEST

SQL > alter session set container=CLONEPDB_PLUG

The session has changed.

SQL > show con_name

CON_NAME

-- CLONEPDB_PLUG

3.CDB instance shutdown and startup

3.1 close

C:\ Users\ Administrator > sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Friday December 15 09:40:41 2017

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connect to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit Production

SQL > shutdown immediate

The database has been closed.

Database has been uninstalled

The ORACLE routine has been closed.

3.2 Startup channel nomount status

The SQL > startup nomount ORACLE routine has been started.

Total System Global Area 2768240640 bytes

Fixed Size 8922760 bytes Variable Size 704645496 bytes Database Buffers 2046820352 bytes Redo Buffers 7852032 bytes

SQL > set line 200

SQL > col con_id format A40

SQL > col name format A20

SQL > col open_mode format A20

SQL > select con_id,name,open_mode from v$pdbs

No rows selected

3.3.Open to mount status

SQL > alter database mount

The database has changed.

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE-

# PDB$SEED MOUNTED

# PDBTEST MOUNTED

# CLONEPDB_PLUG MOUNTED

3.3 Open the database

SQL > alter database open

The database has changed.

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE

# PDB$SEED READ ONLY

# PDBTEST MOUNTED

# CLONEPDB_PLUG MOUNTED

4.PDB on and off

4.1 Open a

SQL > alter pluggable database pdbtest open read write

The plug-in database has changed.

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE

# PDB$SEED READ ONLY

# PDBTEST READ WRITE

# CLONEPDB_PLUG MOUNTED

4.2 close a

5.SQL > alter pluggable database pdbtest close

The plug-in database has changed.

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE

# PDB$SEED READ ONLY

# PDBTEST MOUNTED

# CLONEPDB_PLUG MOUNTED

4.3 turn all on / off

SQL > alter pluggable database all open read write

The plug-in database has changed.

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE

# PDB$SEED READ ONLY

# PDBTEST READ WRITE

# CLONEPDB_PLUG READ WRITE

SQL > alter pluggable database all close

The plug-in database has changed.

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE

# PDB$SEED READ ONLY

# PDBTEST MOUNTED

# CLONEPDB_PLUG MOUNTED

4.4 platoon, open it.

SQL > alter pluggable database all except PDBTEST open read write

The plug-in database has changed.

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE

# PDB$SEED READ ONLY

# PDBTEST MOUNTED

# CLONEPDB_PLUG READ WRITE

SQL > alter pluggable database all except PDBTEST close

The plug-in database has changed.

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE

# PDB$SEED READ ONLY

# PDBTEST MOUNTED

# CLONEPDB_PLUG MOUNTED

5. Change the state of PDB

SQL > col con_id format 999999

SQL > col name format A20

SQL > col open_mode format A20

SQL > set line 100

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE

2 PDB$SEED READ ONLY 3 PDBTEST MOUNTED 4 CLONEPDB_PLUG MOUNTED

SQL > alter pluggable database PDBTEST open restricted

SQL > select con_id,name,open_mode from v$pdbs

CON_ID NAME OPEN_MODE-2 PDB$SEED READ ONLY 3 PDBTEST READ WRITE 4 CLONEPDB_PLUG MOUNTED

SQL > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED 2 PDB$SEED READ ONLY NO 3 PDBTEST READ WRITE YES 4 CLONEPDB_PLUG MOUNTED

SQL > alter pluggable database PDBTEST close

The plug-in database has changed.

SQL > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

2 PDB$SEED READ ONLY NO 3 PDBTEST MOUNTED 4 CLONEPDB_PLUG MOUNTED

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

  • MySQL basic query example (2)

    Note: this blog post is based on the table in the previous post, the previous post: MySQL basic query example (1). 1. Query all fname values corresponding to each s_id in the fruits table

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report