It reported an error when I wanted to create an new database in TDengine.
create database pows;
The error was:
DB error: Unable to establish connection While execute transaction
Then I executed 'show transactions\G;` to show the transaction information.
The result are as below:
result screenshot
But I don't know how to analysis it next step.
Related
I created few procedures that I want to run using Maintenance Plan's Execute T-SQL Statement Task box however I'm getting error that job is not found.
Maintenance Task's configuration:
Returned error for running EXEC [dbo].[sp_backup_full] N'db_name', N'path/where//to/store/backup':
End Progress Error: 2021-06-29 18:59:00.42 Code: 0xC002F210 Source: full_backup_and_delete_old_one Execute SQL Task
Description: Executing the query "EXEC [dbo].[sp_backup_full] N'db_name..." failed with the following error: "Could not find stored procedure 'dbo.sp_backup_full'.".
Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
If you dont specify the databasename, by default, it is run in the master database. You can give three part name for the stored procedure call, to make sure that it is using the right database for execution.
EXEC [DatabaseName].[dbo].[sp_backup_full]
I have this stored procedure:
CREATE PROCEDURE [dbo].[sp_Carrier_Scan_Compliance]
(#RETAILERID INT OUTPUT,
#SYSTEM_ID VARCHAR(10) OUTPUT)
AS
BEGIN
SET #RETAILERID = 2
SET #SYSTEM_ID = 'DMASOS'
...
END
I have created a SSIS package using a Execute SQL Task in the control flow.
These are my Execute SQL Task editor settings:
This are my Variable settings:
These are my Parameter Mapping settings:
When I run the SSIS package, I get an error:
Error: 0xC002F210 at Execute SQL Stored Procedure (to copy data from 'BI-Datatrunk' source table) Task, Execute SQL Task: Executing the query "exec = [sp_Carrier_Scan_Compliance] ? OUTPUT, ? O..." failed with the following error: "Incorrect syntax near '='.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL Stored Procedure (to copy data from 'BI-Datatrunk' source table) Task
Warning: 0x80019002 at Carrier_Scan_Compliance_SP: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
I am not sure what I am missing.
Please help me.
Thanks
The key part of the last error is
The EXECUTE permission was denied on the object
'sp_Carrier_Scan_Compliance', database 'DATAK', schema 'dbo'."
You need to assign EXECUTE permissions to the SQL user executing the Proc
USE DATAK
GO
GRANT EXECUTE ON sp_Carrier_Scan_Compliance TO <sql user>
GO
In a for each loop container , for each job reference.
I am running an execute sql task to get a list of 21 INPUT parameters from my stored procedure ( Task 1 ). The INPUT parameters
are then stored in SSIS variables.
Then I have an execute sql task to run the stored procedure, where I set the 21 Input Paramters and an Output parameter. ( Task 2 )
When running the package it fails at Task 2 with the following generic error:
Error: 0xC002F210 at Run sp_insert_Package, Execute SQL Task:
Executing the query "DECLARE #TestFaultStageID int DECLARE #TestID..."
failed with the following error: "Multiple-step OLE DB operation
generated errors. Check each OLE DB status value, if available. No
work was done.". Possible failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters not set correctly,
or connection not established correctly. Task failed: Run
sp_insert_Fault2 Error: 0xC002F210 at Run sp_insert_Package, Execute
SQL Task: Executing the query "DECLARE #TestFaultStageID int DECLARE
#StoreID..." failed with the following error: "Multiple-step OLE DB
operation generated errors. Check each OLE DB status value, if
available. No work was done.". Possible failure reasons: Problems with
the query, "ResultSet" property not set correctly, parameters not set
correctly, or connection not established correctly. Task failed: Run
sp_insert_Fault2 Warning: 0x80019002 at 02-01-02-Epoch-Jobs-Load: SSIS
Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method
succeeded, but the number of errors raised (2) reached the maximum
allowed (1); resulting in failure. This occurs when the number of
errors reaches the number specified in MaximumErrorCount. Change the
MaximumErrorCount or fix the errors.
I have tried to find the error, by checking all the data types and conversions and other stuff but no luck so far. Is there an easy way to track down or narrow down cause ?
Sql Server 2012
In Execute SQL Task component, in SQLStatement field, you should have question marks (?) set in place where you want to put parameters. They should also be defined in Parameter mapping tab.
Are you sure those are set correctly? Could you share your SQLStatement field value?
Sorted ? missing for the OUTPUT parameter was the problem. Sorry All ! Arghhhh
I'm trying to delete a database (from Sql Server Management Studio) and I receive this error:
Transaction (Process ID 52) was deadlocked on lock resources with
another process and has been chosen as the deadlock victim. Rerun the
transaction. (.Net SqlClient Data Provider)
I googled a lot (with a lot of result also here in so) but I cannot find any solution.
I really need to delete (and restore this db), but I'm stucked.
Any suggestion?
I guess you have open transactions. For example, for the database StackOverflow I am opening a transaction like this:
USE StackOverflow
BEGIN TRAN
and
USE StackOverflow
exec sp_whoisactive
So, when I try to deleted it:
I get the following error:
An exception occurred while executing a Transact-SQL statement or
batch. (Microsoft.SqlServer.ConnectionInfo)
Cannot drop database "StackOverflow" because it is currently in use.
(Microsoft SQL Server, Error: 3702)
If I choose close existing connections from the delete interface the database is successfully deleted.
I have created a SQL stored procedure that produces the expected results when I call it from SQL Management Studio, it has one output parameter which is a message that tells me where the proc failed, if it fails. Here is the top part of the proc
CREATE PROCEDURE [dbo].[uspProgramUpdate]
#EmailFailMessage VARCHAR(100) OUTPUT
At the bottom of my stored procedure is where I set the value of the variable:
BEGIN CATCH
ROLLBACK TRAN [CoS1]
RAISERROR ('***An error occurred during processing, all transactions have been rolled back. Correct the error and restart this process.***', 16, 1)
SET #EmailFailMessage = '***An error occurred during processing, all transactions have been rolled back. Correct the error and restart this process.***'
END CATCH
What I am trying to do (that I can't figure out) is how to capture the text of EmailFailMessage so I can use that text in an email within SSIS.
I have created an Execute SQL Task in SSIS which executes the stored procedure successfully on the SQL server. I have successfully captured the RAISERROR event and I can see that in the output window within Visual Studio window when I run the SSIS package:
Error: 0xC002F210 at Execute SQL - run uspProgramUpdate, Execute SQL Task: Executing the query "EXEC uspProgramUpdate ?" failed with the following error: "***An error occurred during processing, all transactions have been rolled back. Correct the error and restart this process.***". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL - run uspProgramUpdate
The SQLStatement property of the SSIS task is:
EXEC uspCoSSleepProgramUpdate ? OUTPUT
I have the following SSIS variable:
User::EmailFailMessage (string), value = asdf
and the parameter is mapped on the SSIS SQL task in Parameter Mappings as follows:
Variable Name| Direction | Data Type | Parameter Name | Parameter Size
User::EmailFailMessage | Output | VARCHAR | #EmailFailMessage | -1
I have an email task that is being called and for that email task I have set:
MessageSource = #[User::EmailFailMessage]
When I run the SSIS package and receive the email, the message (body) of the email doesn't have the message from SQL after running the stored proc. It does have the initial value set for the User::EmailFailMessage variable and I am expecting that to change, but it isn't.
I have also tried, among other things, using 0 for the parameter name in the Parameter Mapping area of my Execute SQL Task. Using that doesn't change the result.
Personally I use the error message variable that is available in the on Error event handler called User::dataFlowExceptionMessage. That will send the exact error message sent by the failing task. That would be what bubbled up from raiserror. BUt I would suggest that you use the real error message as part of your raise error mesaage to make it easier to daignose the reason why the rollback occurred. I want to know the exact error generally.
Another thing you can do is put your error into a table variable and then insert it into an exception table with the date and the proc name after the rollback. Table variables stay in scope thorugh a rollback. Then you could look in that table to pull the message for your email task and you also have a record of just exactly what failed and when and how often which is useful for troubleshooting.