Wednesday, March 7, 2012

How to find instance name

Hi

I just start to learn SQL server now. I am trying to migrate data from oracle to SQL server 2005 using SQL server migrant assistant for Oracle. But I don't know how to fiill this connection details

SQL Server host:

<ServerHost>

SQL Server port
(leave empty if default):

<8888>

SQL Server instance name
(leave empty if default):

<your_instance>

Target database:

<your_db_name>

Target schema:

dbo (by default)

User name:

<your_username>

Password:

<your_password>

How to find these properties? Anyone can help?

Thanks

Li

set nocount on

Declare @.key Varchar(100), @.PortNumber varchar(20)

if charindex('\',CONVERT(char(20), SERVERPROPERTY('servername')),0) <>0

begin

set @.key = 'SOFTWARE\MICROSOFT\Microsoft SQL Server\'+@.@.servicename+'\MSSQLServer\Supersocketnetlib\TCP'

end

else

begin

set @.key = 'SOFTWARE\MICROSOFT\MSSQLServer\MSSQLServer\Supersocketnetlib\TCP'

end

EXEC master..xp_regread @.rootkey='HKEY_LOCAL_MACHINE', @.key=@.key,@.value_name='Tcpport',@.value=@.PortNumber OUTPUT

SELECT CONVERT(char(20), SERVERPROPERTY('servername')) ServerName,

CONVERT(char(20), SERVERPROPERTY('InstanceName')) instancename,

CONVERT(char(20), SERVERPROPERTY('MachineName'))

as HOSTNAME, convert(varchar(10),@.PortNumber) PortNumber

|||

In a simple way :

Start ->All progrmas->Microsoft SQL Server 2005 -> Configuration Tools -> SQL Server Configuration Manager

In Configuration Manager -> SQL Server 2005 Services -> double click the SQL Service -> click the Service Tab.

There you will find the name of the Host.

In Configuration Manager -> SQL Server 2005 Network configuration ->double click the TCP/IP protcol to see the port no .

or

In SQL Server Management Studio->RegisterServers->double click your server to open the Object Explorer -> right click to select the properties window ->General Tab - to see the ServerName

or Open a new query in SQL Server Management window and execute the following

-- to get the server name

select @.@.ServerName

Thanks

Naras.

|||

Thanks!

What about instance name? How to find it?

Li

|||

SQL Server Instance Name :

In SQL Server Management Studio->RegisterServers->double click your server to open the Object Explorer -> right click to select the properties window ->General Tab - to see the ServerName (instance name)

or Open a new query in SQL Server Management window and execute the following

-- to get the sql server instance name

select @.@.ServerName

Thanks.

Naras.

|||

Thanks, Naras, very helpful

Li

No comments:

Post a Comment