powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / Уменьшение размера БД в SQL Server 6.5
3 сообщений из 3, страница 1 из 1
Уменьшение размера БД в SQL Server 6.5
    #32009897
AlexUnik
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Я недавно обнаружил, что на одном из серверов (6.5) кто-то до меня увеличил размер базы Tempdb до размеров в 300 мб за счет размещения ее полностью на устройстве такого размера (помимо этого, она размещается еще и на других устройствах). Возможно ли отсоединить данное устройство от этой базы или как-то иначе изменить ее размер?
...
Рейтинг: 0 / 0
Уменьшение размера БД в SQL Server 6.5
    #32009962
Fompro
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
SHRINKDB (database_name [, new_size [, 'MASTEROVERRIDE']])
When specified with only the database_name parameter, DBCC SHRINKDB returns the minimum size to which this database can shrink, and it lists all objects and indexes that are preventing you from shrinking it further. You cannot shrink the database to a size smaller than the one returned; use caution and drop or move the database objects until the returned size is acceptable.
When new_size is specified, DBCC SHRINKDB shrinks the size of the specified database to the value, as specified in 2K pages by the new_size parameter. DBCC SHRINKDB may shrink both the data and log portions of the database. To change the size of only the data or the log, shrink the entire database first and then use the ALTER DATABASE statement to increase the size of the data or log portion of the database.
To shrink a user database, the database must be set to single user mode. Use the sp_dboption system stored procedure to set this database option. After setting the database to single-user mode, it is recommended that you dump both the master database and the database you are shrinking, prior to using DBCC SHRINKDB.
To shrink the master or tempdb databases you must start the server in single-user mode (use the sqlservr command-line executable with the -m parameter).

Important The database cannot be shrunk beyond either the size of the model database or to a size that is not a valid increment of allocation units. That is, new_size must be equal to or greater than the minimum size as returned by DBCC SHRINKDB plus any number of 512-byte increments (each of which is 256 2K pages). For example, if DBCC SHRINKDB returned a message that the 'Database can be shrunk to 5376 pages', the database can be shrunk to 5376 (10.5 MB), 5632 (11 MB), 5888 (11.5 MB), and so on. For more information, see the "Shrink a Database" example, later in this section.
After successfully shrinking a database to the desired size, back up both the master database and the database that has been shrunk.

DBCC SHRINKDB is fully logged and recoverable except when used on the master database. The MASTEROVERRIDE clause is required when decreasing the size of the master database. However, use caution if you need to shrink the size of the master database, because recovery could fail if the system fails while shrinking the master database. Back up the master database prior to shrinking it. You must be the system administrator or database owner to execute this statement.
G. Shrink a Database (SHRINKDB)
This example defines the steps to ensure a proper decrease in size of a database:
1. Set the database to single-user mode using the sp_dboption system stored procedure.
2. Change your current database to the database you want to shrink.
3. Verify how small you can make the database. (Run DBCC SHRINKDB without specifying a new_size.)
4. Shrink the database.

USE master
go
sp_dboption 'sales', 'single user', true
go
USE sales
go
DBCC SHRINKDB(sales)
go
Current size of database Size database can be shrunk to
------------------------ ------------------------------
1536 1024

(1 row(s) affected)
DBCC execution completed. If DBCC printed error messages, see your System Administrator.

DBCC SHRINKDB reported a minimum size of 5376 pages. Because the absolute minimum is not always necessary, shrink the sales database down to a new size of 12 MB.
DBCC SHRINKDB(sales, 6144)
go
DBCC SHRINKDB running on database "sales"...
DBCC execution completed. If DBCC printed error messages, see your System Administrator.
...
Рейтинг: 0 / 0
Уменьшение размера БД в SQL Server 6.5
    #32009983
AlexUnik
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
2 Fompro
Спасибо, в этом я разобрался. Меня интересует еще один аспект. Как удалить одно устройство из списка устройств, на которых расположена БД Tempdb (вполне достаточно тех, на которых она была размещена изначально)?
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / Уменьшение размера БД в SQL Server 6.5
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]