Showing posts with label files. Show all posts
Showing posts with label files. Show all posts

Thursday, March 29, 2012

General Network Error OpenXML

Hi

I am using OpenXML to import data from text file. While it is working

fine with small files...I am getting General Network error while

parsing file of 4.5MB. Could anyone suggest the possible cause for

this. What is interesting is that , I am able to load the same file

using another SQL server. Could someone tell me the possible reason for

this behaviour....

Thanks

AnandThis error typically denotes a problem at the network layer. Can you check the NT event logs of the server for any network card failures? What about the SQL errorlog? Does it have any suspicious messages?sql

Monday, March 26, 2012

Gargantual Transaction Files

Can I delete them or otherwise make them smaller?
DB is to be read only, no deletions, no additions.open up Enterprise Manager, right click on the db name "All Tasks" -> "Srink Database" -> Check "Move pages to beginning" Click on the "OK" button.|||The Shrink DB taks in Enterprise Manager does work, but it does not give you much control. Also, it tends to be less than effective with regard to log files.

there are scripts out there that you can run through query analyzer that will work very effectively in shrinking the log file.

essentially, what you need to do is generate several small transactions on the log file. It may not be shrinking properly if there are some large transactions there. As you perform the small transactions, the larger ones will me moved down and eventually they will reside in a place where the log file will allow for them to be removed.|||Paul and BkBlitz2,
thanks for your reply, but "Shrink" did not work" at all.

First: it took some 4-5 min. to post nice message that "Database was shrinked successfully" which is less than 1/4 of the time it takes to create one lousy index on the same file which in turn tells me that nothing worth mentioning really happened.
Second: close to 40 GB of transaction files - which is more than data itself - is still close to 40 GB.
I don't need any of the transaction files. SQL Server assumes that I do but I am sure that I don't.
I need the space it occupies and time it takes to access it. The DB really is "read only" and a backup of if is good enough.

So, my (ignorant) question remains: how to shrink, delete, sell or give away my truckload of transaction files?|||I believe that when you issue a DBCC SHRINKDB only the non-active or unused protion will be shrunk. To see how much of the log can be shrunk issue DBCC SQLPERF ( LOGSPACE ) . This will return a recordset of all databases with their log file size and percentage used, so from here you should get an idea of how much it will shrink. Now you stated that this is a READ ONLY database, if true than issue BACKUP LOG <database_name> WITH TRUNCATE_ONLY. This will clean out the log. Only do this for readonly, since you won't be able to recover the database up to the minute. You would issue a BACKUP DATABASE after if this was a production database. Now try the DBCC SHRINKDB. Again since this is readonly you should then use sp_dboption with trunc. log on chkpt., so that the log will periodically truncate itself.|||The only way you can handle this is to

--1)
use <db_name_here>
go

--2)
/* truncation, i.e. cleaning old transactions stuff out of the file*/
BACKUP LOG <db_name_here> WITH truncate_only
go

--3)
/* real shrinking - does not always work for there might be an active transaction in the file, and it is somewhere at the very end*/
dbcc shrinkfile(<name_of_logfile_here>,1)
// note: you can find the log file name by running: select * from sysfiles

Thanks, this will shrink log file very quickly, and possibly right to 1,024k only!|||Hi

Thx for the tip, of how to backup a transaction logfile within 5 seconds to 1.024K !

My biggest problem in develloping my data warehouse !

Greetings

J

garbage in sql server log files

hi,
My database server had hung up recently, and I had to restart it.
After checking the log I found some garbage entries in it.
has anyone encountered similar errors?
harshal.Garbage entry means what some of kind of ASCII characters or SQL DMP information?

Post a sample one here.|||Originally posted by Satya
Garbage entry means what some of kind of ASCII characters or SQL DMP information?

Post a sample one here.

There is some kind of ascii code|||What is the level of service pack on SQL & OS?
What was the error related when it hung?
Any SQL.DMP files are created?|||Originally posted by Satya
What is the level of service pack on SQL & OS?
What was the error related when it hung?
Any SQL.DMP files are created?

Error: 17883, Severity: 1, State: 0
The Scheduler 0 appears to be hung. SPID 94, ECID 0, UMS Context 0x39836B08.

sp3a and win 2k .|||Review information on following KBAs to deal with:
http://support.microsoft.com/?kbid=816840

http://support.microsoft.com/default.aspx?scid=kb;en-us;810885 - I feel this may be applicable to the situation if you use high-end subsystems h/w.

HTHsql

Friday, March 9, 2012

Function Return Value

I want to write a function that returns the physical filepath of the master database for its MDF and LDF files respectively. This information will then be used to create a new database in the same location as the master database for those servers that do not have the MDF and LDF files in the default locations.

Below I have the T-SQL for the function created and a test query I am using to test the results. If I print out the value of @.MDF_FILE_PATH within the funtion, I get the result needed. When making a call to the function and printing out the variable, all I get is the first letter of the drive and nothing else.

You may notice that in the function how CHARINDEX is being used. I am not sure why, but if I put a backslash "\" as expression1 within the SELECT statement, I do not get the value of the drive. In other words I get "MSSQL\Data" instead of "D:\MSSQL\Data" I then supply the backslash in the SET statement. I assume that this has something to do with my question.

Any suggestions? Thank you.

HERE IS T-SQL FOR THE FUNCTION
IF OBJECT_ID('fn_sqlmgr_get_mdf_filepath') IS NOT NULL
BEGIN
DROP FUNCTION fn_sqlmgr_get_mdf_filepath
END
GO

CREATE FUNCTION fn_sqlmgr_get_mdf_filepath (
@.MDF_FILE_PATH NVARCHAR(1000) --Variable to hold the path of the MDF File of a database.
)
RETURNS NVARCHAR
AS

BEGIN

--Extract the file path for the database MDF physical file.
SELECT @.MDF_FILE_PATH = SUBSTRING(mdf.filename, CHARINDEX('', filename)+1, LEN(filename))
FROM master..sysfiles mdf
WHERE mdf.groupid = 1

SET @.MDF_FILE_PATH = SUBSTRING(@.MDF_FILE_PATH, 1, LEN(@.MDF_FILE_PATH) - CHARINDEX('\', REVERSE(@.MDF_FILE_PATH)))

RETURN @.MDF_FILE_PATH

END

HERE IS THE TEST I AM USING AGAINST THE FUNCTION
SET NOCOUNT ON

DECLARE
@.MDF_FILE_PATH NVARCHAR(1000) --Variable to hold the path of the MDF File of a database.

SELECT @.MDF_FILE_PATH = dbo.fn_sqlmgr_get_mdf_filepath ( @.MDF_FILE_PATH )
PRINT @.MDF_FILE_PATHAny suggestions?

YEah, rethink what you're doing...

MOO|||If you didn't have any information that would possibly be helpful in my question, please leave future posts to those who would be more intelligent in their responses.

If you see something that I am doing wrong, then why not offer a suggestion instead of either keeping the answer to yourself or acting more intelligent than what you are. After all, this is what this forum is intended for.

Thank you.|||Sorry you feel that way...

If you can supply us with what you're doing, I'm sure the people here can assist...if you don't like what I say, I'm sure someone will step...need more details though...

This information will then be used to create a new database in the same location as the master database for those servers that do not have the MDF and LDF files in the default locations.

Any "AUTO-ADMIN" stuff is always risky...(my own opinion) MOO

Why do you have to do this? Are you releasing hundreds of databases?

Also, unless there are performance issues involved, why deviate from standard practices...

AND HOW DARE YOU ACCUSE ME OF BEING INTELLIGENT!

The nerve...|||CREATE FUNCTION fn_sqlmgr_get_mdf_filepath (
@.MDF_FILE_PATH NVARCHAR(1000) --Variable to hold the path of the MDF File of a database.
)
RETURNS NVARCHAR
AS

The return value of the function is declared as NVARCHAR, a single character. You need to declare the return value as a character array.

RETURNS NVARCHAR(1000)|||USE Northwind
GO

CREATE FUNCTION fn_sqlmgr_get_mdf_filepath (
@.MDF_FILE_PATH NVARCHAR(1000)
)
RETURNS VARCHAR(1000)
AS

BEGIN

SELECT @.MDF_FILE_PATH = SUBSTRING(mdf.filename, CHARINDEX('', filename)+1, LEN(filename))
FROM master..sysfiles mdf
WHERE mdf.groupid = 1

SET @.MDF_FILE_PATH = SUBSTRING(@.MDF_FILE_PATH, 1, LEN(@.MDF_FILE_PATH) - CHARINDEX('\', REVERSE(@.MDF_FILE_PATH)))

RETURN @.MDF_FILE_PATH

END
GO

SET NOCOUNT ON
DECLARE @.MDF_FILE_PATH NVARCHAR(1000) --Variable to hold the path of the MDF File of a database.
SELECT @.MDF_FILE_PATH = dbo.fn_sqlmgr_get_mdf_filepath ( @.MDF_FILE_PATH )
PRINT @.MDF_FILE_PATH
SET NOCOUNT OFF
GO

DROP FUNCTION fn_sqlmgr_get_mdf_filepath
GO|||Yeah .. but in spite of all the help from BK ... you need to rethink it anyway ;)|||I think that Brett saw you doing something potentially VERY dangerous, and was trying to get some more information so that we could either:

a) give you appropriate code
b) help you find a better (safer) solution to your problem
c) warn you that, as cartographers of olde would say: "here be dragons".

-PatP|||I think that Brett saw you doing something potentially [i[VERY[/i] dangerous, and was trying to get some more information so that we could either:

a) give you appropriate code
b) help you find a better (safer) solution to your problem
c) warn you that, as cartographers of olde would say: "here be dragons".

-PatP

You know the funny thing about this?

Trying to build a rocket ship, but can't get past retrun nvarchar|||And i dont remember exactly ... but isnt there a registry key we could read to get the default location where a file would be created ...

Hmmm ... what the hell I am thinking .. the files would be created int the default location anyway ... if you do not specify ... so whats with the function ... i am confused (once again ;))|||Thank you Homer37 for your assistance. Your answer worked just fine.|||Improper setting at the time of server installation leads to situations like this, where there is a need to write extra code. However, it also appears that you ARE trying to auto-create databases (I already picture a scene where something in other parts of your code got missed and you are sitting at a non-responsive server because your code ended up creating databases), unless I am misreading the post. To alter the default location you need to use xp_instance_regwrite rather than for every database to be created to reference the same server, following a call to xp_instance_regread.

Sunday, February 26, 2012

Full-Text-Search

Hi,
I have a full-text search enabled table and an image data type column that stores the extracts from the documents stored in the files. I have created a full text catalog that indexes few columns in the table and image data type column as well and I assigned the extension column to this image data type column.
Everything works fine except that search on the image data type column called, in my case "body" does not return anything. The documents exist, there is an information in the "body" column.

My code goes like this:
select FT_TBL.resourceID, FT_TBL.lang, FT_TBL.keywords, FT_TBL.description, FT_TBL.extension, b.rank
from full_text_search as FT_TBL inner join containstable(full_text_search, *, 'Microsoft') as b
on b.[key] = FT_TBL.resourceID
order by b.rank desc

any help appreciated,
thanksI figured the solution to the previous post. I was trying to search on the .pdf files, but I do not have filter installed on the server to filter through these files, other files extension work fine.

Another problem:
I have two tables that are full-text search enabled. And I need to search one table first, and than the columns in the second one. This works fine if the search criteria is found in both tables, but if not the query returns nothing.

help much appreciated!
Thanks|||use union all.

Friday, February 24, 2012

Full-text search other than database

I know how to create full-text indexing on database.
How about is it possible to do a full-text indexing on files like .doc, .xls
on a harddisk by SQL Server using SQL?
eg. I have a word document on
c:\temp\mywork.doc
and a spreadsheet on
c:\myschedule\schedule1.xlsYou can create a linked server to an indexing services catalog which should
contain the directories these file exist in.
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Alan" <alanpltseNOSPAM@.yahoo.com.au> wrote in message
news:OJAjgAMdGHA.2456@.TK2MSFTNGP04.phx.gbl...
>I know how to create full-text indexing on database.
> How about is it possible to do a full-text indexing on files like .doc,
> .xls
> on a harddisk by SQL Server using SQL?
> eg. I have a word document on
> c:\temp\mywork.doc
> and a spreadsheet on
> c:\myschedule\schedule1.xls
>|||Are you talking about create a linked server which is pointing to a folder ?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:OMTrtwOdGHA.3840@.TK2MSFTNGP04.phx.gbl...
> You can create a linked server to an indexing services catalog which
should
> contain the directories these file exist in.
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Alan" <alanpltseNOSPAM@.yahoo.com.au> wrote in message
> news:OJAjgAMdGHA.2456@.TK2MSFTNGP04.phx.gbl...
> >I know how to create full-text indexing on database.
> > How about is it possible to do a full-text indexing on files like .doc,
> > .xls
> > on a harddisk by SQL Server using SQL?
> >
> > eg. I have a word document on
> > c:\temp\mywork.doc
> > and a spreadsheet on
> > c:\myschedule\schedule1.xls
> >
> >
>