When operating on a database, the program prompts that the data log is too large; open the Directory Check of the data file storage, it is found that the LDF file has reached more than 2 GB. The cleanup method is shown on the Internet. I tried it to achieve the desired effect. After completion, the LDF file is less than MB. Back up data before performing the operation...My operations are inQuery AnalyzerThe operation is completed as follows:1. dump tr
--Shrink SQL log
--exec p_compdb ' test '
Create proc P_compdb
@dbname sysname--The name of the database to compress
@bkdatabase bit=1, because the database may be corrupted in the steps of separating the logs, so you can choose whether to automatically database
@bkfname n
sys.database_files; GODBCC shrinkfile (1, truncateonly);D. Emptying the fileThe following example shows the steps to empty a file to remove it from the database. For this example, you first create a data file and assume that the file contains data.CopyUse ADVENTUREWORKS2008R2; go--Create A data file and assume it contains data. ALTER DATABASE adventureworks2008r2 ADD FILE ( NAME = test1data, FILENAME
Step 1: Query Analyzer: Dump transaction datebasename with no_log
Part 2: Enterprise Manager: Right-click the database you want to compress -- all tasks -- contract database -- contract file -- Select log file -- select to contract to xxm in the contract mode, here we will provide a minimum number of M that can be reduced. Enter this number directly and click OK.
If you do not want it to become larger lat
Tags: partially truncated recover technical log management cat sql2005 It's nbspSQL2008 's Shrink logBecause SQL2008 is optimized for file and log management, the following statements can be run in SQL2005 but have been canceled in SQL2008:(SQL2005)Backuplog Dnname with No_logGoDumptransaction Dnname with No_logGoUse DnnameDBCC Shrinkfile (2)Go--------------------------------------------------------------(SQL2008):Clearing the log in SQL2008 must be d
If the log file in the SQL database is too large, you can try the following code to narrow down the log file to the desired size. Copy the code to the query analyzer, modify the three parameters (Database Name, log file name, and target log file size), and run the command.
Set nocount onDeclare @ logicalfilename sysname,@ Maxminutes int,@ Newsize int
Use mydb --
A few days ago also encountered a large log file problem, the actual size of the database is 600M, the actual size of the log file is 33M, but the log files occupy a space of 2.8G!!!
Try a variety of ways, Shirnk DATABASE, TRUNCATE LOG file, there is no way to reduce the file. Anyway, this should be a bug in SQL Server.
Then find the following code, you can red
There are two steps:Step 1. Truncate the log content in the database The code is as follows:Copy code Backup log database name WITH TRUNCATE_ONLY Step 2 force the database to compress its size The code is as follows:Copy code Dbcc shrinkdatabase (database name, TRUNCATEONLY) These two steps need to be execute
Today in the development environment encountered a problem, we found that the hard disk space on the server is full, look at the next found that this disk storage database file should be the source of a not very large Coucay pair. After the inspection, it was found that a data file under this database accounted for 70% of the space under the drive letter, and most of the data came from a table. But even if
In general, the contraction of the SQL database does not greatly reduce the size of the database, its primary role is to shrink the log size, this should be done periodically to avoid the database log too large.
1, set the database
Label:SQL2008 's Shrink logBecause SQL2008 is optimized for file and log management, the following statements can be run in SQL2005 but have been canceled in SQL2008: (SQL2000) --Prog:xinsoft--Time:2005-03-26 10:34SET NOCOUNT onDECLARE @LogicalFileName sysname, @MaxMinutes int, @NewSize intUse Dbjiexin--the name of the database to manipulateSELECT @LogicalFileName = ' Dbjiexin_log ',--log file name@MaxMinut
Label:When our application reaches a certain scale, our data will skyrocket. The original database may not meet our read and write requirements. But the growth of data is a business-wide delight, but the bigger headache is how to achieve effective expansion. How to do it without error.The simplest is the sub-database table.So how does the database know which mach
more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/SQLServer/
(Figure1: Number of error log files 0~99)
In addition to the above methods, you can modify the registry by modifying the form.
Create a new registry key (if it is modified):
Hkey_local_machine/software/microsoft/mssqlserver/mssqlserver/numerrorlogs, by default, does not have this registry entry, type selection REG_DWORD, The numeric value is set to th
Server
A few days ago also encountered a large log file problem, the actual size of the database is 600M, the actual size of the log file is 33M, but the log files occupy a space of 2.8G!!!Try a variety of ways, Shirnk DATABASE, TRUNCATE LOG file, there is no way to reduce the file. Anyway, this should be a bug in SQL Server.Then find the following code, you can
Tags: des style http color os IO data arRemember here, spare. SelectName, Recovery_model_desc fromSYS.databaseswhereName= ' wss_content_1000 ' Usewss_content_1000;ALTER DATABASEwss_content_1000SET RECOVERY Simple;Gousewss_content_1000GOCHECKPOINTGOCHECKPOINTGODBCCShrinkfile(Wss_content_1000_log, 200);Gousewss_content_1000;ALTER DATABASEwss_content_1000SET RECOVERY full;GoResources===============View or change the Recovery Model of a Database (
the SQL window and then reopen for recovery operations, If you also hint that the error you are using can stop the SQL service and then restart it, as the above other errors can generally be changed according to the wrong content to restore
Third, shrinking the database
In general, the contraction of the SQL
"Customer Name": Guizhou Tongren driving Person Training Center"Software name": UF T3 Universal Edition"Database Version": MS SQL Server 2000 "database size": 1GB X 6 (3 accounts for a total of 6 years)."Problem description": Due to server poisoning or Kaka, the customer sent the server computer to the installed shop to redo the operating system. Not detailed to
database. If an error is prompted, stop the SQL Service and restart it, as for the above other errors, you can change the content of the errors to restore them.
Iii. Database shrinking
In general, SQL database contraction does not greatly reduce the
. If an error is prompted, stop the SQL Service and restart it, as for the above other errors, you can change the content of the errors to restore them.Iii. Database shrinkingIn general, the contraction of the SQL database does not greatly reduce the size of the database. It
Mysql database: 1. PHP-obtain the number of rows of MySQL database query results: First, define a database interface function, which can be stored separately as a php page and on another php page, first, you must use the include function to include
First, you need to define a database interface function, which can be
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.