Showing posts with label mirroring. Show all posts
Showing posts with label mirroring. Show all posts

Tuesday, March 20, 2012

Could not start mirroring on a single laptop with two instances of SQL Server 2005

I tried to set up mirroring on my laptop.

I have got two instances of SQL Server 2005 SP2 on my laptop (the first one is the default instance).

Checked configuration running the following scripts

SELECT type_desc, port FROM sys.tcp_endpoints;

GO

SELECT state_desc FROM sys.database_mirroring_endpoints

go

SELECT role FROM sys.database_mirroring_endpoints;

GO

SELECT 'Metadata Check';

SELECT EP.name, SP.STATE,

CONVERT(nvarchar(38), suser_name(SP.grantor_principal_id))

AS GRANTOR,

SP.TYPE AS PERMISSION,

CONVERT(nvarchar(46),suser_name(SP.grantee_principal_id))

AS GRANTEE

FROM sys.server_permissions SP , sys.endpoints EP

WHERE SP.major_id = EP.endpoint_id

ORDER BY Permission,grantor, grantee;

GO

Everything is OK on both instances. Tried to start mirroring and I have got this error message:

TITLE: Database Properties

An error occurred while starting mirroring.


ADDITIONAL INFORMATION:

Alter failed for Database 'Northwind'. (Microsoft.SqlServer.Smo)

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

The server network address "TCP://kookaburra.sydney.ssw.com.au:5022" can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational. (Microsoft SQL Server, Error: 1418)

I could connect to both instances:

C:\Documents and Settings\SergeiTchernykh.SSW2000>sqlcmd -U sa -P <password> -S k
ookaburra,5022
1> exit
C:\Documents and Settings\SergeiTchernykh.SSW2000>sqlcmd -U sa -P <password> -S k
ookaburra\sydney2005,5023
1> exit

I could ping my laptop

C:\Documents and Settings\SergeiTchernykh.SSW2000>ping -a kookaburra

Pinging kookaburra.sydney.ssw.com.au [10.0.0.1] with 32 bytes of data:

Reply from 10.0.0.1: bytes=32 time<1ms TTL=128
Reply from 10.0.0.1: bytes=32 time<1ms TTL=128
Reply from 10.0.0.1: bytes=32 time<1ms TTL=128
Reply from 10.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 10.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Thank you.

Problem solved.

"Database Mirror Wizard" does not show the correct error.

This error was displayed - "Alter failed for Database 'Northwind'. (Microsoft.SqlServer.Smo)" after executing T-SQL statement "ALTER DATABASE SET PARTNER .."

After running SQL Server Profiler I found out that the first error was: Database Northwind wasn't configured for mirroring.

Mirror database should be in RECOVERING mode.

Dropped and restored Northwind database again with NORECOVERY and mirroring started working.

|||

Hi Sergei,

How did you create the endpoints? Since you were able to connect to the sql server instances listening on ports 5022 and 5023, I suspect that you created them for T-SQL payload and not DB mirroring.

Try using something similar to this to create the endpoints:

CREATE ENDPOINT [dbm] STATE=STARTED

AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)

FOR DATABASE_MIRRORING (ROLE = ALL)

Thanks,

Kaloian.

|||

Hi Kaloian,

As long as I have got 3 instances of SQL Server 2005 (later on) on my laptop (default, instance_1 and instance_2 (witness)) I manually configured endpoint for witness using statement "CREATE ENDPOINT ..." on port 5024.

But it wasn't the problem. Problem in my case was that to set up a mirror you need a mirroring database in RECOVERING mode (Ididn't configure that) but the error returned didn't specify that.

Thanks,

Sergei

sql

Sunday, February 19, 2012

Could database mirroring make an application fail?

Hello!
We have a Java application where some things are indicating that it can not
run against a SQL Server 2005 database when database mirroring is enabled.
We're getting an error message in the application.
SQLState:HY000 ErrorCode:0 [DataDirect][SQLServer JDBC
Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unknown
token: 0x54
java.sql.SQLException: [DataDirect][SQLServer JDBC
Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unknown
token: 0x54
In Profiler we can see a successfull login and then nothing more.
Is SQL Server returning some extra information if database mirroring is
enabled that could make a badly coded application / driver fail?
Best regards
Ola
It could be possible, however I don't think so. The mirroring uses service
broker to send the transactions to the remote machine.
Unless the java application is receiving the mirror partner information and
doesn't know what to do with it.
I would recommend getting a network sniffer and then having the app log into
a non-mirrored database, then a morrored database and see what the differenes
in the actual network traffic are. If you could post back your results it
may be helpfull to others.
Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration /
Microsoft Office SharePoint Server 2007: Configuration)
MCITP (dbadmin, dbdev)
"Ola Hallengren" wrote:

> Hello!
> We have a Java application where some things are indicating that it can not
> run against a SQL Server 2005 database when database mirroring is enabled.
> We're getting an error message in the application.
> SQLState:HY000 ErrorCode:0 [DataDirect][SQLServer JDBC
> Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unknown
> token: 0x54
> java.sql.SQLException: [DataDirect][SQLServer JDBC
> Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unknown
> token: 0x54
> In Profiler we can see a successfull login and then nothing more.
> Is SQL Server returning some extra information if database mirroring is
> enabled that could make a badly coded application / driver fail?
> Best regards
> Ola

Could database mirroring make an application fail?

Hello!
We have a Java application where some things are indicating that it can not
run against a SQL Server 2005 database when database mirroring is enabled.
We're getting an error message in the application.
SQLState:HY000 ErrorCode:0 [DataDirect][SQLServer JDBC
Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unknown
token: 0x54
java.sql.SQLException: [DataDirect][SQLServer JDBC
Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unknown
token: 0x54
In Profiler we can see a successfull login and then nothing more.
Is SQL Server returning some extra information if database mirroring is
enabled that could make a badly coded application / driver fail?
Best regards
OlaIt could be possible, however I don't think so. The mirroring uses service
broker to send the transactions to the remote machine.
Unless the java application is receiving the mirror partner information and
doesn't know what to do with it.
I would recommend getting a network sniffer and then having the app log into
a non-mirrored database, then a morrored database and see what the differenes
in the actual network traffic are. If you could post back your results it
may be helpfull to others.
--
Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration /
Microsoft Office SharePoint Server 2007: Configuration)
MCITP (dbadmin, dbdev)
"Ola Hallengren" wrote:
> Hello!
> We have a Java application where some things are indicating that it can not
> run against a SQL Server 2005 database when database mirroring is enabled.
> We're getting an error message in the application.
> SQLState:HY000 ErrorCode:0 [DataDirect][SQLServer JDBC
> Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unknown
> token: 0x54
> java.sql.SQLException: [DataDirect][SQLServer JDBC
> Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unknown
> token: 0x54
> In Profiler we can see a successfull login and then nothing more.
> Is SQL Server returning some extra information if database mirroring is
> enabled that could make a badly coded application / driver fail?
> Best regards
> Ola

Could database mirroring make an application fail?

Hello!
We have a Java application where some things are indicating that it can not
run against a SQL Server 2005 database when database mirroring is enabled.
We're getting an error message in the application.
SQLState:HY000 ErrorCode:0 [DataDirect][SQLServer JDBC
Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unkn
own
token: 0x54
java.sql.SQLException: [DataDirect][SQLServer JDBC
Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Unkn
own
token: 0x54
In Profiler we can see a successfull login and then nothing more.
Is SQL Server returning some extra information if database mirroring is
enabled that could make a badly coded application / driver fail?
Best regards
OlaIt could be possible, however I don't think so. The mirroring uses service
broker to send the transactions to the remote machine.
Unless the Java application is receiving the mirror partner information and
doesn't know what to do with it.
I would recommend getting a network sniffer and then having the app log into
a non-mirrored database, then a morrored database and see what the differene
s
in the actual network traffic are. If you could post back your results it
may be helpfull to others.
--
Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration /
Microsoft Office SharePoint Server 2007: Configuration)
MCITP (dbadmin, dbdev)
"Ola Hallengren" wrote:

> Hello!
> We have a Java application where some things are indicating that it can no
t
> run against a SQL Server 2005 database when database mirroring is enabled.
> We're getting an error message in the application.
> SQLState:HY000 ErrorCode:0 [DataDirect][SQLServer JDBC
> Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Un
known
> token: 0x54
> java.sql.SQLException: [DataDirect][SQLServer JDBC
> Driver][DataDirect][SQLServer JDBC Driver]Unhandled token type: Un
known
> token: 0x54
> In Profiler we can see a successfull login and then nothing more.
> Is SQL Server returning some extra information if database mirroring is
> enabled that could make a badly coded application / driver fail?
> Best regards
> Ola