婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > oracle表空單清理常用代碼段整理

oracle表空單清理常用代碼段整理

熱門標簽:word地圖標注方向 外呼線路外顯本地號碼 美圖秀秀地圖標注 征服者火車站地圖標注 百度地圖標注素材 開封智能外呼系統(tǒng)廠家 阿爾巴尼亞地圖標注app 征服眼公司地圖標注 人工智能地圖標注自己能做嗎
1.查詢表空間使用情況:
sqlplus system/manager@topprod
復(fù)制代碼 代碼如下:

SQL>@q_tbsFREE

2.查詢temp使用方法:
sqlplus system/manager@topprod
復(fù)制代碼 代碼如下:

SQL>SELECT
d.tablespace_name tablespace_name
, d.status tablespace_status
, NVL(a.bytes, 0) tablespace_size
, NVL(t.bytes, 0) used
, TRUNC(NVL(t.bytes / a.bytes * 100, 0)) used_pct
, NVL(s.current_users, 0) current_users
FROM
sys.dba_tablespaces d
, ( select tablespace_name, sum(bytes) bytes
from dba_temp_files
group by tablespace_name
) a
, ( select tablespace_name, sum(bytes_cached) bytes
from v$temp_extent_pool
group by tablespace_name
) t
, v$sort_segment s
WHERE
d.tablespace_name = a.tablespace_name(+)
AND d.tablespace_name = t.tablespace_name(+)
AND d.tablespace_name = s.tablespace_name(+)
AND d.extent_management like 'LOCAL'
AND d.contents like 'TEMPORARY';

2.清理TEMP臨時表空間:(在無用戶連接的狀況下操作,最好在清理之前重啟一下數(shù)據(jù)庫)
復(fù)制代碼 代碼如下:

#重啟數(shù)據(jù)庫
sqlplus '/as sysdba'
SQL>shutdown immediate
SQL>startup
#創(chuàng)建一個臨時表空間temp02,用作臨時替換
SQL>create temporary tablespace temp02 tempfile '/u2/oradb/oradata/topprod/temp02.dbf' size 10M autoextend on next 10M;
#將系統(tǒng)臨時表空間指向temp02
SQL>alter database default temporary tablespace temp02;
#刪除原來的臨時表空間temp
SQL>drop tablespace temp including contents and datafiles;
#創(chuàng)建新的臨時表空間temp
SQL>create temporary tablespace temp tempfile '/u2/oradb/oradata/topprod/temp01.dbf' size 4096M autoextend on next 100M;
#將系統(tǒng)臨時表空間指回temp
SQL>alter database default temporary tablespace temp;
#刪除臨時表空間temp02
SQL>drop tablespace temp02 including contents and datafiles;

3.清理UNDO表空間:(在無用戶連接的狀況下操作,最好在清理之前重啟一下數(shù)據(jù)庫)
復(fù)制代碼 代碼如下:

#重啟數(shù)據(jù)庫
sqlplus '/as sysdba'
SQL>shutdown immediate
SQL>startup
#創(chuàng)建一個UNDO表空間undotbs2,用作臨時替換
SQL>create undo tablespace undotbs2 datafile '/u2/oradb/oradata/topprod/undotbs02.dbf' size 10M autoextend on next 10M;
#將系統(tǒng)UNDO表空間指向undotbs2
SQL>alter system set undo_tablespace=undotbs2 scope=both;
#確保所有在UNDOTBS1的undo segment都已offline
SQL> select SEGMENT_NAME ,STATUS ,TABLESPACE_NAME from dba_rollback_segs;
#刪除原來的UNDO表空間undotbs1
SQL>drop tablespace undotbs1 including contents and datafiles;
#創(chuàng)建新的臨時表空間undotbs1
SQL>create undo tablespace undotbs1 datafile '/u2/oradb/oradata/topprod/undotbs01.dbf' size 4096M;
#將系統(tǒng)UNDO表空間指回undotbs1
SQL>alter system set undo_tablespace=undotbs1 scope=both;
#刪除UNDO表空間undotbs2
SQL>drop tablespace undotbs2 including contents and datafiles;

3.清理TEMPTABS表空間:
復(fù)制代碼 代碼如下:

#刪除TEMPTABS表空間
SQL>drop tablespace temptabs including contents and datafiles;
#創(chuàng)建TEMPTABS表空間
SQL>create tablespace temptabs datafile '/u2/oradb/oradata/topprod/temptabs.dbf' size 4096M autoextend on next 100M;
或者刪除表
[code]
select 'drop table '||segment_name ||';' from dba_segments where tablespace_name='TEMPTABS' and segment_name like 'TT%' and segment_name not like '%_FILE';

4.增加系統(tǒng)表空間:
復(fù)制代碼 代碼如下:

alter tablespace SYSTEM add datafile '/u2/oradb/oradata/topprod/system02.dbf' size 2000M autoextend on next 10M;
alter tablespace SYSAUX add datafile '/u2/oradb/oradata/topprod/sysaux02.dbf' size 2000M autoextend on next 10M;
您可能感興趣的文章:
  • Oracle 查看表空間的大小及使用情況sql語句
  • oracle 創(chuàng)建表空間步驟代碼

標簽:宜春 六安 葫蘆島 孝感 泰安 淮南 酒泉 海北

巨人網(wǎng)絡(luò)通訊聲明:本文標題《oracle表空單清理常用代碼段整理》,本文關(guān)鍵詞  oracle,表空,單清理,單,清理,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《oracle表空單清理常用代碼段整理》相關(guān)的同類信息!
  • 本頁收集關(guān)于oracle表空單清理常用代碼段整理的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 长阳| 西宁市| 霍山县| 磴口县| 兴城市| 文水县| 铜鼓县| 疏勒县| 留坝县| 吉木乃县| 门源| 陆良县| 红原县| 澜沧| 天全县| 虞城县| 惠水县| 青河县| 天祝| 梁河县| 宝鸡市| 驻马店市| 苗栗市| 麻栗坡县| 新宁县| 吉安县| 高唐县| 平陆县| 崇信县| 天津市| 汉中市| 桦甸市| 阳西县| 滦南县| 鄢陵县| 会昌县| 云阳县| 墨玉县| 九龙县| 富顺县| 佳木斯市|