Oracle 查询表空间使用情况及收缩数据文件

news2025/3/1 23:34:12

本文介绍Oracle收缩数据文件的相关操作,运维工作中有时会需要通过收缩数据文件来释放磁盘空间。

数据文件初始化方式:

1.我们创建表空间一般有两种方式初始化其数据文件,即指定初始大小为32G(很大的值)或指定初始大小为100M(很小的值)然后通过自动扩展方式慢慢按需增长。

2.第一种初始数据文件方法坏处就是开始不管你用不用到那么大,都会占用这么大的磁盘空间(这种数据迁移的时候可以使用)。第二种初始化方法按需增长,比较好的监控实际使用磁盘空间,所以推荐初始值很小,使用自动扩展慢慢增长的方式。

一、查看表空间使用情况

1.查询除temp外表空间使用情况

SELECT a.tablespace_name "tb_name",
       total / (1024 * 1024 * 1024) "tb_sizeG)",
       free / (1024 * 1024 * 1024) "tb_free_size(G)",
       (total - free) / (1024 * 1024 * 1024) "tb_used_size(G)",
       round((total - free) / total, 4) * 100 "tb_usage %"
  FROM (SELECT tablespace_name, SUM(bytes) free
          FROM dba_free_space
         GROUP BY tablespace_name) a,
       (SELECT tablespace_name, SUM(bytes) total
          FROM dba_data_files
         GROUP BY tablespace_name) b
 WHERE a.tablespace_name = b.tablespace_name;

select a.tablespace_name tnm,b.FILE_PATH,--b.autoextensible,
       b.cnt,
       trunc(a.bytes/1024/1024/1024) total_G,
       trunc(a.bytes/1024/1024/1024/b.cnt) avg_G,
       trunc(c.bytes/1024/1024/1024) free_G,
       trunc((a.bytes-c.bytes)*100/a.bytes,2) used--,(c.bytes*100)/a.bytes "% FREE"
     from SYS.SM$TS_AVAIL A,SYS.SM$TS_FREE C,
         (select tablespace_name,substr(file_name,1,instr(file_name,'/',2)) FILE_PATH, --f.autoextensible,
         count(*) cnt 
          from dba_data_files  f group by 
tablespace_name,substr(file_name,1,instr(file_name,'/',2))--,autoextensible
          ) b
     WHERE  A.TABLESPACE_NAME=C.TABLESPACE_NAME(+)
          AND A.TABLESPACE_NAME=B.TABLESPACE_NAME
       --   AND A.TABLESPACE_NAME IN (select distinct tablespace_name from dba_tablespaces)
          order by  avg_g desc;

2.查询包含temp在内的所有表空间使用情况

SELECT *
  FROM (SELECT a.tablespace_name,
               to_char(a.bytes / 1024 / 1024, '999,999,999') || 'M' total_bytes,
               to_char(b.bytes / 1024 / 1024, '999,999,999') || 'M' free_bytes,
               to_char(a.bytes / 1024 / 1024 - b.bytes / 1024 / 1024,
                       '999,999,999') || 'M' use_bytes,
               to_char((1 - b.bytes / a.bytes) * 100, '990.99') || '%' USE
          FROM (SELECT tablespace_name, sum(bytes) bytes
                  FROM dba_data_files
                 GROUP BY tablespace_name) a,
               (SELECT tablespace_name, sum(bytes) bytes
                  FROM dba_free_space
                 GROUP BY tablespace_name) b
         WHERE a.tablespace_name = b.tablespace_name
        UNION ALL
        SELECT c.tablespace_name,
               to_char(c.bytes / 1024 / 1024, '999,999,999') || 'M' total_bytes,
               to_char((c.bytes - d.bytes_used) / 1024 / 1024, '999,999,999') || 'M' free_bytes,
               to_char(d.bytes_used / 1024 / 1024, '999,999,999') || 'M' use_bytes,
               to_char(d.bytes_used * 100 / c.bytes, '990.99') || '%' USE
          FROM (SELECT tablespace_name, sum(bytes) bytes
                  FROM dba_temp_files
                 GROUP BY tablespace_name) c,
               (SELECT tablespace_name, sum(bytes_cached) bytes_used
                  FROM v$temp_extent_pool
                 GROUP BY tablespace_name) d
         WHERE c.tablespace_name = d.tablespace_name);

select d.tablespace_name,
       decode(d.status, 'ONLINE', 'OLN', 'READ ONLY', 'R/O', d.status) status,
       d.extent_management,
       decode(d.allocation_type, 'USER', '', d.allocation_type) allocation_type,
       (case
         when initial_extent < 1048576 then
          lpad(round(initial_extent / 1024, 0), 3) || 'K'
         else
          lpad(round(initial_extent / 1024 / 1024, 0), 3) || 'M'
       end) Ext_Size,
       NVL(a.bytes / 1024 / 1024, 0) MB,
       NVL(f.bytes / 1024 / 1024, 0) free,
       (NVL(a.bytes / 1024 / 1024, 0) - NVL(f.bytes / 1024 / 1024, 0)) used,
       NVL(l.large / 1024 / 1024, 0) largest,
       d.MAX_EXTENTS,
       lpad(round((f.bytes / a.bytes) * 100, 0), 3) pfree,
       (case
         when round(f.bytes / a.bytes * 100, 0) >= 20 then
          ' '
         else
          '*'
       end) alrt
  FROM sys.dba_tablespaces d,
       (SELECT tablespace_name, SUM(bytes) bytes
          FROM dba_data_files
         GROUP BY tablespace_name) a,
       (SELECT tablespace_name, SUM(bytes) bytes
          FROM dba_free_space
         GROUP BY tablespace_name) f,
       (SELECT tablespace_name, MAX(bytes) large
          FROM dba_free_space
         GROUP BY tablespace_name) l
 WHERE d.tablespace_name = a.tablespace_name(+)
   AND d.tablespace_name = f.tablespace_name(+)
   AND d.tablespace_name = l.tablespace_name(+)
   AND NOT
        (d.extent_management LIKE 'LOCAL' AND d.contents LIKE 'TEMPORARY')
UNION ALL
select d.tablespace_name,
       decode(d.status, 'ONLINE', 'OLN', 'READ ONLY', 'R/O', d.status) status,
       d.extent_management,
       decode(d.allocation_type,
              'UNIFORM',
              'U',
              'SYSTEM',
              'A',
              'USER',
              '',
              d.allocation_type) allocation_type,
       (case
         when initial_extent < 1048576 then
          lpad(round(initial_extent / 1024, 0), 3) || 'K'
         else
          lpad(round(initial_extent / 1024 / 1024, 0), 3) || 'M'
       end) Ext_Size,
       NVL(a.bytes / 1024 / 1024, 0) MB,
       (NVL(a.bytes / 1024 / 1024, 0) - NVL(t.bytes / 1024 / 1024, 0)) free,
       NVL(t.bytes / 1024 / 1024, 0) used,
       NVL(l.large / 1024 / 1024, 0) largest,
       d.MAX_EXTENTS,
       lpad(round(nvl(((a.bytes - t.bytes) / NVL(a.bytes, 0)) * 100, 100),
                  0),
            3) pfree,
       (case
         when nvl(round(((a.bytes - t.bytes) / NVL(a.bytes, 0)) * 100, 0),
                  100) >= 20 then
          ' '
         else
          '*'
       end) alrt
  FROM sys.dba_tablespaces d,
       (SELECT tablespace_name, SUM(bytes) bytes
          FROM dba_temp_files
         GROUP BY tablespace_name
         order by tablespace_name) a,
       (SELECT tablespace_name, SUM(bytes_used) bytes
          FROM v$temp_extent_pool
         GROUP BY tablespace_name) t,
       (SELECT tablespace_name, MAX(bytes_cached) large
          FROM v$temp_extent_pool
         GROUP BY tablespace_name
         order by tablespace_name) l
 WHERE d.tablespace_name = a.tablespace_name(+)
   AND d.tablespace_name = t.tablespace_name(+)
   AND d.tablespace_name = l.tablespace_name(+)
   AND d.extent_management LIKE 'LOCAL'
   AND d.contents LIKE 'TEMPORARY'
 ORDER by 1

二、收缩数据文件

如果通过上述SQL查询出表空间的使用率较低,剩余空间较大,此时我们可以考虑通过收缩数据文件来释放空闲空间。

1.使用 resize check脚本生成执行SQL

可先通过如下脚本查询有哪些数据文件可以释放,该脚本成功执行后会提供可执行的语句,直接复制便可执行已收缩数据文件。

REM Script is meant for Oracle version 9 and higher
REM -----------------------------------------------
 
set serveroutput on
exec dbms_output.enable(1000000);
 
declare
 
cursor c_dbfile is
select f.tablespace_name,f.file_name,f.file_id,f.blocks,t.block_size
,decode(t.allocation_type,'UNIFORM',t.initial_extent/t.block_size,0) uni_extent
,decode(t.allocation_type,'UNIFORM',(128+(t.initial_extent/t.block_size)),128) file_min_size
from dba_data_files f,
dba_tablespaces t
where f.tablespace_name = t.tablespace_name
and t.status = 'ONLINE'
order by f.tablespace_name,f.file_id;
 
cursor c_freespace(v_file_id in number) is
select block_id, block_id+blocks max_block
from dba_free_space
where file_id = v_file_id
order by block_id desc;
 
/* variables to check settings/values */
dummy number;
checkval varchar2(10);
block_correction1 number;
block_correction2 number;
 
/* running variable to show (possible) end-of-file */
file_min_block number;
 
/* variables to check if recycle_bin is on and if extent as checked is in ... */
recycle_bin boolean:=false;
extent_in_recycle_bin boolean;
 
/* exception handler needed for non-existing tables note:344940.1 */
sqlstr varchar2(100);
table_does_not_exist exception;
pragma exception_init(table_does_not_exist,-942);
 
/* variable to spot space wastage in datafile of uniform tablespace */
space_wastage number;
 
begin
 
/* recyclebin is present in Oracle 10.2 and higher and might contain extent as checked */
begin
select value into checkval from v$parameter where name = 'recyclebin';
if checkval = 'on'
then
recycle_bin := true;
end if;
exception
when no_data_found
then
recycle_bin := false;
end;
 
/* main loop */
for c_file in c_dbfile
loop
/* initialization of loop variables */
dummy :=0;
extent_in_recycle_bin := false;
file_min_block := c_file.blocks;
 
begin
 
space_wastage:=0; /* reset for every file check */
 
<<check_free>>
 
for c_free in c_freespace(c_file.file_id)
loop
/* if blocks is an uneven value there is a need to correct
with -1 to compare with end-of-file which is even */
block_correction1 := (0-mod(c_free.max_block,2));
block_correction2 := (0-mod(c_file.blocks,2));
if file_min_block+block_correction2 = c_free.max_block+block_correction1
then
 
/* free extent is at end so file can be resized */
file_min_block := c_free.block_id;
 
/* Uniform sized tablespace check if space at end of file
is less then uniform extent size */
elsif (c_file.uni_extent !=0) and ((c_file.blocks - c_free.max_block) < c_file.uni_extent)
then
 
/* uniform tablespace which has a wastage of space in datafile
due to fact that space at end of file is smaller than uniform extent size */
 
space_wastage:=c_file.blocks - c_free.max_block;
file_min_block := c_free.block_id;
 
else
/* no more free extent at end of file, file cannot be further resized */
exit check_free;
end if;
end loop;
end;
 
/* check if file can be resized, minimal size of file 128 {+ initial_extent} blocks */
if (file_min_block = c_file.blocks) or (c_file.blocks <= c_file.file_min_size)
then
 
dbms_output.put_line('Tablespace: '||c_file.tablespace_name||' Datafile: '||c_file.file_name);
dbms_output.put_line('cannot be resized no free extents found');
dbms_output.put_line('Note: for some cases, dba_free_spaces data is not accurate, and this script does not work for such cases. You may want to manually check if the datafile is feasible to be resized');
dbms_output.put_line('.');
 
else
 
/* file needs minimal no of blocks which does vary over versions,
using safe value of 128 {+ initial_extent} */
if file_min_block < c_file.file_min_size
then
file_min_block := c_file.file_min_size;
end if;
 
 
dbms_output.put_line('Tablespace: '||c_file.tablespace_name||' Datafile: '||c_file.file_name);
dbms_output.put_line('current size: '||(c_file.blocks*c_file.block_size)/1024||'K'||' can be resized to: '||round((file_min_block*c_file.block_size)/1024)||'K (reduction of: '||round(((c_file.blocks-file_min_block)/c_file.blocks)*100,2)||' %)');
 
 
/* below is only true if recyclebin is on */
if recycle_bin
then
begin
sqlstr:='select distinct 1 from recyclebin$ where file#='||c_file.file_id;
execute immediate sqlstr into dummy;
 
if dummy > 0
then
 
dbms_output.put_line('Extents found in recyclebin for above file/tablespace');
dbms_output.put_line('Implying that purge of recyclebin might be needed in order to resize');
dbms_output.put_line('SQL> purge tablespace '||c_file.tablespace_name||';');
end if;
exception
when no_data_found
then null;
when table_does_not_exist
then null;
end;
end if;
dbms_output.put_line('SQL> alter database datafile '''||c_file.file_name||''' resize '||round((file_min_block*c_file.block_size)/1024)||'K;');
 
if space_wastage!=0
then
dbms_output.put_line('Datafile belongs to uniform sized tablespace and is not optimally sized.');
dbms_output.put_line('Size of datafile is not a multiple of NN*uniform_extent_size + overhead');
dbms_output.put_line('Space that cannot be used (space wastage): '||round((space_wastage*c_file.block_size)/1024)||'K');
dbms_output.put_line('For optimal usage of space in file either resize OR increase to: '||round(((c_file.blocks+(c_file.uni_extent-space_wastage))*c_file.block_size)/1024)||'K');
end if;
 
dbms_output.put_line('.');
 
end if;
 
end loop;
 
end;
/

比如执行结果如下:

Tablespace: BLOBS Datafile: /Data/STUDY/datafile/studyblobs01.dbf
current size: 33553408K can be resized to: 33548288K (reduction of: .02 %)
SQL> alter database datafile '/Data/STUDY/datafile/studyblobs01.dbf' resize 33548288K;
.
Tablespace: BLOBS Datafile: /Data/STUDY/datafile/studyblobs02.dbf
cannot be resized no free extents found
Note: for some cases, dba_free_spaces data is not accurate, and this script does not work for such cases. You may want to manually check if the datafile is feasible to be resized
.
Tablespace: BLOBS Datafile: /Data/STUDY/datafile/studyblobs03.dbf
cannot be resized no free extents found
Note: for some cases, dba_free_spaces data is not accurate, and this script does not work for such cases. You may want to manually check if the datafile is feasible to be resized
.
Tablespace: INDX Datafile: /Data/STUDY/datafile/studyindex01.dbf
current size: 33553408K can be resized to: 32640000K (reduction of: 2.72 %)
SQL> alter database datafile '/Data/STUDY/datafile/studyindex01.dbf' resize 32640000K;
.
Tablespace: INDX Datafile: /Data/STUDY/datafile/studyindex02.dbf
cannot be resized no free extents found
Note: for some cases, dba_free_spaces data is not accurate, and this script does not work for such cases. You may want to manually check if the datafile is feasible to be resized
.
Tablespace: SYSAUX Datafile: /Data/STUDY/datafile/studysysaux01.dbf
current size: 4741120K can be resized to: 4734976K (reduction of: .13 %)
SQL> alter database datafile '/Data/STUDY/datafile/studysysaux01.dbf' resize 4734976K;
.
Tablespace: SYSAUX Datafile: /Data/STUDY/datafile/studysysaux02.dbf
current size: 4608000K can be resized to: 4250624K (reduction of: 7.76 %)
SQL> alter database datafile '/Data/STUDY/datafile/studysysaux02.dbf' resize 4250624K;
.
Tablespace: SYSTEM Datafile: /Data/STUDY/datafile/studysystem01.dbf
current size: 1843200K can be resized to: 790528K (reduction of: 57.11 %)
SQL> alter database datafile '/Data/STUDY/datafile/studysystem01.dbf' resize 790528K;
.
Tablespace: UNDOTBS1 Datafile: /Data/STUDY/datafile/studyundotbs01.dbf
current size: 33553408K can be resized to: 2811904K (reduction of: 91.62 %)
SQL> alter database datafile '/Data/STUDY/datafile/studyundotbs01.dbf' resize 2811904K;
.
Tablespace: UNDOTBS1 Datafile: /Data/STUDY/datafile/studyundotbs02.dbf
cannot be resized no free extents found
Note: for some cases, dba_free_spaces data is not accurate, and this script does not work for such cases. You may want to manually check if the datafile is feasible to be resized
.
Tablespace: USERS Datafile: /Data/STUDY/datafile/studyusers01.dbf
cannot be resized no free extents found
Note: for some cases, dba_free_spaces data is not accurate, and this script does not work for such cases. You may want to manually check if the datafile is feasible to be resized
.
Tablespace: USERS Datafile: /Data/STUDY/datafile/studyusers02.dbf
cannot be resized no free extents found
Note: for some cases, dba_free_spaces data is not accurate, and this script does not work for such cases. You may want to manually check if the datafile is feasible to be resized
.
Tablespace: USERS Datafile: /Data/STUDY/datafile/studyusers03.dbf
cannot be resized no free extents found
Note: for some cases, dba_free_spaces data is not accurate, and this script does not work for such cases. You may want to manually check if the datafile is feasible to be resized
.
Tablespace: WCAUDIT Datafile: /Data/STUDY/datafile/studywcaudit01.dbf
current size: 9832064K can be resized to: 9818112K (reduction of: .14 %)
SQL> alter database datafile '/Data/STUDY/datafile/studywcaudit01.dbf' resize 9818112K;
.
 
PL/SQL procedure successfully completed
 
SQL> 

可提炼出如下 SQL 用以收缩数据文件(根据实际需求选择执行):

SQL> alter database datafile '/Data/STUDY/datafile/studyblobs01.dbf' resize 33548288K;
SQL> alter database datafile '/Data/STUDY/datafile/studyindex01.dbf' resize 32640000K;
SQL> alter database datafile '/Data/STUDY/datafile/studysysaux01.dbf' resize 4734976K;
SQL> alter database datafile '/Data/STUDY/datafile/studysysaux02.dbf' resize 4250624K;
SQL> alter database datafile '/Data/STUDY/datafile/studysystem01.dbf' resize 790528K;
SQL> alter database datafile '/Data/STUDY/datafile/studyundotbs01.dbf' resize 2811904K;
SQL> alter database datafile '/Data/STUDY/datafile/studywcaudit01.dbf' resize 9818112K;

2.通过查询dba_data_files表自己写执行SQL

select file_name,user_bytes from dba_data_files;

比如查询结果中的这一行:
在这里插入图片描述
我们可以执行如下语句来收缩表空间:
SQL> alter database datafile ‘/Data/STUDY/datafile/studyblobs01.dbf’ resize 26213351424;

如遇到“ORA-03297: file contains used data beyond requested RESIZE value”错误,可以resize后的值稍微调大一些再次执行。

参考文章:
https://www.cnblogs.com/rangle/p/9263505.html

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

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

相关文章

Grafana接入Zabbix数据源

1. 对接 Zabbix 1.1 安装 Zabbix 插件 在线安装&#xff1a; 1.2 配置 Zabbix 数据源 点击 Configuration > Data Sources > Add data source。选择 Zabbix&#xff0c;填写&#xff1a; URL&#xff1a;http://<zabbix-server>/api_jsonrpc.phpUsername&#x…

华为在不同发展时期的战略选择(节选)

华为在不同发展时期的战略选择&#xff08;节选&#xff09; 添加图片注释&#xff0c;不超过 140 字&#xff08;可选&#xff09; 来源&#xff1a;谢宁专著《华为战略管理法&#xff1a;DSTE实战体系》。本文有节选修改。 导言 从目前所取得的成就往回看&#xff0c;华为…

lua基础语法学习

lua基础语法学习 文章目录 lua基础语法学习1. 基础2. 输入输出3. 分支结构与循环结构4. 函数5. 元表与元方法6. 面向对象 1. 基础 注释 --单行注释--[[ 多行注释 --]]标识符 标识符以一个字母 A 到 Z 或 a 到 z 或下划线 _ 开头后加上 0 个或多个字母&#xff0c;下划线&…

【个人开发】deepspeed+Llama-factory 本地数据多卡Lora微调【完整教程】

文章目录 1.背景2.微调方式2.1 关键环境版本信息2.2 步骤2.2.1 下载llama-factory2.2.2 准备数据集2.2.3 微调模式2.2.3.1 zero-1微调2.2.3.2 zero-2微调2.2.3.3 zero-3微调2.2.3.4 单卡Lora微调 2.2.4 实验2.2.4.1 实验1&#xff1a;多GPU微调-zero12.2.4.2 实验2&#xff1a;…

【SpringBoot】数据访问技术spring Data、 JDBC、MyBatis、JSR-303校验

Spring Boot 数据访问技术及特性 目录标题 Spring Boot 数据访问技术及特性摘要1. 引言2. Spring Data架构与原理2.1 Spring Data概述2.2 Spring Data核心组件2.3 Spring Boot与Spring Data的集成机制 3. Spring Boot与JDBC的整合3.1 JDBC整合流程3.2 数据源自动配置3.3 JdbcTe…

手机放兜里,支付宝“碰一下”被盗刷?

大家好&#xff0c;我是小悟。 近期&#xff0c;网络上关于“支付宝‘碰一下’支付易被盗刷”的传言甚嚣尘上&#xff0c;不少用户对此心生疑虑。 首先&#xff0c;要明确一点&#xff1a;“碰一下”支付并不会像某些传言中所描述的那样容易被隔空盗刷。这一观点已经得到了支付…

vue框架后遗症∶被遗忘的dom操作

用多了vue、react等前端框架&#xff0c;不得不说用数据驱动视图来开发真的很香&#xff0c;但是也免不了会有不用这些框架的项目&#xff0c;dom操作还是很有必要的&#xff0c;一开始学习网页设计的时候就教过&#xff0c;后面一直开发项目基本上用框架。虽然有些想不起来了&…

基于深度学习+NLP豆瓣电影数据爬虫可视化推荐系统

博主介绍&#xff1a;资深开发工程师&#xff0c;从事互联网行业多年&#xff0c;熟悉各种主流语言&#xff0c;精通java、python、php、爬虫、web开发&#xff0c;已经做了多年的设计程序开发&#xff0c;开发过上千套设计程序&#xff0c;没有什么华丽的语言&#xff0c;只有…

快速列出MS Word中所有可用字体

Word中有很多字体&#xff0c;虽然在字体下拉列表中提供了字体的样例&#xff0c;但是并不全面&#xff0c;例如使用Batang字体的话&#xff0c;数字会显示成什么效果&#xff0c;就无法直观的看到。 打开Word应用程序&#xff0c;新建一个空白文档&#xff0c;按AltF11打开VBE…

【密码学实战】Java 实现 SM2 国密算法(签名带id、验签及 C1C3C2 加密解密)

前言 SM2是中国国家密码管理局发布的椭圆曲线公钥密码算法标准&#xff08;GB/T 32918&#xff09;&#xff0c;属于国密算法体系。与RSA和ECDSA相比&#xff0c;SM2在相同安全强度下密钥更短、计算效率更高。本文将介绍如何在Java中实现SM2的密钥生成、数字签名、验签、加密及…

flex布局自定义一行几栏,靠左对齐===grid布局

模板 <div class"content"><div class"item">1222</div><div class"item">1222</div><div class"item">1222</div><div class"item">1222</div><div class"…

使用 Ansys Discovery 高效创建角焊缝

概括 Ansys Discovery 2024R1 中的焊缝功能是一项重大改进&#xff0c;旨在简化和精简工程模拟中焊缝的分配过程。此功能集成了间歇焊缝等高级工具和功能&#xff0c;以更直观、更高效的方式促进焊缝的准备和分配。 该功能为工程师提供了无缝的工作流程&#xff0c;以准备和分…

Rk3568驱动开发_新字符设备驱动原理_7

1.申请设备号&#xff1a; 之前用的是register_chrdev(LED_MAJOR, LED_NAME, &led_fops);手动申请很不方便 使用alloc_chrdev_region函数申请设备号&#xff0c;手动申请的话要先查询是否有空余的设备号&#xff0c;很不方便&#xff0c;用此函数内核会自动将将空余设备号…

ESP32-S3 42引脚 语音控制模块、设备运转展示 GOOUUU TECH 果云科技S3-N16R8 控制舵机 LED开关 直流电机

最近还是想玩了下esp32&#xff0c;基于原来的开发板&#xff0c;看见佬做了一个语音识别的项目&#xff0c;通过这个语音识别可以控制LED开关和直流电机这些&#xff0c;详情可见视频&#xff08;推荐&#xff09;具体硬件就在下方。 信泰微】ESP32-S3 42引脚 语音控制模块、…

2025年光电科学与智能传感国际学术会议(ICOIS 2025)

重要信息 官网&#xff1a;www.ic-icois.org 时间&#xff1a;2025年3月14-16日 地点&#xff1a;中国-长春 简介 2025年光电科学与智能传感国际学术会议&#xff08;ICOIS 2025&#xff09;将于2025年3月14-16日在中国-长春隆重召开。会议将围绕“光学光电”、“智能传感”…

深入探索Python机器学习算法:监督学习(线性回归,逻辑回归,决策树与随机森林,支持向量机,K近邻算法)

文章目录 深入探索Python机器学习算法&#xff1a;监督学习一、线性回归二、逻辑回归三、决策树与随机森林四、支持向量机五、K近邻算法 深入探索Python机器学习算法&#xff1a;监督学习 在机器学习领域&#xff0c;Python凭借其丰富的库和简洁的语法成为了众多数据科学家和机…

Ubuntu+deepseek+Dify本地部署

1.deepseek本地部署 在Ollama官网下载 需要魔法下载 curl -fsSL https://ollama.com/install.sh | sh 在官网找到需要下载的deepseek模型版本 复制命令到终端 ollama run deepseek-r1:7b 停止ollama服务 sudo systemctl stop ollama # sudo systemctl stop ollama.servi…

PostgreSQL10 逻辑复制实战:构建高可用数据同步架构!

PostgreSQL10 逻辑复制实战&#xff1a;打造高可用数据同步架构&#xff01; 概述 PostgreSQL 10 引入了逻辑复制&#xff08;Logical Replication&#xff09;&#xff0c;为数据库高可用和数据同步提供了更灵活的选择。PostgreSQL 复制机制主要分为物理复制和逻辑复制两种&…

基于STM32的智能家居能源管理系统

1. 引言 传统家庭能源管理存在能耗监控粗放、设备联动不足等问题&#xff0c;难以适应绿色低碳发展需求。本文设计了一款基于STM32的智能家居能源管理系统&#xff0c;通过多源能耗监测、负荷预测与优化调度技术&#xff0c;实现家庭能源的精细化管理与智能优化&#xff0c;提…

Rust学习总结之-match

Rust 有一个叫做 match 的极为强大的控制流运算符&#xff0c;它允许我们将一个值与一系列的模式相比较&#xff0c;并根据相匹配的模式执行相应代码。模式可由字面量、变量、通配符和许多其他内容构成。 一&#xff1a;match定义 可以把 match 表达式想象成某种硬币分类器&a…