Managing a tempdb database

This page describes the management of the tempdb database in Cloud SQL for SQL Server.

The tempdb database is a system database that holds many objects, including temporary tables, stored procedures, and more. In your instances, you can perform common operations on this database.

You can manage the tempdb database of your instance in a way that meets your needs.

A tempdb database is recreated each time an instance is restarted. To prevent the loss of user permissions, Cloud SQL provides permissions to the sqlserver user after an instance is restarted.

Overview

The sqlserver user has the CONTROL permission for managing the tempdb database options. Additionally, the user can grant the permission to other users.

See the general information about managing a tempdb database.

Managing tempdb files

After you connect to an instance, the sqlserver user can manage the tempdb files.

Number of files

The user has the CONTROL permission on the tempdb database. The user can control settings for the number of files (and more). For example, the user can perform these operations:

  • ALTER DATABASE [tempdb] ADD FILE
  • ALTER DATABASE [tempdb] REMOVE

File size

The user can control the size of files in the tempdb database. For information about using the ALTER DATABASE statement to change the file size options, see ALTER DATABASE (Transact-SQL) File and Filegroup Options.

What's next