Tags: blog http os using AR for file SP dataAfter AlwaysOn is configured, because there is no use of the full recovery model, the simple or bulk-logged mode is not available, so the log is growing and cannot be emptied using the change recovery modeManual operation shrinking or truncating the log is also invalidAfter reading some articles, it was found that someone usedPrimary instance out of availability g
every 15 minutes within seven days, which is retained for 2 days.You can use the database maintenance plan Wizard to easily create a backup plan, but you must remember how long the backup will be retained. Otherwise, it will be a bad thing if the hard disk space is backed up.
2.
A few days ago, I also encountered the problem that the log file is too large. the actual size of the database is 600 mb, and the actual size of the
The sql2008 shrink log is as follows:
The code is as follows
Copy Code
BACKUP LOG dbname to disk= ' Dbname.log 'DBCC shrinkfile (' Dbname_log ', 1)
But remember to perform two times before you can finally perform the contraction;
Shrink database files (if not compressed, database files do not reduce Enterprise Manager--right--the database you want to compress--all tas
space" topic in SQL Server online Help.Additionally, transaction log extensions can cause the following scenarios:· Very large transaction log files.· The transaction may fail and may start rolling back.· The transaction may take a long time to complete.· performance issues may occur.· There may be blocking behavior.ReasonTransaction
full mode when the purge is complete.Use[Master]GOAlterDATABASEDnnameSETRECOVERY SimpleWithno_waitGOAlterDATABASEDnnameSETRECOVERY Simple--Simple ModeGOUseDnnameGODbccShrinkfile (N' Dnname_log ', One, Truncateonly)GOUse[Master]GOAlterDATABASEDnnameSETRECOVERYFullWithno_waitGOAlterDATABASEDnnameSETRECOVERYFull--Revert to full modeGOAdvantages: This cleanup log runs short of time, 90GB of log can be cleared
necessarily in Sqlserver7 and the following versions):
First step:
Back up the entire database in case of a rainy start
Step Two:
After the backup is complete, execute the following statement in Query Analyzer:
EXEC sp_detach_db Yourdbname,true--Dismount the DB's registration information in MSSQL
Step Three:
Delete the log file in the same directory as the physical file of the
Log4jdbcIs a Java JDBC driver that can log SQL and/or jdbc cils (and optionally SQL timingInformation) for other JDBC drivers
The official homepage is code.google.com/p/log4jdbc/
A log tool that prints SQL statements based on slf4j.The latest version is 1.2 final.
Label:Recently the customer reflected a problem, saying that the application server failed to write the database, the first thought is the application server problem, and later from the feedback database running log, because the database is full of things log, resulting in no longer write data.The following conclusions are drawn from this problem:1, the database data files and things
Cause Analysis and Solution for SQL Server failure to contract log files, SQL Cause Analysis
An error is reported when the server executes a job that compresses the log file size recently.
One of my batch log shrinking scripts
USE [master] GO/****** Object: StoredProcedure
Alterdatabase dnname SET RECOVERY Full--revert to fully mode GOAdvantages: This cleanup log runs short of time, 90GB of log can be cleared in minutes or so, after doing a full backup in minutescan be completed.Cons: But this action is best not to be used frequently, as it will result in system fragmentation. Log and diff backups can be truncated in normal state
then replace the data file of the new library with the attached failed data file, and then set the database as the Emergency Recovery mode, so that the data can be read in generalALTER DATABASE db_name SET EMERGENCYAfter the database can be read, you can try to set it to ONLINE mode, if successful, then DBCC CHECKDB once, confirm no problemIf you can't online, you probably have to create a new library and then take the data from the contingency mode library to the new library.Special Note: The
Label:Restore a full backup first, but be sure to select with Nonerecovery in the full backup (option 2nd in Enterprise Manager) The SQL statement is: Restore Database MyData from disk = ' C:\temp\movedb.bak ' WITH NORECOVERY The database then becomes the recovery mode, so you can restore the trn file by adding it in one piece. Statement is: Restore log Mydata from disk =
"D:\Program Files\Microsoft
Provide a sophisticated method of compressing the log and database files as follows:
1. Clear the Log
DUMP TRANSACTION Library name with NO_LOG
2. Truncate the transaction log:
BACKUP LOG database name with NO_LOG
3. Shrink the database file (if not compressed, the database file does not decrease
Enterprise Manager--ri
SQL Server 2000Log cleanup tutorial
SQL Server 2000 database logs are too large!How can I clean up SQL Server 2000 logs?How to compress SQL Server 2000 logs?How can I reduce the Log Size of SQL Server 2000?
As far as xiaobian know
Server
SQL Server 2000 Log shipping Function-settings (1)
The log shipping feature automatically copies the transaction log file for the database and is saved to another database in the standby server (standby server). Therefore, the availability of SQL Server databases can
number of MB allowed to be shrunk is displayed. Enter this number directly and click OK.
You can also use SQL statements. (Note: the LDF file size does not change after you use the Enterprise Manager to perform the shrink operation. Use the following SQL command)
-- Shrink DatabaseDBCC shrinkdatabase (database name)
-- Contract the specified data file. 1 is the file number. You can use this statement
1. Clear logsDump transaction database name with no_log2. truncate transaction logs:Backup log database name with no_log3. Compress database files (if not compressed, the database files will not be reducedEnterprise Manager -- Right-click the database you want to compress -- all tasks -- contract database -- contract file-- Select log file -- select to shrink to xxm in the contraction mode. Here, a minimum
number of MB allowed to be shrunk is displayed. Enter this number directly and click OK.
You can also use SQL statements to complete
-- Shrink Database
DBCC shrinkdatabase (database name)
-- Contract the specified data file. 1 is the file number. You can use this statement to query: Select * From sysfiles
DBCC shrinkfile (1)
4. To minimize log files (for SQL
can also use SQL statements to complete-- Shrink DatabaseDBCC shrinkdatabase (customer profile)
-- Contract the specified data file. 1 is the file number. You can use this statement to query: Select * From sysfilesDBCC shrinkfile (1)
4. To minimize log files (for SQL 7.0, this step can only be performed in the query anal
disaster recovery solutions: AlwaysOn availability Groups, database mirroring, and log shipping.
2impact on Database startupWhen the database restarts or restores to the last time, the database will enter the recovery state, normally, this state lasts a few 10 seconds, but in special cases, it will take a very long time, even a few hours, if this step fails, the database enters into the suspended suspect state, Not available for normal use.so,
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.