Oracle的学习心得和知识总结(二十一)|Oracle数据库可插拔数据库PDB的创建及删除

news2025/1/12 1:41:19

注:提前言明 本文借鉴了以下博主、书籍或网站的内容,其列表如下:

1、参考书籍:《Oracle Database SQL Language Reference》
2、参考书籍:《PostgreSQL中文手册》
3、EDB Postgres Advanced Server User Guides,点击前往
4、PostgreSQL数据库仓库链接,点击前往
5、PostgreSQL中文社区,点击前往
6、Oracle Real Application Testing 官网首页,点击前往
7、Oracle 21C RAT Testing Guide,点击前往
8、测试指南 Setting Up Replay Clients,点击前往
9、swingbench-免费的oracle性能压测工具,点击前往
10、使用免费负载生成器swingbench对oracle数据库进行压力测试(测试Oracle的功能或评估性能),点击前往
11、牛刀小试–Oracle Swingbench 压力测试,点击前往
12、创建可插拔数据库PDB,点击前往


1、本文内容全部来源于开源社区 GitHub和以上博主的贡献,本文也免费开源(可能会存在问题,评论区等待大佬们的指正)
2、本文目的:开源共享 抛砖引玉 一起学习
3、本文不提供任何资源 不存在任何交易 与任何组织和机构无关
4、大家可以根据需要自行 复制粘贴以及作为其他个人用途,但是不允许转载 不允许商用 (写作不易,还请见谅 💖)


Oracle数据库可插拔数据库PDB的创建及删除

  • 文章快速说明索引
  • 从种子PDB来创建
  • 从本地PDB来克隆
  • PDB数据库的删除
  • PDB进行数据负载



文章快速说明索引

学习目标:

目的:接下来这段时间我想做一些兼容Oracle数据库Real Application Testing (即:RAT)上的一些功能开发,本专栏这里主要是学习以及介绍Oracle数据库功能的使用场景、原理说明和注意事项等,基于PostgreSQL数据库的功能开发等之后 由新博客进行介绍和分享!


学习内容:(详见目录)

1、Oracle数据库可插拔数据库PDB的创建及删除


学习时间:

2023年04月18日 20:06:34


学习产出:

1、Oracle数据库可插拔数据库PDB的创建及删除
2、CSDN 技术博客 1篇


注:下面我们所有的学习环境是Centos7+PostgreSQL15.0+Oracle19c+MySQL5.7

postgres=# select version();
                                   version                                   
-----------------------------------------------------------------------------
 PostgreSQL 15.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.1.0, 64-bit
(1 row)

postgres=#

#-----------------------------------------------------------------------------#

SQL> select * from v$version; 

BANNER									    BANNER_FULL 								BANNER_LEGACY									CON_ID
--------------------------------------------------------------------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ----------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production	    Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production	Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production		     0
									    Version 19.3.0.0.0


SQL>
#-----------------------------------------------------------------------------#

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.19    |
+-----------+
1 row in set (0.06 sec)

mysql>

从种子PDB来创建

第一步,查看pdb状态,如下:

[oracle@dbserver ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 19 10:10:28 2023
Version 19.3.0.0.0

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

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 1157624440 bytes
Fixed Size		    9134712 bytes
Variable Size		  486539264 bytes
Database Buffers	  654311424 bytes
Redo Buffers		    7639040 bytes
Database mounted.
Database opened.
SQL> 
SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB			  READ WRITE NO
SQL> 

如上,seed pdb 在数据库cdb启动时处于read only的状态!


第二步,查看其数据文件,如下:

SQL> set line 1000
SQL> col name format a100
SQL> select name, con_id from v$datafile order by con_id;

NAME													 CON_ID
---------------------------------------------------------------------------------------------------- ----------
/home/oracle/oracle19c/oradata/ORCL/system01.dbf							      1
/home/oracle/oracle19c/oradata/ORCL/sysaux01.dbf							      1
/home/oracle/oracle19c/oradata/ORCL/undotbs01.dbf							      1
/home/oracle/oracle19c/oradata/ORCL/users01.dbf 							      1
/home/oracle/oracle19c/oradata/ORCL/pdbseed/sysaux01.dbf						      2
/home/oracle/oracle19c/oradata/ORCL/pdbseed/undotbs01.dbf						      2
/home/oracle/oracle19c/oradata/ORCL/pdbseed/system01.dbf						      2
/home/oracle/oracle19c/oradata/ORCL/orclpdb/soe.dbf							      3
/home/oracle/oracle19c/oradata/ORCL/orclpdb/system01.dbf						      3
/home/oracle/oracle19c/oradata/ORCL/orclpdb/sysaux01.dbf						      3
/home/oracle/oracle19c/oradata/ORCL/orclpdb/undotbs01.dbf						      3

NAME													 CON_ID
---------------------------------------------------------------------------------------------------- ----------
/home/oracle/oracle19c/oradata/ORCL/orclpdb/users01.dbf 						      3

12 rows selected.

SQL> select name, con_id from v$tempfile order by con_id;

NAME													 CON_ID
---------------------------------------------------------------------------------------------------- ----------
/home/oracle/oracle19c/oradata/ORCL/temp01.dbf								      1
/home/oracle/oracle19c/oradata/ORCL/pdbseed/temp012021-02-02_16-06-33-641-PM.dbf			      2
/home/oracle/oracle19c/oradata/ORCL/orclpdb/temp01.dbf							      3

SQL>
-- PDB$SEED 数据存放的位置
[oracle@dbserver ~]$ tree /home/oracle/oracle19c/oradata/ORCL/pdbseed/
/home/oracle/oracle19c/oradata/ORCL/pdbseed/
├── sysaux01.dbf
├── system01.dbf
├── temp012021-02-02_16-06-33-641-PM.dbf
└── undotbs01.dbf

0 directories, 4 files
[oracle@dbserver ~]$ tree /home/oracle/oracle19c/oradata/ORCL/orclpdb/
/home/oracle/oracle19c/oradata/ORCL/orclpdb/
├── addmrpt_1_1124_1125.txt
├── ashrpt_1_0406_1304.html
├── awrrpt_1_1124_1125.html
├── soe.dbf
├── sysaux01.dbf
├── system01.dbf
├── temp01.dbf
├── undotbs01.dbf
└── users01.dbf

0 directories, 9 files
[oracle@dbserver ~]$

第三步,创建新的PDB目录,如下:

-- mkdir capturepdb
-- mkdir replaypdb
[oracle@dbserver ~]$ cd /home/oracle/oracle19c/oradata/ORCL/
[oracle@dbserver ORCL]$ ls
capturepdb  control01.ctl  control02.ctl  orclpdb  pdbseed  redo01.log  redo02.log  redo03.log  replaypdb  sysaux01.dbf  system01.dbf  temp01.dbf  undotbs01.dbf  users01.dbf
[oracle@dbserver ORCL]$ 
[oracle@dbserver ORCL]$ ls capturepdb/
[oracle@dbserver ORCL]$ 
[oracle@dbserver ORCL]$ ls replaypdb/
[oracle@dbserver ORCL]$

第四步,创建capturepdb,如下:

SQL> create pluggable database capturepdb admin user sysdba identified by 123456 roles=(connect) file_name_convert=('/home/oracle/oracle19c/oradata/ORCL/pdbseed','/home/oracle/oracle19c/oradata/ORCL/capturepdb');

Pluggable database created.

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB			  READ WRITE NO
	 4 CAPTUREPDB			  MOUNTED
SQL>
[oracle@dbserver ORCL]$ ll capturepdb/
总用量 716880
-rw-rw---- 1 oracle oracle 346038272 4月  19 10:19 sysaux01.dbf
-rw-rw---- 1 oracle oracle 283123712 4月  19 10:19 system01.dbf
-rw-rw---- 1 oracle oracle  37756928 4月  19 10:19 temp012021-02-02_16-06-33-641-PM.dbf
-rw-rw---- 1 oracle oracle 104865792 4月  19 10:19 undotbs01.dbf
[oracle@dbserver ORCL]$ 
SQL> col name format a100
SQL> select name, con_id from v$datafile order by con_id;

NAME													 CON_ID
---------------------------------------------------------------------------------------------------- ----------
/home/oracle/oracle19c/oradata/ORCL/system01.dbf							      1
/home/oracle/oracle19c/oradata/ORCL/sysaux01.dbf							      1
/home/oracle/oracle19c/oradata/ORCL/undotbs01.dbf							      1
/home/oracle/oracle19c/oradata/ORCL/users01.dbf 							      1
/home/oracle/oracle19c/oradata/ORCL/pdbseed/system01.dbf						      2
/home/oracle/oracle19c/oradata/ORCL/pdbseed/sysaux01.dbf						      2
/home/oracle/oracle19c/oradata/ORCL/pdbseed/undotbs01.dbf						      2
/home/oracle/oracle19c/oradata/ORCL/orclpdb/system01.dbf						      3
/home/oracle/oracle19c/oradata/ORCL/orclpdb/soe.dbf							      3
/home/oracle/oracle19c/oradata/ORCL/orclpdb/users01.dbf 						      3
/home/oracle/oracle19c/oradata/ORCL/orclpdb/sysaux01.dbf						      3

NAME													 CON_ID
---------------------------------------------------------------------------------------------------- ----------
/home/oracle/oracle19c/oradata/ORCL/orclpdb/undotbs01.dbf						      3
/home/oracle/oracle19c/oradata/ORCL/capturepdb/sysaux01.dbf						      4
/home/oracle/oracle19c/oradata/ORCL/capturepdb/system01.dbf						      4
/home/oracle/oracle19c/oradata/ORCL/capturepdb/undotbs01.dbf						      4

15 rows selected.

SQL> col file_name for a100;
SQL> col tablespace_name for a20;
SQL> select file_id, file_name, tablespace_name from cdb_data_files;

   FILE_ID FILE_NAME												TABLESPACE_NAME
---------- ---------------------------------------------------------------------------------------------------- --------------------
	 7 /home/oracle/oracle19c/oradata/ORCL/users01.dbf							USERS
	 4 /home/oracle/oracle19c/oradata/ORCL/undotbs01.dbf							UNDOTBS1
	 1 /home/oracle/oracle19c/oradata/ORCL/system01.dbf							SYSTEM
	 3 /home/oracle/oracle19c/oradata/ORCL/sysaux01.dbf							SYSAUX
	 9 /home/oracle/oracle19c/oradata/ORCL/orclpdb/system01.dbf						SYSTEM
	10 /home/oracle/oracle19c/oradata/ORCL/orclpdb/sysaux01.dbf						SYSAUX
	11 /home/oracle/oracle19c/oradata/ORCL/orclpdb/undotbs01.dbf						UNDOTBS1
	12 /home/oracle/oracle19c/oradata/ORCL/orclpdb/users01.dbf						USERS
	17 /home/oracle/oracle19c/oradata/ORCL/orclpdb/soe.dbf							SOE

9 rows selected.

SQL>

第五步,打开上面创建的pdb,如下:

SQL> alter session set container = capturepdb;

Session altered.

SQL> alter pluggable database capturepdb open;

Pluggable database altered.

SQL>
SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 4 CAPTUREPDB			  READ WRITE NO
SQL> select name, con_id from v$datafile order by con_id;

NAME													 CON_ID
---------------------------------------------------------------------------------------------------- ----------
/home/oracle/oracle19c/oradata/ORCL/capturepdb/system01.dbf						      4
/home/oracle/oracle19c/oradata/ORCL/capturepdb/undotbs01.dbf						      4
/home/oracle/oracle19c/oradata/ORCL/capturepdb/sysaux01.dbf						      4

SQL> select file_id, file_name, tablespace_name from cdb_data_files;

   FILE_ID FILE_NAME												TABLESPACE_NAME
---------- ---------------------------------------------------------------------------------------------------- --------------------
	21 /home/oracle/oracle19c/oradata/ORCL/capturepdb/system01.dbf						SYSTEM
	22 /home/oracle/oracle19c/oradata/ORCL/capturepdb/sysaux01.dbf						SYSAUX
	23 /home/oracle/oracle19c/oradata/ORCL/capturepdb/undotbs01.dbf 					UNDOTBS1

SQL>

此时再新建一个会话,如下:

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB			  READ WRITE NO
	 4 CAPTUREPDB			  READ WRITE NO
SQL> col file_name for a100;
SQL> col tablespace_name for a20;
SQL> select file_id, file_name, tablespace_name from cdb_data_files;

   FILE_ID FILE_NAME												TABLESPACE_NAME
---------- ---------------------------------------------------------------------------------------------------- --------------------
	 7 /home/oracle/oracle19c/oradata/ORCL/users01.dbf							USERS
	 4 /home/oracle/oracle19c/oradata/ORCL/undotbs01.dbf							UNDOTBS1
	 1 /home/oracle/oracle19c/oradata/ORCL/system01.dbf							SYSTEM
	 3 /home/oracle/oracle19c/oradata/ORCL/sysaux01.dbf							SYSAUX
	 9 /home/oracle/oracle19c/oradata/ORCL/orclpdb/system01.dbf						SYSTEM
	10 /home/oracle/oracle19c/oradata/ORCL/orclpdb/sysaux01.dbf						SYSAUX
	11 /home/oracle/oracle19c/oradata/ORCL/orclpdb/undotbs01.dbf						UNDOTBS1
	12 /home/oracle/oracle19c/oradata/ORCL/orclpdb/users01.dbf						USERS
	17 /home/oracle/oracle19c/oradata/ORCL/orclpdb/soe.dbf							SOE
	21 /home/oracle/oracle19c/oradata/ORCL/capturepdb/system01.dbf						SYSTEM
	22 /home/oracle/oracle19c/oradata/ORCL/capturepdb/sysaux01.dbf						SYSAUX

   FILE_ID FILE_NAME												TABLESPACE_NAME
---------- ---------------------------------------------------------------------------------------------------- --------------------
	23 /home/oracle/oracle19c/oradata/ORCL/capturepdb/undotbs01.dbf 					UNDOTBS1

12 rows selected.

SQL>

第六步,配置tnsnames.ora,并建立连接,如下:

[oracle@dbserver ~]$ vim  ./oracle19c/product/19c/dbhome_1/network/admin/tnsnames.ora
[oracle@dbserver ~]$ 
[oracle@dbserver ~]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 oracle
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 oracle
[oracle@dbserver ~]$ 
[oracle@dbserver ~]$ cat  ./oracle19c/product/19c/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /home/oracle/oracle19c/product/19c/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))


ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

PDBORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCLPDB)
    )
  )

CAPTUREPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = capturepdb)
    )
  )
[oracle@dbserver ~]$ cat /home/oracle/oracle19c/product/19c/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /home/oracle/oracle19c/product/19c/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )
SID_LIST_LISTENER =  
(SID_LIST =  
  (SID_DESC =  
  (GLOBAL_DBNAME = orcl)
  (SID_NAME = orcl)
  )
)
[oracle@dbserver ~]$

然后重启了一下监听,如下:

[oracle@dbserver ~]$ lsnrctl stop ; lsnrctl start
...
[oracle@dbserver ~]$ lsnrctl status
...

在这里插入图片描述

[oracle@dbserver ~]$ sqlplus sys/123456@capturepdb as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 19 11:20:01 2023
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 4 CAPTUREPDB			  READ WRITE NO

-- 查看用户
SQL> select username,common,con_id from cdb_users where account_status = 'OPEN';

USERNAME	COM	CON_ID
--------------- --- ----------
SYS		YES	     4
SYSTEM		YES	     4
C##ORACLE	YES	     4
SYSDBA		NO	     4
C##SPA123	YES	     4
C##USER1	YES	     4
WMSYS		YES	     4

7 rows selected.

SQL> 

第七步,创建并指定默认表空间,如下:

SQL> col file_name for a100;
SQL> col tablespace_name for a20;
SQL> 
SQL> select file_name, tablespace_name from cdb_data_files;

FILE_NAME											     TABLESPACE_NAME
---------------------------------------------------------------------------------------------------- --------------------
/home/oracle/oracle19c/oradata/ORCL/capturepdb/system01.dbf					     SYSTEM
/home/oracle/oracle19c/oradata/ORCL/capturepdb/sysaux01.dbf					     SYSAUX
/home/oracle/oracle19c/oradata/ORCL/capturepdb/undotbs01.dbf					     UNDOTBS1

SQL> create tablespace users datafile '/home/oracle/oracle19c/oradata/ORCL/capturepdb/user.dbf' size 50M autoextend on next 1G maxsize 5G;

Tablespace created.

SQL> select file_name, tablespace_name from cdb_data_files;

FILE_NAME											     TABLESPACE_NAME
---------------------------------------------------------------------------------------------------- --------------------
/home/oracle/oracle19c/oradata/ORCL/capturepdb/system01.dbf					     SYSTEM
/home/oracle/oracle19c/oradata/ORCL/capturepdb/sysaux01.dbf					     SYSAUX
/home/oracle/oracle19c/oradata/ORCL/capturepdb/undotbs01.dbf					     UNDOTBS1
/home/oracle/oracle19c/oradata/ORCL/capturepdb/user.dbf 					     USERS

SQL>

从本地PDB来克隆

从容器数据库中克隆本地capturepdb来创建replaypdb,如下:

第一步,以只读方式打开capturepdb,如下:

[oracle@dbserver ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 19 11:33:47 2023
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB			  READ WRITE NO
	 4 CAPTUREPDB			  READ WRITE NO
SQL> 
SQL> conn sys/123456@capturepdb as sysdba
Connected.
SQL> 
SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 4 CAPTUREPDB			  READ WRITE NO
SQL> shutdown immediate;
Pluggable Database closed.
SQL> 
SQL> startup open read only;
Pluggable Database opened.
SQL> 
SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 4 CAPTUREPDB			  READ ONLY  NO
SQL>

第二步,查看数据文件,并创建新的PDB目录,如下:

SQL> set line 1000;
SQL> col name format a100;
SQL> 
SQL> select name, con_id from v$datafile where con_id = 4;

NAME													 CON_ID
---------------------------------------------------------------------------------------------------- ----------
/home/oracle/oracle19c/oradata/ORCL/capturepdb/system01.dbf						      4
/home/oracle/oracle19c/oradata/ORCL/capturepdb/sysaux01.dbf						      4
/home/oracle/oracle19c/oradata/ORCL/capturepdb/undotbs01.dbf						      4
/home/oracle/oracle19c/oradata/ORCL/capturepdb/user.dbf 						      4

SQL>
[oracle@dbserver ~]$ cd /home/oracle/oracle19c/oradata/ORCL/
[oracle@dbserver ORCL]$ 
[oracle@dbserver ORCL]$ ls replaypdb/
[oracle@dbserver ORCL]$

第三步,克隆 如下:

[oracle@dbserver ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 19 12:44:54 2023
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> create pluggable database replaypdb from capturepdb file_name_convert=('capturepdb','replaypdb');

Pluggable database created.

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB			  READ WRITE NO
	 4 CAPTUREPDB			  READ ONLY  NO
	 5 REPLAYPDB			  MOUNTED
SQL>

第四步,打开replaypdb数据库,如下:

SQL> conn /as sysdba
Connected.
SQL> 
SQL> alter session set container = capturepdb;

Session altered.

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 4 CAPTUREPDB			  READ ONLY  NO
SQL> alter pluggable database capturepdb close immediate;

Pluggable database altered.

SQL> alter pluggable database capturepdb open;

Pluggable database altered.

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 4 CAPTUREPDB			  READ WRITE NO
SQL>
SQL> conn /as sysdba
Connected.
SQL> 
SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB			  READ WRITE NO
	 4 CAPTUREPDB			  READ WRITE NO
	 5 REPLAYPDB			  MOUNTED
SQL> alter session set container = replaypdb;

Session altered.

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 5 REPLAYPDB			  MOUNTED
SQL> alter pluggable database replaypdb open;

Pluggable database altered.

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 5 REPLAYPDB			  READ WRITE NO
SQL>
[oracle@dbserver ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 19 12:55:11 2023
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB			  READ WRITE NO
	 4 CAPTUREPDB			  READ WRITE NO
	 5 REPLAYPDB			  READ WRITE NO
SQL>

PDB数据库的删除

alter pluggable database pdbname close;
drop pluggable database pdbname [including datafiles];

PDB进行数据负载

[oracle@dbserver ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 19-APR-2023 12:59:54

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                19-APR-2023 12:57:27
Uptime                    0 days 0 hr. 2 min. 39 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /home/oracle/oracle19c/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File         /home/oracle/oracle19c/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver.localdomain)(PORT=1521)))
Services Summary...
Service "86b637b62fdf7a65e053f706e80a27ca" has 1 instance(s).
  Instance "orcl", status READY, has 2 handler(s) for this service...
Service "ba57177fca292d25e055020c2946ed4e" has 1 instance(s).
  Instance "orcl", status READY, has 2 handler(s) for this service...
Service "capturepdb" has 1 instance(s).
  Instance "orcl", status READY, has 2 handler(s) for this service...
Service "f9a7f0e56dce0f4de0538477a8c06579" has 1 instance(s).
  Instance "orcl", status READY, has 2 handler(s) for this service...
Service "f9aa168e2c4e38fde0538477a8c0bb32" has 1 instance(s).
  Instance "orcl", status READY, has 2 handler(s) for this service...
Service "orcl" has 2 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
  Instance "orcl", status READY, has 2 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclpdb" has 1 instance(s).
  Instance "orcl", status READY, has 2 handler(s) for this service...
Service "replaypdb" has 1 instance(s).
  Instance "orcl", status READY, has 2 handler(s) for this service...
The command completed successfully
[oracle@dbserver ~]$ 
[oracle@dbserver ~]$ sqlplus sys/123456@capturepdb as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 19 13:06:16 2023
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select snap_id, begin_interval_time, end_interval_time from dba_hist_snapshot order by end_interval_time desc;

   SNAP_ID BEGIN_INTERVAL_TIME							       END_INTERVAL_TIME
---------- --------------------------------------------------------------------------- ---------------------------------------------------------------------------
      1132 19-APR-23 12.00.41.585 PM						       19-APR-23 01.00.07.221 PM
      1131 19-APR-23 11.00.30.577 AM						       19-APR-23 12.00.41.585 PM
      1130 19-APR-23 10.21.35.563 AM						       19-APR-23 11.00.30.577 AM
      1129 19-APR-23 10.11.09.000 AM						       19-APR-23 10.21.35.563 AM
      1128 18-APR-23 11.19.32.000 PM						       18-APR-23 11.30.03.024 PM
      1127 18-APR-23 06.31.53.000 PM						       18-APR-23 06.42.35.592 PM
      1126 12-APR-23 05.16.19.000 PM						       12-APR-23 05.26.49.832 PM

7 rows selected.

SQL> show pdbs;

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 4 CAPTUREPDB			  READ WRITE NO
SQL> exec dbms_workload_repository.create_snapshot();

PL/SQL procedure successfully completed.

SQL> select snap_id, begin_interval_time, end_interval_time from dba_hist_snapshot order by end_interval_time desc;

   SNAP_ID BEGIN_INTERVAL_TIME							       END_INTERVAL_TIME
---------- --------------------------------------------------------------------------- ---------------------------------------------------------------------------
	 1 19-APR-23 10.11.09.000 AM						       19-APR-23 01.09.22.022 PM
      1132 19-APR-23 12.00.41.585 PM						       19-APR-23 01.00.07.221 PM
      1131 19-APR-23 11.00.30.577 AM						       19-APR-23 12.00.41.585 PM
      1130 19-APR-23 10.21.35.563 AM						       19-APR-23 11.00.30.577 AM
      1129 19-APR-23 10.11.09.000 AM						       19-APR-23 10.21.35.563 AM
      1128 18-APR-23 11.19.32.000 PM						       18-APR-23 11.30.03.024 PM
      1127 18-APR-23 06.31.53.000 PM						       18-APR-23 06.42.35.592 PM
      1126 12-APR-23 05.16.19.000 PM						       12-APR-23 05.26.49.832 PM

8 rows selected.

SQL>

下面使用swingbench进行负载,如下:

在这里插入图片描述

[oracle@dbserver capturepdb]$ pwd
/home/oracle/oracle19c/oradata/ORCL/capturepdb
[oracle@dbserver capturepdb]$ ll
总用量 799160
-rw-rw---- 1 oracle oracle 377495552 4月  19 13:11 sysaux01.dbf
-rw-rw---- 1 oracle oracle 283123712 4月  19 13:11 system01.dbf
-rw-rw---- 1 oracle oracle  37756928 4月  19 13:03 temp012021-02-02_16-06-33-641-PM.dbf
-rw-rw---- 1 oracle oracle 104865792 4月  19 13:08 undotbs01.dbf
-rw-rw---- 1 oracle oracle  52436992 4月  19 13:08 user.dbf
[oracle@dbserver capturepdb]$

在这里插入图片描述

在这里插入图片描述

[oracle@dbserver capturepdb]$ ll
总用量 3761320
-rw-rw---- 1 oracle oracle 2603622400 4月  19 13:25 soe.dbf
-rw-rw---- 1 oracle oracle  387981312 4月  19 13:25 sysaux01.dbf
-rw-rw---- 1 oracle oracle  283123712 4月  19 13:24 system01.dbf
-rw-rw---- 1 oracle oracle  247472128 4月  19 13:24 temp012021-02-02_16-06-33-641-PM.dbf
-rw-rw---- 1 oracle oracle  277880832 4月  19 13:25 undotbs01.dbf
-rw-rw---- 1 oracle oracle   52436992 4月  19 13:24 user.dbf
[oracle@dbserver capturepdb]$

数据加载完成,开始负载,如下:
在这里插入图片描述

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/436296.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

华为OD机试(Java),5键键盘的输出

一、题目描述 有一个特殊的5键键盘,上面有a,ctrl-c,ctrl-x,ctrl-v,ctrl-a五个键。 a键在屏幕上输出一个字母a;ctrl-c将当前选择的字母复制到剪贴板;ctrl-x将当前选择的字母复制到剪贴板&#…

极氪要上市,吉利“基因改造”成功

文|智能相对论 作者| 落笔 当越来越多的国产新锐品牌入局新能源汽车市场,晚半拍的极氪却用较短的时间实现了主观逆袭。据统计,极氪001自问世以来便接连斩获消费者欢心,2022年极氪001更是实现了全年交付71941台的战绩,且持续蝉联…

ASP音乐网站的设计与实现

本文阐述了音乐网站的设计与实现,本系统采用ASPSQL Sever 2000作为开发工具。前台主要实现歌曲的分类显示及分类查询、歌曲的在线试听及下载、会员注册、登录以及最新音乐的新闻介绍,并且还为用户提供了在线交流的平台等功能;后台主要用于数据…

BGP路由优选实验

一,实验要求及其拓扑图 二:划分好IP的拓扑 三: 实验分析 1、使用 Preval 策略,确保R4通过R2到达192.168.10.0/24 1、抓取流量 [r4]ip ip-prefix PV permit 192.168.10.0 24 2、配置策略 [r4]route-policy PV permit node 10 [r4…

Web UI自动化测试框架

WebUI automation testing framework based on Selenium and unittest. 基于 selenium 和 unittest 的 Web UI自动化测试框架。 特点 提供更加简单API编写自动化测试。提供脚手架,快速生成自动化测试项目。自动生成HTML测试报告生成。自带断言方法,断言…

Linux常用环境配置

一、sqlite3 1、官网地址 SQLite Download Page 2、在Linux下载 右键复制源代码链接在linux用wget下载 wget https://www.sqlite.org/2023/sqlite-autoconf-3410200.tar.gz 3、解压 tar -xzvf sqlite-autoconf-3410200.tar.gz 4、编译 # 进入解压目录 cd sqlite-autoconf-34102…

App 版本更新插件介绍及使用指南

随着移动互联网的发展,APP 已经成为人们生活中必不可少的一部分,而版本更新也是 APP 发展过程中必不可少的环节。为了更好地实现 APP 版本更新和管理,我们推荐一个非常实用的插件:App 版本更新插件。 该插件支持强制更新、静默更…

Hystrix传递ThreadLocal范围对象的问题(最为细致的分析)

场景 在springcloud微服务体系下,从网关层开始要在request请求头放置一些重要参数,比如traceId,并要求在fegin之间的调用时,也能够一直传递下去,由于实际项目使用中,都是fegin集成了hystrix一起配合使用的…

cloud-canal的部署使用

一,官网参考: https://www.clougence.com/ https://www.clougence.com/cc-doc/quick/quick_start 二,点击下载私有部署版 返回数据: 版本号: 2.5.0.7 MD5值: 18e2502xxxxxxx 下载地址: https://tgzdownload.clougence.com/lates…

华为OD机试(Java),分班

一、题目描述 幼儿园两个班的小朋友在排队时混在了一起,每位小朋友都知道自己是否与前面一位小朋友是否同班,请你帮忙把同班的小朋友找出来。 小朋友的编号为整数,与前一位小朋友同班用Y表示,不同班用N表示。 二、输入描述 输…

PYQT5学习笔记01——PYQT5初体验以及PYQT5程序基本结构分析

一、PYQT5初体验 我们首先用代码编写一个窗口,窗口里面有一个标签控件,标签内的文本是 Hello World,代码如下: # -*- coding: UTF-8 -*- # 导入需要的包 from PyQt5.Qt import * import sys# 创建应用程序对象 app QApplicatio…

【c++初阶】:

c入门 一.概念二.使用三.应用四.常引用五.引用与指针 一.概念 c语言中我们常用指针找地址,但在c中,忽略了指针(当然也可以使用指针)。常用引用这个概念。 二.使用 可以看到这里的b和c本质上都是a,只是不同的称呼罢了。…

手把手教你将项目部署到服务器!

一、导入centos7虚拟机: 打开VMWare,点击“打开虚拟机”,选择centos7.ova之后,选择存储路径: 点击导入: 选择“不再显示此消息”,点击“重试”按钮: 点击“编辑虚拟机设置”&#x…

【数据结构】二叉树OJ题

😽PREFACE 🎁欢迎各位→点赞👍 收藏⭐ 评论📝 📢系列专栏:数据结构 🔊本专栏主要更新的是数据结构部分知识点 💪种一棵树最好是十年前其次是现在 目录 1.单值二叉树 2.相同的树 …

Hadoop之Hive

文章目录 一、Hive简介1.1 Hive 基本概念1.2 Hive架构图1.3 Hive数据模型 二、Hive安装配置2.1 内嵌模式2.2 配置元数据到mysql2.3本地模式2.4远程模式2.5 Hive JDBC Hiverserver22.5.1远程模式下使用Beeline CLI2.5.2 DataGrip图形化客户端 2.6 Hive常见属性配置 一、Hive简介…

Vue基础入门(上)

<script src"https://unpkg.com/vuenext"></script> 从面向dom编程到面向数据编程 输入显示列表 const appVue.createApp({data(){return{inputValue:,list:[]}},methods:{handleAddItem(){this.list.push(this.inputValue);this.inputValue;}},templ…

(一) nvidia jetson orin nvcsi tegra-capture-vi camera相关内容梳理 之 vi相关代码分析

背景:对于nvidia 的jetson orin 的camera,其内部是如何实现的尼?硬件方面的pipeline是怎么关联的,其内部有哪些camera相关的modules?对于这些modules,软件上又是怎么去实现?设备树如何去抽象这些modules?分析完后,给我们一个camera sensor,如何进行bring up?本文将会…

什么是 AUTOSAR C++14?

总目录链接>> AutoSAR入门和实战系列总目录 总目录链接>> AutoSAR BSW高阶配置系列总目录 文章目录 什么是 AUTOSAR C14&#xff1f;AUTOSAR C14 规则和偏差静态分析工具可以完全支持自动 什么是 AUTOSAR C14&#xff1f; 它是 C 版本 14 (ISO/IEC 14882:2014…

Mac安装Stable Diffusion教程【超详细教程】附带安装包

Mac安装Stable Diffusion教程 本机配置Mac安装Stable Diffusion教程 配带官方说明重要注意事项安装所需文件已上传网盘自动安装新安装&#xff1a; 自动安装现有安装&#xff1a; 下载稳定扩散模型故障排除Web UI无法启动&#xff1a;性能不佳&#xff1a; 本机配置 电脑&…

DJ4-3 路由器的工作原理

目录 一、路由器的整体结构 二、输入端口的功能 1. 三大模块 2. 查找与转发模块 三、交换结构 1. 经内存的交换结构 2. 经总线的交换结构 3. 经交换矩阵交换结构 四、输出端口的功能 五、排队 1. 输入端口排队 2. 输出端口排队 一、路由器的整体结构 路由器的两个…