- 首先要知道的,就是這個temporary tablespace是做什麼用的,竟然比資料檔還要龐大。以下是眾多資料中最clear且easy的說明(不過我看他的年份也最舊...):Temporary tablespaces are used to manage space for database sort operations and for storing global temporary tables. For example, if you join two large tables, and Oracle cannot do the sort in memory (see SORT_AREA_SIZE initialisation parameter), space will be allocated in a temporary tablespace for doing the sort operation. Other SQL operations that might require disk sorting are: CREATE INDEX, ANALYZE, Select DISTINCT, ORDER BY, GROUP BY, UNION, INTERSECT, MINUS, Sort-Merge joins, etc.
- 接著,temporary tablespace看來只是暫時替代記憶體用的,真的需要備份嗎? oracle的文件裡其實就滿明確的說: You should not back up temporary tablespaces.But why??TEMPFILEs are not recorded in the database's control file. This implies that one can just recreate them whenever you restore the database, or after deleting them by accident.
- 最後,來個新的tempfile吧,以下是我在production直接玩的(不要命XD),跟我看到的所有文件不太一樣,待會再說說。
3.1. 直接利用UI介面在該temporary tablespace新增一個tempfile,設定好大小、autoextend的大小等
3.2. 把舊的tempfile drop掉:
SQL> alter database tempfile 'oradata/[db_name]/[file_name]' drop; - 觀察一陣子在手動把原本龐大的tempfile delete掉吧~
我說大部份人的做法,都是先create另一個tablespace,把user的temp tablespace轉到新的tablespace上,接著砍掉舊的tempfile重新指定好後,再把user的temp tablespace轉回來,最後砍掉新增的tablespace...
我真的還不確定我那種直接來的方法會不會有影響,可是目前觀察起來是好的,到底會不會有問題呢= =
Ref: 找來的陳年老文
Post a Comment