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 common commands

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

Share

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

1. Check how many pdb databases there are:

SQL > show pdbs

2. Switch to the specified container database:

SQL > alter session set container=ORCLPDB

3. Start the container database:

SQL > alter pluggable database ORCLPDB open

4. Close the container database:

SQL > alter pluggable database ORCLPDB close immediate

5. Check the database name:

SQL > show con_name

6. Creation and deletion of database:

-- 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

-- do not specify to create the library directly

Create pluggable database salespdb admin user admin identified by admin file_name_convert= ('/ u01qapax oraclehelplicoradata') orcl12c scarp pdbAccording to the sales pdbAccord')

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

Create pluggable database orcl2 from orcl1;-- test_pdb must be open before it can be opened

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

Alter pluggable database orcl2 close;-cannot be deleted until it is closed

Drop pluggable database orcl2 including datafiles;-Delete PDB orcl2

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

CREATE OR REPLACE TRIGGER open_pdbs

AFTER STARTUP ON DATABASE

BEGIN

EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN'

END open_pdbs

7. PDB create user (create user after linking to pdb database):

Create user hanfuyou identified by hanfuyou default tablespace users temporary tablespace temp

Grant connect,resource,unlimited tablespace to hanfuyou

Unplug and delete PDB

1. Unplug SALESPDB # must be connected to CDB$ROOT

# close SALESPDB first

SQL > alter pluggable database SALESPDB close immediate

SQL > alter pluggable database SALESPDB unplug into'/ home/oracle/salespdb.xml'

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 PDB. When deleting, you can delete the data file together:

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

SQL > drop pluggable database SALESPDB keep datafiles

3 、 plug an unplugged PDB

# insert PDB locally

SQL > create pluggable database SALESPDB02 using'/ home/oracle/salespdb.xml' nocopy tempfile reuse

SQL > alter pluggable database SALESPDB02 open

4. Insert PDB in different storage locations of the machine.

Mkdir / u01/app/oracle/oradata/orcl12c/salespdb01/

SQL > create pluggable database SALESPDB01 using'/ home/oracle/salespdb.xml'

SOURCE_FILE_NAME_CONVERT= ('/ u01qqapax oradata / orcl12c _ salespdbamp / u01qqqappr _ account _ salespdbamp')

MOVE FILE_NAME_CONVERT= ('/ u01ActionActionActionoradata MOVE FILE_NAME_CONVERT='/ u01ActionActionActionActionoradata')

PATH_PREFIX='/u01/app/oracle/oradata/orcl12c/salespdb01/' STORAGE (MAXSIZE 2G MAX_SHARED_TEMP_SIZE 100m)

Here the xml file indicates that the data file is in / u01/app/oracle/oradata/orcl12c/salespdb/

In fact, the data file is in / u01/app/salespdb/

And eventually we will put the data file in / u01/app/oracle/oradata/orcl12c/salespdb01/.

The solution to the garbled problem:

Export NLS_LANG=american_america.AL32UTF8 (add statement to environment variable)

Authorization:

Https://www.cnblogs.com/g253187360/p/8110442.html

Https://www.cnblogs.com/SummerinShire/p/6539607.html

Https://blog.csdn.net/Darker2016/article/details/84147293

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