本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
縮減 tempdb 資料庫
有兩種方式可縮減 Amazon RDS 資料庫執行個體上的 tempdb 資料庫。您可以使用 rds_shrink_tempdbfile 程序,或設定 SIZE 屬性。
使用 rds_shrink_tempdbfile 程序
您可以使用 Amazon RDS 程序 msdb.dbo.rds_shrink_tempdbfile,來縮減 tempdb 資料庫。只有在您對 rds_shrink_tempdbfile 具有 CONTROL 存取權時,才能呼叫 tempdb。當您呼叫 rds_shrink_tempdbfile 時,資料庫執行個體沒有停機時間。
rds_shrink_tempdbfile 程序具有下列參數。
| 參數名稱 | 資料類型 | 預設 | 必要 | 描述 |
|---|---|---|---|---|
|
SYSNAME |
— |
必要 |
要縮減之檔案的邏輯名稱。 |
|
int |
null |
選擇性 |
檔案的新大小 (以 MB 為單位)。 |
下列範例會取得 tempdb 資料庫的檔案名稱。
use tempdb; GO select name, * from sys.sysfiles; GO
下列範例會縮減名為 tempdb 的 test_file 資料庫檔案,並要求 10 MB 的新大小:
exec msdb.dbo.rds_shrink_tempdbfile @temp_filename = N'test_file', @target_size =10;
設定 SIZE 屬性
您也可以設定 tempdb 屬性,然後重新啟動資料庫執行個體,來縮減 SIZE 資料庫。如需重新啟動資料庫執行個體的詳細資訊,請參閱重新啟動中的資料庫執行個體。
下列範例示範將 SIZE 屬性設定為 1024 MB。
alter database [tempdb] modify file (NAME = N'templog', SIZE =1024MB)