,request_mode,request_status,request_type,request_lifetimefrom sys.dm_ Tran_locks where resource_database_id=db_id () and [email protected] @SPIDrollback Tran--All requested resource information Select Request_session_id,resource_type,resource_description,request_mode,request_status,request_ Type,request_lifetime,request_owner_type,resource_associated_entity_id,lock_owner_addressfrom sys.dm_tran_locks where resource_database_id=db_id () Order by request_session_id--According to Sys.dm_tran_locks
END
GO
BEGIN TRY
SELECT GETDATE ()
SELECT 1/0--evergreen divide by zero example!
END TRY
BEGIN CATCH
SELECT ' There is an error! ' + error_message ()
RETURN
END CATCH;
2. The function table that obtains the error message:The following system functions are valid in the CATCH block. Can be used to get more error messages:
function
Description
Error_number ()
Returns the error number of the e
Tags: blog http io strong SP on log CTIGet ready:CREATE TABLE Nums (X int);Purpose: Inserts only one row into the table.--------------------------------------------------------------------------------------------------------------- ---------------------- BEGIN TRANSACTION Tran_a-it is best to define a name for the transaction.Insert into Nums (X) VALUES (9); Save Transaction Save_tran; --Define a savepo
The SQL Server replication divides large transactions into small transaction distribution methods.
In SQL server replication, when a large transaction is executed in the published database, for example, 100,000 or more data is ope
.
there is a SQL Server Agent service in SQL Server that has a " job function ", much like a timer trigger ,
using a " job " to execute a specific T-SQL statement or process at a specific time is an efficient and effective method .
2.
Generate forecast Control Table
Msdn provides a good explanation of transaction and error handling.
If you have any questions, you can check that.
Here we will extract some important words.
"If an error prevents the successful completion of a transaction, SQL Server automatically rolls back the transaction
information, see Considerations for switching from the full or bulk-logged recovery model. In SQL SERVER 2008, BACKUP log with truncate_only is no longer supported, and to shrink the database log, you first need to truncate the file by setting the database recovery mode to simple. The statements are as follows: --BACKUP log TestDB with no_log
UseTestDB; GO
--Truncate The log by changing the database rec
The SQL Server transaction log may be filled, which blocks subsequent database operations, including update, DELETE, INSERT, and checkpoint.
Full transaction log fills can cause 1105 errors:
Can ' t allocate space for object syslogs in database dbname because
The logsegment is full. If you are ran out of spaces in s
. Active_backup_or_restore: Data backup or restore in progress, preventing log truncation 5. Active_transaction: Transaction is active 6. Database_mirring: Database mirroring is paused or the repository log is behind the main library The above is the enumeration value used by version 2008, and after SQL Server 2012, a new enumeration value is used 0 = None1 = Che
successful repair ( turn off other query windows if an error occurs )
ALTER DATABASE Bigdata_testinfo set Multi_userYou refresh the database and you find out, okay ~
Scared to the point, quickly check the data there is no problem (formerly)
The size of the wood is also changed
Expand:
Someone attached to the time found ... Tips for rejecting xxx
Uh.. is actually not open permission:
Leave the current user's permission open and OK.
If y
under database a Dbo.prtesta EXEC dbo. Prtesta The following error will appear: The context of the transaction is being used by another session. I believe you already understand what is called loopback link Server , when we change the dbo.prtestb of the stored procedure in database B to cross-library access, such as: SELECT * from B.dbo.test The problem is solved. Therefore, you must pay attention to avoi
Label: Method One:
Use [master]
GO
ALTER DATABASE dnname SET RECOVERY simple with no_wait
GO
ALTER DATABASE dnname SET RECOVERY Simple--Easy mode
GO
Use Dnname
GO
DBCC shrinkfile (N ' Dnname_log ', one, truncateonly)
GO
Use [master]
GO
ALTER DATABASE dnname SET RECOVERY full with no_wait
GO
ALTER DATABASE dnname SET RECOVERY Full--Revert to complete mode
GO
Method Two: Error: Database .... The
Tags: BSP span end pre appear ROM transaction user begin ----View additions and deletions do not affect the underlying table
----view does not allow repeating columns
Create Viewhaha--Create a View
as
SelectStudent.*, Score.cno,score.degree fromStudent,scorewhereStudent. Sno=Score.snoSelect * fromhaha----Business
begin Tran
Insert intoUsersValues('Zhao Four','c002')
Insert intoUsersValues('Zhao','c001')
if @ @error>0
begin
rollback Tran;
En
is 0
rollback Tran--rolling back things
Else
Commit Tran--Submit Things
--three paradigms of---database design
--1. The values in each column are single
--2. Meet 1, each table must have a primary key
--3. Satisfy 2, the foreign key table only appears in the primary key table in the primary key column, the other columns do not appear. When there are three columns in a table and more of the data is often duplicated, you need to take these columns out to create a separate table
--set a primary
Tags: style blog http os io ar strong for dataHttp://www.cnblogs.com/Kymo/archive/2008/05/14/1194161.htmlLet's take a look at the SQL Server Online Help related instructions
begin Transaction: marks the starting point for an explicit local transaction. BEGIN TRANSACTION
Detailed description of SQL Deadlock Detection Methods, detailed description of SQL lock Detection
The deadlock in SQL server refers to the state in which processes are permanently blocked. The following describes how to detect
Brief introductionThis article describes what information is logged in the transaction log of SQL Server and how to read the information in these transaction logs. First, a Microsoft is not exposed to the function Fn_dblog, in the next part of the article mainly use this function to read the
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.