暫存資料表空間總是滿的初步想法(AIX系統,裸裝置)

來源:互聯網
上載者:User

由於開發人員的水平有高低,dba精力有限,不可能及時解決sql語句問題!打算通過模仿重做日誌的方法來解決資料庫運行緩慢問題!

1.查看臨時檔案的使用/剩餘空間

  1. select (BYTES_USED+BYTES_FREE)/1024/1024 "總空間M", BYTES_USED/1024/1024 "使用空間M"   from v$temp_space_header;  

2.查看目前使用者所屬的暫存資料表空間

  1. select username ,temporary_tablespace from dba_users;   

  USERNAME    TEMPORARY_TABLESPACE
  -----------         ------------------------------
  SYS                TEMP1
  SYSTEM         TEMP1
  DBSNMP         TEMP1
  HUJINPEI         TEMP1
  ALAN1             TEMP1
  PERFUSER     TEMP1
  ALAN2             TEMP1
  MYUSER          TEMP1
  OUTLN            TEMP1
  WMSYS           TEMP1

  已選擇10行。

3.查看當前有那些臨時檔案。

  1. select name from v$tempfile;   

4.在裸裝置上面建立資料檔案

   a.在檔案系統裡面建立想要的的連結
      比如:cd /sgerp5/sgerp5 
            touch temp03.dbf

   b.建立軟連結

      注意:這步千萬小心,/dev/sgerp5_sgtemp03這個目錄不能錯,如果錯了,掛載成功,但是會各種奇怪的錯誤 

       ①--建立資料檔案

           mklv -y sgerp5_temp03 -T O -t raw -a ie -e x sgvg 60 hdisk2 hdisk3 hdisk4 hdisk5 

       ②--建立連結

          ln -fs /dev/sgerp5_sgtemp03 /sgerp5/sgerp5/temp03.dbf

  

5.重建立立一個暫存資料表空間:請仔細核對指令碼,暫存資料表空間建立命令和永久不一樣

  1. CREATE TEMPORARY TABLESPACE "TEMP3" TEMPFILE   
  2. '/sgerp5/sgerp5/temp03.dbf' SIZE 10G  
  3. AUTOEXTEND ON NEXT 655360 MAXSIZE 30G  
  4. EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1048576;  

6.將建好的TEMP資料表空間設定為資料庫預設的暫存資料表空間:

  1. alter database default temporary tablespace temp;  
  2. --查看預設的資料表空間  
  3. select username,temporary_tablespace from dba_users;   

7、DROP掉舊的TEMP1的資料表空間:(如果不用drop直接跳到第十步)

  1. drop tablespace temp1 including contents and datafiles;  

8、如果drop不掉,可能現在的暫存資料表空間有人在用,等到session釋放以後再搞,以下查看誰佔用的暫存資料表空間

  1. SELECT se.username,  
  2.        sid,  
  3.        serial#,  
  4.        sql_address,  
  5.        machine,  
  6.        program,  
  7.        tablespace,  
  8.        segtype,  
  9.        contents   
  10.   FROM v$session se,  
  11.        v$sort_usage su  
  12. HERE se.saddr=su.session_addr    
  • 1
  • 2
  • 下一頁

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.