What is the difference between DCN and CQN supported by Oracle? - database

What is the difference between DCN(Database Change Notification) and CQN(Continuous Query Notifications) supported by Oracle?

Related

How to capture CDC operation timing when using AWS DMS to migrate SQL Server into AWS S3?

I want to migrate on-premises SQL Server CDC to S3 files with AWS DMS. Everything works well but CDC operation time in target.
I have:
[__$start_lsn]
,[__$end_lsn]
,[__$seqval]
,[__$operation]
columns data in target but nothing regarding timing.
How can I have the operation time in the target?
I know that if there is a way to return the result of a SQL function in target I can call sys.fn_cdc_map_lsn_to_time(x.__$start_lsn) function, but no idea how to do this.
On-premises SQL Server version is:
Microsoft SQL Server 2014 (SP1-CU4)- 12.0.4436.0 (X64)
Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor)
Based on your answer to my clarifying question in the comment, I think this will work:
select sys.fn_cdc_map_lsn_to_time(__$start_lsn)
from «some change instance»;
You can get the value for «some change instance» from the sys.sp_cdc_help_change_data_capture system stored procedure.
But! I'm guessing though that you want to use this to track the progress of your DMS operation. I that's the case, I'd suggest changing the query slightly. Like so:
select sys.fn_cdc_map_lsn_to_time(max(__$start_lsn))
from «some change instance»;
That is, map the time of the last_lsn rather than all of them. Good hunting!

Windows Collation error occured when deployed window 2012

My question might have the same title as this question: Sql collation issues when deploying live. However that question is 8 years old and talks about issue on different sql server.
My infos as below:
SQL Server is Turkish_100_CI_AI Windows Collation Name (Transact-SQL)
DB is Turkish_CI_AS (SQL Server Collation Name):
and
dev env: windows 8
test env: windows 2012
From this question:
Select City COLLATE DATABASE_DEFAULT AS Place, State, Country FROM DEPT1
UNION ALL
Select '' AS Place, 'Arizona' As State, Country FROM DEPT2
works properly on sql server.
Problem occurs when deployed to test server with the same connection string (to the same db)
So I can guess the issue related windows os differences only.
Error message is:
Implicit conversion of varchar value to varchar cannot be performed because the collation of the value is unresolved due to a collation conflict between "Turkish_CI_AS" and "Turkish_100_CI_AI" in UNION ALL operator.
When I run my UNION sql query.
What can be cause and how can I handle given error, in context of changing windows os only?
EDIT: Closing question as the colleague informs that db are not the same, so question is no more valid
Please execute this query in both environments:
select COLUMNPROPERTYEX(object_id('dbo.DEPT1'), 'City', 'Collation') as column_collation,
DATABASEPROPERTYEX(db_name(), 'Collation') as db_collation, db_name() as db_name;
If you get the error for the exact query from your question the difference is between your column collation and database collation.
If you did not define explicitly the column collation it's inherited from database collation, and there is no need to COLLATE at all when you execute your query WHITHIN THAT DATABASE.
If instead your query is executed in the context of another database, or you use temporary tables (that are created with the collation of tempdb) then you need to use COLLATE.
So please check one more time your db collation, your column collation, and the database(maybe your query is executed in another database then you think)

Is there any way to write select sql query which will take the value from excel sheet and display the result in sql window [duplicate]

This question already has answers here:
How to run a SQL query on an Excel table?
(11 answers)
Closed 8 years ago.
I have one excel sheet(name as:-LTATestData.xls). It contain some column with corresponding some value. I want select sql query which read the column value from excel sheet and display the result.
I have tried to search in google, i get below query which may solve my purpose
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 10.0;Database=C:\work\LTATestData.xls',
'SELECT * FROM [Sheet1$]')
But when I run this query I am getting below error message:- "OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode."
Please let me know how to do this. Thanks in advance.
The main cause for this might be because of a mismatch between a 64-bit SQL Server and a 32-bit Microsoft Office installation. Therefore rather upgrade to a 64-bit Microsoft Office than downgrade a sql server version.
Alternatively, here a couple of posts if your versions are all up to date (Please read the comments sections as well)
The following posts might be helpful solving the problem: HOW TO: FIX ERROR - "the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine"
AND
SQL SERVER – Fix: Error: MS Jet OLEDB 4.0 cannot be used for distributed queries because the provider is used to run in apartment mode.

How to pass Table-Valued Parameters (Array-like Parameter) to Stored Procedure in Microsoft SQL Server 2008 R2 using JDBC? [duplicate]

This question already has answers here:
Call stored procedure with table-valued parameter from java
(5 answers)
Closed 3 years ago.
How to pass Table-Valued Parameters (Array-like Parameter) to Stored Procedure in Microsoft SQL Server 2008 R2 using Microsoft SQL Server 2008 R2 JDBC Driver ?
Is it possible with jTDS?
The current (3.0) Microsoft driver doesn't support passing TVPs.
At one point, Microsoft was soliciting votes for TVP vs. Bulk Copy:
http://blogs.msdn.com/b/jdbcteam/archive/2011/09/22/tvp-or-bulk-copy.aspx
TVP got more votes, but it remains to be seen what actually got done. The most recent CTP for version 4.0 doesn't appear to have TVP support.
While this question was about SQL Server 2008, and while it really wasn't possible to pass table valued parameters at the time, it is now. This is documented here in the JDBC driver manual. For example, it could be done like this:
SQLServerDataTable table = new SQLServerDataTable();
table.addColumnMetadata("i" ,java.sql.Types.INTEGER);
table.addRow(1);
table.addRow(2);
table.addRow(3);
table.addRow(4);
try (SQLServerPreparedStatement stmt=
(SQLServerPreparedStatement) connection.prepareStatement(
"SELECT * FROM some_table_valued_function(?)")) {
// Magic here:
stmt.setStructured(1, "dbo.numbers", table);
try (ResultSet rs = stmt.executeQuery()) {
...
}
}
I've also recently blogged about this here.
I have solved this problem by myself. I have created CLR .Net Stored Proc with accepts a BLOB parameter. This BLOB is just a list of serialized INTs. It is possible to deserialize it using T-SQL or .Net CLR SP.
.Net CLR SP has better performance, which was really important for my project.

Query SQL Server from Oracle - force metadata refresh

I am a SQL Server developer, with a task in Oracle. DBA set up a DBLink in Oracle that points at a SQL Server database. I am writing a view on the SQL Server data and then a view on the Oracle side to join it with additional Oracle data.
Problem: if I change the definition of the view on SQL Server, even "Select * From myview#dblink" errors with "Invalid column." Closing TOAD and reopening seems to correct the problem, but the real question is how to force Oracle to re-read the metadata without resetting the connection?
This sounds like an issue with TOAD, not oracle. What happens if you do it in SQL*Plus?
I dont know if I understand you but if you got a dblink that points to a SQL server DB in your Oracle DB and you need data in SQL server just do:
SELECT *
FROM TABLE#dblink
SELECT "COL", "COL2", "COL3
from TABLE#dblink
SELECT T."COL", H."COL"
FROM TABLE1#dblink T, TABLE2#dblink H
WHERE T."ID" = H."ID"
Maybe you can do?:
alter view <<view_name>> compile;
I haven't tested this because I have no db link from Oracle to MSSQL.
This seems to be an issue with the Oracle 10g client. The current solution is to disconnect and reconnect. Given that I haven't been able to find anyone else with this problem, i will assume that it is a problem with my client config.

Resources