Get definition of an index from query in SQL Server
Hi,
I need to get definition of an index using query in SQL Server 2008 as we can get definition of a stored procedure using sp_helptext command.
Thanks In advance,
Jitesh
I have worked on the script and updated the script as per my need. Now I am able to generate the script for a specific index. Here is the script:-
CREATE PROCEDURE ScriptCreateDropIndexes_SP
@TableName SYSNAME
,@SchemaName SYSNAME = 'dbo'
,@SORT_IN_TEMPDB VARCHAR(3) = 'OFF'
,@DROP_EXISTING VARCHAR(3) = 'OFF'
,@STATISTICS_NORECOMPUTE VARCHAR(3) = 'OFF'
,@ONLINE VARCHAR(3) = 'OFF'
,@Index_Name NVARCHAR(1000)
,@is_Create int = 0
AS
Parameters
@Schemaname - SchemaName to which the table belongs to. Default value 'dbo'.
@Tablename - TableName for which the Indexes need to be scripted.
@SORT_IN_TEMPDB - Runtime value for SORT_IN_TEMPDB option in create index.
Valid Values ON \ OFF. Default = 'OFF'
@DROP_EXISTING - Runtime value for DROP_EXISTING option in create index.
Valid Values ON \ OFF. Default = 'OFF'
@STATISTICS_NORECOMPUTE - Runtime value for STATISTICS_NORECOMPUTE option in create index.
Valid Values ON \ OFF. Default = 'OFF'
@ONLINE - Runtime value for ONLINE option in create index.
Valid Values ON \ OFF. Default = 'OFF'
SET NOCOUNT ON
IF @SORT_IN_TEMPDB NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @SORT_IN_TEMPDB is ON \ OFF',16,1)
RETURN
END
IF @DROP_EXISTING NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @DROP_EXISTING is ON \ OFF',16,1)
RETURN
END
IF @STATISTICS_NORECOMPUTE NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @STATISTICS_NORECOMPUTE is ON \ OFF',16,1)
RETURN
END
IF @ONLINE NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @ONLINE is ON \ OFF',16,1)
RETURN
END
DECLARE @IDXTable TABLE
Schema_ID INT
,Object_ID INT
,Index_ID INT
,SchemaName SYSNAME
,TableName SYSNAME
,IndexName SYSNAME
,IsPrimaryKey BIT
,IndexType INT
,CreateScript VARCHAR(MAX) NULL
,DropScript VARCHAR(MAX) NULL
,ExistsScript VARCHAR(MAX) NULL
,Processed BIT NULL
INSERT INTO @IDXTable
Schema_ID
,Object_ID
,Index_ID
,SchemaName
,TableName
,IndexName
,IsPrimaryKey
,IndexType
SELECT ST.Schema_id
,ST.Object_id
,SI.Index_id
,SCH.Name
,ST.Name
,SI.Name
,SI.is_primary_key
,SI.Type
FROM SYS.INDEXES SI
JOIN SYS.TABLES ST
ON SI.Object_ID = ST.Object_ID
JOIN SYS.SCHEMAS SCH
ON SCH.schema_id = ST.schema_id
WHERE SCH.Name = 'dbo'
AND ST.Name = 'group_master'
AND SI.name = 'uq_group_master__parent_id'
AND SI.Type IN (1,2,3)
DECLARE @SchemaID INT
DECLARE @TableID INT
DECLARE @IndexID INT
DECLARE @isPrimaryKey BIT
DECLARE @IndexType INT
DECLARE @CreateSQL VARCHAR(MAX)
DECLARE @IndexColsSQL VARCHAR(MAX)
DECLARE @WithSQL VARCHAR(MAX)
DECLARE @IncludeSQL VARCHAR(MAX)
DECLARE @WhereSQL VARCHAR(MAX)
DECLARE @SQL VARCHAR(MAX)
DECLARE @DropSQL VARCHAR(MAX)
DECLARE @ExistsSQL VARCHAR(MAX)
DECLARE @IndexName SYSNAME
DECLARE @TblSchemaName SYSNAME
SELECT @TblSchemaName = QUOTENAME(@Schemaname) + '.' + QUOTENAME(@TableName)
SELECT @CreateSQL = ''
SELECT @IndexColsSQL = ''
SELECT @WithSQL = ''
SELECT @IncludeSQL = ''
SELECT @WhereSQL = ''
WHILE EXISTS(SELECT 1
FROM @IDXTable
WHERE CreateScript IS NULL)
BEGIN
SELECT TOP 1 @SchemaID = Schema_ID
,@TableID = Object_ID
,@IndexID = Index_ID
,@isPrimaryKey = IsPrimaryKey
,@IndexName = IndexName
,@IndexType = IndexType
FROM @IDXTable
WHERE CreateScript IS NULL
AND SchemaName = @SchemaName
AND TableName = @TableName
ORDER BY Index_ID
IF @isPrimaryKey = 1
BEGIN
SELECT @ExistsSQL = ' EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N''' + @TblSchemaName + ''') AND name = N''' + @IndexName + ''')'
SELECT @DropSQL = ' ALTER TABLE '+ @TblSchemaName + ' DROP CONSTRAINT [' + @IndexName + ']'
END
ELSE
BEGIN
SELECT @ExistsSQL = ' EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N''' + @TblSchemaName + ''') AND name = N''' + @IndexName + ''')'
SELECT @DropSQL = ' DROP INDEX [' + @IndexName + '] ON ' + @TblSchemaName
END
IF @IndexType IN (1,2)
BEGIN
SELECT @CreateSQL = CASE
WHEN SI.is_Primary_Key = 1 THEN
'ALTER TABLE ' + @TblSchemaName
+ ' ADD CONSTRAINT [' + @IndexName + '] PRIMARY KEY ' + SI.type_desc
WHEN SI.Type IN (1,2) THEN
' CREATE ' + CASE SI.is_Unique
WHEN 1 THEN ' UNIQUE ' ELSE '' END + SI.type_desc + ' INDEX ' + QUOTENAME(SI.Name) + ' ON ' + @TblSchemaName
END
,@IndexColsSQL = ( SELECT SC.Name + ' '
+ CASE SIC.is_descending_key
WHEN 0 THEN ' ASC '
ELSE 'DESC'
END + ','
FROM SYS.INDEX_COLUMNS SIC
JOIN SYS.COLUMNS SC
ON SIC.Object_ID = SC.Object_ID
AND SIC.Column_ID = SC.Column_ID
WHERE SIC.OBJECT_ID = SI.Object_ID
AND SIC.Index_ID = SI.Index_ID
AND SIC.is_included_column = 0
ORDER BY SIC.Key_Ordinal
FOR XML PATH('')
,@WithSQL =' WITH (PAD_INDEX = ' + CASE SI.is_padded WHEN 1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' IGNORE_DUP_KEY = ' + CASE SI.ignore_dup_key WHEN 1
THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_ROW_LOCKS = ' + CASE SI.Allow_Row_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_PAGE_LOCKS = ' + CASE SI.Allow_Page_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
CASE SI.Type WHEN 2 THEN 'SORT_IN_TEMPDB = ' + @SORT_IN_TEMPDB
+',DROP_EXISTING = ' + @DROP_EXISTING + ',' ELSE '' END +
CASE WHEN SI.Fill_Factor > 0 THEN ' FILLFACTOR =
' + CONVERT(VARCHAR(3),SI.Fill_Factor) + ',' ELSE '' END +
' STATISTICS_NORECOMPUTE = ' + @STATISTICS_NORECOMPUTE
+ ', SORT_IN_TEMPDB = ' + @SORT_IN_TEMPDB +
', ONLINE = ' + @ONLINE + ') ON ' + QUOTENAME(SFG.Name)
,@IncludeSQL = ( SELECT QUOTENAME(SC.Name) + ','
FROM SYS.INDEX_COLUMNS SIC
JOIN SYS.COLUMNS SC
ON SIC.Object_ID = SC.Object_ID
AND SIC.Column_ID = SC.Column_ID
WHERE SIC.OBJECT_ID
= SI.Object_ID
AND SIC.Index_ID = SI.Index_ID
AND SIC.is_included_column = 1
ORDER BY SIC.Key_Ordinal
FOR
XML PATH('')
,@WhereSQL = SI.Filter_Definition
FROM SYS.Indexes SI
JOIN SYS.FileGroups SFG
ON SI.Data_Space_ID =SFG.Data_Space_ID
WHERE Object_ID = @TableID
AND Index_ID = @IndexID
SELECT @IndexColsSQL = '(' + SUBSTRING(@IndexColsSQL,1,LEN(@IndexColsSQL)-1) + ')'
IF LTRIM(RTRIM(@IncludeSQL)) <> ''
SELECT @IncludeSQL = ' INCLUDE (' + SUBSTRING(@IncludeSQL,1,LEN(@IncludeSQL)-1) + ')'
IF LTRIM(RTRIM(@WhereSQL)) <> ''
SELECT @WhereSQL = ' WHERE (' + @WhereSQL + ')'
END
IF @IndexType = 3
BEGIN
SELECT @CreateSQL = ' CREATE ' + CASE
WHEN SI.Using_xml_index_id IS NULL THEN ' PRIMARY '
ELSE '' END
+ SI.type_desc + ' INDEX ' + QUOTENAME(SI.Name) + ' ON ' + @TblSchemaName
,@IndexColsSQL = ( SELECT SC.Name + ' '
+ ','
FROM SYS.INDEX_COLUMNS SIC
JOIN SYS.COLUMNS SC
ON SIC.Object_ID = SC.Object_ID
AND SIC.Column_ID = SC.Column_ID
WHERE SIC.OBJECT_ID = SI.Object_ID
AND SIC.Index_ID = SI.Index_ID
AND SIC.is_included_column = 0
ORDER BY SIC.Key_Ordinal
FOR XML PATH('')
,@WithSQL =' WITH (PAD_INDEX = ' + CASE SI.is_padded WHEN 1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_ROW_LOCKS = ' + CASE SI.Allow_Row_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_PAGE_LOCKS = ' + CASE SI.Allow_Page_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
CASE SI.Type WHEN 2 THEN 'SORT_IN_TEMPDB = OFF,DROP_EXISTING
= OFF,' ELSE '' END +
CASE WHEN SI.Fill_Factor > 0 THEN ' FILLFACTOR =
' + CONVERT(VARCHAR(3),SI.Fill_Factor) + ',' ELSE '' END +
'SORT_IN_TEMPDB = OFF ' + ') '
,@IncludeSQL = ' USING XML INDEX [' + (SELECT Name
FROM SYS.XML_Indexes SIP
WHERE SIP.Object_ID = SI.Object_ID
AND SIP.Index_ID = SI.Using_XML_Index_ID) + '] FOR PATH '
FROM SYS.XML_Indexes SI
WHERE SI.Object_ID = @TableID
AND SI.Index_ID = @IndexID
SELECT @IndexColsSQL = '(' + SUBSTRING(@IndexColsSQL,1,LEN(@IndexColsSQL)-1) + ')'
END
SELECT @CreateSQL = @CreateSQL
+ @IndexColsSQL + CASE WHEN @IndexColsSQL <> '' THEN CHAR(13) ELSE ''
END
+ ISNULL(@IncludeSQL,'') + CASE WHEN @IncludeSQL <> '' THEN CHAR(13) ELSE
'' END
+ ISNULL(@WhereSQL,'') + CASE WHEN @WhereSQL <> '' THEN CHAR(13) ELSE
'' END
--+ @WithSQL
UPDATE @IDXTable
SET CreateScript = @CreateSQL
,DropScript = @DropSQL
,ExistsScript = @ExistsSQL
WHERE Schema_ID = @SchemaID
AND Object_ID = @TableID
AND Index_ID = @IndexID
END
-- PRINT REPLICATE('-',100)
-- PRINT 'DROP Indexes'
-- PRINT REPLICATE('-',100)
if @is_Create = 0
begin
UPDATE @IDXTable
SET Processed = 0
WHERE SchemaName = @SchemaName
AND TableName = @TableName
WHILE EXISTS(SELECT 1
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName )
BEGIN
SELECT @SQL = ''
SELECT TOP 1 @SchemaID = Schema_ID
,@TableID = Object_ID
,@IndexID = Index_ID
,@SQL = 'IF ' + ExistsScript + CHAR(13) + DropScript + CHAR(13)
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName
ORDER BY IndexType DESC,Index_id DESC
PRINT @sql
UPDATE @IDXTable
SET Processed = 1
WHERE Schema_ID = @SchemaID
AND Object_ID = @TableID
AND Index_ID = @IndexID
END
end
--PRINT REPLICATE('-',100)
--PRINT 'Create Indexes'
-- PRINT REPLICATE('-',100)
if @is_Create = 1
begin
UPDATE @IDXTable
SET Processed = 0
WHERE SchemaName = @SchemaName
AND TableName = @TableName
WHILE EXISTS(SELECT 1
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName )
BEGIN
SELECT @SQL = ''
SELECT TOP 1 @SchemaID = Schema_ID
,@TableID = Object_ID
,@IndexID = Index_ID
,@SQL = 'IF NOT ' + ExistsScript + CHAR(13) + CreateScript + CHAR(13)
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName
ORDER BY IndexType DESC,Index_id DESC
PRINT @sql
UPDATE @IDXTable
SET Processed = 1
WHERE Schema_ID = @SchemaID
AND Object_ID = @TableID
AND Index_ID = @IndexID
END
end
Similar Messages
-
Outer join query for SQL server from Oracle
Hi All,
My question is regarding making queries from Oracle to SQL Server database thorugh DBLink.
In my oracle database I have a DBLink emp.world for SQL Server database.
I need to query SQL Server data from oracle (so that this query can be combined with other oracle tables).
Query is given below:
SELECT
a."EmpID" as "Employee ID",
a."EmpStatus" "Employee Status"
b."EmpSub" as "Employee Subjects"
FROM
[email protected] a
left outer join [email protected] b on a."EmpID" = b."suEmpID"
ORDER BY a."EmpID";My problem is when I run the same query from oracle, it does not show the EmpID that does not exist in Subjects table, but when run from actual SQL Server database, it shows all the records.
Samples are given below:
Run from Oracle
Employee ID Employee Status Employee Subjects
101 Active Maths
102 Active Maths
102 Active Physics
104 Inactive Chemistry
Run form SQL Server
Employee ID Employee Status Employee Subjects
101 Active Maths
102 Active Maths
102 Active Physics
103 Active NULL
104 Inactive ChemistryI am not sure why in oracle outer join for SQL server tables is not working. What is the right way for outer join in this case.
I am using oracle database 10gR2 and SQL Server 2005.
Please Help.
Thanks.SELECT
a."EmpID" as "Employee ID",
a."EmpStatus" "Employee Status"
b."EmpSub" as "Employee Subjects"
FROM
[email protected] a
left outer join [email protected] b on a."EmpID" = b."suEmpID"
ORDER BY a."EmpID";
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm#sthref3175
From your description, it appears you may need a right outer join. You want to get back all the rows from 'B', not from 'A'. Try a right join and let us know. -
Different output of same query in SQL Server and Oracle
I have two tables table1 and table2
--table1 has two columns c1 int and c2 varchar. there are not constraints added in it. it has data as given below
c1 c2
6 d
5 j
102 g
4 g
103 f
3 h
501 j
1 g
601 n
2 m
--table2 has only one column c1 int. there are not constraints added in it. it has data as given below
c1
6
1
4
3
2
now when i run below given query in sql server and oracle it gives me different result
select *
from table1
inner join (SELECT ROW_NUMBER() OVER (order by c1 ASC) AS c1 from table2) table2 on table2.c1=table1.c1
sql server output
c1 c2 c1
1 g 1
2 m 2
3 h 3
4 g 4
5 j 5
oracle output
C1 C2 C1
5 j 5
4 g 4
3 h 3
1 g 1
2 m 2
If you notice the first column in both output. It is sorted in sql server and not in oracle.
Why it is behaving differently in oracle? Is there any way I can solve this in oracle?
Thanks,
JigsIt is NOT behaving "differently" in Oracle; you just haven't specified an order that you expect your results to be in, so you're going to get output in whatever order the database fancies displaying it (ie. no guarenteed order). This is an artifact of how the database chooses to put together the data, and different databases (or even datasets within the same database) can and most likely will behave differently.
Even SQL Server won't guarentee to always get your data in an ordered fashion if you exclude the order by clause, even if you think it has always output the data in an ordered fashion.
Your solution is to add an order by clause, in BOTH databases, to force the order of the output data. -
Import data from postgreSQL into SQL server 2005
I am trying to import one table from postgreSQL to SQL Server 2005 using sql server import and export wizard. When i test the connection after providing data source, location, username, password in the Data Link Properties section I get the message "Test Connection Succeeded". As soon as i press next to go onto next step i get the following error.
TITLE: SQL Server Import and Export Wizard
Cannot get string literals from the database connection "Provider=PostgreSQL.1;User ID=sa;Data Source=localhost;Location=TestMasterMap;Extended Properties=".
ADDITIONAL INFORMATION:
Object reference not set to an instance of an object. (DTSWizard)
BUTTONS:
OK
I have tried all sorts of different combinations for these properties but it always fails on this step. Can anybody help me with this?
The settings above worked for a small table with 3 rows. Now when I try to import the bigger table which I wanted to import in the first instance I get following out of memory error. Anybody knows how to work around this. I have checked my task manager and more than half of my memory was still not used when I get this error.
TITLE: SQL Server Import and Export Wizard
Column information for the source and destination data could not be retrieved.
"Query" -> [temporary].[dbo].[exporttable]:
- ERROR [HY000] Out of memory while reading tuples.;
No query has been executed with that handle
ADDITIONAL INFORMATION:
ERROR [HY000] Out of memory while reading tuples.;
No query has been executed with that handle (PSQLODBC.DLL)
BUTTONS:
OK -
Execute SQL Task with Parameter - from DB2 to SQL Server
I am pulling data from DB2 to SQL Server.
1st Execute SQL task runs the following against DB2:
SELECT TIMESTAMP(CHAR(CURRENT_DATE - (DAY(CURRENT_DATE)-1) DAYS - 1 MONTH)) as START_MONTH
FROM SYSIBM.SYSDUMMY1;
I'm storing it as a Result Set.
Next I have a Data Flow Task. This pulls data from DB2 where the date matches the parameter.
FROM SCHEMA.TABLE t
WHERE DATE_TIME_COLUMN= ?
This works fine. Guessing, because the parameter source is DB2 and the Data Flow source is DB2.
The problem is, I want to remove existing data for the same date in the SQL table. IE, if I'm pulling March 2014 data from DB2, I want to be sure there is no March 2014 data in the SQL table. The main use is for re-runs.
So, I added another Execute SQL task after the first one that assigns the variable, and before the Data Flow Task. This runs the following statement against SQL Server:
DELETE FROM
database.dbo.table
WHERE DATE_TIME_FIELD >= ?
The package fails at the new Execute SQL Task with the following error message:
Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "DELETE FROM
SBO.dbo.tblHE_MSP_FEE_BUCKETS
WHERE T..." failed with the following error: "Parameter name is unrecognized.". 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 Task
SSIS package "Load_MSP_Fee_Buckets_SQL.dtsx" finished: Success.
The program '[14240] Load_MSP_Fee_Buckets_SQL.dtsx: DTS' has exited with code 0 (0x0).
I am assuming this is something to do with the Parameter source being DB2, and trying to use against SQL?
Any suggestions on how to make this work??
Thanks,
-Al HParameter name is unrecognized
is the key, how come DB2 is related if it runs against SQL Server
What I think is happening you do not use the OLEDB connection to SQL Server.
Likewise, if it is ADO then the query needs to be
DELETE FROM
database.dbo.table
WHERE DATE_TIME_FIELD >= @MyDate
Arthur My Blog -
Error while converting schema from oracle to SQL server
Hello,
I am getting following error while converting schema from oracle to SQL server using SSMA.
I get Errors 1-3 while migrating procedures and error 4 while migrating a table.
1- O2SS0050: Conversion of identifier 'SYSDATE' is not supported.
2- O2SS0050: Conversion of identifier 'to_date(VARCHAR2, CHAR)' is not supported.
3- O2SS0050: Conversion of identifier 'regexp_replace(VARCHAR2, CHAR)' is not supported.
4- O2SS0486: <Primary key name> constraint is disabled in Oracle and cannot be converted because SQL Server does not support disabling of primary or unique constraint.
Please suggest.
Thanks.The exact statement in oracle side which causing this error (O2SS0050:
Conversion of identifier 'to_date(VARCHAR2, CHAR)' is not supported.) is below:
dStartDate:= to_date(sStartDate,'MON-YYYY');
Statement causing error O2SS0050:
Conversion of identifier 'regexp_replace(VARCHAR2, CHAR)' is not supported is below.
nCount2:= length(regexp_replace(sDataRow,'[^,]'));
So there is no statement which is using to_date(VARCHAR2,
CHAR) and regexp_replace(VARCHAR2, CHAR) in as such. 'MON-YYYY' and '[^,]'
are CHAR values hence SSMA is unable to convert it from varchar2 to char.
Regarding SYSDATE issue, you mean to put below code in target(SQL) side in SSMA ?
dDate date := sysdate;
Thanks. -
Connecting from Oracle to SQL Server
Hi
I am now tring to connect from oracle to sql server using database link.
Created database link
but when connecting to remote db getting the floowing error
select * from region@mysqlserverdsn
ERROR at line 1:
ORA-28545: error diagnosed by Net8 when connecting to an agent
Unable to retrieve text of NETWORK/NCR message 65535
ORA-02063: preceding 2 lines from MYSQLSERVERDSN
Can anyone help
My Listener File
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc1)
(SID_DESC =
(GLOBAL_DBNAME = ORCL.DOMAIN.COM)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(SID_NAME = orcl)
(SID_DESC =
(GLOBAL_DBNAME = NORTHWIND.DOMAIN.COM)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(SID_NAME = MYSQLSERVERDSN)
(PROGRAM=hsodbc)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = SALIHKM.DOMAIN.COM)(PORT = 1522))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
My Tnsnames Entry
MYSQLSERVERDSN =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xxx.xxx.xxx)(PORT=1522))
(CONNECT_DATA=(SID=MYSQLSERVERDSN))
(HS=OK)
Lsnrctl is working fine.
c:\>lsnrctl start
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 18-MAY-2006 18:53
:13
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting tnslsnr: please wait...
TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
System parameter file is D:\oracle\product\10.2.0\db_1\network\admin\listener.or
a
Log messages written to D:\oracle\product\10.2.0\db_1\network\log\listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=SALIHKM.DOMAIN.COM)(POR
T=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROCipc)
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SALIHKM.DOMAIN.COM)(POR
T=1522)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Produ
ction
Start Date 18-MAY-2006 18:53:16
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File D:\oracle\product\10.2.0\db_1\network\admin\listener.o
ra
Listener Log File D:\oracle\product\10.2.0\db_1\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=SALIHKM.DOMAIN.COM)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROCipc)))
Services Summary...
Service "NORTHWIND.DOMAIN.COM" has 1 instance(s).
Instance "MYSQLSERVERDSN", status UNKNOWN, has 1 handler(s) for this service..
Service "ORCL.DOMAIN.COM" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
But Tnsping show no listener
C:\>tnsping MYSQLSERVERDSN
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 18-MAY-2
006 18:56:27
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
D:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xxx.xxx.xxx)(P
ORT=1522)) (CONNECT_DATA=(SID=MYSQLSERVERDSN)) (HS=OK))
TNS-12541: TNS:no listener
Services
C:\>lsnrctl services
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 18-MAY-2006 19:00
:04
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SALIHKM.DOMAIN.COM)(POR
T=1522)))
Services Summary...
Service "NORTHWIND.DOMAIN.COM" has 1 instance(s).
Instance "MYSQLSERVERDSN", status UNKNOWN, has 1 handler(s) for this service..
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "ORCL.DOMAIN.COM" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:1 refused:0 state:ready
LOCAL SERVER
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1002 state:ready
DISPATCHER <machine: SALIHKM, pid: 2080>
(ADDRESS=(PROTOCOL=tcp)(HOST=SALIHKM.DOMAIN.COM)(PORT=1070))
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:1 refused:0 state:ready
LOCAL SERVER
The command completed successfully
I am very much confused with this situation.
Thanks & Regards
Salih KmHi ,
Thanks for your reply.
Contents of my initMYSQLSERVERDSN.ora file is
# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
# HS init parameters
HS_FDS_CONNECT_INFO = MYSQLSERVERDSN
HS_FDS_TRACE_LEVEL = 0
HS_FDS_TRACE_FILE_NAME = hsmsql.trc
# Environment variables required for the non-Oracle system
#set <envvar>=<value>
set ODBCINI=c:\WINDOWS\ODBC.INI
SALIHKM.DOMAIN.COM is my system in which Oracle Test DB is Installed.
SQL Server is in another location.
In Tnsnames i specified ip address.
One more doubt.
I am using 10g Release 2 demo version.
whether it will support Hetrogeneous Services?
How to know whether a database supports HS or not?
Thanks & Regards
Salih Km -
Oracle 10gR2 64bit odbc from oracle to sql server Win 2008 EE 64bits
Hi, I am having trouble with a 10gR2 64bits creation of odbc from oracle to sql server, I have follow several instruction with no luck at all. My OS is windows 2008 EE 64bits on the oracle and sql server server.
This is what I have done
1. in the $oracle_home/hs/admin directory
inithsodbc.ora
# HS init parameters
HS_FDS_CONNECT_INFO = hsodbc
HS_FDS_TRACE_LEVEL = off
2. in the $oracle_home/network/admin
# listener.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
(SID_DESC=
(SID_NAME=hsodbc)
(ORACLE_HOME=C:\oracle\product\10.2.0\db_1)
(PROGRAM=C:\oracle\product\10.2.0\db_1\hs\hsodbc)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xx.xx.xx.xx)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
And the tnsname.ora
# tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
PRUEBA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xx.xx.xx.xx)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = prueba)
hsodbc =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=xx.xx.xx.xx)(PORT=1521))
(CONNECT_DATA=(SID=hsodbc))
(HS=OK)
I create the odbc connection an test it , the result is TEST PASSED
4. The i create a database link on my database
CREATE PUBLIC DATABASE LINK XYZ
CONNECT TO "sysdba" IDENTIFIED BY "masterkey"
USING 'hsodbc';
5 execute a select
SQL> select * from dual@XYZ;
select * from dual@XYZ
ERROR at line 1:
ORA-28545: error diagnosed by Net8 when connecting to an agent
Unable to retrieve text of NETWORK/NCR message 65535
ORA-02063: preceding 2 lines from XYZ
6. When I check the listener log i'm getting this error
25-MAR-2011 11:48:40 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=)(USER=Administrator))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=169870592)) * status * 0
25-MAR-2011 11:48:47 * (CONNECT_DATA=(SID=hsodbc)(CID=(PROGRAM=)(HOST=PRO)(USER=PRO\Administrator))) * (ADDRESS=(PROTOCOL=tcp)(HOST=xx.xx.xx.xx)(PORT=49329)) * establish * hsodbc * 12518
TNS-12518: TNS:listener could not hand off client connection
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error
Edited by: user626125 on Mar 26, 2011 11:39 AM
Edited by: user626125 on Apr 12, 2011 2:49 PMHeterogeneous Connectivity
-
RH server 8 - upscaling from Access to SQL Server 2008?
Hi gang-
We are currently running RoboHelp Server 8 on the default Access database and Tomcat. We would like to increase the number of help projects that are tracked by the RH Server, and have concerns that Access will handle the increased load, so we are considering upsizing to SQL Server 2008.
Our IT people think this should be fairly straightforward, but want to know if Adobe provides any tool or has any recommendations when upsizing from Access to SQL Server.They are concerned about retaining things like primary and secondary keys, as well as any indexes that are currently in Access.
If anyone has experience with such a migration, please share!
Thanks,
-=Ed.We are also currently on an Access DB and considering (have been for some time but that's a different story) upgrading to SQL Server. There is no migration tool from Access to SQL Server provided so you'd have to allow some additional effort if you want to retain the data. I am not an expert on DBs but I'm sure there are ways to migrate the data. I have found a few links when searching on Google. For example:
http://support.microsoft.com/kb/237980
Adobe does provide a cheat sheet at the link below which may be useful to you.
http://blogs.adobe.com/techcomm/2009/05/advanced_database_setup_for_robohelp_server_8.html
The RoboColum(n)
@robocolumn
Colum McAndrew -
Any way of importing from Access to SQL Server?
I have a huge store of information in Access. But now I'm required to use SQL Server.
Is there any way of importing the information from Access to SQL Server by Java programming?
Or is there a manual way of doing that?
Thank you in advance.I need to use Java because this is for a client. I
can't expect the client to follow those steps. As a
result, I want to create something simple for the
client to convert from Access to SQL Server.
Any other way of doing that?
That argument does not make sense.
There is no way that a 'client' is going to be able to manage MS SQL Server without understanding how it works. MS SQL Server is a complex database and requires at least some dedicated support, even if it is only part time.
For example consider the following:
-MS Access does not have a log file. MS SQL Server does. How is the log file going to be sized?
-If the log file fills up (like for a run away query) MS SQL Server comes to a screeching halt. How is that problem going to be fixed?
Now maybe you are going to provide that support, which means you can run those scripts. Or the client is going to support it in which case they need to have someone who understands it - and they will need to know how to run those scripts (since it is rather basic knowledge.) -
Upsizing from Access to SQL Server - eek!
Ok - I've built quite a few dynamic sites using DW and
Access, but the site
i'm currently working on requires Microsoft SQL Server for
the database.
The site is almost complete and is written in Classic ASP.
Can anyone point me in the right direction, tutorials, crash
course, etc to
get me up to spped with the task?
Would my ASP code need changing at all?
Thanks in advance
AndyHi Joe
Thanks for the help -
Andy
"Joe Makowiec" <[email protected]> wrote in
message
news:[email protected]..
> On 19 Feb 2007 in macromedia.dreamweaver.appdev, Andy
wrote:
>
>> Ok - I've built quite a few dynamic sites using DW
and Access, but
>> the site i'm currently working on requires Microsoft
SQL Server for
>> the database. The site is almost complete and is
written in Classic
>> ASP.
>>
>> Can anyone point me in the right direction,
tutorials, crash course,
>> etc to get me up to spped with the task?
>> Would my ASP code need changing at all?
>
> As Far As I Know - the only place you'll run into a
problem is that there
> are a few differences in SQL between Access and SQL
Server. There are a
> number of sites with information:
>
>
http://www.google.com/search?q=differences+access+sql+server
>
> The first result (at aspfaq.com) looks good.
>
> But you shouldn't have any problem with the ASP code. I
think you'll
> like the change from Access to SQL Server.
>
> --
> Joe Makowiec
>
http://makowiec.net/
> Email:
http://makowiec.net/email.php -
Fetch data from another mirosoft sql server to sap
Dear all,
I want to fetch data from another mirosoft sql server
to SAP(my sap server IN unix, oracle 10g).
Thanks
Shashi
Moderator Message: Try to do you own research before posting your question. Get back to the forums in case you are stuck with any issue
Edited by: Suhas Saha on Jul 26, 2011 3:21 PMhi,
u should see following documentation:
Oracle9i Heterogeneous Connectivity Administrator's Guide
Release 1 (9.0.1)
Part Number A88789_01
in it u just go to chapter no. 4 (using the gateway),,u'll find ur answer there.
regards
umar -
Converting MDX query into SQL Server 2008
We have MDX query based OLAP CUbes.
To reduce MDX based dependenies, we have to convert MDX based cube to sql server 2008 based queries.
For this I need expert advise to convert below query to sql server 2008 based query :
CREATE MEMBER CURRENTCUBE.Measures.[Ack Lost]
AS 'Sum(PeriodsToDate([Time].[Year], [Time].CurrentMember ), [Measures].[Lost])',
FORMAT_STRING = "#,#",
VISIBLE = 1;Hi Sachin,
According to your description, you need to convert the MDX query to T-SQL query, right?
Your MDX query is calculated measure that return the total value from the first sibling and ending with the given member. In T-SQL query we can use the query as Yogisha provided to achieve the same requirement. Now you need to a tool to convert all the MDX
related SSAS cube queries to MS SQL Server 2008 based queries.
Although MDX has some similarities with T-SQL these languages are in many ways different. Beginning to learn and comprehend SQL Server Analysis Services (SSAS) MDX queries can be difficult after one has spent years writing queries in T-SQL. Currently, there
is no such a tool to convert a MDX query to T-SQL query since the structure difference between MDX and T-SQL. So you need to convert them manually, please refer to the links below to see the details.
http://www.mssqltips.com/sqlservertip/2916/comparison-of-queries-written-in-tsql-and-sql-server-mdx/
https://sqlmate.wordpress.com/2013/11/12/t-sql-vs-mdx-2/
http://technet.microsoft.com/en-us/library/aa216779(v=sql.80).aspx
Regards,
Charlie Liao
TechNet Community Support -
Creation of database link from oracle to sql server 2000
Hi
I need to create a database link from oracle to sql server 2000.Assuming your Oracle database is running on Windows, you can set up a database link using ODBC using Heterogeneous Services and Generic Connectivity, but there are some functional limitations (i.e. no two-phase commits). If you can live with those limitations but aren't on Windows, you can generally purchase an ODBC driver for your operating system that will connect to SQL Server through someone like DataDirect and still use Generic Connectivity. If you cannot live with those limitations, you can purchase one of Oracle's Transparent Gateway products (though this can get somewhat pricey).
What version of Oracle are you on?
What operating system(s) are you using?
What are you going to use the database link for?
Justin -
Migrating Data from MySQL to SQL Server 2012
Hi all,
I'm Migrating a database from MySQL to SQL Server 2012, using SSMA for MySQL v5.2.1258. I've got the schema migrated over and have resolved any migration issues (stored procedures / views), but when it comes to migrating over the data I'm just hitting
a wall.
None of the data is migrating and when the migration report is displayed every table has a red x against it's Status. The Output box has the following:
Data migration operation has finished.
0 table(s) successfully migrated.
0 table(s) partially migrated.
64 table(s) failed to migrate.
I've seen on the forum that someone else was having the same problem
(http://social.msdn.microsoft.com/Forums/en-US/sqlservermigration/thread/b835f4b3-3d93-42a4-9b6b-d21d3dfd8dab/)
I've set the project settings mode to default, still getting the same error and tried using both Client Side Data Migration and Server Side migration, with both giving the same result. I've tried going through the step-by-step blog as well.
I am doing something really stupid? There are 64 tables, so don't really want to try doing exports from each table and importing it into the new database.
Hope someone can help.
Cheers
AlexHello,
I don’t have suggestions for you, but you can try contacting the SQL Server Migration Assistant (SSMA) Team via e-mail ([email protected])
to see if they can provide a solution on this scenario.
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com
Maybe you are looking for
-
SCHEDULING AGREEMENT AND SCHEDULING LINE CREATION
Hello Guys, I trying creating a scheduling agreement(SA) for vendor & material combination. I have created a Scheduling agreement in ME31L then maintained in ME38. In ME38 i have also mentioned the delivery date. when i am checking EKKO for Purchasin
-
Hello, I worked earlier on Weblogic 8.1 and after a long gap I am coming back to Weblogic Server. And I tried to install & setup Weblogic Server 11g R1 (10.3.5). I successfully installed WL 11g on a Linux machine, configured the domain, and admin ser
-
Adobe Premiere Pro CS3 image on student machines
Hello! At the beginning of the 2008/2009 school year I installed Adobe Creative Suite 3: Master Collection on some of our school computers, a media lab. All the applications work great, such as Adobe Photoshop, InDesign, etc. The one application we c
-
I keep geeting blocked from some video chat sites with the message to upgrade. I click on the upgrade, thinking there might be a slight change I don't have. The Download manager tells me I have the most current Flash Player. I'm stuck in a "dumb"
-
ITunes 7.0 & Firmware 1.2 Help!
Hey guys, I have my 30gb Video iPod, and it's been working for the past 9months which i;ve owned it. Just about an hour ago I update iTunes and Firmeware, but now i'm regretting it. Before the update my Videos were working and now, they're not. They