Label:SQLreduce the log file size Author : CC Abba 2014-6-14 in Daily SQL database operations, there are often SQL log files are oversized and larger than normal MDF database files, as a general user, LDF is too large, it only affects the server's hard disk space. Here's
server| Recovery
The transaction log file (LDF) is deleted when the SQL Server service is not started (SQL Server cannot delete the log file while it is working), in which case the corresponding database is flagged as suspect (sus
FirstUse [database name];Exec sp_helpfile;
You can use sp_helpfile to query the logic name of the log file, and then you can use DBCC to reduce the LOG fileBackup log [database name] WITH TRUNCATE_ONLYDbcc shrinkfile ([logical name of log
FirstUse [database name];Exec sp_helpfile;
You can use sp_helpfile to query the logic name of the log file, and then you can use DBCC to reduce the LOG fileBackup log [database name] WITH TRUNCATE_ONLYDbcc shrinkfile ([logical name of log
When the log file is full and the SQL database cannot write the file, you can use either of the following methods:One method: Clear logs.1. Open the query analyzer and enter the commandDump transaction database name with no_log2. open the Enterprise Manager and right-click the database you want to compress -- all tasks
@ Echo off
Rem "set the Infos below, then it can be completed MED ."
Rem "========================================"
Rem "Please set the path of SQL Files"
@ Set script_path = C:/temp
Rem "Please set the connection of DB server"
@ Set db_conn = dbusername/dbpassword @ dbsid
Rem "========================================"
Rem "get the time string"
@ Set times = % Date:/= % time: = %
Rem "get the time string"
@ Set
When I restored the database from the database backup, I found that there were more than 120 GB of log files, but I couldn't use SQL Management. I used the DBCC statement to clear it! Space released! And speed!
First of all, we need to check the type of the backup data. This is very important, but it cannot be cleared.
Select name, recovery_model_desc from sys. databases
After the command is executed, yo
Run
Sqlldr username/password control = 'tbl _ EMP. CTL'
An error occurred while importing data.
SQL * loader-522: lfiopn failed for file (sqlldr. Log)
The cause of this error is that the command is not executed in the directory where the file is located.
------------------------------------------------
For ex
Label:Method 1: TRUNCATE TABLE name --This will not only delete the data, but also reset the field of the identity property. TRUNCATE TABLE jsqMethod 2: Delete from your table name? DBCC CHECKIDENT (your table name, reseed,0) resets the field of the identity property so that its next value starts at 1?The truncate command not only clears all data, but also restores the value of the identity's seed to the original value. DBCC CHECKIDENT is more convenient, and you can specify the value of seed wi
If the server has a raid failure, and after the data base recovery is successful, one of the SQL Server log files (extension LDF) is found to be severely damaged, and we can recover all the data by doing the following.
Start by creating a new database with the same name, then stopping the SQL Server service, overwriting the new database
Tags: reminding full database full effort Enterprise Manager start sql2000 Enterprise ManagementCustomer Name: Shenzhen Science and Technology Information Co., Ltd.Database type: sql2000Database size: 20gFailure passesThe computer suddenly loses power, the software shows a database error, unable to connect, open Enterprise Manager, display numberAccording to the database, the DBCC query shows "SQL Server detected a consistency-based logical I/O errorP
SQL Server deletes the log file after the LDF saves the steps:Create a new database first,Remove the new. mdbOverwrite with the MDB you want to restoreExecute the following statementALTER DATABASE ' Db_core ' SET RECOVERY simple;ALTER DATABASE Db_core SET emergencyALTER DATABASE Db_core set Single_userDBCC CHECKDB (' Db_core ', Repair_allow_data_loss)DBCC CHECKDB
started with the following SQL statement:SELECT * FROM Msdb.dbo.sysjobhistorywhere step_id=0 and job_id= (select job_id from msdb.dbo.sysjobs where [name]= ' Job name ')and run_dateBecause I added a step_id query condition, so the first time cleaning did not clean up, the actual amount of data is still very large, because only delete a state of the2, to delete:Delete from Msdb.dbo.sysjobhistorywhere job_id= (select job_id from msdb.dbo.sysjobs where
One, MySQL
Read files
Common read files, you can use 16 in place of strings
Select Load_file (' C:/boot.ini ')Select Load_file (0x633a2f626f6f742e696e69)Select Load_file ('//ecma.io/1.txt ') # SMB protocolSelect Load_file (' \\\\ecma.io\\1.txt ') # Available for DNS tunneling
Write a file
I'm temporarily aware of two ways to write a
--The following is a SQL statement that reads data from several common file formats directly in SQL--/* text FileSELECT * FROMOPENROWSET (' MICROSOFT. JET. oledb.4.0 ', ' Text; Hdr=no;database=c: '--c: is the directory, Aa#txt)--aa#txt is a text file name Aa.txt--*/--/* Excel FileSELECT * FROMOPENROWSET (' MICROSOFT. J
Label:Backup and recovery-related log files in SQL Server database have MDF and LDF files present in \\sqlserver_install_dir\MSSQL\Data\1. Document interpretation. mdf fileMDF is a SQL Server database file.. ldf fileLDF is a log file
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.