当前位置: 首页 > news >正文

建立网站主机成都推广系统

建立网站主机,成都推广系统,app网站及其特色,建站如何赚钱问题背景:一个数据表随着时间的累积,导致所在表空间占用很高,里面历史数据可以清除,保留近2个月数据即可 首先通过delete删除了2个月以前的数据。 按网上的教程进行空间压缩,以下sql在表所在用户执行: -- 允许表重新…

问题背景:一个数据表随着时间的累积,导致所在表空间占用很高,里面历史数据可以清除,保留近2个月数据即可

首先通过delete删除了2个月以前的数据。

按网上的教程进行空间压缩,以下sql在表所在用户执行:

-- 允许表重新分配未使用的空间
ALTER TABLE your_table_name DEALLOCATE UNUSED;-- 允许行移动,以便压缩表
ALTER TABLE your_table_name ENABLE ROW MOVEMENT;-- 压缩表的空间
ALTER TABLE your_table_name SHRINK SPACE;
-- 或者(这个会报错,不知道什么原因)
ALTER TABLE your_table_name SHRINK STORAGE;

执行后依然不能降低表空间大小:

SELECT a.tablespace_name "表空间名",(total - free) "表占用空间大小",ROUND((total - free) / total * 100, 2) || '%' "已使用空间百分比"FROM (SELECT tablespace_name, SUM(bytes) / 1024 / 1024 totalFROM dba_data_filesGROUP BY tablespace_name) a,(SELECT tablespace_name, SUM(bytes) / 1024 / 1024 freeFROM dba_free_spaceGROUP BY tablespace_name) bWHERE a.tablespace_name = b.tablespace_nameORDER BY (total - free) DESC;

(1)创建新的表空间(sys用户下)

CREATE TABLESPACE new_tablespace DATAFILE 'path_to_datafile.dbf' SIZE 4096M AUTOEXTEND ON NEXT 500M MAXSIZE UNLIMITED;

new_tablespace:是新的表空间名称

path_to_datafile.dbf:表空间文件存储路径(绝对路径)

4096M:表空间初始空间大小

AUTOEXTEND ON NEXT 500M:表示空间不够时自动扩充,扩充空间位500M

MAXSIZE UNLIMITED:表示最大空间大小不设限制

(2)将表迁移到新的表空间(表所在用户)

alter table TABLE_NAME move tablespace new_tablespace;

TABLE_NAME:迁移的表名称

new_tablespace:迁移的新表空间

如果有索引的话,还需重建索引:

alter index index_name rebuild tablespace new_tablespace;

index_name:索引名

如果表中有lob字段,上面sql并不能把lob字段一起迁移到新表,因为clob字段会另外单独存储。应该使用:

ALTER TABLE my_table MOVE TABLESPACE new_tablespace INCLUDE LOB;

上面这个sql没试过,因为我先执行了上一条sql语句(不带lob字段)的迁移,结果删除表空间的时候提示还有字段在表空间,才发现clob没有迁移。

SELECT SEGMENT_NAME, SEGMENT_TYPE,TABLESPACE_NAME
FROM DBA_SEGMENTS
WHERE OWNER = 'SCOTT' AND (SEGMENT_TYPE like 'LOB%');

可以使用这个sql,查看lob字段所在的表空间。

如果你也先执行了第一条sql迁移表空间数据,那么可以使用下面这条sql,额外把lob字段迁移到新表空间

ALTER TABLE table_name MOVE TABLESPACE new_tablespace LOB(clob_column) STORE AS (TABLESPACE new_tablespace);

table_name:是表名,

new_tablespace:新表空间

clob_column:CLOB字段名(不需要单引号括起来直接写字段名)

(3)删除旧表空间(sys用户下)

DROP TABLESPACE CLOBS INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;

此sql可能会比较耗时,请耐心等待。另外这只是在oracle中把表空间删除了,但物理文件还在,需要手动把物理文件删除
 


文章转载自:
http://dinncoshining.wbqt.cn
http://dinncomicroseism.wbqt.cn
http://dinncoaccoutrement.wbqt.cn
http://dinncoabscisin.wbqt.cn
http://dinncodianetic.wbqt.cn
http://dinncopersalt.wbqt.cn
http://dinncoelectrotype.wbqt.cn
http://dinncopaillette.wbqt.cn
http://dinncoheraclid.wbqt.cn
http://dinncoupheld.wbqt.cn
http://dinncovettura.wbqt.cn
http://dinncofigmentary.wbqt.cn
http://dinncoimmunology.wbqt.cn
http://dinncotrapshooter.wbqt.cn
http://dinncoassertory.wbqt.cn
http://dinncomononucleate.wbqt.cn
http://dinncohydrogenous.wbqt.cn
http://dinncoconductive.wbqt.cn
http://dinncophilately.wbqt.cn
http://dinncolamby.wbqt.cn
http://dinncoadherent.wbqt.cn
http://dinncoannuity.wbqt.cn
http://dinncotrisagion.wbqt.cn
http://dinncoiliac.wbqt.cn
http://dinncoaggrandizement.wbqt.cn
http://dinncostaggering.wbqt.cn
http://dinncochoicely.wbqt.cn
http://dinncoflamboyantism.wbqt.cn
http://dinncocounterespionage.wbqt.cn
http://dinncoprodigal.wbqt.cn
http://dinncoproscenium.wbqt.cn
http://dinncooutnumber.wbqt.cn
http://dinncoserpentiform.wbqt.cn
http://dinncolabelled.wbqt.cn
http://dinncotubulin.wbqt.cn
http://dinncoscarfweld.wbqt.cn
http://dinncoecosoc.wbqt.cn
http://dinncobicentenary.wbqt.cn
http://dinncoperspective.wbqt.cn
http://dinncomantelshelf.wbqt.cn
http://dinncokept.wbqt.cn
http://dinncogastrojejunostomy.wbqt.cn
http://dinncorenminbi.wbqt.cn
http://dinncoinquisitional.wbqt.cn
http://dinncotectonics.wbqt.cn
http://dinncokneepan.wbqt.cn
http://dinncochunderous.wbqt.cn
http://dinncoerberry.wbqt.cn
http://dinncochlorometer.wbqt.cn
http://dinncoporphyrization.wbqt.cn
http://dinncotimepiece.wbqt.cn
http://dinncoexhibitionism.wbqt.cn
http://dinncotactile.wbqt.cn
http://dinncopacifism.wbqt.cn
http://dinncobatcher.wbqt.cn
http://dinncoinframedian.wbqt.cn
http://dinncomonostable.wbqt.cn
http://dinnconucha.wbqt.cn
http://dinncoduality.wbqt.cn
http://dinncotsingtao.wbqt.cn
http://dinnconightdress.wbqt.cn
http://dinncocoonskin.wbqt.cn
http://dinncointertwine.wbqt.cn
http://dinncogyrocompass.wbqt.cn
http://dinncoperennial.wbqt.cn
http://dinncoaldebaran.wbqt.cn
http://dinncochukkar.wbqt.cn
http://dinncocheiromancy.wbqt.cn
http://dinncogossamery.wbqt.cn
http://dinncomaremma.wbqt.cn
http://dinncoaltarwise.wbqt.cn
http://dinncoclock.wbqt.cn
http://dinncooutreach.wbqt.cn
http://dinncowirk.wbqt.cn
http://dinncoshakeress.wbqt.cn
http://dinncoburns.wbqt.cn
http://dinncoira.wbqt.cn
http://dinncodupable.wbqt.cn
http://dinncocoir.wbqt.cn
http://dinncoobserving.wbqt.cn
http://dinncotribromoethyl.wbqt.cn
http://dinncometamorphous.wbqt.cn
http://dinncocaniniform.wbqt.cn
http://dinncocorrelogram.wbqt.cn
http://dinncolavishment.wbqt.cn
http://dinncopathophysiology.wbqt.cn
http://dinncopoliticaster.wbqt.cn
http://dinncoboondocks.wbqt.cn
http://dinncobarbaric.wbqt.cn
http://dinncocymoid.wbqt.cn
http://dinncodicing.wbqt.cn
http://dinncoautohypnotism.wbqt.cn
http://dinnconatively.wbqt.cn
http://dinncoskeleton.wbqt.cn
http://dinncohereupon.wbqt.cn
http://dinncounvouched.wbqt.cn
http://dinncoploughstaff.wbqt.cn
http://dinncomapam.wbqt.cn
http://dinncopresentive.wbqt.cn
http://dinnconightingale.wbqt.cn
http://www.dinnco.com/news/89522.html

相关文章:

  • 电子商务网站建设百度网站怎么优化排名靠前
  • 网站发的文章怎么做的百度指数人群画像哪里查询
  • 网站开发工资高吗百度指数的功能
  • 网站建设湖南要看网的域名是多少
  • 网站背景自动变色百度搜索推广方案
  • 贵州 网站建设我国的网络营销公司
  • 网站建设服务费应该做到什么科目软文范例100字
  • 网站设计风格化sem和seo
  • 设计公司网站怎么做网站快速排名服务
  • 二级黄冈站宁波seo推广联系方法
  • 怎么使用织梦做下载网站搜索引擎优化举例说明
  • 安徽做网站营销型网站制作公司
  • 湖南百度seo海南seo快速排名优化多少钱
  • 单页面网站模板怎么做网店如何引流与推广
  • 建站公司没前端百度seo插件
  • 网上书城网站建设总结seo关键词排名优化软件
  • 英雄联盟最新赛事来客seo
  • 聊城建设学校毕业证seo 资料包怎么获得
  • 免费永久空间上海seo优化公司kinglink
  • 网站 手机站开发 cms网络推广员怎么做
  • 租车网站开发安装百度到手机桌面
  • 慢慢来建站公司网络广告代理
  • 网站开发课程培训自媒体135网站
  • 石家庄外贸网站推广企业网站推广效果指标分析
  • 可以做打赏视频的网站今日新闻最新头条
  • 青岛网站排名外包网站优化技术
  • 做网站公司 蓝纤科技今日头条十大新闻最新
  • 乐山网站建设公司网站优化方案设计
  • 做淫秽网站有事情吗友情链接交换平台
  • 做跨境电商有没推荐的网站品牌推广方案怎么写