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

Unplug and delete Oracle12c_PDB

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

Share

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

Here is a brief description of how to unplug PDB, delete PDB, and insert PDB:

1 、 unplug PDB

View PDB information:

SQL > select name,open_mode from v$pdbs

NAME OPEN_MODE

PDB$SEED READ ONLY

PDB_1 READ WRITE

PDB_2 READ WRITE

PDB_3 READ WRITE

PDB_4 READ WRITE

SQL > show con_name

CON_NAME

-

CDB$ROOT

Unplug the PDB_4 (must be connected to the CDB$ROOT):

First turn off PDB_4

SQL > alter pluggable database pdb_4 close immediate

Pluggable database altered.

Then you can unplug.

SQL > alter pluggable database pdb_4 unplug into'/ home/oracle/unplugged_pdbs/pdb_4.xml'

Pluggable database altered.

The XML file contains information such as the location of each data file, as well as initialization parameters.

2 、 drop PDB

You can delete the data file when you close and unplug the PDB, and delete the data file together:

You also need to connect to the CDB$ROOT container and execute the following statement:

SQL > drop pluggable database pdb_4 keep datafiles

Pluggable database dropped.

SQL > select name,open_mode from v$pdbs

NAME OPEN_MODE

PDB$SEED READ ONLY

PDB_1 READ WRITE

PDB_2 READ WRITE

PDB_3 READ WRITE

Keep datafiles is used here to retain the data files of PDB_4. Alternatively, you can use inluding datafiles to completely delete PDB's data files.

3 、 plug an unplugged PDB

Plug PDB_4:

SQL > create pluggable database pdb_4_replug using'/ home/oracle/unplugged_pdbs/pdb_4.xml' nocopy tempfile reuse

Pluggable database created.

SQL > select name from v$pdbs

NAME

-

PDB$SEED

PDB_1

PDB_2

PDB_3

PDB_4_REPLUG

SQL > select name,open_mode from v$pdbs

NAME OPEN_MODE

PDB$SEED READ ONLY

PDB_1 READ WRITE

PDB_2 READ WRITE

PDB_3 READ WRITE

PDB_4_REPLUG MOUNTED

In the above create pluggable database statement, because the data files are all in the location specified by the xml file, and the original location is still used as the new

The location where the data file of the pdb is stored, so there are no other clauses.

Another plug PDB statement may also be as follows:

CREATE PLUGGABLE DATABASE pdbname

USING'/ location/filename.xml'

SOURCE_FILE_NAME_CONVERT= ('/ location1/','/location2/')

MOVE

FILE_NAME_CONVERT= ('/ location2/','/location3/')

PATH_PREFIX='/location3/'

STORAGE (MAXSIZE 2G MAX_SHARED_TEMP_SIZE 100m)

Here the xml file indicates that the data file is in / location1/, but in fact the data file is in / location2/, and eventually we want to put the data file

Put in / location3/

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