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
This series of articles I saw in the sqlskill.com's PAUL blog, many misunderstandings are more typical and representative, the original from the T-SQL Tuesday #11: Misconceptions about... EVERYTHING !!, Hope to help you.
Misunderstanding #28: Several misunderstandings about the log recovery mode of large-capacity transactions
28 a) Common DML operations can be "minimum logged"
No. In the large-capacity
SQL Server is a relational database management system, the application is very extensive, in the process of SQL Server database operations will inevitably occur mistakenly deleted or other reasons caused by log damage, and because of the importance of data in
1. Delete Log
2. Clear the Log
3. Shrinking database files
4. truncating the transaction log
The performance of the database is the DBA need to focus on, the increase of log files seriously affect the performance of the database, this article will introduce
production database unless you have sufficient reason and enough certainty, or ...
It's not you who takes responsibility.
Now that this method is unsafe, I'll introduce a safe approach.
As you know, SQL Server automatically truncates the inactive part of the transaction log when it completes the
Misunderstanding #28: Several misunderstandings about the log recovery mode of large-capacity transactions
28 A) Common DML operations can be "minimum logged"No. In the large-capacity transaction log recovery mode, only a small number of batch operations can be "least recorded logs". The list of such operations can be found in operations that can be Minimally
the production database unless you have sufficient reason and sufficient certainty, or ...
It's not you who take responsibility.
Now that this method is unsafe, I'll introduce a secure approach.
As you know, SQL Server automatically truncates the inactive portions of the transaction log when it completes a
"]); } } }}ViewThere is no difference between the use and the normal data table.using (var conn = new SqlConnection("Server=.;Integrated Security=true")){ conn.Open(); using (var cmd = new SqlCommand("select top 10 * from [AdventureWorks2016CTP3].[HumanResources].[vEmployee]", conn)) { using (var reader = cmd.ExecuteReader()) { while (reader.Read())
In the query analyzer, perform the following three steps in sequence, where databasename is your database file name1. Clear logs: Dump transaction databasename with no_log
2. truncate transaction logs: backup log databasename with no_log
3. shrink the database: DBCC shrinkdatabase (databasename)
--/////////////////////////////////////// //////////////////////////
In the query analyzer, perform the following three steps in sequence, where databasename is your database file name
1. Clear logs: dump transaction databasename WITH NO_LOG
2. truncate transaction logs: backup log databasename WITH NO_LOG
3. shrink the database: dbcc shrinkdatabase (databasename)
--/////////////////////////////////////// ////////////////////////
How to quickly master "log transfer" in SQL Server"
A cluster is an effective solution to achieve high availability. Sometimes it is counterproductive. Moreover, it is very expensive. Therefore, database administrators can use Log transfer instead of clusters to provide high availability.
SQL Server database prompts "tempdb" log is full solution, sqlservertempdb
Execute SQL statements. Temporary tables are not used in the middle.
Prompt server: Message 9002, Level 17, status 2, Row 1 Database 'tempdb' logs are full. Back up the
',@ Physname = 'C: \ Program Files \ Microsoft SQL Server \ MSSQL \ data \ database name. MDF'
5. In order to automatically contract in the future, make the following settings:Enterprise Manager -- server -- Right-click Database -- Property -- option -- select "auto contract"
(Sql2005: Property -- option -- Miscellaneous -- Automatic -- automatic shrinking, i
recommended to truncate logs on the production database unless you have good reasons and are sure enough, or ......You are not responsible for this.Since this method is not safe, I will introduce a security method below.As we all know, SQL Server will automatically cut off the inactive part of the transaction log when
automatically contract in the future, make the following settings:
Enterprise Manager -- server -- Right-click Database -- Property -- option -- select "auto contract"
-- SQL statement setting method:
Exec sp_dboption 'database name', 'autowrite', 'true'
6. If you want to prevent the log from increasing too much in the future
Enterprise Manager --
Tags: des style blog http color using OS dataSome of the operations of databases in SQL Server in Bulk_logged/simple mode take the form of minimizing log logging to reduce the amount of Tran log disk logs to improve overall performance.Here I'll briefly describe which operations will minimize logging in what circumstan
SQL2008 Empty Delete log:
Method One:
Use [master]
to
ALTER DATABASE AFMS set RECOVERY simple and no_wait
go
alter DATABASE AFMS SET RECOVERY S Imple
go
to Afms
go
DBCC shrinkfile (N ' Afms_log ', one, truncateonly) go use
[master]
Go
ALTER DATABASE AFMS set RECOVERY full and no_wait
go
alter DATABASE AFMS SET RECOVERY full
Go
' Clearing the log in SQL2008 must be done in simple mode, until th
subject is running without a long transaction--Query execution time longer than Dbm_monitor_alerts table Time_behind threshold transactionDECLARE @database_id intDECLARE @time_behind intSet @database_id =5Select @time_behind =time_behind from msdb: dbm_monitor_alerts WHERE [email protected]_idSelect COUNT (1) as Long_transactions_count from Sys.dm_tran_database_transactions dt,sys.dm_tran_active_transactions Stwhere dt.transaction_id=st.transaction_i
Myth #7: Multiple mirrors can exist for a database
Error
This myth is a bit of a cliché. Only one mirror server is allowed per principal server. If you want to have copies of multiple principal servers, use transaction log shipping, which allows multiple secondary instances to exist for each principal.
One adva
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.